Semtrace::EmbeddingStore
Loads and indexes a static token embedding matrix for nearest-neighbor search.
Binary format (from extract_embeddings.py): Header: vocab_size (u32 LE), dimensions (u32 LE) Data: vocab_size * dimensions float32 values, row-major
Constructors
Class methods
Adds vector b to vector a, returning a new array.
Computes the L2 (Euclidean) norm of a vector.
Instance methods
close
Sourcedimensions
SourceReturns the L2-normalized embedding vector for a token ID. Only available if build_norm_index was true.
Finds the k nearest tokens to a query vector.
Finds the k nearest tokens by inner product.
search_normalized(query : Array(Float32) | Slice(Float32), k : Int = 1) : Array(USearch::SearchResult)
Finds the k nearest normalized tokens to a query vector.
vocab
Sourcevocab_size
Source