Skip to main content

Module embeddings

Module embeddings 

Source
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")?;
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.)
HashEmbedding
Hash-based embedding provider (placeholder, not semantic)

Traits§

EmbeddingProvider
Trait for text embedding providers

Type Aliases§

BoxedEmbeddingProvider
Type-erased embedding provider for dynamic dispatch