fabricatio_novel.actions.novel_rag
Novel RAG actions for retrieval-augmented generation.
Classes
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.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. The writing_style_query is the raw user intent (e.g. “Hemingway terse prose style”) and is used for LanceDB retrieval — enable use_refined_query on the fetch config (or the WritingStyleFetchConfig instance) to expand it into multiple semantically diverse queries via the LLM before search.
- 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
Raw user writing-style intent. Used for both LanceDB retrieval (as the search query) and, when use_refined_query is enabled on the fetch config, as the input to LLM-driven query refinement.
- writing_style_fetch_config: fabricatio_novel.models.novel_rag.WritingStyleFetchConfig | None = None
Optional fetch configuration override. Set use_refined_query=True on it to enable LLM-based query refinement; set refined_query_count to control how many variants are produced.
- use_reranker: bool = False
When True, embedding search fetches limit * rerank_scale_factor docs, then reranks to limit.
- use_refined_query: bool | None = None
Convenience override for WritingStyleFetchConfig.use_refined_query. Has no effect when writing_style_fetch_config is supplied explicitly (use the config field instead). Tri-state: None leaves the default (False); True/False toggles refinement on/off.
- refined_query_count: int | None = None
Convenience override for WritingStyleFetchConfig.refined_query_count. Ignored when writing_style_fetch_config is supplied explicitly.
- refine_query_template: str | None = None
Convenience override for WritingStyleFetchConfig.refine_query_template. Ignored when writing_style_fetch_config is supplied explicitly.
- 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