pub trait EmbeddingModel:
Send
+ Sync
+ Any {
// Required methods
fn embed<'life0, 'life1, 'async_trait>(
&'life0 self,
texts: Vec<&'life1 str>,
) -> 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) -> u32;
fn model_id(&self) -> &str;
// Provided method
fn warmup<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
A model that produces dense vector embeddings from text.
Required Methods§
Sourcefn embed<'life0, 'life1, 'async_trait>(
&'life0 self,
texts: Vec<&'life1 str>,
) -> 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: Vec<&'life1 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Embed a batch of text strings into dense vectors.
Returns one Vec<f32> per input text, each with dimensions()
elements.
Sourcefn dimensions(&self) -> u32
fn dimensions(&self) -> u32
The dimensionality of the embedding vectors produced by this model.