Content generation¶
axiom.populate¶
axiom.populate — LLM universe authoring.
The seven Creator Studio “Populate” generators, engine-side: each one reads the universe context from the .db, queries the extraction LLM and inserts the new content idempotently (already-known ids/names are skipped). After every write, the text source of a folder universe is resynchronised (the text stays the source of truth).
Zero Qt dependency. The LLM is injectable (llm=) for tests and composition; by default it is built from the user config with the extraction model. Progress messages go through on_status (optional callback) — the Qt tasks plug it into their signals.
populate_entities specificity (TICKET-031): the context is processed in chunks and each chunk is committed immediately — an LLM failure mid-batch (429 quota exhausted despite the backend retries) keeps the work already done, and re-running resumes where it stopped.
- axiom.populate.entity_id_for(name)[source]¶
Stable id derived from an entity name.
A 100% non-Latin name (Cyrillic, CJK…) would yield an empty _safe_id — the entity would then be silently skipped. Deterministic fallback (hash of the name): the Populate idempotency (re-run = resume, known ids skipped) requires ids that are stable from one run to the next.
- axiom.populate.populate_meta(db_path, mode='auto', custom_text=None, llm=None, on_status=<function _noop_status>, cancel=None)[source]¶
Refine the metadata (name, global lore, system prompt, first message).
- axiom.populate.populate_stats(db_path, mode='auto', custom_text=None, llm=None, on_status=<function _noop_status>, cancel=None)[source]¶
Generate stat definitions. Returns the number inserted.
- axiom.populate.populate_rules(db_path, mode='auto', custom_text=None, llm=None, on_status=<function _noop_status>, cancel=None)[source]¶
Generate game rules. Returns the number inserted.
- axiom.populate.populate_events(db_path, mode='auto', custom_text=None, llm=None, on_status=<function _noop_status>, cancel=None)[source]¶
Schedule world events. Returns the number inserted.
- axiom.populate.populate_entities(db_path, mode='auto', custom_text=None, llm=None, on_status=<function _noop_status>, cancel=None)[source]¶
Generate NPCs/factions from the context (or a free-form instruction).
The context is split into chunks (global lore + each lore entry); each chunk is inserted and committed immediately (TICKET-031): an LLM failure mid-batch keeps the work already done, re-running resumes (existing ids are skipped). Returns the number inserted.
- axiom.populate.populate_lore(db_path, mode='auto', custom_text=None, llm=None, on_status=<function _noop_status>, cancel=None)[source]¶
Extend the Lore Book. Returns the number of inserted entries.
axiom.regenerate¶
axiom.regenerate — regenerating a narrative variant.
Replays turn turn_id with the same player message to produce a new variant of the narrative text (without re-evaluating rules or stats), then appends it to the turn’s multiverse payload in the Event_Log ({“active”: idx, “variants”: […]}).
Zero Qt dependency. Streaming is surfaced through the on_token callback.
- axiom.regenerate.history_to_messages(history)[source]¶
Convert the event-sourced history (user_input / narrative_text) into LLM messages (the active variant is authoritative for the narrative).
- axiom.regenerate.regenerate_variant(llm, db_path, save_id, turn_id, history, system_prompt, user_message, temperature=0.7, top_p=1.0, verbosity_level='balanced', player_id='player_1', on_token=None)[source]¶
Generate an alternative variant of turn turn_id and record it.
The new variant is appended to the turn’s narrative_text payload and becomes the active variant. Returns the generated text.
axiom.image_generator¶
axiom/image_generator.py
Image generator engine for Axiom AI. Translates game/narrative context into visual prompts using the LLM and calls local image generation APIs (Stable Diffusion WebUI, ComfyUI, or mock).
- axiom.image_generator.closest_aspect_ratio(width, height)[source]¶
Return the supported Gemini aspect ratio closest to width/height.
- class axiom.image_generator.ImageGenerator(config, llm=None)[source]¶
Handles prompt generation and communication with local image generation backends.
- Parameters:
config (AppConfig)
llm (LLMBackend | None)
- config¶
The AppConfig instance containing image settings.
- llm¶
The LLMBackend instance used for prompt engineering.
- generate_prompt(narrative_text, location_desc='', character_desc='', game_state_tag='')[source]¶
Use the auxiliary LLM to extract a visual prompt from the narrative turn.
- Parameters:
- Returns:
A comma-separated visual prompt optimized for Stable Diffusion.
- Return type: