embed

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Embedder

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

Embedder is the pluggable embedding interface.

func New

func New() Embedder

New returns the configured embedder based on EMBED_PROVIDER env var. Defaults to NoOpEmbedder when not configured.

type NoOpEmbedder

type NoOpEmbedder struct{}

NoOpEmbedder skips embedding — search falls back to full-text.

func (*NoOpEmbedder) Dimensions

func (n *NoOpEmbedder) Dimensions() int

func (*NoOpEmbedder) Embed

func (n *NoOpEmbedder) Embed(_ context.Context, _ string) ([]float32, error)

type OllamaEmbedder

type OllamaEmbedder struct {
	BaseURL string
	Model   string
}

OllamaEmbedder calls the local Ollama embeddings API.

func (*OllamaEmbedder) Dimensions

func (e *OllamaEmbedder) Dimensions() int

func (*OllamaEmbedder) Embed

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

type OpenAIEmbedder

type OpenAIEmbedder struct {
	APIKey string
	Model  string
}

OpenAIEmbedder calls the OpenAI embeddings API.

func (*OpenAIEmbedder) Dimensions

func (e *OpenAIEmbedder) Dimensions() int

func (*OpenAIEmbedder) Embed

func (e *OpenAIEmbedder) 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