fabricatio_novel.actions.novel_rag
Novel RAG actions for retrieval-augmented generation.
Classes
Retrieve writing style documents from LanceDB based on a query. |
|
Inject retrieved writing style documents into scripts. |
|
Generate chapter contents from scripts with RAG writing style augmentation. |
|
Store writing style reference texts from files into LanceDB. |
Module Contents
- class fabricatio_novel.actions.novel_rag.RetrieveWritingStyles(/, **data: Any)
Bases:
fabricatio_novel.capabilities.novel_rag.NovelComposeRAG,fabricatio_core.ActionRetrieve writing style documents from LanceDB based on a query.
- writing_style_query: str | None = None
The query text used to search for relevant writing style documents.
- writing_style_fetch_config: fabricatio_novel.models.novel_rag.WritingStyleFetchConfig | None = None
Optional fetch configuration override for writing style retrieval.
- class fabricatio_novel.actions.novel_rag.InjectWritingStyleToScript(/, **data: Any)
Bases:
fabricatio_novel.capabilities.novel_rag.NovelComposeRAG,fabricatio_core.ActionInject retrieved writing style documents into scripts.
Handles both script-level (global_prompt) and scene-level (per-scene prompt) injection. Script-level uses the provided writing_styles; scene-level fetches per-scene docs from LanceDB based on each scene’s description.
- novel_scripts: List[fabricatio_novel.models.scripting.Script] | None = None
The list of chapter scripts to augment with writing style guidance.
- writing_styles: List[fabricatio_novel.models.novel_rag.WritingStyleDocument] | None = None
Global writing style documents to inject into each script’s global_prompt.
- writing_style_fetch_config: fabricatio_novel.models.novel_rag.WritingStyleFetchConfig | None = None
Optional fetch configuration override for scene-level writing style retrieval.
- class fabricatio_novel.actions.novel_rag.GenerateChaptersFromScriptsWithRAG(/, **data: Any)
Bases:
fabricatio_novel.capabilities.novel_rag.NovelComposeRAG,fabricatio_core.ActionGenerate chapter contents from scripts with RAG writing style augmentation.
Mirrors GenerateChaptersFromScripts but inherits NovelComposeRAG so that create_chapters() applies script-level and scene-level style injection before generating prose. Passes writing_style_fetch_config through kwargs.
- novel_draft: fabricatio_novel.models.draft.NovelDraft | None = None
The novel draft (for language, metadata).
- novel_scripts: List[fabricatio_novel.models.scripting.Script] | None = None
The list of chapter scripts to expand into full text.
- novel_characters: List[fabricatio_character.models.character.CharacterCard] | None = None
The list of characters to provide context.
- writing_style_query: str | None = None
Query text for writing style retrieval. Used to build default fetch config.
- writing_style_fetch_config: fabricatio_novel.models.novel_rag.WritingStyleFetchConfig | None = None
Optional fetch configuration override for writing style retrieval.
- class fabricatio_novel.actions.novel_rag.StoreWritingStyleTexts(/, **data: Any)
Bases:
fabricatio_rag.actions.db.StoreTextFile,fabricatio_novel.capabilities.novel_rag.NovelComposeRAGStore writing style reference texts from files into LanceDB.
Reads text files, splits them into chunks, and indexes them in the LanceDB vector store for later RAG retrieval. This is a standalone ingestion workflow — it does not generate novel content.
- store_model: Type[fabricatio_novel.models.novel_rag.WritingStyleDocument]
- output_key: str = 'stored_count'
The key used to store this action’s output in the context dictionary.
- store_config: fabricatio_lancedb.capabilities.lancedb.LancedbAddRAGConfig | None = None