Documentation
¶
Overview ¶
Package embed provides the local-embedding arm of the hybrid funnel: an Ollama-backed Embedder plus the f32 vector codec and similarity helper. Hot-path package: stdlib only. The Embedder interface is structurally identical to gopheragent's tools.Embedder so a future upstream Ollama embedder can replace ollama.go without touching consumers (plan §upstream).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeVec ¶
DecodeVec deserializes an EncodeVec blob. Returns nil for malformed input (length not a multiple of 4) — a stale/corrupt row degrades to "no vector", never an error on the hot path.
func Dot ¶
Dot returns the dot product — cosine similarity for Normalized vectors. Mismatched or empty vectors score 0 (treated as "no signal").
Types ¶
type Ollama ¶
type Ollama struct {
Endpoint string // e.g. http://localhost:11434
Model string // e.g. nomic-embed-text
Client *http.Client
}
Ollama calls the local /api/embed endpoint. Vectors come back Normalized so Dot is cosine. The zero timeout on the shared client is deliberate: callers bound each call with ctx (100ms on the hot path, seconds for indexing).