rag.core.index ============== .. py:module:: rag.core.index .. autoapi-nested-parse:: Chroma persistence helpers for the papers collection. Exceptions ---------- .. autoapisummary:: rag.core.index.IndexMissingError Functions --------- .. autoapisummary:: rag.core.index.open_chroma_collection rag.core.index.load_vector_index Module Contents --------------- .. py:exception:: IndexMissingError Bases: :py:obj:`FileNotFoundError` Raised when the Chroma collection has no documents yet. .. py:function:: open_chroma_collection(*, config: rag.core.config.RagConfig) -> Any Open (or create) the persistent Chroma collection. :param config: Paths and collection name. :type config: RagConfig :returns: Open collection handle. :rtype: chromadb.Collection .. py:function:: load_vector_index(*, config: rag.core.config.RagConfig, embed_model: llama_index.core.embeddings.BaseEmbedding, require_nonempty: bool = True) -> llama_index.core.VectorStoreIndex Load a ``VectorStoreIndex`` backed by the persistent Chroma store. :param config: Index configuration. :type config: RagConfig :param embed_model: Embedding model used at query time (must match ingest). :type embed_model: BaseEmbedding :param require_nonempty: When True, raise if the collection has zero documents. :type require_nonempty: bool :returns: LlamaIndex vector index over Chroma. :rtype: VectorStoreIndex :raises IndexMissingError: If ``require_nonempty`` and the collection is empty.