Help us shape the future of Go! Take the 2026 Go Developer Survey

embedding

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CustomProvider

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

CustomProvider is a generic OpenAI-compatible embedding provider. Works with OpenRouter, Together AI, Voyage AI, Mistral, Cohere, Azure OpenAI, Fireworks, Anyscale, Groq, DeepInfra, and any other API that implements the OpenAI /v1/embeddings endpoint.

func NewCustom

func NewCustom(baseURL, apiKey, model string, dims int, headers map[string]string) *CustomProvider

func (*CustomProvider) Dimensions

func (p *CustomProvider) Dimensions() int

func (*CustomProvider) Embed

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

func (*CustomProvider) EmbedBatch

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

type GeminiProvider

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

func NewGemini

func NewGemini(ctx context.Context, apiKey, model string) (*GeminiProvider, error)

func (*GeminiProvider) Close

func (p *GeminiProvider) Close() error

func (*GeminiProvider) Dimensions

func (p *GeminiProvider) Dimensions() int

func (*GeminiProvider) Embed

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

func (*GeminiProvider) EmbedBatch

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

type OllamaProvider

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

func NewOllama

func NewOllama(baseURL, model string, dims int) *OllamaProvider

func (*OllamaProvider) Dimensions

func (p *OllamaProvider) Dimensions() int

func (*OllamaProvider) Embed

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

func (*OllamaProvider) EmbedBatch

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

type OpenAIProvider

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

func NewOpenAI

func NewOpenAI(apiKey, model, baseURL string) *OpenAIProvider

func (*OpenAIProvider) Dimensions

func (p *OpenAIProvider) Dimensions() int

func (*OpenAIProvider) Embed

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

func (*OpenAIProvider) EmbedBatch

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

type Provider

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

Jump to

Keyboard shortcuts

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