openai

package
v0.0.0-...-cdc1604 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OpenAi

type OpenAi struct {
	RequestHookFunc  func(llmberjack.Requester, *openai.ChatCompletionNewParams) error
	ResponseHookFunc func(*openai.ChatCompletion, *llmberjack.InnerResponse) error
	// contains filtered or unexported fields
}

func New

func New(opts ...Opt) (*OpenAi, error)

func (*OpenAi) ChatCompletion

func (p *OpenAi) ChatCompletion(ctx context.Context, llm internal.Adapter, requester llmberjack.Requester) (*llmberjack.InnerResponse, error)

func (*OpenAi) CloseThread

func (p *OpenAi) CloseThread(threadId *llmberjack.ThreadId)

func (*OpenAi) CopyThread

func (p *OpenAi) CopyThread(threadId *llmberjack.ThreadId) *llmberjack.ThreadId

func (*OpenAi) Init

func (p *OpenAi) Init(llm internal.Adapter) error

func (*OpenAi) RequestOptionsType

func (*OpenAi) RequestOptionsType() reflect.Type

func (*OpenAi) ResetThread

func (p *OpenAi) ResetThread(threadId *llmberjack.ThreadId)

type Opt

type Opt func(*OpenAi)

func WithApiKey

func WithApiKey(apiKey string) Opt

func WithBaseUrl

func WithBaseUrl(url string) Opt

WithBaseUrl sets the URL at which the OpenAI-compatible API is available.

If not specified, will use OpenAI's API.

func WithDefaultModel

func WithDefaultModel(model string) Opt

Jump to

Keyboard shortcuts

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