openai

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const MaxFunctionCalls = 10
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 ai.ServiceConfig) *OpenAI

func NewCompatible

func NewCompatible(llmService ai.ServiceConfig) *OpenAI

func (*OpenAI) ChatCompletion

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

func (*OpenAI) ChatCompletionNoStream

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

func (*OpenAI) CountTokens added in v0.4.0

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() ai.LLMConfig

func (*OpenAI) TokenLimit added in v0.4.0

func (s *OpenAI) TokenLimit() int

func (*OpenAI) Transcribe

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

Jump to

Keyboard shortcuts

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