pub trait EmbeddingService: Send + Sync {
// Required methods
fn generate_embedding<'life0, 'life1, 'async_trait>(
&'life0 self,
text: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>, ContextError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn generate_batch_embeddings<'life0, 'life1, 'async_trait>(
&'life0 self,
texts: Vec<&'life1 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, ContextError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn embedding_dimension(&self) -> usize;
fn max_text_length(&self) -> usize;
}Expand description
Embedding service trait for generating vector embeddings
Required Methods§
Sourcefn generate_embedding<'life0, 'life1, 'async_trait>(
&'life0 self,
text: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn generate_embedding<'life0, 'life1, 'async_trait>(
&'life0 self,
text: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Generate embedding for text content
Sourcefn generate_batch_embeddings<'life0, 'life1, 'async_trait>(
&'life0 self,
texts: Vec<&'life1 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn generate_batch_embeddings<'life0, 'life1, 'async_trait>(
&'life0 self,
texts: Vec<&'life1 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Generate embeddings for multiple texts in batch
Sourcefn embedding_dimension(&self) -> usize
fn embedding_dimension(&self) -> usize
Get the dimension of embeddings produced by this service
Sourcefn max_text_length(&self) -> usize
fn max_text_length(&self) -> usize
Get the maximum text length supported