pub trait Embedder: Send + Sync {
// Required methods
fn embed<'life0, 'life1, 'async_trait>(
&'life0 self,
texts: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn dimensions(&self) -> usize;
}Expand description
Trait for text embedding models.
Implementations must be Send + Sync to allow sharing across async tasks
via Arc<dyn Embedder>.
Required Methods§
Sourcefn embed<'life0, 'life1, 'async_trait>(
&'life0 self,
texts: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn embed<'life0, 'life1, 'async_trait>(
&'life0 self,
texts: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Embed one or more texts into fixed-dimensional vectors.
Returns one vector per input text. All vectors have the same
dimensionality (see dimensions).
Sourcefn dimensions(&self) -> usize
fn dimensions(&self) -> usize
Dimensionality of the output vectors (e.g., 384 for BGE-Small-EN).