pub trait Embedder: Send + Sync {
// Required methods
fn embed(&self, texts: &[&str]) -> Result<Vec<Vec<f32>>>;
fn model_id(&self) -> &str;
fn dim(&self) -> usize;
// Provided method
fn embed_one(&self, text: &str) -> Result<Vec<f32>> { ... }
}Expand description
Required Methods§
Sourcefn embed(&self, texts: &[&str]) -> Result<Vec<Vec<f32>>>
fn embed(&self, texts: &[&str]) -> Result<Vec<Vec<f32>>>
Embed a batch of texts. out[i] corresponds to texts[i].
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl Embedder for HashEmbedder
impl Embedder for Model2VecEmbedder
Available on crate feature
embed only.