openai

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OpenAIEmbeddingProvider

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

OpenAIEmbeddingProvider implements the EmbeddingProvider interface for OpenAI

func NewOpenAIEmbeddingProvider

func NewOpenAIEmbeddingProvider(apiKey, model string, dimensions int) (*OpenAIEmbeddingProvider, error)

NewOpenAIEmbeddingProvider creates a new OpenAI embedding provider

func (*OpenAIEmbeddingProvider) BatchSize

func (o *OpenAIEmbeddingProvider) BatchSize() int

BatchSize returns the maximum batch size

func (*OpenAIEmbeddingProvider) Dimensions

func (o *OpenAIEmbeddingProvider) Dimensions() int

Dimensions returns the embedding vector dimensions

func (*OpenAIEmbeddingProvider) EmbedChunks

EmbedChunks embeds multiple chunks in a batch

func (*OpenAIEmbeddingProvider) EmbedQuery

func (o *OpenAIEmbeddingProvider) EmbedQuery(ctx context.Context, query string) []float32

EmbedQuery embeds a single query for search

func (*OpenAIEmbeddingProvider) MaxTokens

func (o *OpenAIEmbeddingProvider) MaxTokens() int

MaxTokens returns the maximum token limit for the model

func (*OpenAIEmbeddingProvider) Name

func (o *OpenAIEmbeddingProvider) Name() string

Name returns the provider name

func (*OpenAIEmbeddingProvider) Validate

func (o *OpenAIEmbeddingProvider) Validate(ctx context.Context) error

Validate tests the provider connection

type OpenAILLMProvider

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

OpenAILLMProvider implements the LLMProvider interface for OpenAI

func NewOpenAILLMProvider

func NewOpenAILLMProvider(apiKey, model, fallbackModel string) (*OpenAILLMProvider, error)

NewOpenAILLMProvider creates a new OpenAI LLM provider

func (*OpenAILLMProvider) Call

Call makes a non-streaming LLM request

func (*OpenAILLMProvider) Name

func (o *OpenAILLMProvider) Name() string

Name returns the provider name

func (*OpenAILLMProvider) Stream

Stream makes a streaming LLM request

func (*OpenAILLMProvider) Validate

func (o *OpenAILLMProvider) Validate(ctx context.Context) error

Validate tests the provider connection

type OpenAIModelSpec

type OpenAIModelSpec struct {
	Dimensions int
	MaxTokens  int
}

OpenAIModelSpec holds default specifications for an OpenAI embedding model

Jump to

Keyboard shortcuts

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