ractogateway.rag.stores.milvus_store

Milvus / Zilliz vector store (lazy import).

Install with: pip install ractogateway[rag-milvus]

class ractogateway.rag.stores.milvus_store.MilvusStore(collection='ractogateway', *, host='localhost', port=19530, uri=None, token=None, dimension=None, metric_type='IP', batch_size=100)[source]

Bases: BaseVectorStore

Vector store backed by Milvus or Zilliz Cloud.

Parameters:
  • collection (str) – Milvus collection name.

  • host (str) – Milvus server host (default "localhost").

  • port (int) – Milvus server port (default 19530).

  • uri (str | None) – Zilliz Cloud URI (overrides host/port when set).

  • token (str | None) – Zilliz Cloud API token.

  • dimension (int | None) – Embedding dimension. Inferred on first add.

  • metric_type (str) – "IP" (inner product / cosine) or "L2".

  • batch_size (int) – Vectors per insert batch.

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

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).

delete(chunk_ids)[source]

Remove chunks with the given IDs from the store.

Return type:

None

clear()[source]

Remove all chunks from the store.

Return type:

None

count()[source]

Return the total number of indexed chunks.

Return type:

int