EmbeddingProvider

Trait EmbeddingProvider 

Source
pub trait EmbeddingProvider: Send + Sync {
    // Required methods
    fn embed<'life0, 'life1, 'async_trait>(
        &'life0 self,
        text: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = CellstateResult<EmbeddingVector>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn embed_batch<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        texts: &'life1 [&'life2 str],
    ) -> Pin<Box<dyn Future<Output = CellstateResult<Vec<EmbeddingVector>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn dimensions(&self) -> i32;
    fn model_id(&self) -> &str;
}
Expand description

Async trait for embedding providers.

Implementations must be thread-safe (Send + Sync). This is the interface definition only - implementations live in crates/api/src/providers/.

Required Methods§

Source

fn embed<'life0, 'life1, 'async_trait>( &'life0 self, text: &'life1 str, ) -> Pin<Box<dyn Future<Output = CellstateResult<EmbeddingVector>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Generate an embedding for a single text.

Source

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

Generate embeddings for multiple texts in a batch.

Source

fn dimensions(&self) -> i32

Get the number of dimensions this provider produces.

Source

fn model_id(&self) -> &str

Get the model identifier for this provider.

Implementors§