pub trait Embedder: Send + Sync {
// Required methods
fn embed<'life0, 'life1, 'async_trait>(
&'life0 self,
text: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>, CoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn dim(&self) -> usize;
// Provided methods
fn embed_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
texts: &'life1 [String],
_rule_ids: Option<&'life2 [String]>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, CoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn is_semantic(&self) -> bool { ... }
}Expand description
Abstract embedding provider.
Uses #[async_trait] to keep the trait object-safe
(i.e. usable as Box<dyn Embedder>) while allowing async fn syntax.
Required Methods§
fn embed<'life0, 'life1, 'async_trait>(
&'life0 self,
text: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>, CoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn dim(&self) -> usize
Provided Methods§
fn embed_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
texts: &'life1 [String],
_rule_ids: Option<&'life2 [String]>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, CoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Sourcefn is_semantic(&self) -> bool
fn is_semantic(&self) -> bool
Whether this embedder produces semantically meaningful vectors.
Defaults to true so real embedding providers don’t have to opt
in; lexical-only fallbacks override to false so hybrid retrieval
knows to lean harder on the FTS baseline for keyword-heavy queries.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".