pub trait EmbeddingBackend: Send + Sync {
// Required methods
fn embed_batch<'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 dimension(&self) -> usize;
fn backend_kind(&self) -> BackendKind;
}Expand description
Core embedding backend trait. All backends must be Send + Sync so they
can be held behind an Arc and called from async tasks.
Required Methods§
Sourcefn embed_batch<'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_batch<'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 a batch of raw texts and return a float32 embedding per input.
Callers must pre-process texts (apply prefixes, truncation) before
calling this method. The returned Vec has the same length as
texts. Empty input returns an empty vec immediately.
Sourcefn backend_kind(&self) -> BackendKind
fn backend_kind(&self) -> BackendKind
The concrete backend kind — used for metrics and re-embed bookkeeping.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".