ai

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAnthropicLLM

func NewAnthropicLLM(apiKey, model string) (driven.LLMService, error)

func NewCohereEmbedding

func NewCohereEmbedding(apiKey, model string) (driven.EmbeddingService, error)

func NewOllamaEmbedding

func NewOllamaEmbedding(baseURL, model string) (driven.EmbeddingService, error)

func NewOllamaLLM

func NewOllamaLLM(baseURL, model string) (driven.LLMService, error)

func NewOpenAIEmbedding

func NewOpenAIEmbedding(apiKey, model, baseURL string) (driven.EmbeddingService, error)

NewOpenAIEmbedding creates a new OpenAI embedding service

func NewOpenAILLM

func NewOpenAILLM(apiKey, model, baseURL string) (driven.LLMService, error)

func NewVoyageEmbedding

func NewVoyageEmbedding(apiKey, model string) (driven.EmbeddingService, error)

Types

type Factory

type Factory struct{}

Factory creates AI services based on configuration

func NewFactory

func NewFactory() *Factory

NewFactory creates a new AI service factory

func (*Factory) CreateEmbeddingService

func (f *Factory) CreateEmbeddingService(settings *domain.EmbeddingSettings, credentials *driven.AICredentials) (driven.EmbeddingService, error)

CreateEmbeddingService creates an embedding service from settings and credentials

func (*Factory) CreateLLMService

func (f *Factory) CreateLLMService(settings *domain.LLMSettings, credentials *driven.AICredentials) (driven.LLMService, error)

CreateLLMService creates an LLM service from settings and credentials

type OpenAIEmbedding

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

OpenAIEmbedding implements EmbeddingService using OpenAI's embedding API

func (*OpenAIEmbedding) Close

func (e *OpenAIEmbedding) Close() error

Close releases resources held by the embedding service

func (*OpenAIEmbedding) Dimensions

func (e *OpenAIEmbedding) Dimensions() int

Dimensions returns the embedding dimension size

func (*OpenAIEmbedding) Embed

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

Embed generates embeddings for multiple texts

func (*OpenAIEmbedding) EmbedQuery

func (e *OpenAIEmbedding) EmbedQuery(ctx context.Context, query string) ([]float32, error)

EmbedQuery generates an embedding for a search query

func (*OpenAIEmbedding) HealthCheck

func (e *OpenAIEmbedding) HealthCheck(ctx context.Context) error

HealthCheck verifies the embedding service is available

func (*OpenAIEmbedding) Model

func (e *OpenAIEmbedding) Model() string

Model returns the model name being used

Jump to

Keyboard shortcuts

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