Skip to main content

cognee_vector/
lib.rs

1//! Vector database abstraction for Cognee-Rust.
2//!
3//! Provides vector storage and similarity search for embeddings.
4
5/// Pure-Rust in-memory brute-force vector database (OSS default fallback).
6pub mod brute_force_vector_db;
7/// Error types for vector database operations.
8pub mod error;
9/// Data models for vector points, search results, and collection configuration.
10pub mod models;
11/// Vector database trait definition.
12pub mod vector_db_trait;
13
14#[cfg(feature = "pgvector")]
15pub mod pgvector_adapter;
16
17/// Embedded file-backed vector store via the LanceDB crate.
18///
19/// Disabled on Android — the LanceDB + Arrow native stack does not
20/// cross-compile cleanly to mobile targets, so `BruteForceVectorDB`
21/// remains the Android default.
22#[cfg(not(target_os = "android"))]
23pub mod lancedb_adapter;
24
25#[cfg(feature = "testing")]
26pub mod mock_vector_db;
27
28pub use brute_force_vector_db::BruteForceVectorDB;
29pub use error::{VectorDBError, VectorDBResult};
30pub use models::{
31    CollectionConfig, DATASET_ID_KEY, DATASET_IDS_KEY, DistanceMetric, SearchResult, VectorPoint,
32};
33pub use vector_db_trait::VectorDB;
34
35#[cfg(feature = "pgvector")]
36pub use pgvector_adapter::PgVectorAdapter;
37
38#[cfg(not(target_os = "android"))]
39pub use lancedb_adapter::LanceDbAdapter;
40
41#[cfg(feature = "testing")]
42pub use mock_vector_db::MockVectorDB;