pub trait EmbeddingBackend: Send + Sync {
// Required methods
fn embedding_dimension(&self) -> usize;
fn is_bert_based(&self) -> bool;
fn process_batch<'life0, 'async_trait>(
&'life0 self,
texts: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
A backend capable of producing embedding vectors for a batch of texts.
Required Methods§
Sourcefn embedding_dimension(&self) -> usize
fn embedding_dimension(&self) -> usize
Dimension of the produced embedding vectors.
Sourcefn is_bert_based(&self) -> bool
fn is_bert_based(&self) -> bool
Whether this backend runs a BERT-style model. BERT backends are routed through the engine’s concurrency controller, timeout, and adaptive batching machinery; non-BERT backends are invoked directly.
Sourcefn process_batch<'life0, 'async_trait>(
&'life0 self,
texts: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn process_batch<'life0, 'async_trait>(
&'life0 self,
texts: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Process a batch of texts and return one embedding vector per text.
The engine slices large inputs into chunks no larger than the engine’s
current_batch_size before calling this method.