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 - 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.)
- Hash
Embedding - Hash-based embedding provider (placeholder, not semantic)
Traits§
- Embedding
Provider - Trait for text embedding providers
Type Aliases§
- Boxed
Embedding Provider - Type-erased embedding provider for dynamic dispatch