Expand description
Text Embedding Providers
This module provides a pluggable embedding system for AgenticDB.
§Available Providers
- HashEmbedding: Fast hash-based placeholder (default, not semantic)
- OnnxEmbedding: Real semantic embeddings using ONNX Runtime (feature:
onnx-embeddings) ✅ RECOMMENDED - LatticeEmbedding: Real semantic embeddings using lattice-embed, pure-Rust native inference (feature:
lattice-embeddings) - CandleEmbedding: Real embeddings using candle-transformers (feature:
real-embeddings) - ApiEmbedding: External API calls (OpenAI, Anthropic, Cohere, etc.)
§Usage
use ruvector_core::embeddings::{EmbeddingProvider, HashEmbedding};
// Default: Hash-based (fast, but not semantic)
let hash_provider = HashEmbedding::new(384);
let embedding = hash_provider.embed("hello world")?;
§ONNX Embeddings (Recommended for Production)
ⓘ
use ruvector_core::embeddings::{EmbeddingProvider, OnnxEmbedding};
// Real semantic embeddings using all-MiniLM-L6-v2
let provider = OnnxEmbedding::from_pretrained("sentence-transformers/all-MiniLM-L6-v2")?;
let embedding = provider.embed("hello world")?;
// "dog" and "cat" WILL be similar (semantic understanding!)Structs§
- ApiEmbedding
- API-based embedding provider (OpenAI, Anthropic, Cohere, etc.)
- Embedding
Space Access - Capabilities retained when opening a corpus with an incompatible active embedding space. Vector inspection never invokes the active embedder.
- Embedding
Space Identity - Complete immutable identity of a retrieval vector space.
- Hash
Embedding - Hash-based embedding provider (placeholder, not semantic)
- Prompt
Templates - The exact query and passage prompt templates a registered model owns.
- Symmetric
Embedding Adapter - Explicit migration wrapper for symmetric embedding implementations.
Enums§
- Embedding
Distance Metric - Embedding
Role - The role of text at a retrieval boundary.
- Embedding
Role Policy - Whether a model requires distinct query and passage transforms.
- Output
Dtype - Pooling
Strategy - Pooling
Strategy Name - Prefix
Policy
Constants§
- EMBEDDING_
SPACE_ FORMAT_ REVISION - Revision of this crate’s embedding semantics, and the only ruvector-owned
version number that may reach
runtime_revisionand thereforeembedding_space_id.
Traits§
- Embedding
Provider - Trait for text embedding providers
Functions§
- apply_
prompt_ template - Apply the identity’s registered prompt template for
roleto raw text. - build_
revision - Build provenance of the running binary — informational only.
- default_
space_ identity - A non-attested symmetric identity for providers with no registry fixture (hash placeholders, opaque fleet backends, tests).
- embedding_
cache_ key - legacy_
embed_ call_ count - registry_
identity - Build the identity a registered model must have, from the exact registry
fixture for
model_id. - registry_
prompt_ templates - The exact prompt templates registered for
model_id.
Type Aliases§
- Boxed
Embedding Provider - Type-erased embedding provider for dynamic dispatch