embeddings

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package embeddings provides a vector embedding interface with implementations for OpenAI, Ollama, and Cohere providers.

Index

Constants

View Source
const DefaultRequestTimeout = 2 * time.Minute

DefaultRequestTimeout bounds a single embedding HTTP request when a provider's Config leaves Timeout unset, so a hung provider can't block a caller forever.

Variables

View Source
var ErrNilInput = errors.New("nil embedding input provided")

ErrNilInput indicates a nil *Input was passed to GenerateEmbedding.

Functions

This section is empty.

Types

type Embedder

type Embedder interface {
	GenerateEmbedding(ctx context.Context, input *Input) (*Embedding, error)
}

Embedder generates vector embeddings for text.

type Embedding

type Embedding struct {
	GeneratedAt time.Time
	SourceText  string
	Model       string
	Provider    string
	Vector      []float32
	Dimensions  int
}

Embedding is the result of embedding a single piece of content. It carries provenance alongside the vector so that re-embedding and ETL pipelines can be driven from the stored result alone.

type Input

type Input struct {
	// Content is the text to embed.
	Content string

	// Model optionally overrides the provider's configured DefaultModel.
	// Leave empty to use the default from the provider's Config.
	Model string
}

Input is the content to be embedded.

Directories

Path Synopsis
Package mock provides mock implementations of the embeddings package's interfaces.
Package mock provides mock implementations of the embeddings package's interfaces.

Jump to

Keyboard shortcuts

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