fabricatio_novel.capabilities.novel_mental
Mental state integration for novel composition.
Provides optional psychological state tracking for characters during novel generation. Characters are seeded with mental states from their CharacterCard, and states evolve after each chapter via LLM event analysis.
Usage:
from fabricatio_novel.capabilities.novel_mental import MentalComposeMixin
class MyComposer(MentalComposeMixin):
pass
Classes
Mixin that adds psychological state tracking to novel composition. |
Functions
|
Build per-character event strings from chapter summary. |
|
Render character mental states as concise prompt injection. |
Module Contents
- class fabricatio_novel.capabilities.novel_mental.NovelComposeMental(/, **data: Any)
Bases:
fabricatio_novel.capabilities.novel.NovelCompose,fabricatio_character.capabilities.mental.UseMindMixin that adds psychological state tracking to novel composition.
Overrides compose_novel and create_chapters to seed, inject, and evolve character mental states. Reuses all base class methods via super().
- async seed_mental_states(characters: List[fabricatio_character.models.character.CharacterCard]) Dict[str, fabricatio_character.models.mental.MentalState]
Seed mental states for a list of characters.
Standalone entry point — does not require the novel pipeline.
- character_system_prompt(states: Dict[str, fabricatio_character.models.mental.MentalState], name: str) str
Get the system prompt for a character based on their current mental state.
Returns empty string if character not found.
- async compose_novel(outline: str, language: str | None = None, chapter_guidance: str | None = None, **kwargs: Unpack[fabricatio_core.models.kwargs_types.ValidateKwargs[fabricatio_novel.models.novel.Novel]]) Novel | None
Novel composition pipeline with mental state integration.
- async create_chapters(draft: fabricatio_novel.models.draft.NovelDraft, chapter_plans: List[ChapterPlan], characters: List[CharacterCard], guidance: str | None = None, character_states: Dict[str, fabricatio_character.models.mental.MentalState] | None = None, **kwargs: Unpack[fabricatio_core.models.kwargs_types.ValidateKwargs[str]]) List[str]
Generate chapters with mental state injection and evolution.
Wraps base class create_chapters: injects mental states into prompt context before each chapter, evolves states after each chapter summary.
- fabricatio_novel.capabilities.novel_mental.build_character_events(summary: fabricatio_novel.models.scripting.ChapterSummary, states: Dict[str, fabricatio_character.models.mental.MentalState]) Dict[str, str]
Build per-character event strings from chapter summary.
- fabricatio_novel.capabilities.novel_mental.mental_states_context(states: Dict[str, fabricatio_character.models.mental.MentalState]) str
Render character mental states as concise prompt injection.