bankai/embed

embed — the embedding seam. Turns text into a fixed-dim vector for aarondb’s vec_index (HNSW). bankai’s vector features (dedup, memory RAG, semantic search) call embed here and nothing else.

Default backend: the signed hashing trick over lowercased tokens — dependency-free (pure Gleam + aarondb/vector.normalize), deterministic, produces LEXICAL-similarity vectors (catches near-duplicate wording, not synonyms). To get true semantic similarity, swap this single module’s embed for an OpenAI/ollama-backed one; nothing else in bankai changes.

Values

pub const backend: String

The default backend’s name (surfaced in CLI/help so the lexical limitation is honest, not hidden).

pub const dims: Int

Vector dimensionality for the default term-hash backend.

pub fn embed(text: String) -> List(Float)

Embed text into a 256-dim L2-normalized vector (signed hashing trick). Deterministic, no model. This is the seam — replace it for real embeddings.

Search Document