rag.core.ingest =============== .. py:module:: rag.core.ingest .. autoapi-nested-parse:: PDF ingest pipeline: load → chunk → embed → Chroma (LlamaIndex path). Classes ------- .. autoapisummary:: rag.core.ingest.IngestResult Functions --------- .. autoapisummary:: rag.core.ingest.build_embed_model rag.core.ingest.load_pdf_documents rag.core.ingest.ingest_llamaindex rag.core.ingest.ingest_papers Module Contents --------------- .. py:class:: IngestResult Summary of an ingest run. :ivar documents: Number of page-level documents written (PDFs with extractable text). :vartype documents: int :ivar nodes: Number of chunks written to Chroma. :vartype nodes: int :ivar chroma_dir: Persistence directory used. :vartype chroma_dir: Path :ivar collection_name: Chroma collection name. :vartype collection_name: str .. py:attribute:: documents :type: int .. py:attribute:: nodes :type: int .. py:attribute:: chroma_dir :type: pathlib.Path .. py:attribute:: collection_name :type: str .. py:function:: build_embed_model(*, config: rag.core.config.RagConfig) -> llama_index.embeddings.huggingface.HuggingFaceEmbedding Construct the local HuggingFace embedding model. :param config: Provides ``embed_model_name``. :type config: RagConfig :returns: LlamaIndex embedding wrapper. :rtype: HuggingFaceEmbedding .. py:function:: load_pdf_documents(*, pdf_paths: collections.abc.Sequence[pathlib.Path]) -> list[llama_index.core.Document] Extract per-page LlamaIndex documents from PDFs. :param pdf_paths: PDF files to load. :type pdf_paths: sequence of Path :returns: One LlamaIndex document per extractable page. :rtype: list of Document :raises FileNotFoundError: If no page yields extractable text. .. py:function:: ingest_llamaindex(*, config: rag.core.config.RagConfig, embed_model: llama_index.core.embeddings.BaseEmbedding | None = None, rebuild: bool = True) -> IngestResult Ingest PDFs with LlamaIndex into persistent Chroma. :param config: Paths, chunking, and model settings. :type config: RagConfig :param embed_model: Optional pre-built embedder (tests can inject a stub). :type embed_model: BaseEmbedding or None :param rebuild: When True, delete the existing collection before writing. :type rebuild: bool :returns: Counts and paths for the run. :rtype: IngestResult .. py:function:: ingest_papers(*, config: rag.core.config.RagConfig, embed_model: llama_index.core.embeddings.BaseEmbedding | None = None, rebuild: bool = True) -> IngestResult Ingest PDFs using ``config.strategy``. :param config: Paths, chunking, model settings, and orchestration strategy. :type config: RagConfig :param embed_model: Optional LlamaIndex embedder (ignored by other backends). :type embed_model: BaseEmbedding or None :param rebuild: When True, delete the existing collection before writing. :type rebuild: bool :returns: Counts and paths for the run. :rtype: IngestResult