Skip to main content

rightkit_embed/
lib.rs

1//! Local embeddings and a persistent cosine vector store.
2//!
3//! Feature boundaries: `inference` (ONNX text embedder) and `vector` (SQLite-backed
4//! cosine store). Both are default-on; a `vector`-only build does not pull ort or tokenizers.
5
6#[cfg(all(feature = "inference", target_os = "macos"))]
7mod coreml;
8#[cfg(feature = "inference")]
9mod coreml_units;
10#[cfg(feature = "inference")]
11mod e40;
12#[cfg(feature = "inference")]
13mod embedder;
14#[cfg(feature = "inference")]
15mod parity_cache;
16#[cfg(feature = "vector")]
17mod vector;
18
19#[cfg(feature = "inference")]
20pub use coreml_units::{
21    CoreMlComputeUnit, CoreMlUnits, CoreMlUnitsParseError, NEURAL_ENGINE_MAX_TOKENS,
22};
23/// Benchmark support, behind the `bench-internals` feature; not part of the stable API.
24#[cfg(feature = "bench-internals")]
25pub use e40::{E40SessionProfile, RunSplit};
26#[cfg(feature = "inference")]
27pub use embedder::{
28    truncate_and_normalize, AcceleratorParity, EmbedError, Embedder, EmbedderConfig,
29    ExecutionProvider, LoadTimings, ParityCacheOutcome, SessionCreate,
30    ACCELERATOR_PARITY_MIN_COSINE, DEFAULT_MAX_BATCH, EMBEDDINGGEMMA2_COREML_MODEL_ID,
31    EMBEDDINGGEMMA2_E40_MODEL_ID, EMBEDDINGGEMMA2_MODEL_ID, EMBEDDINGGEMMA_MODEL_ID,
32};
33#[cfg(feature = "bench-internals")]
34pub use embedder::{BenchEmbedSplit, BenchTokens};
35#[cfg(feature = "vector")]
36pub use vector::{cosine_similarity, Nearest, VectorError, VectorStore, DEFAULT_VECTOR_DIM};