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
  • 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")?;
ⓘ
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.)
EmbeddingSpaceAccess
Capabilities retained when opening a corpus with an incompatible active embedding space. Vector inspection never invokes the active embedder.
EmbeddingSpaceIdentity
Complete immutable identity of a retrieval vector space.
HashEmbedding
Hash-based embedding provider (placeholder, not semantic)
PromptTemplates
The exact query and passage prompt templates a registered model owns.
SymmetricEmbeddingAdapter
Explicit migration wrapper for symmetric embedding implementations.

Enums§

EmbeddingDistanceMetric
EmbeddingRole
The role of text at a retrieval boundary.
EmbeddingRolePolicy
Whether a model requires distinct query and passage transforms.
OutputDtype
PoolingStrategy
PoolingStrategyName
PrefixPolicy

Constants§

EMBEDDING_SPACE_FORMAT_REVISION
Revision of this crate’s embedding semantics, and the only ruvector-owned version number that may reach runtime_revision and therefore embedding_space_id.

Traits§

EmbeddingProvider
Trait for text embedding providers

Functions§

apply_prompt_template
Apply the identity’s registered prompt template for role to 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§

BoxedEmbeddingProvider
Type-erased embedding provider for dynamic dispatch