ruvector_core/
lib.rs

1//! # Ruvector Core
2//!
3//! High-performance Rust-native vector database with HNSW indexing and SIMD-optimized operations.
4//!
5//! ## Working Features (Tested & Benchmarked)
6//!
7//! - **HNSW Indexing**: Approximate nearest neighbor search with O(log n) complexity
8//! - **SIMD Distance**: SimSIMD-powered distance calculations (~16M ops/sec for 512-dim)
9//! - **Quantization**: Scalar (4x) and binary (32x) compression with distance support
10//! - **Persistence**: REDB-based storage with config persistence
11//! - **Search**: ~2.5K queries/sec on 10K vectors (benchmarked)
12//!
13//! ## ⚠️ Experimental/Incomplete Features - READ BEFORE USE
14//!
15//! - **AgenticDB**: ⚠️⚠️⚠️ **CRITICAL WARNING** ⚠️⚠️⚠️
16//!   - Uses PLACEHOLDER hash-based embeddings, NOT real semantic embeddings
17//!   - "dog" and "cat" will NOT be similar (different characters)
18//!   - "dog" and "god" WILL be similar (same characters) - **This is wrong!**
19//!   - **MUST integrate real embedding model for production** (ONNX, Candle, or API)
20//!   - See [`agenticdb`] module docs and `/examples/onnx-embeddings` for integration
21//! - **Advanced Features**: Conformal prediction, hybrid search - functional but less tested
22//!
23//! ## What This Is NOT
24//!
25//! - This is NOT a complete RAG solution - you need external embedding models
26//! - Examples use mock embeddings for demonstration only
27
28#![warn(missing_docs)]
29#![warn(clippy::all)]
30
31pub mod advanced_features;
32
33// AgenticDB requires storage feature
34#[cfg(feature = "storage")]
35pub mod agenticdb;
36
37pub mod distance;
38pub mod embeddings;
39pub mod error;
40pub mod index;
41pub mod quantization;
42
43// Storage backends - conditional compilation based on features
44#[cfg(feature = "storage")]
45pub mod storage;
46
47#[cfg(not(feature = "storage"))]
48pub mod storage_memory;
49
50#[cfg(not(feature = "storage"))]
51pub use storage_memory as storage;
52
53pub mod types;
54pub mod vector_db;
55
56// Performance optimization modules
57pub mod arena;
58pub mod cache_optimized;
59pub mod lockfree;
60pub mod simd_intrinsics;
61
62/// Advanced techniques: hypergraphs, learned indexes, neural hashing, TDA (Phase 6)
63pub mod advanced;
64
65// Re-exports
66pub use advanced_features::{
67    ConformalConfig, ConformalPredictor, EnhancedPQ, FilterExpression, FilterStrategy,
68    FilteredSearch, HybridConfig, HybridSearch, MMRConfig, MMRSearch, PQConfig, PredictionSet,
69    BM25,
70};
71
72#[cfg(feature = "storage")]
73pub use agenticdb::AgenticDB;
74
75pub use embeddings::{EmbeddingProvider, HashEmbedding, ApiEmbedding, BoxedEmbeddingProvider};
76
77#[cfg(feature = "real-embeddings")]
78pub use embeddings::CandleEmbedding;
79
80// Compile-time warning about AgenticDB limitations
81#[cfg(feature = "storage")]
82const _: () = {
83    // This will appear in cargo build output as a note
84    #[deprecated(
85        since = "0.1.0",
86        note = "AgenticDB uses placeholder hash-based embeddings. For semantic search, integrate a real embedding model (ONNX, Candle, or API). See /examples/onnx-embeddings for production setup."
87    )]
88    const AGENTICDB_EMBEDDING_WARNING: () = ();
89    let _ = AGENTICDB_EMBEDDING_WARNING;
90};
91
92pub use error::{Result, RuvectorError};
93pub use types::{DistanceMetric, SearchQuery, SearchResult, VectorEntry, VectorId};
94pub use vector_db::VectorDB;
95
96#[cfg(test)]
97mod tests {
98    use super::*;
99
100    #[test]
101    fn test_version() {
102        // Verify version matches workspace - use dynamic check instead of hardcoded value
103        let version = env!("CARGO_PKG_VERSION");
104        assert!(!version.is_empty(), "Version should not be empty");
105        assert!(version.starts_with("0.1."), "Version should be 0.1.x");
106    }
107}