Skip to main content

Embedder

Trait Embedder 

Source
pub trait Embedder: Send + Sync {
    // Required methods
    fn embed<'life0, 'life1, 'async_trait>(
        &'life0 self,
        inputs: &'life1 [Vec<ContentPart>],
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, EmbedError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn dimension(&self) -> usize;
    fn provider_name(&self) -> &str;
    fn model_name(&self) -> &str;

    // Provided method
    fn embed_one<'life0, 'life1, 'async_trait>(
        &'life0 self,
        text: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<f32>, EmbedError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Core trait for generating multimodal embeddings.

Required Methods§

Source

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

Embed a slice of multimodal content, returning one Vec<f32> per input.

Source

fn dimension(&self) -> usize

Dimension of the vectors produced by this embedder.

Source

fn provider_name(&self) -> &str

Provider identifier used for store compatibility checks.

Source

fn model_name(&self) -> &str

Model identifier used for store compatibility checks.

Provided Methods§

Source

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

Convenience: embed a single string.

Implementors§