ractogateway.rag.stores.base

Abstract base class for vector stores.

class ractogateway.rag.stores.base.BaseVectorStore[source]

Bases: ABC

Persist and search embedding vectors.

All vector stores share the same interface: add(), search(), delete(), clear(), and count(). The underlying storage backend is determined by the concrete subclass.

abstractmethod add(chunks)[source]

Add chunks (with embeddings) to the store.

Parameters:

chunks (list[Chunk]) – Chunks to index. Each chunk must have a non-None embedding.

Raises:

ValueError – If any chunk has embedding=None.

Return type:

None

abstractmethod search(embedding, top_k=5, filters=None)[source]

Search for the top_k most similar chunks.

Parameters:
  • embedding (list[float]) – Query embedding vector.

  • top_k (int) – Number of results to return.

  • filters (dict[str, Any] | None) – Optional metadata filters (store-specific format).

Return type:

list[RetrievalResult]

Returns:

list[RetrievalResult] – Ranked list of results (rank 1 = most similar).

abstractmethod delete(chunk_ids)[source]

Remove chunks with the given IDs from the store.

Return type:

None

abstractmethod clear()[source]

Remove all chunks from the store.

Return type:

None

abstractmethod count()[source]

Return the total number of indexed chunks.

Return type:

int