pub trait Embedder:
Send
+ Sync
+ 'static {
// Required methods
fn embed<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
inputs: &'life1 [&'life2 str],
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, EmbedError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
fn dim(&self) -> usize;
fn handle(&self) -> &str;
}Expand description
Producer of fixed-dimension float vectors for input text. Batched.
Adapters MUST:
- Return exactly
inputs.len()vectors, in the same order. - Each vector MUST be exactly
dim()long. - Treat empty
inputsasOk(Vec::new())(no provider call).
Required Methods§
Sourcefn embed<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
inputs: &'life1 [&'life2 str],
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, EmbedError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn embed<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
inputs: &'life1 [&'life2 str],
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, EmbedError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Embed a batch of strings. Empty input → empty output, no provider call.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".