openai

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2025 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const DefaultModelName = openai.GPT4oMini20240718

Variables

This section is empty.

Functions

This section is empty.

Types

type AIGenerationError

type AIGenerationError struct {
	Reason openai.FinishReason
}

func (*AIGenerationError) Error

func (e *AIGenerationError) Error() string

type ClientOption

type ClientOption func(*ClientOptions)

func WithApiKey

func WithApiKey(key string) ClientOption

func WithModelName

func WithModelName(name string) ClientOption

type ClientOptions

type ClientOptions struct {
	ApiKey    string
	ModelName string
}

type OpenAiClient

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

func NewOpenAiClient

func NewOpenAiClient(options ...ClientOption) (*OpenAiClient, error)

func (*OpenAiClient) Send

func (c *OpenAiClient) Send(
	ctx context.Context,
	prompt string,
	mod *nexus.SchemaMod,
	hook markxus.LlmStreamConsumeHook,
) (string, error)

Jump to

Keyboard shortcuts

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