Documentation
¶
Overview ¶
Package embedder produces dense vector embeddings for text snippets. The default backend is Ollama's /api/embeddings HTTP endpoint.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrEmbedderRequest = errors.New("embedder request failed") )
Sentinel errors for typed handling by callers.
Functions ¶
This section is empty.
Types ¶
type Embedder ¶
type Embedder interface {
Embed(ctx context.Context, texts []string) ([][]float32, error)
Dim() int
}
Embedder turns a batch of texts into a batch of vectors.
func New ¶
func New(cfg config.SemanticIndexConfig) (Embedder, error)
New creates an Embedder from configuration. Currently only "ollama" is supported; other values fall back to a no-op embedder that returns ErrEmbedderUnavailable on use.
func NewMemoryEmbedder ¶
func NewMemoryEmbedder(mc config.MemoryConfig) (Embedder, error)
NewMemoryEmbedder constructs the embedder used by the project-memory subsystem. Backends:
- "openai" — OpenAI-compatible HTTP POST /v1/embeddings (also works against Voyage, Together, vLLM, llama.cpp `--server`, LM Studio…).
- "ollama" — local Ollama server at base_url.
- "cybertron" — placeholder: pure-Go transformers (planned; returns ErrEmbedderUnavailable so callers fall back to BM25 cleanly).
- "" — defaults to "openai" if a base_url is set, otherwise "ollama" (preserving existing behaviour for users with Ollama).
Click to show internal directories.
Click to hide internal directories.