embeddings

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package embeddings provides Ollama embedding client implementation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EmbeddingClient

type EmbeddingClient interface {
	// Embed generates embeddings for multiple texts
	Embed(ctx context.Context, texts []string) ([][]float32, error)

	// EmbedOne generates an embedding for a single text
	EmbedOne(ctx context.Context, text string) ([]float32, error)
}

EmbeddingClient defines the interface for generating text embeddings

type OllamaClient added in v1.1.1

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

OllamaClient implements EmbeddingClient using local Ollama API

func NewOllamaClient added in v1.1.1

func NewOllamaClient(baseURL, model string) *OllamaClient

NewOllamaClient creates a new Ollama embedding client baseURL is typically "http://localhost:11434" model is the embedding model name, e.g. "nomic-embed-text"

func (*OllamaClient) Embed added in v1.1.1

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

Embed generates embeddings for multiple texts

func (*OllamaClient) EmbedOne added in v1.1.1

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

EmbedOne generates an embedding for a single text

type OpenAIClient

type OpenAIClient struct {
	APIKey     string
	Model      string
	BaseURL    string
	HTTPClient *http.Client
}

OpenAIClient implements EmbeddingClient using OpenAI's API

func NewOpenAIClient

func NewOpenAIClient(apiKey string) *OpenAIClient

NewOpenAIClient creates a new OpenAI embedding client

func (*OpenAIClient) Embed

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

Embed generates embeddings for multiple texts

func (*OpenAIClient) EmbedOne

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

EmbedOne generates an embedding for a single text

Jump to

Keyboard shortcuts

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