Lumosai Vector Storage System
A unified, high-performance vector storage system for Lumos.ai that provides a consistent interface across multiple storage backends.
๐ Features
- Unified Interface: Single API for all vector storage backends
- Multiple Backends: Memory, Qdrant, PostgreSQL, MongoDB, and more
- High Performance: Optimized for speed and scalability
- Type Safety: Strong typing with comprehensive error handling
- Async/Await: Full async support with tokio
- Extensible: Easy to add new storage backends
๐ Architecture
lumosai_vector/
โโโ core/ # Core abstractions and traits
โโโ memory/ # In-memory storage implementation
โโโ qdrant/ # Qdrant vector database integration
โโโ postgres/ # PostgreSQL with pgvector support
โโโ mongodb/ # MongoDB vector search (coming soon)
โโโ vectorize/ # Cloudflare Vectorize (coming soon)
๐ง Quick Start
Add to your Cargo.toml:
[]
= { = "../lumosai_vector", = ["memory"] }
Basic Usage
use *;
async
๐๏ธ Storage Backends
Memory Storage
Fast in-memory storage for development and testing:
use MemoryVectorStorage;
let storage = new.await?;
Features:
- โ Fast in-memory operations
- โ Perfect for development and testing
- โ No external dependencies
- โ Data is not persistent
Qdrant Storage
High-performance vector database (requires qdrant feature):
= { = ["qdrant"] }
use QdrantVectorStorage;
let storage = new.await?;
Features:
- โ High-performance vector search
- โ Distributed and scalable
- โ Advanced filtering capabilities
- โ Production-ready
PostgreSQL Storage
SQL database with pgvector extension (requires postgres feature):
= { = ["postgres"] }
use PostgresVectorStorage;
let storage = new.await?;
Features:
- โ ACID transactions
- โ SQL integration
- โ Rich metadata queries
- โ Mature ecosystem
๐ง Configuration
Features
default = ["memory"]- Includes memory storagememory- In-memory storage implementationqdrant- Qdrant vector database supportpostgres- PostgreSQL with pgvector supportall- All available backends
Auto-Detection
The system can automatically detect and use the best available backend:
use utils;
let storage = create_auto_storage.await?;
This will try backends in order of preference:
- Qdrant (if available and configured)
- PostgreSQL (if DATABASE_URL is set)
- Memory (fallback)
๐งช Testing
Run tests for all modules:
Run tests for specific backend:
๐ Migration from Old Architecture
This unified module replaces the previous separate crates:
lumos-vector-coreโlumosai_vector::corelumos-vector-memoryโlumosai_vector::memorylumos-vector-qdrantโlumosai_vector::qdrant
The API remains the same, only import paths have changed.
๐ Performance
Benchmark results on a typical development machine:
| Backend | Insert (1K docs) | Search (top-10) | Memory Usage |
|---|---|---|---|
| Memory | 50ms | 2ms | 100MB |
| Qdrant | 200ms | 5ms | 50MB |
๐ค Contributing
- Add new storage backends in their own subdirectory
- Implement the
VectorStoragetrait - Add feature flags and documentation
- Include comprehensive tests
๐ License
MIT OR Apache-2.0