pub trait Embedder: Send + Sync {
// Required methods
fn model_name(&self) -> &str;
fn dimension(&self) -> usize;
fn max_tokens(&self) -> usize;
fn modalities(&self) -> &[Modality];
fn embed_text<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
texts: &'life1 [&'life2 str],
config: &'life3 EmbeddingConfig,
) -> Pin<Box<dyn Future<Output = Result<Vec<EmbeddingOutput>, EmbedError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
// Provided methods
fn embed_image<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_image_data: &'life1 [u8],
_config: &'life2 EmbeddingConfig,
) -> Pin<Box<dyn Future<Output = Result<EmbeddingOutput, EmbedError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn embed_query<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
query: &'life1 str,
config: &'life2 EmbeddingConfig,
) -> Pin<Box<dyn Future<Output = Result<EmbeddingOutput, EmbedError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
}Expand description
Trait for generating embeddings.
Required Methods§
Sourcefn model_name(&self) -> &str
fn model_name(&self) -> &str
Model name/identifier.
Sourcefn max_tokens(&self) -> usize
fn max_tokens(&self) -> usize
Maximum tokens per input.
Sourcefn modalities(&self) -> &[Modality]
fn modalities(&self) -> &[Modality]
Supported modalities.
Sourcefn embed_text<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
texts: &'life1 [&'life2 str],
config: &'life3 EmbeddingConfig,
) -> Pin<Box<dyn Future<Output = Result<Vec<EmbeddingOutput>, EmbedError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn embed_text<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
texts: &'life1 [&'life2 str],
config: &'life3 EmbeddingConfig,
) -> Pin<Box<dyn Future<Output = Result<Vec<EmbeddingOutput>, EmbedError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Embed text content.
Provided Methods§
Sourcefn embed_image<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_image_data: &'life1 [u8],
_config: &'life2 EmbeddingConfig,
) -> Pin<Box<dyn Future<Output = Result<EmbeddingOutput, EmbedError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn embed_image<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_image_data: &'life1 [u8],
_config: &'life2 EmbeddingConfig,
) -> Pin<Box<dyn Future<Output = Result<EmbeddingOutput, EmbedError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Embed image content.
Sourcefn embed_query<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
query: &'life1 str,
config: &'life2 EmbeddingConfig,
) -> Pin<Box<dyn Future<Output = Result<EmbeddingOutput, EmbedError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn embed_query<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
query: &'life1 str,
config: &'life2 EmbeddingConfig,
) -> Pin<Box<dyn Future<Output = Result<EmbeddingOutput, EmbedError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Embed a query (may use different instruction).