Skip to main content

Module embedder

Module embedder 

Source
Expand description

Local embedding generation backed by fastembed. fastembed wrapper and per-process embedding cache.

Owns the in-process TextEmbedding model and exposes batch encode/query helpers used by remember, recall, and related commands.

Functionsยง

controlled_batch_count
Returns the number of batches that embed_passages_controlled would produce for the given token_counts slice without running inference.
embed_passage
Embeds a single passage using the passage: prefix required by E5 models.
embed_passages_batch
Embeds multiple passages in a single ONNX batch call.
embed_passages_controlled
Embeds passages grouped into token-budget-aware batches to avoid OOM on variable-length inputs.
embed_passages_serial
Embed multiple passages serially.
embed_query
Embeds a search query using the query: prefix required by E5 models.
f32_to_bytes
Convert &f32 to &u8 for sqlite-vec storage.
get_embedder
Returns the process-wide singleton embedder, initializing it on first call. Subsequent calls return the cached instance regardless of models_dir.