pub trait Embedder {
// Required methods
fn id(&self) -> String;
fn embed(&self, texts: &[String], kind: EmbedKind) -> Result<Vec<Vec<f32>>>;
// Provided methods
fn min_similarity(&self) -> f32 { ... }
fn score_margin(&self) -> f32 { ... }
}Required Methods§
Provided Methods§
Sourcefn min_similarity(&self) -> f32
fn min_similarity(&self) -> f32
Score floor under which the top match is treated as “nothing relevant” and the hook injects nothing. Embedder-specific because cosine distributions differ sharply: the hashed bag-of-words space is sparse, so unrelated text scores near 0 and a low floor works; bge is anisotropic, so even unrelated text cosines ~0.5 and the floor must sit well above that. The default is calibrated for bag-of-words; embedders override it.
Sourcefn score_margin(&self) -> f32
fn score_margin(&self) -> f32
Max score gap below the single best match for a co-relevant peer to still be injected. Tighter spaces (bge) need a smaller margin. Default is for bag-of-words.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".