pub trait Embedder:
Send
+ Sync
+ Debug {
// Required methods
fn model(&self) -> &str;
fn embed(&self, texts: &[&str]) -> Result<Vec<Vec<f32>>, Error>;
fn dimension(&self) -> usize;
}Expand description
Turns texts into vectors of one dimension.
Required Methods§
Sourcefn model(&self) -> &str
fn model(&self) -> &str
Names the model, so vectors from another one are never compared
with these: static:<file name> or local:<program>.
Sourcefn embed(&self, texts: &[&str]) -> Result<Vec<Vec<f32>>, Error>
fn embed(&self, texts: &[&str]) -> Result<Vec<Vec<f32>>, Error>
One vector per text, in order, each dimension
long. A text the model has nothing for gets zeros.
fn dimension(&self) -> usize
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".