fabricatio_novel.actions.enrich
Action for storing LLM-enriched text chunks in the LanceDB vector store.
Mirrors StoreWritingStyleTexts: reads text files, processes them, and indexes the resulting documents under a dedicated LanceDB table. Here the processing step is EnrichChunkTextNovel.enrich, which produces question-answer pairs from each source file. Each pair is flattened into a short text string and stored as one EnrichedDocument.
Classes
MRO anchor combining enrichment, semantic chunking, and LanceDB storage. |
|
Store LLM-enriched text chunks from files into LanceDB. |
Module Contents
- class fabricatio_novel.actions.enrich.EnrichedNovelComposeRAG(/, **data: Any)
Bases:
fabricatio_novel.capabilities.enrich.EnrichChunkTextNovel,fabricatio_rag.capabilities.chunk.PreciseChunkText,fabricatio_lancedb.capabilities.lancedb.LancedbRAG[fabricatio_novel.models.novel_enrich.EnrichedDocument,fabricatio_novel.models.novel_enrich.EnrichedAddConfig,fabricatio_novel.models.novel_enrich.EnrichedFetchConfig],abc.ABCMRO anchor combining enrichment, semantic chunking, and LanceDB storage.
Pulls together: - EnrichChunkTextNovel.enrich for QA-pair generation per chunk - PreciseChunkText.precise_chunk for LLM-guided semantic splitting of source files
(each input file is split into coherent chunks before enrichment, since naive whole-file enrichment degrades on long texts)
LancedbRAG for add_document / rebuild_index machinery over EnrichedDocument
- class fabricatio_novel.actions.enrich.StoreEnrichedTexts(/, **data: Any)
Bases:
fabricatio_core.Action,EnrichedNovelComposeRAG,abc.ABCStore LLM-enriched text chunks from files into LanceDB.
Each input file is read, semantically split into coherent chunks via PreciseChunkText.precise_chunk, fed chunk-by-chunk to EnrichChunkTextNovel.enrich to produce question-answer pairs, and each pair is indexed as a separate EnrichedDocument. Document count is stored under output_key (default “stored_count”).
- chunk_guideline: str = ''
Guidance passed to PreciseChunkText.precise_chunk for semantic splitting.
- text_files: List[pathlib.Path] | None = None
Files to read, chunk, enrich, and store. Provided by the workflow runtime.
- output_key: str = 'stored_count'
Key under which the number of stored documents is stored in context.
- store_config: fabricatio_novel.models.novel_enrich.EnrichedAddConfig | None = None
Optional LanceDB add-config override (table_name, batch sizes, rebuild flag).