pub trait EmbeddingFunc:
Send
+ Sync
+ 'static {
// Required method
fn embed<'life0, 'async_trait>(
&'life0 self,
texts: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, StoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
}Expand description
Trait for computing embeddings for vector search.
Implementations provide async embedding generation from text inputs, used by vector-capable stores for similarity search.
§Errors
Implementations should return StoreError::Embedding or a suitable variant
if embedding generation fails (network error, model error, etc.).
Required Methods§
Sourcefn embed<'life0, 'async_trait>(
&'life0 self,
texts: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, StoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn embed<'life0, 'async_trait>(
&'life0 self,
texts: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, StoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Generate embedding vectors for the given texts.
§Arguments
texts- Text strings to embed
§Errors
Returns StoreError if embedding generation fails.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".