Documentation
¶
Overview ¶
Package embedding provides text-to-vector embedding for Cortex.
Embeddings enable semantic search: instead of matching keywords, search by meaning. The service supports multiple backends:
- ollama: Local Ollama server (default: nomic-embed-text, 768 dims)
- openai: OpenAI API (text-embedding-3-small, 384 dims)
- none: Disabled (default)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Provider string // "ollama", "openai", "none"
APIKey string // API key (OpenAI only; defaults to env var)
Model string // Model name override
BaseURL string // Base URL override (Ollama: default http://localhost:11434)
}
Config configures the embedding service.
type Service ¶
type Service interface {
// Embed returns a vector embedding for the given text.
Embed(ctx context.Context, text string) ([]float32, error)
// Dimensions returns the embedding dimension size.
Dimensions() int
// Model returns the model identifier.
Model() string
}
Service generates embeddings from text.
Click to show internal directories.
Click to hide internal directories.