Skip to main content

EmbeddingProvider

Trait EmbeddingProvider 

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

Synchronous embedding provider.

Required Methods§

Source

fn embed(&self, text: &str) -> MenteResult<Vec<f32>>

Generate an embedding vector for a single text.

Source

fn embed_batch(&self, texts: &[&str]) -> MenteResult<Vec<Vec<f32>>>

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.

Implementors§