openai

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const MaxFunctionCalls = 10
View Source
const OpenAIMaxImageSize = 20 * 1024 * 1024 // 20 MB
View Source
const StreamingTimeoutDefault = 10 * time.Second

Variables

View Source
var ErrStreamingTimeout = errors.New("timeout streaming")

Functions

This section is empty.

Types

type OpenAI

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

func New

func New(llmService llm.ServiceConfig, httpClient *http.Client, metricsService metrics.LLMetrics) *OpenAI

func NewAzure

func NewAzure(llmService llm.ServiceConfig, httpClient *http.Client, metricsService metrics.LLMetrics) *OpenAI

func NewCompatible

func NewCompatible(llmService llm.ServiceConfig, httpClient *http.Client, metricsService metrics.LLMetrics) *OpenAI

func (*OpenAI) ChatCompletion

func (s *OpenAI) ChatCompletion(conversation llm.BotConversation, opts ...llm.LanguageModelOption) (*llm.TextStreamResult, error)

func (*OpenAI) ChatCompletionNoStream

func (s *OpenAI) ChatCompletionNoStream(conversation llm.BotConversation, opts ...llm.LanguageModelOption) (string, error)

func (*OpenAI) CountTokens

func (s *OpenAI) CountTokens(text string) int

func (*OpenAI) GenerateImage

func (s *OpenAI) GenerateImage(prompt string) (image.Image, error)

func (*OpenAI) GetDefaultConfig

func (s *OpenAI) GetDefaultConfig() llm.LanguageModelConfig

func (*OpenAI) InputTokenLimit

func (s *OpenAI) InputTokenLimit() int

func (*OpenAI) Transcribe

func (s *OpenAI) Transcribe(file io.Reader) (*subtitles.Subtitles, error)

type ToolBufferElement

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

Jump to

Keyboard shortcuts

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