embedding

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package embedding provides concrete Embedder implementations for generating text embedding vectors. Supports OpenAI, Google, and OpenAI-compatible endpoints (Ollama, LiteLLM, etc.).

Embedders satisfy the resume.Embedder interface and can be used for resume embedding, query embedding, and semantic similarity search.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Provider name: "openai", "google", "openai-compat", "litellm", "none"
	Provider string `toml:"provider" json:"provider"`

	// Model name (e.g., "text-embedding-3-small", "text-embedding-004")
	Model string `toml:"model" json:"model"`

	// APIKey for the embedding provider
	APIKey string `toml:"api_key" json:"api_key"`

	// BaseURL for custom endpoints (OpenAI-compatible providers)
	BaseURL string `toml:"base_url" json:"base_url"`
}

Config holds configuration for creating an Embedder.

type Embedder

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

Embedder generates embedding vectors from text. Same interface as resume.Embedder — implementations satisfy both.

func New

func New(cfg Config) (Embedder, error)

New creates an Embedder from the given configuration. Returns nil if provider is "none" or empty.

Jump to

Keyboard shortcuts

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