Skip to main content

EmbedBackend

Trait EmbedBackend 

Source
pub trait EmbedBackend: Send + Sync {
    // Required methods
    fn dim(&self) -> usize;
    fn embed(&self, text: &str) -> Result<Vec<f32>>;

    // Provided method
    fn model(&self) -> &str { ... }
}
Expand description

Pluggable embedding backend. The host owns the model; multilingual recall quality comes from choosing a multilingual model (e.g. bge-m3 / multilingual-e5) — text reaches the backend as NFC-normalized UTF-8, script untouched (Arabic/Mandarin/English alike).

Required Methods§

Source

fn dim(&self) -> usize

Source

fn embed(&self, text: &str) -> Result<Vec<f32>>

Provided Methods§

Source

fn model(&self) -> &str

Model identifier recorded as file provenance (e.g. “bge-m3”). Backends should override this; it lets a later open detect that the stored vectors came from a different model.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§