openaiv1

package
v0.29.0-beta Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TextChatTask = "TASK_CHAT"
)

Variables

This section is empty.

Functions

func ExecuteTextChat

func ExecuteTextChat(inputStruct ai.TextChatInput, client httpclient.IClient, job *base.Job, ctx context.Context) (*structpb.Struct, error)

func Init

func Init(bc base.Component) *component

Init returns an initialized OpenAI connector.

func NewClient

func NewClient(setup *structpb.Struct, logger *zap.Logger) *httpclient.Client

Types

type ChatModelRequester

type ChatModelRequester struct {
	Input  ai.TextChatInput
	Client httpclient.IClient
}

func (*ChatModelRequester) SendChatRequest

func (r *ChatModelRequester) SendChatRequest(job *base.Job, ctx context.Context) (*structpb.Struct, error)

type IChatModelRequester

type IChatModelRequester interface {
	SendChatRequest(*base.Job, context.Context) (*structpb.Struct, error)
}

func ModelRequesterFactory

func ModelRequesterFactory(input ai.TextChatInput, client httpclient.IClient) IChatModelRequester

type O1ModelRequester

type O1ModelRequester struct {
	Input  ai.TextChatInput
	Client httpclient.IClient
}

o1-preview or o1-mini

func (*O1ModelRequester) SendChatRequest

func (r *O1ModelRequester) SendChatRequest(_ *base.Job, _ context.Context) (*structpb.Struct, error)

When it supports streaming, the job and ctx will be used.

type SupportJSONOutputModelRequester

type SupportJSONOutputModelRequester struct {
	Input  ai.TextChatInput
	Client httpclient.IClient
}

https://platform.openai.com/docs/api-reference/chat/create#chat-create-response_format Compatible with GPT-4o, GPT-4o mini, GPT-4 Turbo and all GPT-3.5 Turbo models newer than gpt-3.5-turbo-1106.

func (*SupportJSONOutputModelRequester) SendChatRequest

func (r *SupportJSONOutputModelRequester) SendChatRequest(job *base.Job, ctx context.Context) (*structpb.Struct, error)

Jump to

Keyboard shortcuts

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