This Project helps you to create docs for your projects
Project description
Executive Navigation Tree
- 📘 Introduction
- ⚙️ Setup & Configuration
- 🛠️ Core Functions
- 📦 Manager
- 🧩 Modules
- 🤖 Models
- 📡 Extraction & Processing
- 📝 Documentation Generation
- 📚 Repository & Mixing
- 📦 Compression
- 🔄 Data Loop
Basic Introduction Generation (get_introdaction)
| Entity | Type | Role | Notes |
|---|---|---|---|
global_data |
str |
Input | Full documentation content. |
model |
Model |
Input | LLM interface. |
language |
str |
Input (default "en") |
Language hint. |
intro |
str |
Output | Generated introduction. |
Builds a prompt with BASE_INTRO_CREATE and global_data, then returns the LLM answer.
IntroText – Global Data Intro Builder
Responsibility – Generates a textual introduction from global_data.
Visible Interactions – Calls get_introdaction.
Logic Flow –
generate(info, model)→intro = get_introdaction(info.get("global_data"), model, info.get("language")).- Return
intro.
Warning: All modules assume the presence of specific keys (
code_mix,full_data,global_data,language). Absence results inNonebeing passed to downstream functions, which may raise runtime errors if those functions lack internal checks.
IntroLinks – HTML Link Intro Builder
Responsibility – Extracts HTML links from full_data and builds an introductory paragraph.
Visible Interactions – Calls get_all_html_links, get_links_intro.
Logic Flow –
generate(info, model)→
Introduction Generation with Links (get_links_intro)
| Entity | Type | Role | Notes |
|---|---|---|---|
links |
list[str] |
Input | Anchor list from get_all_html_links. |
model |
Model |
Input | Provides get_answer_without_history. |
language |
str |
Input (default "en") |
Language hint for the LLM. |
intro_links |
str |
Output | Generated introductory text. |
logger |
BaseLogger |
Side‑effect | Logs start, completion, and result. |
Creates a prompt containing the language directive, BASE_INTRODACTION_CREATE_LINKS, and the stringified links. Calls model.get_answer_without_history and returns the LLM’s response.
` tag with strict naming constraints, then returns the LLM’s response.
Warning – All functions assume the provided
Modelinstance implementsget_answer_without_history. Missing methods will raiseAttributeError. The logger must be operational; otherwise logging calls will fail.
PowerShell installation (Windows)
Execute the following command in an elevated PowerShell window to fetch and execute the installation script directly from the repository:
irm raw.githubusercontent.com/Drag-GameStudio/ADG/main/install.ps1 | iex
irm(Invoke‑WebRequest) downloads the script content.- The pipeline to
iex(Invoke‑Expression) runs the script in the current session.
Shell installation (Linux/macOS)
Run this one‑liner in a terminal to retrieve and execute the Linux installer:
curl -sSL raw.githubusercontent.com/Drag-GameStudio/ADG/main/install.sh | bash
curl -sSLsilently follows redirects and outputs the script.- The output is piped to
bashfor immediate execution.
GitHub Actions secret configuration
To enable the workflow to interact with the Grock service, add a secret named GROCK_API_KEY to the repository’s GitHub Actions secrets:
- Navigate to the repository’s Settings → Secrets and variables → Actions.
- Click New repository secret.
- Enter Name:
GROCK_API_KEY. - Paste the API key obtained from the Grock documentation.
- Save the secret.
The workflow will automatically read GROCK_API_KEY from the environment, allowing authenticated calls to the Grock API during execution.
The configuration file is a YAML document that defines several top‑level sections:
Project metadata
project_name: a string that specifies the name of the project.language: the language code (e.g.,"en").
Files to ignore
ignore_files: a list of directory or file names that should be excluded from documentation generation (e.g.,"dist").
Build settings (build_settings block)
save_logs: boolean, whentruethe generation process stores logs.log_level: integer controlling verbosity (e.g.,2).
Structure settings (structure_settings block)
include_intro_links: boolean, adds introductory links iftrue.include_order: boolean, keeps the original order of sections whentrue.max_doc_part_size: integer, maximum size (in characters) for each documentation part.
Additional project information (project_additional_info block)
- Custom key/value pairs, such as
global idea, provide free‑form description of the project’s purpose.
Custom descriptions (custom_descriptions block)
- A list of strings that can contain special instructions or explanatory text. These strings are processed by the generator to enrich the final documentation (e.g., how to install the workflow, how to write the configuration file, how to use the Manager class).
When creating the file, follow standard YAML syntax: use indentation (two spaces) for nested sections, place lists under a dash (-), and ensure string values are quoted if they contain special characters. This structure enables the documentation generator to read all required options and produce the desired output.
read_config – YAML Configuration Parsing
| Entity | Type | Role | Notes |
|---|---|---|---|
file_data |
str |
Raw YAML content | Passed by caller |
data |
dict |
Parsed YAML tree | Result of yaml.safe_load |
config |
Config |
Central project configuration | Instantiated locally |
ignore_files |
list[str] |
Files/patterns to skip | Defaults from YAML or empty |
language |
str |
Documentation language | Defaults to "en" |
project_name |
str |
Identifier for the project | May be None |
project_additional_info |
dict |
Arbitrary key‑value pairs | Empty dict if omitted |
pcs |
ProjectBuildConfig |
Build‑time settings container | Populated via load_settings |
custom_modules |
`list[CustomModule | CustomModuleWithOutContext]` | User‑defined processing hooks |
structure_settings_object |
StructureSettings |
Runtime doc‑structure flags | Loaded from structure_settings |
Logic Flow
- Parse
file_datawithyaml.safe_load. - Instantiate a fresh
Config. - Extract top‑level keys (
ignore_files,language,project_name,project_additional_info,build_settings). - Load build settings into a
ProjectBuildConfigand attach toconfigviaset_pcs. - Populate ignore patterns and additional info on
config. - Build
custom_moduleslist, choosingCustomModuleWithOutContextwhen a description starts with"%". - Initialise
StructureSettings, apply any overrides from YAML. - Return tuple
(config, custom_modules, structure_settings_object).
Assumption – All expected YAML sections exist; missing sections yield defaults as coded.
_print_welcome Function Execution
| Entity | Type | Role | Notes |
|---|---|---|---|
BLUE, BOLD, CYAN, RESET |
str |
ANSI colour codes | Used only within this function |
ascii_logo |
str |
Formatted ASCII art | Combines colour codes for visual header |
print (built‑in) |
callable | Output side‑effect | Sends logo and status lines to stdout |
Purpose – Render a coloured ASCII banner and a one‑line status message when the package is imported.
Logic Flow
- Define colour constants (
BLUE,BOLD,CYAN,RESET). - Build
ascii_logousing an f‑string that inserts the colour constants. - Print the logo, then a line showing “ADG Library | Status: Ready to work” with cyan text.
- Print a separator line (
'—' * 35).
Warning – This function executes at import time, causing I/O side‑effects even if the consumer only needs the library’s API.
Logger Initialization
| Entity | Type | Role | Notes |
|---|---|---|---|
BaseLogger |
class | Core logger object | Instantiated as logger |
BaseLoggerTemplate |
class | Formatting/template provider | Passed to logger.set_logger |
InfoLog, ErrorLog, WarningLog |
classes | Log‑level helpers (imported but not used here) | Exported for downstream modules |
Purpose – Prepare a singleton‑style logger ready for use throughout the package.
Logic Flow
- Import logger classes from
.ui.logging. - Create
logger = BaseLogger(). - Apply a default template via
logger.set_logger(BaseLoggerTemplate()).
Interactions – Subsequent modules import logger from this package; they rely on the pre‑configured template for consistent output formatting. No external configuration files are consulted in this fragment.
All information is derived exclusively from the provided autodocgenerator/__init__.py source.
Logging Infrastructure – BaseLog Hierarchy & Singleton BaseLogger
| Entity | Type | Role | Notes |
|---|---|---|---|
BaseLog |
class | Abstract | Stores message and level; provides _log_prefix. |
ErrorLog, WarningLog, InfoLog |
subclasses | Concrete | Override format() with severity tag. |
BaseLoggerTemplate |
class | Abstract logger | Holds log_level; routes via global_log. |
FileLoggerTemplate |
subclass | File‑output logger | Writes formatted logs to a file. |
BaseLogger |
singleton class | Proxy | Delegates log() to assigned logger_template. |
Logic Flow
BaseLogger.__new__ensures a single instance.set_logger()injects a concreteBaseLoggerTemplate.log()forwards theBaseLogobject tologger_template.global_log, which respectslog_level.
Assumption – A logger template is set before any
BaseLogger.logcall; otherwise anAttributeErrorwould occur.
BaseProgress – Abstract Progress Interface
| Entity | Type | Role | Notes |
|---|---|---|---|
BaseProgress |
class | Abstract base | Defines the progress API used by the documentation generator. |
create_new_subtask |
method(name: str, total_len: int) → None |
Abstract | Intended to start a child progress track. |
update_task |
method() → None |
Abstract | Advances either the current sub‑task or the base task. |
remove_subtask |
method() → None |
Abstract | Clears the active sub‑task reference. |
Component Responsibility
Provides a minimal contract that concrete progress reporters must implement, allowing the generator to switch between rich‑terminal, console, or other visual back‑ends without code changes.
Visible Interactions
LibProgress and ConsoleGtiHubProgress inherit from it and are passed to higher‑level functions (e.g., gen_doc_parts) as the progress_bar argument.
Technical Logic Flow
- Instantiation does nothing (
__init__is empty). - Sub‑classes override the three abstract methods to manipulate their own state.
Data Contract
| Entity | Type | Role | Notes |
|---|---|---|---|
name |
str |
Input to create_new_subtask |
Human‑readable identifier of the sub‑task. |
total_len |
int |
Input to create_new_subtask |
Expected number of update_task calls. |
current progress |
internal | Side‑effect | Updated via update_task; no external return. |
Assumption – The base class is never used directly; calling its methods without a concrete implementation would raise
NotImplementedError.
LibProgress – Rich‑Library Progress Implementation
| Entity | Type | Role | Notes |
|---|---|---|---|
LibProgress |
class | Concrete BaseProgress |
Wraps rich.progress.Progress. |
progress |
Progress |
Dependency | Provided by the rich library. |
_base_task |
int |
Internal | ID of the top‑level “General progress” task. |
_cur_sub_task |
`int | None` | Internal |
Component Responsibility
Renders hierarchical progress bars in terminals that support ANSI graphics, tracking overall and per‑chunk documentation generation.
Visible Interactions
create_new_subtask(name, total_len)registers a new rich task and stores its ID.update_task()advances either_cur_sub_taskor_base_task.remove_subtask()discards the current sub‑task reference, leaving the base task alive.
Technical Logic Flow
- Constructor receives a
Progressinstance and creates the base task (totaldefaults to 4). create_new_subtaskcallsself.progress.add_task(name, total=total_len)and caches the ID.update_taskchecks_cur_sub_task; if set, updates it, otherwise updates the base task.remove_subtasksimply null‑ifies_cur_sub_task.
Data Contract – same as abstract plus the internal task IDs.
ConsoleGtiHubProgress – Simple Console Fallback
| Entity | Type | Role | Notes |
|---|---|---|---|
ConsoleGtiHubProgress |
class | Concrete BaseProgress |
Prints textual progress to stdout. |
gen_task |
ConsoleTask |
Internal | Represents the overall “General Progress”. |
curr_task |
`ConsoleTask | None` | Internal |
Component Responsibility
Provides a lightweight, environment‑agnostic progress indicator when the rich library cannot be used (e.g., CI logs).
Visible Interactions
- Mirrors the abstract API:
create_new_subtask,update_task,remove_subtask. - Delegates actual printing to
ConsoleTask.progress().
Technical Logic Flow
- Instantiation creates a
ConsoleTasknamed “General Progress” with 4 steps. create_new_subtaskreplacescurr_taskwith a newConsoleTask.update_taskcallscurr_task.progress()if a sub‑task exists; otherwise updatesgen_task.remove_subtaskclearscurr_task, causing subsequent updates to affect the general task again.
Data Contract – identical to the abstract contract; progress is emitted via print.
Warning – This implementation does not persist state beyond the current process; restarting the script will reset all counters.
Manager – Orchestrator for Documentation Pipeline
Responsibility – Coordinates preprocessing, LLM‑driven generation, post‑processing and caching for a single project directory.
Visible Interactions –
- Imports from preprocessor, postprocessor, engine.models, ui, factory.
- Uses
BaseProgress/LibProgressfor task updates,BaseLoggerfor log emission,DocFactoryfor modular doc assembly.
Logic Flow –
__init__stores paths, config, models, logger and ensures a cache folder exists.read_file_by_file_key→ open cached file → return its contents.get_file_path→ compose absolute path underCACHE_FOLDER_NAME.generate_code_file→ instantiateCodeMix, build repository content intocode_mix.txt, log start/finish, update progress.generate_global_info→ readcode_mix.txt, split viasplit_data, compress withcompress_to_one, writeglobal_info.md, update progress.generete_doc_parts→ optionally readglobal_info.md, callgen_doc_partswith sync model & settings, writeoutput_doc.md, update progress.factory_generate_doc→ read current doc & code mix, buildinfodict, log module list & key sizes, invokedoc_factory.generate_doc, prepend result to existing doc, update progress.order_doc→ split current doc by anchors, reorder sections viaget_order, overwriteoutput_doc.md.clear_cache→ delete log file ifsave_logsis false.
Data Contract
| Entity | Type | Role | Notes |
|---|---|---|---|
project_directory |
str |
Input | Root of the target code base. |
config |
Config |
Input | Supplies ignore_files, language, pbc.log_level, pbc.save_logs, get_project_settings(). |
sync_model / async_model |
Model / AsyncModel |
Input | LLM interface passed to preprocessors/post‑processors. |
progress_bar |
BaseProgress |
Input/Side‑effect | Must implement update_task(). |
self.logger |
BaseLogger |
Side‑effect | Writes to report.txt via FileLoggerTemplate. |
Cached files (code_mix.txt, global_info.md, output_doc.md, report.txt) |
on‑disk | Persistent storage | Created/overwritten by manager methods. |
info (in factory_generate_doc) |
dict |
Input to DocFactory.generate_doc |
Keys: language, full_data, code_mix. |
| Return values | None (except read_file_by_file_key) |
Side‑effects | Methods write files or update progress; only read_file_by_file_key returns file contents. |
Warning – The manager assumes all configured keys exist; missing files raise
FileNotFoundError, and absent config attributes causeAttributeError. !noinfo
BaseModule Abstract Interface
Responsibility – Defines the contract for all documentation generation modules.
Visible Interactions – Sub‑classes inherit from this ABC and are invoked by DocFactory.
Logic Flow –
- Constructor (
__init__) does nothing (pass). - Declares abstract
generate(info: dict, model: Model)method.
CustomModule – Context‑Aware Description Generator
Responsibility – Generates a custom description using the supplied discription and a code split.
Visible Interactions – Calls generete_custom_discription, split_data.
Logic Flow –
- Store
discriptionat init. generate(info, model)→
CustomModuleWithOutContext – Description‑Only Generator
Responsibility – Produces a description without processing source code.
Visible Interactions – Calls generete_custom_discription_without.
Logic Flow –
- Store
discription. generate(info, model)→
DocFactory Orchestrator
Responsibility – Executes a sequence of BaseModule instances, aggregates their outputs, and logs progress.
Visible Interactions – Receives a list of module instances, a Model, a BaseProgress reporter, and uses BaseLogger.
Logic Flow –
- Store
modulestuple as list; instantiateBaseLogger. generate_doc(info, model, progress)- Initialise
output = "". progress.create_new_subtask("Generate parts", len(self.modules)).- Iterate
moduleinself.modules:- Call
module.generate(info, model)→module_result. - Append
module_result + "\n\n"tooutput. - Log informational messages with
InfoLog. progress.update_task().
- Call
- End loop →
progress.remove_subtask(). - Return aggregated
output.
- Initialise
Data Contract
| Entity | Type | Role | Notes |
|---|---|---|---|
info |
dict |
Input data (code snippets, language, etc.) | Keys accessed via info.get(...) in modules. |
model |
Model |
LLM interface used by modules | Passed unchanged to post‑processor calls. |
progress |
BaseProgress |
Progress tracking object | Must implement create_new_subtask, update_task, remove_subtask. |
module_result |
str |
Partial documentation fragment | Concatenated into final output. |
self.logger |
BaseLogger |
Logging sink | Emits InfoLog entries. |
Note:
DocFactorydoes not perform any validation ofinfokeys; missing keys may causeNoneto be passed downstream.
ParentModel – Shared configuration & model rotation
| Entity | Type | Role | Notes |
|---|---|---|---|
api_key |
str |
API credential | Defaults to API_KEY from autodocgenerator.engine.config.config |
history |
History |
Message buffer | Injected or created on‑demand |
use_random |
bool |
Randomise model order | True enables random.shuffle |
regen_models_name |
list[str] |
Rotation list | Copied from MODELS_NAME then shuffled if use_random |
current_model_index |
int |
Cursor in regen_models_name |
Starts at 0 |
Assumption –
MODELS_NAMEandAPI_KEYare defined in the imported config module.
The class stores credentials, a shared History, and prepares a shuffled list of model identifiers for fail‑over usage.
GPTModel – Synchronous Groq client wrapper
| Entity | Type | Role | Notes |
|---|---|---|---|
client |
Groq |
Sends sync chat requests | Instantiated with self.api_key |
logger |
BaseLogger |
Emits runtime logs | Same log types as async variant |
generate_answer |
def |
Returns LLM reply | Same signature as async version |
Logic Flow mirrors AsyncGPTModel but uses the synchronous self.client.chat.completions.create call and returns the extracted result directly.
Both wrappers expose the same public contract, differing only in async vs sync execution.
AsyncGPTModel – Asynchronous Groq client wrapper
| Entity | Type | Role | Notes |
|---|---|---|---|
client |
AsyncGroq |
Sends async chat requests | Instantiated with self.api_key |
logger |
BaseLogger |
Emits runtime logs | Uses InfoLog, WarningLog, ErrorLog |
generate_answer |
async def |
Returns LLM reply | Parameters: with_history: bool = True, prompt: str = None |
Logic Flow
- Log start of generation.
- Select
messagesfromself.history.historyor the suppliedprompt. - Loop until a model succeeds:
- If
regen_models_nameempty → log error & raiseModelExhaustedException. - Pick
model_namefromregen_models_name[current_model_index]. - Call
await self.client.chat.completions.create(messages=messages, model=model_name). - On exception → log warning, advance
current_model_index(wrap‑around).
- If
- Extract
result = chat_completion.choices[0].message.content. - Log the selected model and the answer (level 2).
- Return
result.
Interactions – Relies on AsyncGroq for network I/O, History for context, and the shared logger. No file I/O.
Semantic Title Ordering (LLM Interaction)
| Entity | Type | Role | Notes |
|---|---|---|---|
model |
Model |
Input | Must expose get_answer_without_history. |
chanks |
dict[str,str] |
Input | Mapping from anchor links to text chunks. |
logger |
BaseLogger |
Side‑effect | Emits InfoLog entries at various levels. |
prompt |
list[dict] |
Local | Single user‑role message requesting a comma‑separated ordering. |
result |
str |
Output (raw LLM reply) | Expected list of #anchor titles. |
new_result |
list[str] |
Local | Stripped titles from result. |
order_output |
str |
Return | Concatenated chunk texts in LLM‑provided order. |
Logic Flow
- Initialise
BaseLogger; log start and input keys/values. - Build
promptcontaining the titles (list(chanks.keys())). - Call
model.get_answer_without_history(prompt); capture raw string. - Split on commas, strip whitespace →
new_result. - Iterate
new_result; for each anchor retrieve its chunk viachanks.get(el)and append toorder_output(newline‑separated). - Log each addition; return the assembled
order_output.
Warning – If the model returns a malformed list (missing titles or extra commas), mismatches may lead to
Nonevalues in the final output.
HTML Link Extraction (get_all_html_links)
| Entity | Type | Role | Notes |
|---|---|---|---|
data |
str |
Input | Raw documentation text. |
links |
list[str] |
Output | Anchor links prefixed with #. |
logger |
BaseLogger |
Side‑effect | Logs progress at INFO level. |
pattern |
str |
Internal | Regex \<a name=["']?(.*?)["']?\>\</a\> . |
The function scans data for <a name=…></a> anchors, captures the name when longer than five characters, prefixes it with #, logs the count and the list, then returns links. No file I/O occurs.
Anchor Extraction & Chunk Splitting
| Entity | Type | Role | Notes |
|---|---|---|---|
chunks |
list[str] |
Input (raw HTML fragments) | Passed to extract_links_from_start. |
pattern (in extract_links_from_start) |
str |
Constant | r'^<a name=["\']?(.*?)["\']?></a>' matches a leading anchor. |
anchor_name |
str |
Local | Captured name; processed only if len > 5. |
links |
list[str] |
Output (prefixed anchors) | Each stored as # + name. |
text |
str |
Input (full doc) | Split by split_text_by_anchors. |
result_chanks |
list[str] |
Output | Trimmed, non‑empty chunks after re.split. |
all_links |
list[str] |
Output | Result of extract_links_from_start on the chunks. |
result |
dict[str,str] |
Output | Mapping #anchor → chunk. Returns None on size mismatch. |
Logic Flow
extract_links_from_startiterateschunks; regex anchors at start are captured.- If an anchor’s name exceeds five characters,
"#"+nameis appended tolinks. split_text_by_anchorsbuilds a look‑ahead pattern ((?=<a name=…>)) to split the full text intochunks.- Whitespace‑trimmed chunks become
result_chanks. extract_links_from_startprocesses these chunks; if the count of anchors ≠ chunks, the function aborts (None).- Otherwise a dict
resultmaps each#anchorto its associated chunk.
Assumption – No file I/O occurs; the functions only transform in‑memory strings.
gen_doc – End‑to‑End Documentation Generation Pipeline
| Entity | Type | Role | Notes |
|---|---|---|---|
project_path |
str |
Root of the source project | Supplied by caller |
config |
Config |
Project‑wide settings | From read_config |
custom_modules |
list[...] |
Extension hooks for doc factories | Passed to DocFactory |
structure_settings |
StructureSettings |
Controls ordering & intro links | Determines size & optional steps |
sync_model / async_model |
GPTModel / AsyncGPTModel |
Language model back‑ends | Instantiated with global API_KEY |
manager |
Manager |
Orchestrates parsing, generation, caching | Core engine object |
| Return value | str |
Final assembled documentation | Read from manager’s output cache |
Logic Flow
- Create
GPTModelandAsyncGPTModelusing the sharedAPI_KEY. - Initialise
Managerwithproject_path,config, both models, and a console progress bar. - Invoke
manager.generate_code_file()→ extracts source code. - Call
manager.generete_doc_parts(...)→ splits docs perstructure_settings.max_doc_part_size. - Run
manager.factory_generate_doc(DocFactory(*custom_modules))→ applies user‑defined modules. - If
include_orderis true,manager.order_doc()reorders sections. - If
include_intro_linksis true, generate intro links viaIntroLinks()factory. - Clear temporary caches with
manager.clear_cache(). - Return the assembled document read by
manager.read_file_by_file_key("output_doc").
Interactions – gen_doc ties together configuration (Config), custom processing (CustomModule*), the GPT backend, and the Manager orchestration. No external I/O occurs beyond the initial YAML read (handled elsewhere).
Warning – The function assumes
API_KEYis defined inautodocgenerator.engine.config.config; absence raises an import error.
gen_doc_parts – Orchestrated Multi‑Chunk Documentation
| Entity | Type | Role | Notes |
|---|---|---|---|
full_code_mix |
str |
Input | Complete source to be documented. |
max_symbols |
int |
Input | Symbol limit passed to split_data. |
model |
Model |
Input | Same contract as above. |
project_settings |
ProjectSettings |
Input | Supplies global prompts. |
language |
str |
Input | Target language for docs. |
progress_bar |
BaseProgress |
Side‑effect | Tracks per‑chunk progress. |
global_info |
str / None |
Optional | Extra project context. |
all_result |
str |
Output | Concatenated documentation. |
logger |
BaseLogger |
Side‑effect | Logs orchestration milestones. |
Logic Flow
- Split source via
split_data. - Create a sub‑task on
progress_barfor the number of chunks. - For each chunk
el:- Call
write_docs_by_partspassing the previous result asprev_info. - Append returned text and two newlines to
all_result. - Retain only the last 3000 characters of
resultfor the next iteration (context window). - Update progress bar.
- Call
- Remove sub‑task, log final length, and return
all_result.
write_docs_by_parts – Per‑Chunk Documentation Generation
| Entity | Type | Role | Notes |
|---|---|---|---|
part |
str |
Input | Text fragment to document. |
model |
Model |
Input | Must implement get_answer_without_history(prompt). |
project_settings |
ProjectSettings |
Input | Provides prompt for system context. |
prev_info |
str / None |
Optional | Previously generated doc fragment. |
language |
str |
Input | Language code (default "en"). |
global_info |
str / None |
Optional | Additional project‑wide context. |
answer |
str |
Output | Raw LLM response, possibly wrapped in markdown fences. |
logger |
BaseLogger |
Side‑effect | Logs generation steps. |
Logic Flow
- Initialise logger and base system prompts (language, global project info, static
BASE_PART_COMPLITE_TEXT). - Append optional
global_infoandprev_infoprompts. - Append user prompt containing
part. - Call
model.get_answer_without_history(prompt=prompt). - Strip leading/trailing ````` fences if present and return cleaned text.
Warning – The function assumes the LLM returns a string; non‑string answers would raise a type error.
Template‑Based Custom Description Generation (generete_custom_discription_without)
| Entity | Type | Role | Notes |
|---|---|---|---|
model |
Model |
Input | LLM interface. |
custom_description |
str |
Input | Desired description task. |
language |
str |
Input (default "en") |
Language hint. |
result |
str |
Output | LLM answer respecting strict tag rules. |
Constructs a prompt that enforces a single opening `
Iterative Custom Description Generation (generete_custom_discription)
| Entity | Type | Role | Notes |
|---|---|---|---|
splited_data |
str (iterable) |
Input | Segments of documentation. |
model |
Model |
Input | LLM interface. |
custom_description |
str |
Input | Task description for the LLM. |
language |
str |
Input (default "en") |
Language hint. |
result |
str |
Output | First non‑error description. |
Iterates over splited_data, sending a prompt that includes the segment, BASE_CUSTOM_DISCRIPTIONS, and the task. Breaks when the LLM response does not contain "!noinfo" or "No information found" early in the text; otherwise continues. Returns the final result.
Repository Structure Packing (CodeMix)
| Entity | Type | Role | Notes |
|---|---|---|---|
root_dir |
Path |
Input | Base directory for scanning. |
ignore_patterns |
list[str] |
Input | Glob patterns to exclude files/dirs. |
logger |
BaseLogger |
Side‑effect | Logs ignored paths. |
should_ignore |
method |
Local | Returns True if a path matches any ignore pattern. |
output_file |
str |
Input | Destination text file for the mix. |
out |
file handle | Side‑effect | Receives repository tree and file contents. |
Logic Flow
- Resolve
root_dir; instantiateBaseLogger. should_ignoreconverts aPathto a relative string, then checks against each glob pattern (full path, basename, and any path part).build_repo_contentopensoutput_filefor writing.- First pass: iterate sorted
rglob("*"); for each non‑ignored path write an indented tree line (dir/orfile). - Write a separator line (
"="*20). - Second pass: iterate again; for each non‑ignored file, write a
<file path="…">tag, then the file’s text (read with UTF‑8, errors ignored). Errors are captured and written as plain text.
Critical – No network or external service calls; all operations are local filesystem reads/writes.
compress – Core LLM‑driven Compression
| Entity | Type | Role | Notes |
|---|---|---|---|
data |
str |
Input | Raw source text to be compressed. |
project_settings |
ProjectSettings |
Input | Supplies system prompt via its prompt property. |
model |
Model |
Input | Must implement get_answer_without_history(prompt). |
compress_power |
int |
Input | Determines compression intensity; passed to helper text. |
prompt |
list[dict] |
Local | System‑user message stack fed to the LLM. |
answer |
str |
Output | LLM’s compressed response. |
Logic Flow
- Assemble a three‑message
prompt: project‑level system prompt, a dynamically built “base compress” text (get_BASE_COMPRESS_TEXT), and the user‑provideddata. - Invoke
model.get_answer_without_history(prompt=prompt). - Return the LLM’s reply unchanged.
Assumption – No file I/O; transformation occurs entirely in‑memory.
compress_and_compare – Batch Compression with Progress
| Entity | Type | Role | Notes |
|---|---|---|---|
data |
list[str] |
Input | Collection of text fragments. |
model |
Model |
Input | Same requirements as above. |
project_settings |
ProjectSettings |
Input | Shared prompt source. |
compress_power |
int |
Input (default 4) | Max fragments per batch. |
progress_bar |
BaseProgress |
Side‑effect | Visual sub‑task tracking. |
compress_and_compare_data |
list[str] |
Local | Holds concatenated compressed batches. |
Logic Flow
- Initialise
compress_and_compare_datasized toceil(len(data)/compress_power). - Create a sub‑task on
progress_barfor the full length ofdata. - Iterate
datawith indexi; compute batch indexcurr_index = i // compress_power. - Call
compresson each element, appending the result plus a newline to the appropriate batch slot. - Update the progress bar after each element; finally remove the sub‑task.
- Return the list of batched compressed strings.
compress_to_one – Recursive Full‑Document Collapse
| Entity | Type | Role | Notes |
|---|---|---|---|
data |
list[str] |
Input/Output | Shrinks each iteration until a single string remains. |
model |
Model |
Input | Same LLM contract. |
project_settings |
ProjectSettings |
Input | Provides prompt context. |
compress_power |
int |
Input (default 4) | Base batch size; may be reduced to 2 for small tails. |
progress_bar |
BaseProgress |
Side‑effect | Propagated to inner calls. |
count_of_iter |
int |
Local | Iteration counter (for potential logging). |
Logic Flow
- Loop while
len(data) > 1. - Adjust
new_compress_power: if remaining items are fewer thancompress_power + 1, set to 2 to avoid a final singleton batch. - Replace
datawith the result ofcompress_and_compare(data, …, new_compress_power, progress_bar). - Increment
count_of_iter. - Once reduced to a single element, return
data[0].
Warning – The function assumes
compress_and_comparealways returns a non‑empty list; an empty return would raise anIndexError.
split_data – Symbol‑Based Chunking Loop
| Entity | Type | Role | Notes |
|---|---|---|---|
splited_by_files |
list[str] |
Local | Initial list of file‑level fragments (source not shown). |
max_symbols |
int |
Input | Upper bound for symbols per chunk. |
split_objects |
list[str] |
Local | Accumulates final chunks respecting max_symbols. |
logger |
BaseLogger |
Side‑effect | Emits progress messages. |
Logic Flow
- Log start.
- Refinement loop – while any element exceeds
1.5 × max_symbols, split it atmax_symbols/2and insert the second half right after the original. - Packing loop – iterate
splited_by_files; create a newsplit_objectsentry when adding the element would breach1.25 × max_symbols. Otherwise, concatenate with a newline. - Log final chunk count and return
split_objects.
Assumption –
splited_by_filesis pre‑populated; no I/O occurs here.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file autodocgenerator-0.9.2.8.tar.gz.
File metadata
- Download URL: autodocgenerator-0.9.2.8.tar.gz
- Upload date:
- Size: 39.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.2 CPython/3.12.12 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff9dec4087610d4e8369b842c94346fda6701fb1439b4571e4d6a364c72ba342
|
|
| MD5 |
6e0b63c7ef80afb3482d19759dc9ab17
|
|
| BLAKE2b-256 |
435bc5b15d02a6e69c772f7e1092278ae3885d4b5f6a491f6785d877ab9a3f11
|
File details
Details for the file autodocgenerator-0.9.2.8-py3-none-any.whl.
File metadata
- Download URL: autodocgenerator-0.9.2.8-py3-none-any.whl
- Upload date:
- Size: 35.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.2 CPython/3.12.12 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92e3100ff7bac009dfc6951f6f590fb6eab41309c4deac476fe5d7ace3c22e0d
|
|
| MD5 |
1ce36469a1cc04432745813fc73f9be3
|
|
| BLAKE2b-256 |
6abf6c3da00a0fdd43e5fb848367a5175aab93a3b02e6240cfd86a17be1f1bca
|