Skip to main content

EmbeddingProvider

Trait EmbeddingProvider 

Source
pub trait EmbeddingProvider: Send + Sync {
    // Required methods
    fn embed<'life0, 'async_trait>(
        &'life0 self,
        texts: Vec<String>,
    ) -> Pin<Box<dyn Future<Output = VectorResult<Vec<Vec<f32>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn embed_one<'life0, 'life1, 'async_trait>(
        &'life0 self,
        text: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = VectorResult<Vec<f32>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn health_check<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = VectorResult<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn model_info<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = VectorResult<ModelInfo>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

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

Abstraction over text embedding providers.

Required Methods§

Source

fn embed<'life0, 'async_trait>( &'life0 self, texts: Vec<String>, ) -> Pin<Box<dyn Future<Output = VectorResult<Vec<Vec<f32>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Embed a list of texts.

Source

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

Embed a single text.

Source

fn health_check<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = VectorResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Check service readiness.

Source

fn model_info<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = VectorResult<ModelInfo>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return metadata about the active model.

Provided Methods§

Source

fn cache_stats<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Option<EmbeddingCacheStats>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return cache statistics when available.

Implementors§