Skip to main content

MultiVectorEmbeddingModel

Trait MultiVectorEmbeddingModel 

Source
pub trait MultiVectorEmbeddingModel: ModelInfo {
    // Required methods
    fn embed<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        texts: &'life1 [&'life2 str],
    ) -> Pin<Box<dyn Future<Output = Result<MultiVectorEmbedResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn dimensions(&self) -> u32;

    // Provided method
    fn warmup<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

A model that produces per-token (multi-vector / ColBERT) embeddings from text.

Use cases include late-interaction reranking with BGE-M3’s ColBERT head and answerai-colbert-small. Each input yields a variable-length list of per-token vectors; score them against a query with max_sim.

Required Methods§

Source

fn embed<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, texts: &'life1 [&'life2 str], ) -> Pin<Box<dyn Future<Output = Result<MultiVectorEmbedResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Embed a batch of text strings into per-token vectors.

Returns one ragged list of per-token vectors per input, in input order.

§Errors

Returns an error if tokenization fails, the model session errors, or the upstream API rejects the request.

Source

fn dimensions(&self) -> u32

The dimensionality of each per-token vector produced by this model.

Provided Methods§

Source

fn warmup<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Optional warmup hook (e.g. load weights into memory on first access). The default is a no-op.

§Errors

Returns an error if the underlying model fails to initialize.

Implementors§