fabricatio_novel.commands.storage
LanceDB-backed storage CLI commands (lancedb-gated).
Registers onto the shared app from fabricatio_novel.cli:
store-refs—store_reference_texts()(raw chunks)enrich-refs—store_enriched_texts()(LLM-enriched QA chunks)
Functions
|
Ingest text files as writing style references into the LanceDB vector store. |
|
Ingest text files as LLM-enriched QA chunks into the LanceDB vector store. |
Module Contents
- fabricatio_novel.commands.storage.store_reference_texts(patterns: list[str] = typer.Argument(..., help="File paths and/or glob patterns to ingest (e.g. 'refs/*.txt')."), chunks_size: int = typer.Option(512, '--chunks-size', '-cs', help='Maximum words per chunk when splitting files.', envvar='NOVEL_CHUNKS_SIZE'), overlap: float = typer.Option(0.3, '--overlap', '-ov', help='Overlap ratio between consecutive chunks (0.0–1.0).', envvar='NOVEL_OVERLAP'), ndim: int | None = _EMBED_NDIM, embedding_send_to: str | None = _EMBED_SEND_TO, batch_size: int = _BATCH_SIZE, parallel_size: int = _PARALLEL_SIZE) None
Ingest text files as writing style references into the LanceDB vector store.
Accepts literal file paths and glob patterns. All matching files are collected, deduplicated, and indexed. This is a standalone operation — it does not trigger novel generation.
- fabricatio_novel.commands.storage.store_enriched_texts(patterns: list[str] = typer.Argument(..., help="File paths and/or glob patterns to enrich and ingest (e.g. 'corpus/*.txt')."), enrich_guideline: str = typer.Option('', '--enrich-guideline', '-eg', help="Guidance passed to the LLM for QA-pair generation (e.g. 'Extract world-building facts')."), chunk_guideline: str = typer.Option('', '--chunk-guideline', '-cg', help="Guidance passed to the LLM for semantic splitting of source files (e.g. 'Split on scene boundaries')."), chunk_max_size: int = typer.Option(5, '--chunk-max-size', '-cmx', help='Maximum mini-chunks per output chunk.'), chunk_min_size: int = typer.Option(2, '--chunk-min-size', '-cmn', help='Minimum mini-chunks per output chunk.'), mini_chunk_size: int | None = typer.Option(None, '--mini-chunk-size', '-mcs', help='Mini-chunk character size (defaults to rag_config.mini_chunk_size).'), ndim: int | None = _EMBED_NDIM, embedding_send_to: str | None = _EMBED_SEND_TO, batch_size: int = _BATCH_SIZE, parallel_size: int = _PARALLEL_SIZE) None
Ingest text files as LLM-enriched QA chunks into the LanceDB vector store.
Each input file is read, semantically split 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. This is a standalone operation — it does not trigger novel generation.