| Crates.io | lumosai_vector |
| lib.rs | lumosai_vector |
| version | 0.1.4 |
| created_at | 2025-06-09 09:16:00.166434+00 |
| updated_at | 2025-06-14 13:47:01.4158+00 |
| description | Unified vector storage system for Lumos.ai |
| homepage | |
| repository | https://github.com/louloulin/lumos.ai.git |
| max_upload_size | |
| id | 1705703 |
| size | 244,538 |
A unified, high-performance vector storage system for Lumos.ai that provides a consistent interface across multiple storage backends.
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)
Add to your Cargo.toml:
[dependencies]
lumosai_vector = { path = "../lumosai_vector", features = ["memory"] }
use lumosai_vector::prelude::*;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a memory storage instance
let storage = lumosai_vector::memory::MemoryVectorStorage::new().await?;
// Create an index
let config = IndexConfig::new("documents", 384)
.with_metric(SimilarityMetric::Cosine);
storage.create_index(config).await?;
// Insert documents
let docs = vec![
Document::new("doc1", "Hello world")
.with_embedding(vec![0.1; 384])
.with_metadata("type", "greeting"),
];
storage.upsert_documents("documents", docs).await?;
// Search
let request = SearchRequest::new("documents", vec![0.1; 384])
.with_top_k(5);
let results = storage.search(request).await?;
println!("Found {} results", results.results.len());
Ok(())
}
Fast in-memory storage for development and testing:
use lumosai_vector::memory::MemoryVectorStorage;
let storage = MemoryVectorStorage::new().await?;
Features:
High-performance vector database (requires qdrant feature):
lumosai_vector = { features = ["qdrant"] }
use lumosai_vector::qdrant::QdrantVectorStorage;
let storage = QdrantVectorStorage::new("http://localhost:6334").await?;
Features:
SQL database with pgvector extension (requires postgres feature):
lumosai_vector = { features = ["postgres"] }
use lumosai_vector::postgres::PostgresVectorStorage;
let storage = PostgresVectorStorage::new("postgresql://user:pass@localhost/db").await?;
Features:
default = ["memory"] - Includes memory storagememory - In-memory storage implementationqdrant - Qdrant vector database supportpostgres - PostgreSQL with pgvector supportall - All available backendsThe system can automatically detect and use the best available backend:
use lumosai_vector::utils;
let storage = utils::create_auto_storage().await?;
This will try backends in order of preference:
Run tests for all modules:
cd lumosai_vector
cargo test --workspace
Run tests for specific backend:
cargo test -p lumosai-vector-memory
cargo test -p lumosai-vector-qdrant --features qdrant
This unified module replaces the previous separate crates:
lumos-vector-core โ lumosai_vector::corelumos-vector-memory โ lumosai_vector::memorylumos-vector-qdrant โ lumosai_vector::qdrantThe API remains the same, only import paths have changed.
Benchmark results on a typical development machine:
| Backend | Insert (1K docs) | Search (top-10) | Memory Usage |
|---|---|---|---|
| Memory | 50ms | 2ms | 100MB |
| Qdrant | 200ms | 5ms | 50MB |
VectorStorage traitMIT OR Apache-2.0