ractogateway.rag.stores.in_memory_store
In-memory vector store — pure Python, zero extra dependencies.
Uses brute-force cosine similarity over a list of stored vectors. Suitable for development, testing, and small corpora (< 10k chunks).
- class ractogateway.rag.stores.in_memory_store.InMemoryVectorStore(similarity='cosine')[source]
Bases:
BaseVectorStorePure-Python brute-force vector store — no extra dependencies.
This store keeps all chunks and their embeddings in memory. It is not suitable for production-scale corpora but requires no installation.
- Parameters:
similarity (
str) – Similarity function to use. Currently only"cosine"is supported.
- add(chunks)[source]
Add chunks (with embeddings) to the store.
- Parameters:
chunks (
list[Chunk]) – Chunks to index. Each chunk must have a non-Noneembedding.- Raises:
ValueError – If any chunk has
embedding=None.- Return type:
- search(embedding, top_k=5, filters=None)[source]
Search for the top_k most similar chunks.
- Parameters:
- Return type:
- Returns:
list[RetrievalResult] – Ranked list of results (rank 1 = most similar).