semantica.vector_store provides a unified API for storing and searching vector embeddings across all major backends:
- Swap backends with a one-line change: no application code changes needed
HybridSearchfuses dense vector similarity with metadata filtering via RRF or weighted averageNamespaceManagerfor multi-tenant structural isolationFAISSStorewith flat, ivf, hnsw, and pq index types- Batch embed and store with parallel workers; metadata update without re-embedding
Exported Classes
What You Get
- VectorStore — Unified interface across FAISS, Pinecone, Weaviate, Qdrant, Milvus, PgVector
- One-line backend swap: no application code changes
add_documents()auto-embeds;store_vectors()for pre-computed embeddings
- HybridSearch — Dense vector similarity with metadata filtering
- RRF or weighted-average fusion strategies
- Multi-source fusion across separate collections
- MetadataStore — Rich metadata indexing by field values
- Update metadata fields without re-embedding
- OR and AND query operators
- NamespaceManager — Structural per-tenant namespace isolation
- Faster queries (smaller search space per tenant)
- Safer than metadata-filter-only separation
- Batch Operations — Bulk add, delete, and metadata updates
- Parallel embedding with configurable
batch_sizeandworkers - In-place vector updates without full re-indexing
- Parallel embedding with configurable
- FAISS Index Types — flat, ivf, hnsw, and pq index types
- Full configuration control via
FAISSStore.create_index() save()/load()for disk persistence
- Full configuration control via
Getting Started
VectorStore is the main entry point. Use "inmemory" for development and "faiss" for local production:
Quick Start
1
Create a vector store
2
Add vectors
3
Search by semantic similarity
4
Filter results by metadata
Backends
- In-memory / FAISS
- Pinecone
- Weaviate
- Qdrant
- PgVector
- Milvus
pip install faiss-cpu.Backend Selection Guide
HybridSearch
HybridSearch combines vector similarity with metadata filtering. Pass vector_store at construction to avoid supplying raw vectors on every call:
vector_store, pass vectors explicitly:
Metadata Filtering
MetadataFilter supports chained conditions: all conditions are ANDed:
MetadataFilter Methods
SearchRanker
SearchRanker fuses results from multiple ranked lists:
Namespace Isolation
UseNamespaceManager to assign vectors to named namespaces for multi-tenant isolation:
Batch Operations
Persistence (FAISS and in-memory)
Cloud backends (Pinecone, Weaviate, Qdrant, Milvus, PgVector) manage persistence themselves.
save()/load() are for the in-memory and FAISS backends only.MetadataStore
MetadataStore indexes structured metadata and lets you query by field values without a vector:
FAISS Index Type Reference
FAISS index type is configured by creating aFAISSStore directly and calling create_index(). Use lowercase type names:
When using
VectorStore(backend="faiss"), the underlying FAISSStore is initialised with a flat index by default. To use ivf/hnsw/pq, construct FAISSStore directly and call create_index() with the desired type.Common Workflows
- Semantic search pipeline
- Filtered retrieval
- Multi-source fusion
- Multi-tenant namespaces
- Embeddings — Generate the vectors stored here.
- Context — AgentContext uses VectorStore for memory retrieval.
- Split — Chunk documents before embedding and storing.
- Ingest — Ingest documents before embedding and storing.
