Skip to main content

SearchEmbedder

Trait SearchEmbedder 

Source
pub trait SearchEmbedder: Send + Sync {
    // Required methods
    fn dims(&self) -> usize;
    fn model_id(&self) -> &str;
    fn is_local(&self) -> bool;
    fn embed<'life0, 'life1, 'async_trait>(
        &'life0 self,
        text: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<f32>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Narrow embedding seam for the semantic message index. Core wraps its registry-configured retrieval::Embedder behind this trait so the crate never depends on the model registry (per-consumer embedder config is a RAG concern, a later decomposition wave).

Required Methods§

Source

fn dims(&self) -> usize

The dimensionality this embedder produces (fixes the vec0 table width).

Source

fn model_id(&self) -> &str

A stable identifier for the embedding model. Rows are tagged with it so a query embedded by a different model never matches an incomparable vector space.

Source

fn is_local(&self) -> bool

true for a deterministic local (network-free) embedder. Callers use this to decide whether embedding work can run inline or must be spawned off the request path.

Source

fn embed<'life0, 'life1, 'async_trait>( &'life0 self, text: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<f32>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Embed a single piece of text into a normalized vector of length dims.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§