fabricatio_novel.capabilities.novel

This module contains the capabilities for the novel.

Classes

NovelCompose

This class contains the capabilities for the novel.

Module Contents

class fabricatio_novel.capabilities.novel.NovelCompose(/, **data: Any)

Bases: fabricatio_character.capabilities.character.CharacterCompose, fabricatio_core.capabilities.propose.Propose, fabricatio_core.capabilities.usages.UseLLM, abc.ABC

This class contains the capabilities for the novel.

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]]) fabricatio_novel.models.novel.Novel | None

Main novel composition pipeline.

async create_draft(outline: str, language: str | None = None, **kwargs: Unpack[fabricatio_core.models.kwargs_types.ValidateKwargs[fabricatio_novel.models.draft.NovelDraft]]) fabricatio_novel.models.draft.NovelDraft | None

Generate a draft for the novel based on the provided outline.

async create_characters(draft: fabricatio_novel.models.draft.NovelDraft, **kwargs: Unpack[fabricatio_core.models.kwargs_types.ValidateKwargs[fabricatio_character.models.character.CharacterCard]]) None | List[fabricatio_character.models.character.CharacterCard] | List[fabricatio_character.models.character.CharacterCard | None]

Generate characters based on draft.

async create_scripts(draft: fabricatio_novel.models.draft.NovelDraft, characters: List[fabricatio_character.models.character.CharacterCard], **kwargs: Unpack[fabricatio_core.models.kwargs_types.ValidateKwargs[fabricatio_novel.models.scripting.Script]]) List[fabricatio_novel.models.scripting.Script] | List[fabricatio_novel.models.scripting.Script | None] | None

Generate chapter scripts based on draft and characters.

async create_chapters(draft: fabricatio_novel.models.draft.NovelDraft, chapter_plans: List[fabricatio_novel.models.plan.ChapterPlan], characters: List[fabricatio_character.models.character.CharacterCard], guidance: str | None = None, **kwargs: Unpack[fabricatio_core.models.kwargs_types.ValidateKwargs[str]]) List[str]

Generate chapters sequentially with rolling summary context.

Each chapter is generated one at a time. After each chapter, a structured summary is produced and passed to the next chapter’s prompt to maintain narrative continuity across the entire novel.

async summarize_chapter(chapter_title: str, chapter_content: str, language: str, previous_summary: fabricatio_novel.models.scripting.ChapterSummary | None = None, **kwargs: Unpack[fabricatio_core.models.kwargs_types.ValidateKwargs[fabricatio_novel.models.scripting.ChapterSummary]]) fabricatio_novel.models.scripting.ChapterSummary | None

Generate a structured summary of a chapter for cross-chapter context tracking.

Parameters:
  • chapter_title – The formatted title of the chapter.

  • chapter_content – The raw text content of the generated chapter.

  • language – The language of the novel.

  • previous_summary – The previous chapter’s summary, used as starting-state reference. For the first chapter this is None.

  • **kwargs – Additional keyword arguments for LLM usage.

Returns:

A ChapterSummary if successful, None otherwise.

static assemble_novel(draft: fabricatio_novel.models.draft.NovelDraft, chapter_plans: List[fabricatio_novel.models.plan.ChapterPlan], chapter_contents: List[str]) fabricatio_novel.models.novel.Novel

Assemble the final novel from components.