Skip to main content

leann_core/
lib.rs

1//! LEANN — Lightweight Embedding-Augmented Nearest Neighbors.
2//!
3//! Build, search, and manage vector indexes with optional graph-based
4//! embedding recomputation for 97% storage reduction.
5//!
6//! # Quick start
7//!
8//! ```ignore
9//! use leann_core::{LeannBuilder, LeannSearcher};
10//!
11//! // Build an index
12//! let mut builder = LeannBuilder::new("model-name", Some(384), "sentence-transformers");
13//! builder.add_text("Hello world", Default::default());
14//! builder.build_index(&path, &provider)?;
15//!
16//! // Search
17//! let searcher = LeannSearcher::open(&path)?;
18//! let results = searcher.search("hello", 5)?;
19//! ```
20
21pub mod backend;
22#[cfg(feature = "bm25")]
23pub(crate) mod bm25;
24pub mod builder;
25#[cfg(feature = "chat")]
26pub mod chat;
27pub mod chunking;
28pub mod document_loaders;
29pub mod embedding;
30pub mod hnsw;
31pub mod index;
32pub(crate) mod metadata_filter;
33#[cfg(feature = "multi-vector")]
34pub mod multi_vector;
35pub mod passages;
36#[cfg(feature = "chat")]
37pub mod react_agent;
38pub mod search_result;
39pub mod searcher;
40pub(crate) mod settings;
41pub mod sources_manifest;
42#[cfg(feature = "watch")]
43pub mod sync;
44
45pub use backend::{BackendConfig, BackendIndex};
46pub use builder::LeannBuilder;
47#[cfg(feature = "chat")]
48pub use chat::LeannChat;
49pub use index::IndexMeta;
50pub use metadata_filter::{FilterSpec, MetadataFilterEngine, MetadataFilters};
51pub use passages::{Passage, PassageManager};
52pub use search_result::SearchResult;
53pub use searcher::{LeannSearcher, SearcherOptions};
54
55#[cfg(feature = "bm25")]
56pub use bm25::BM25Scorer;