embedding

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package embedding defines a small, provider-agnostic interface for generating vector embeddings from text.

The core abstraction is the Embedder interface, which turns a slice of input texts into a slice of embedding vectors while preserving input order.

This package also defines common types used across implementations: - Vector: an embedding vector (typically []float32) - Model: a provider-specific model identifier string

Provider implementations live in subpackages (for example, embedding/openai).

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyInput = errors.New("empty input")

ErrEmptyInput is returned when an embedding call receives no input texts.

Functions

This section is empty.

Types

type Embedder

type Embedder interface {
	Embed(ctx context.Context, texts []string) ([]Vector, error)
}

Embedder generates vector embeddings for input texts.

Implementations should preserve the ordering of inputs.

type Model

type Model string

Model identifies an embedding model name.

Examples: - OpenAI: "text-embedding-3-small" - Ollama: "nomic-embed-text".

type Vector

type Vector = []float32

Vector is an embedding vector.

Most OpenAI-compatible embedding endpoints return float32 vectors.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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