Skip to main content

QueryEmbedder

Trait QueryEmbedder 

Source
pub trait QueryEmbedder:
    Send
    + Sync
    + Debug {
    // Required methods
    fn embed_query(&self, text: &str) -> Result<Vec<f32>, EmbedderError>;
    fn identity(&self) -> QueryEmbedderIdentity;
}
Expand description

A read-time query embedder.

Implementations must be Send + Sync so the coordinator can share a single Arc<dyn QueryEmbedder> across reader threads without cloning per call. All methods are &self — embedders are expected to be internally immutable or to manage their own interior mutability.

Required Methods§

Source

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

Embed a single query string into a dense vector.

§Errors

Returns EmbedderError::Unavailable if the embedder cannot produce a vector right now (e.g. the model weights failed to load under a feature-flag stub), or EmbedderError::Failed if the embedding pipeline itself errored. The coordinator treats either variant as a graceful degradation, NOT a hard query failure.

Source

fn identity(&self) -> QueryEmbedderIdentity

Model identity / version / dimension / normalization identity.

Must match the write-time contract for the corresponding vec table. Phase 12.5a does not yet enforce the match at runtime; Phase 12.5b will gate the vector branch on identity() equality with the active vector profile.

Implementors§