EmbeddingProvider

Trait EmbeddingProvider 

Source
pub trait EmbeddingProvider: Send + Sync {
    // Required methods
    fn embed_record<'life0, 'life1, 'async_trait>(
        &'life0 self,
        record: &'life1 DataRecord,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<f32>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn embed_batch<'life0, 'life1, 'async_trait>(
        &'life0 self,
        records: &'life1 [DataRecord],
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn dimension(&self) -> usize;
}
Expand description

Trait for computing embeddings from records

Required Methods§

Source

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

Compute embedding for a single record

Source

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

Compute embeddings for a batch of records

Source

fn dimension(&self) -> usize

Embedding dimension

Implementors§