Skip to main content

MultimodalEmbeddingModel

Trait MultimodalEmbeddingModel 

Source
pub trait MultimodalEmbeddingModel: ModelInfo {
    // Required methods
    fn embed<'life0, 'async_trait>(
        &'life0 self,
        inputs: Vec<MultimodalInput>,
    ) -> Pin<Box<dyn Future<Output = Result<EmbedResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn dimensions(&self) -> u32;
    fn supported_modalities(&self) -> &[Modality];

    // 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 a single dense vector from heterogeneous content (text + image + audio together).

Supports models like Cohere Embed v4, Jina Embeddings v4, and Gemini Embedding 2 that map mixed-modality inputs into a single shared embedding space.

Required Methods§

Source

fn embed<'life0, 'async_trait>( &'life0 self, inputs: Vec<MultimodalInput>, ) -> Pin<Box<dyn Future<Output = Result<EmbedResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Embed a batch of mixed-modality inputs.

Each MultimodalInput produces one vector spanning all its blocks.

§Errors

Returns an error if the provider rejects an unsupported modality combination or runs out of memory.

Source

fn dimensions(&self) -> u32

The dimensionality of vectors produced by this model.

Source

fn supported_modalities(&self) -> &[Modality]

Modalities accepted by this model (e.g. &[Text, Image] for Cohere Embed v4 vs &[Text, Image, Audio, Video] for Gemini Embedding 2).

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. The default is a no-op.

§Errors

Returns an error if the underlying model fails to initialize.

Implementors§