embed

package
v0.6.6 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2025 License: Apache-2.0 Imports: 16 Imported by: ? 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

Index

Constants

This section is empty.

Variables

View Source
var ErrNotSupported = errors.New("embeddings not supported by this provider")

ErrNotSupported is returned by providers that do not offer embeddings.

Functions

func DummyEmbedding

func DummyEmbedding(text string) []float32

DummyEmbedding is kept for tests/back-compat.

Types

type ClaudeEmbedder

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

ClaudeEmbedder proxies to Anthropic-recommended Voyage AI embeddings. Requires VOYAGE_API_KEY. Defaults:

  • model: "voyage-3.5" (override via ADK_EMBED_MODEL)
  • input_type: "document" (override via ADK_EMBED_INPUT_TYPE)
  • endpoint: "https://api.voyageai.com/v1/embeddings" (override via VOYAGE_API_BASE)

func (*ClaudeEmbedder) Embed

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

type DummyEmbedder

type DummyEmbedder struct{}

---------- Dummy (fallback) ----------

func (DummyEmbedder) Embed

func (DummyEmbedder) Embed(_ context.Context, text string) ([]float32, error)

type Embedder

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

Embedder is a pluggable text-embedding provider.

func AutoEmbedder

func AutoEmbedder() Embedder

AutoEmbedder chooses a provider from env: ADK_EMBED_PROVIDER=openai|google|gemini|ollama|claude ADK_EMBED_MODEL=<model string> If not set, it infers from available API keys/OLLAMA_HOST, else dummy.

func NewClaudeEmbedder

func NewClaudeEmbedder(model string) (Embedder, error)

func NewFastEmbeed

func NewFastEmbeed(ctx context.Context, opt *Options) (Embedder, error)

func NewOllamaEmbedder

func NewOllamaEmbedder(model string) (Embedder, error)

func NewOpenAIEmbedder

func NewOpenAIEmbedder(model string) (Embedder, error)

func NewVertexAIEmbedder

func NewVertexAIEmbedder(model string) (Embedder, error)

type FastEmbedder

type FastEmbedder struct{}

func (FastEmbedder) Close

func (FastEmbedder) Close() error

func (FastEmbedder) Dim

func (FastEmbedder) Dim() int

func (FastEmbedder) Embed

func (FastEmbedder) Embed(ctx context.Context, q string) ([]float32, error)

func (FastEmbedder) EmbedPassages

func (FastEmbedder) EmbedPassages(ctx context.Context, docs []string) ([][]float32, error)

type OllamaEmbedder

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

func (*OllamaEmbedder) Embed

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

type OpenAIEmbedder

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

func (*OpenAIEmbedder) Embed

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

type Options

type Options struct {
	Model     string
	CacheDir  string
	MaxLength int
	BatchSize int
}

type VertexAIEmbedder

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

func (*VertexAIEmbedder) Embed

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

Jump to

Keyboard shortcuts

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