ai

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2026 License: Apache-2.0 Imports: 10 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)

NewOpenAILLM creates a new OpenAI LLM service

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

type OpenAILLM added in v0.2.2

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

OpenAILLM implements LLMService using OpenAI's chat completion API

func (*OpenAILLM) Close added in v0.2.2

func (l *OpenAILLM) Close() error

Close releases resources held by the LLM service

func (*OpenAILLM) Complete added in v0.2.2

Complete sends a completion request to the LLM and returns the response

func (*OpenAILLM) Model added in v0.2.2

func (l *OpenAILLM) Model() string

Model returns the model name being used

func (*OpenAILLM) Ping added in v0.2.2

func (l *OpenAILLM) Ping(ctx context.Context) error

Ping verifies the LLM service is reachable and properly configured

Jump to

Keyboard shortcuts

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