Skip to main content

Embedder

Trait Embedder 

Source
pub trait Embedder: Send {
    // Required methods
    fn dim(&self) -> usize;
    fn embed(&mut self, texts: &[&str]) -> Result<Vec<Vec<f32>>, HostError>;
}
Expand description

Turns texts into embedding vectors. Batched by design — providers price and perform far better on batches.

Required Methods§

Source

fn dim(&self) -> usize

Vector dimension this embedder produces. 0 disables the vector layer (the engine is fully functional without it).

Source

fn embed(&mut self, texts: &[&str]) -> Result<Vec<Vec<f32>>, HostError>

Embeds every text, one vector per input, in input order.

§Errors

HostError::Embed describing the transport or response problem.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§