Skip to main content

Module embed

Module embed 

Source
Expand description

Comindly embed — local static embeddings for semantic code search.

Uses Model2Vec (model2vec-rs) static embeddings: pure-Rust, CPU-only, no ONNX runtime, tiny + fast (~ms/query) — the approach semble validated for agentic code search. Vectors are L2-normalized, so cosine similarity is a plain dot product.

This is the optional semantic layer. It rides on top of the deterministic graph: search fuses this signal with lexical BM25 and graph centrality (see comindly’s hybrid search) — never the sole retrieval path.

Modules§

rank
Code-aware ranking signals for hybrid search: identifier splitting, lexical scoring, query classification, and path penalties. Ideas borrowed from semble (re-implemented, not copied); comindly adds a dependency-graph centrality signal on top (applied by the caller).

Structs§

Embedder
Loads a Model2Vec model (from a Hugging Face repo id or a local path) and encodes text.

Constants§

DEFAULT_MODEL
A small, well-known static model. Swap for a code-specialized Model2Vec distillation (e.g. a potion-code variant) for higher code accuracy — same API.

Functions§

symbol_text
Build the text used to represent a symbol for embedding: name, signature, the human-readable descriptor path, and docstring — the tokens a natural-language query about this code would plausibly match.