embedder

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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