rag.core.index¶

Chroma persistence helpers for the papers collection.

Exceptions¶

IndexMissingError

Raised when the Chroma collection has no documents yet.

Functions¶

open_chroma_collection(→ Any)

Open (or create) the persistent Chroma collection.

load_vector_index(→ llama_index.core.VectorStoreIndex)

Load a VectorStoreIndex backed by the persistent Chroma store.

Module Contents¶

exception rag.core.index.IndexMissingError[source]¶

Bases: FileNotFoundError

Raised when the Chroma collection has no documents yet.

rag.core.index.open_chroma_collection(*, config: rag.core.config.RagConfig) Any[source]¶

Open (or create) the persistent Chroma collection.

Parameters:

config (RagConfig) – Paths and collection name.

Returns:

Open collection handle.

Return type:

chromadb.Collection

rag.core.index.load_vector_index(*, config: rag.core.config.RagConfig, embed_model: llama_index.core.embeddings.BaseEmbedding, require_nonempty: bool = True) llama_index.core.VectorStoreIndex[source]¶

Load a VectorStoreIndex backed by the persistent Chroma store.

Parameters:
  • config (RagConfig) – Index configuration.

  • embed_model (BaseEmbedding) – Embedding model used at query time (must match ingest).

  • require_nonempty (bool) – When True, raise if the collection has zero documents.

Returns:

LlamaIndex vector index over Chroma.

Return type:

VectorStoreIndex

Raises:

IndexMissingError – If require_nonempty and the collection is empty.