ZeusDB is a high-performance vector database powered by Rust, offering advanced features like product quantization, persistent storage, and enterprise-grade logging.This documentation shows how to use ZeusDB to bring enterprise-grade vector search capabilities to your LangChain applications.
Quick Start
Installation
Getting Started
This example uses OpenAIEmbeddings, which requires an OpenAI API key - Get your OpenAI API key here If you prefer, you can also use this package with any other embedding provider (Hugging Face, Cohere, custom functions, etc.).Basic Usage
Factory Methods
For convenience, you can create and populate a vector store in a single step:Example 1: Create from texts (creates index and adds texts in one step)
Example 2: - Create from documents (creates index and adds documents in one step)
Advanced Features
ZeusDB’s enterprise-grade capabilities are fully integrated into the LangChain ecosystem, providing quantization, persistence, advanced search features and many other enterprise capabilities.Memory-Efficient Setup with Quantization
For large datasets, use Product Quantization to reduce memory usage:Persistence
ZeusDB persistence lets you save a fully populated index to disk and load it later with complete state restoration. This includes vectors, metadata, HNSW graph, and (if enabled) Product Quantization models. What gets saved:- Vectors & IDs
- Metadata
- HNSW graph structure
- Quantization config, centroids, and training state (if PQ is enabled)
How to Save your vector store
How to Load your vector store
Notes
- The path is a directory, not a single file. Ensure the target is writable.
- Saved indexes are cross-platform and include format/version info for compatibility checks.
- If you used PQ, both the compression model and state are preserved—no need to retrain after loading.
- You can continue to use all vector store APIs (similarity_search, retrievers, etc.) on the loaded_store.
Advanced Search Options
Use these to control scoring, diversity, metadata filtering, and retriever integration for your searches.Similarity search with scores
Returns(Document, raw_distance)
pairs from ZeusDB — lower distance = more similar.
If you prefer normalized relevance in [0, 1]
, use similarity_search_with_relevance_scores
.
MMR search for diversity
MMR (Maximal Marginal Relevance) balances two forces: relevance to the query and diversity among selected results, reducing near-duplicate answers. Control the trade-off with lambda_mult (1.0 = all relevance, 0.0 = all diversity).Search with metadata filtering
Filter results using document metadata you stored when adding docsAs a Retriever
Turning the vector store into a retriever gives you a standard LangChain interface that chains (e.g., RetrievalQA) can call to fetch context. Under the hood it uses your chosen search type (similarity or mmr) and search_kwargs.Async Support
ZeusDB supports asynchronous operations for non-blocking, concurrent vector operations. When to use async: web servers (FastAPI/Starlette), agents/pipelines doing parallel searches, or notebooks where you want non-blocking/concurrent retrieval. If you’re writing simple scripts, the sync methods are fine. Those are asynchronous operations - the async/await versions of the regular synchronous methods. Here’s what each one does:await vector_store.aadd_documents(documents)
- Asynchronously adds documents to the vector store (async version ofadd_documents()
)await vector_store.asimilarity_search("query", k=5)
- Asynchronously performs similarity search (async version ofsimilarity_search()
)await vector_store.adelete(ids=["doc1", "doc2"])
- Asynchronously deletes documents by their IDs (async version ofdelete()
)
- You’re building async applications (using
asyncio
, FastAPI, etc.) - You want non-blocking operations that can run concurrently
- You’re handling multiple requests simultaneously
- You want better performance in I/O-bound applications
python my_script.py
):
await
):
Monitoring and Observability
Performance Monitoring
Enterprise Logging
ZeusDB includes enterprise-grade structured logging that works automatically with smart environment detection:Configuration Options
Index Parameters
Search Parameters
Error Handling
The integration includes comprehensive error handling:Requirements
- Python: 3.10 or higher
- ZeusDB: 0.0.8 or higher
- LangChain Core: 0.3.74 or higher
Installation from Source
Use Cases
- RAG Applications: High-performance retrieval for question answering
- Semantic Search: Fast similarity search across large document collections
- Recommendation Systems: Vector-based content and collaborative filtering
- Embeddings Analytics: Analysis of high-dimensional embedding spaces
- Real-time Applications: Low-latency vector search for production systems
Compatibility
LangChain Versions
- LangChain Core: 0.3.74+
Distance Metrics
- Cosine: Default, normalized similarity
- Euclidean (L2): Geometric distance
- Manhattan (L1): City-block distance
Embedding Models
Compatible with any embedding provider:- OpenAI (
text-embedding-3-small
,text-embedding-3-large
) - Hugging Face Transformers
- Cohere Embeddings
- Custom embedding functions
Support
- Documentation: docs.zeusdb.com
- Issues: GitHub Issues
- Email: contact@zeusdb.com
Making vector search fast, scalable, and developer-friendly.