embedding

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package embedding provides vector embedding implementations for semantic search.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OpenAIConfig

type OpenAIConfig struct {
	APIKey     string
	Model      string        // default: "text-embedding-3-small"
	Dimensions int           // default: 1536 (model-dependent)
	BaseURL    string        // default: "https://api.openai.com/v1"
	Timeout    time.Duration // default: 30s
}

OpenAIConfig configures the OpenAI embeddings client.

type OpenAIEmbedder

type OpenAIEmbedder struct {
	// contains filtered or unexported fields
}

OpenAIEmbedder implements memory.Embedder using the OpenAI embeddings API.

func NewOpenAIEmbedder

func NewOpenAIEmbedder(cfg OpenAIConfig) *OpenAIEmbedder

NewOpenAIEmbedder creates an OpenAI embeddings client.

func (*OpenAIEmbedder) Dimensions

func (e *OpenAIEmbedder) Dimensions() int

func (*OpenAIEmbedder) Embed

func (e *OpenAIEmbedder) Embed(ctx context.Context, text string) ([]float32, error)

func (*OpenAIEmbedder) EmbedBatch

func (e *OpenAIEmbedder) EmbedBatch(ctx context.Context, texts []string) ([][]float32, error)

func (*OpenAIEmbedder) Model

func (e *OpenAIEmbedder) Model() string

Jump to

Keyboard shortcuts

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