Skip to main content

embed_passages_batch

Function embed_passages_batch 

Source
pub fn embed_passages_batch(
    embedder: &Mutex<TextEmbedding>,
    texts: &[&str],
    batch_size: usize,
) -> Result<Vec<Vec<f32>>, AppError>
Expand description

Embeds multiple passages in a single ONNX batch call.

batch_size is capped at FASTEMBED_BATCH_SIZE. All texts receive the passage: prefix.

ยงErrors

Returns Err when the mutex is poisoned or the model inference fails.