Documentation
¶
Overview ¶
Package embed is the BYOAI embedding layer. Mesh never runs inference itself; it calls a configured endpoint (Ollama, OpenAI, Voyage, any /v1/embeddings server) so vectors stay on the user's sovereign infrastructure. Embeddings are a mechanical transform, not the reasoning AI - the agent is still the librarian.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Embedder ¶
type Embedder interface {
Embed(ctx context.Context, texts []string) ([][]float32, error)
Model() string
Dim() int
}
Embedder turns text into vectors. Implementations must be deterministic for a given model so a vault's vectors stay comparable. Dim() is the vector width; it pins the space so a same-named-but-different-width model is caught, not silently cosined across incompatible dimensions.
type HTTP ¶
type HTTP struct {
BaseURL string
ModelID string
Key string // bearer token; empty for keyless local endpoints
Client *http.Client
// contains filtered or unexported fields
}
HTTP is an OpenAI-compatible embeddings client. It speaks the POST {BaseURL}/embeddings {model, input:[...]} -> {data:[{embedding:[...]}]} shape that Ollama (via /v1), OpenAI, Voyage, LiteLLM, and most local servers expose. BaseURL should include the version prefix, e.g. http://localhost:11434/v1 or https://api.openai.com/v1.
type Stub ¶
type Stub struct{ D int }
Stub is a deterministic, network-free embedder for tests and offline demos. It hashes tokens into a fixed-dimension bag-of-words vector (L2-normalized). It is NOT semantic: it exists to exercise vector storage, cosine, and fusion plumbing, never to prove retrieval quality.