Expand description
Semantic (embedding) search over schema records.
Embeds path + description + type per record and the query with a local
all-MiniLM-L6-v2 model (pipeline borrowed from ae), compresses to 64-d
Matryoshka vectors, and ranks by cosine. Falls back to a deterministic hash
embedder when the model can’t be fetched, so it always runs.
v0 embeds every record per invocation (fine at schema scale). A persistent embedding cache keyed by schema hash — like ae’s SQLite store — is the follow-up for very large / federated schemas; the embed and rank steps are kept separable here so that cache drops in cleanly.
Functions§
- clear_
cache - Delete all cached embedding vector files; returns how many were removed.
- is_
cached - Whether the schema’s vectors are already cached (either embedder kind), so a semantic search would be warm. Checked without loading a model.
- search
- Embed the query and each record, rank by cosine. Returns
(score, record)pairs, best first — the caller formats them exactly like fuzzy hits, so--json/--ndjsonwork identically in both modes. - warm
- Embed + cache every record’s vector without running a real query — pre-warms the cache so the first search is instant. Returns the record count.