Skip to main content

AsyncEmbeddingProvider

Trait AsyncEmbeddingProvider 

Source
pub trait AsyncEmbeddingProvider: Send + Sync {
    // Required methods
    fn embed(
        &self,
        text: &str,
    ) -> impl Future<Output = MenteResult<Vec<f32>>> + Send;
    fn embed_batch(
        &self,
        texts: &[&str],
    ) -> impl Future<Output = MenteResult<Vec<Vec<f32>>>> + Send;
    fn dimensions(&self) -> usize;
    fn model_name(&self) -> &str;
}
Expand description

Asynchronous embedding provider.

Required Methods§

Source

fn embed( &self, text: &str, ) -> impl Future<Output = MenteResult<Vec<f32>>> + Send

Generate an embedding vector for a single text.

Source

fn embed_batch( &self, texts: &[&str], ) -> impl Future<Output = MenteResult<Vec<Vec<f32>>>> + Send

Generate embedding vectors for a batch of texts.

Source

fn dimensions(&self) -> usize

The dimensionality of the embedding vectors produced by this provider.

Source

fn model_name(&self) -> &str

The name of the model used by this provider.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§