Skip to main content

EmbeddingModel

Trait EmbeddingModel 

Source
pub trait EmbeddingModel: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn version(&self) -> &str;
    fn dimension(&self) -> u32;
    fn embed_batch(&self, texts: &[&str]) -> OrbokResult<Vec<Vec<f32>>>;
}
Expand description

Local embedding model abstraction (RFC-008 §6).

Implementations must not transmit text externally (NFR-001).

Required Methods§

Source

fn name(&self) -> &str

Stable name stored in models.model_name.

Source

fn version(&self) -> &str

Version string stored in models.model_version.

Source

fn dimension(&self) -> u32

Output dimension — must match stored embeddings (RFC-008 §11).

Source

fn embed_batch(&self, texts: &[&str]) -> OrbokResult<Vec<Vec<f32>>>

Embed a batch of normalized texts. Returns one vector per input, each L2-normalized.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§