embedder

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 15 Imported by: 0

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 (
	ErrEmbedderUnavailable = errors.New("embedder unavailable")
	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

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).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL