Skip to main content

Module embedding

Module embedding 

Source
Expand description

Embedding storage codec + similarity. Always compiled (the library indexes and searches vectors even when built without the HTTP LLM backend).

Vectors are stored in the container’s embeddings/vectors.f32 asset as a flat, row-major little-endian f32 matrix of shape rows × dim.

Functions§

centroid
Mean of a set of vectors (centroid). Empty input → empty vector.
cosine
Cosine similarity in [-1, 1]; 0 if either vector is degenerate or mismatched.
decode_f32_matrix
Decode a flat little-endian f32 buffer into rows × dim.
encode_f32_matrix
Encode an embedding matrix (rows × dim, row-major) to little-endian f32 bytes.