Skip to main content

Embedder

Trait Embedder 

Source
pub trait Embedder {
    type Error: Error + Send + Sync + 'static;

    // Required methods
    fn embed(&self, text: &str) -> Result<Vec<f32>>;
    fn embed_batch(&self, texts: &[&str]) -> Result<Vec<Vec<f32>>>;
    fn dimension(&self) -> usize;
    fn is_ready(&self) -> bool;
}
Expand description

Text embedding abstraction for converting text to vector representations

§Synchronous Version

This trait provides synchronous operations for text embeddings.

Required Associated Types§

Source

type Error: Error + Send + Sync + 'static

The error type returned by embedding operations

Required Methods§

Source

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

Generate embeddings for a single text

Source

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

Generate embeddings for multiple texts in batch

Source

fn dimension(&self) -> usize

Get the dimensionality of embeddings produced by this embedder

Source

fn is_ready(&self) -> bool

Check if the embedder is ready for use

Implementors§