Skip to main content

BatchEmbedder

Trait BatchEmbedder 

Source
pub trait BatchEmbedder: Send + Sync {
    // Required methods
    fn batch_embed(
        &self,
        texts: &[String],
    ) -> Result<Vec<Vec<f32>>, EmbedderError>;
    fn identity(&self) -> QueryEmbedderIdentity;
    fn max_tokens(&self) -> usize;
}
Expand description

A write-time batch embedder used by regenerate_vector_embeddings_in_process.

Unlike QueryEmbedder (which operates one query at a time for read-time vector search), BatchEmbedder accepts a slice of texts and returns a vector per input. This is more efficient for write-time regeneration where all chunk texts can be processed together.

Required Methods§

Source

fn batch_embed(&self, texts: &[String]) -> Result<Vec<Vec<f32>>, EmbedderError>

Embed a batch of texts. Returns one Vec<f32> per input text, in the same order.

§Errors

Returns EmbedderError if the embedder cannot process the batch.

Source

fn identity(&self) -> QueryEmbedderIdentity

Model identity metadata. Must match the write-time contract for the vec table being written.

Source

fn max_tokens(&self) -> usize

Maximum number of tokens this embedder can process per text chunk.

Implementors§