autorag.store

Vector-store façade for the RAG pipeline.

Defines the VectorStore interface that Retriever calls into. Concrete backends (in-memory, Chroma, etc.) implement the four primitives; the topic-side Chroma collection used by the /viz page lives separately in autorag.chroma_store.

class autorag.store.VectorStore[source]

Bases: object

Abstract embedding-vector store.

Subclasses provide a backend-specific implementation of each method. The interface is intentionally thin: the orchestration layer (AutoRAG) handles batching, persistence cadence, and tenant separation.

add(chunks)[source]

Insert chunks (with populated embedding fields) into the store.

Parameters:

chunks (list[Chunk])

Return type:

None

search(query_embedding, top_k)[source]

Return the top_k nearest chunks to query_embedding.

Parameters:
Return type:

list[Retrieved]

persist()[source]

Flush in-memory state to durable storage.

Return type:

None

load()[source]

Restore previously persisted state.

Return type:

None

class autorag.store.InMemoryStore[source]

Bases: VectorStore

Simple, non-persistent reference implementation.

Stores chunks in a Python list. Useful for tests and small demos; not suitable for production retrieval workloads.

add(chunks)[source]

Append chunks; no embedding-index structure is built.

Parameters:

chunks (list[Chunk])

Return type:

None