embed

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 2 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 embed turns text into vectors whose closeness is closeness of meaning, so the agent can find the decisions most like the one it faces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Similarity

func Similarity(a, b []float32) float64

Similarity is the vectors' cosine, from -1 to 1; 0 when they can't be compared.

Types

type Embedded

type Embedded struct {
	Vectors [][]float32
	Model   string
	CostUSD float64 // 0 if unpriced
}

type Embedder

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

Embedder turns texts into vectors, one each, in order.

Directories

Path Synopsis
Package openai is the embedding provider for OpenAI's Embeddings API.
Package openai is the embedding provider for OpenAI's Embeddings API.

Jump to

Keyboard shortcuts

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