Skip to main content

MultiFunctionEmbedder

Trait MultiFunctionEmbedder 

Source
pub trait MultiFunctionEmbedder: Send + Sync {
    // Required methods
    fn embed_multi<'a>(&'a self, text: &'a str) -> MultiEmbedFuture<'a>;
    fn embed_batch_multi<'a>(
        &'a self,
        texts: Vec<String>,
    ) -> MultiEmbedBatchFuture<'a>;
    fn model_name(&self) -> &str;
    fn dimensions(&self) -> usize;
}
Expand description

Trait for embedders that produce multiple representations from a single model call: dense, sparse, and multi-vector.

This is the BGE-M3 style multi-function interface. Implementations produce all three representations so that downstream retrieval can fuse them via Reciprocal Rank Fusion (RRF) or other methods.

Required Methods§

Source

fn embed_multi<'a>(&'a self, text: &'a str) -> MultiEmbedFuture<'a>

Embed a single text, returning dense, sparse, and multi-vec representations.

Source

fn embed_batch_multi<'a>( &'a self, texts: Vec<String>, ) -> MultiEmbedBatchFuture<'a>

Embed multiple texts in a batch, returning all three representations per text.

Takes owned strings to avoid lifetime issues across async boundaries.

Source

fn model_name(&self) -> &str

The model name this embedder uses.

Source

fn dimensions(&self) -> usize

Expected dense embedding dimensions.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§