pub trait EmbeddingProvider: Send + Sync {
// Required methods
fn content_dim(&self) -> usize;
fn trigger_dim(&self) -> usize;
fn embed_content(&self, text: &str) -> Result<Vec<f32>>;
fn embed_trigger(&self, text: &str) -> Result<Vec<f32>>;
// Provided methods
fn model_name(&self) -> &'static str { ... }
fn embed_both(&self, text: &str) -> Result<(Vec<f32>, Vec<f32>)> { ... }
}Expand description
Embedding provider trait — swap for real models at construction time.
Required Methods§
fn content_dim(&self) -> usize
fn trigger_dim(&self) -> usize
fn embed_content(&self, text: &str) -> Result<Vec<f32>>
fn embed_trigger(&self, text: &str) -> Result<Vec<f32>>
Provided Methods§
fn model_name(&self) -> &'static str
Sourcefn embed_both(&self, text: &str) -> Result<(Vec<f32>, Vec<f32>)>
fn embed_both(&self, text: &str) -> Result<(Vec<f32>, Vec<f32>)>
Embed text for both the content and trigger spaces. Default issues two
separate calls. Providers backed by a single shared model (e.g. a remote
embedding endpoint) should override this to make one request and avoid the
duplicate round trip on the recall hot path.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".