openai

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MIT Imports: 19 Imported by: 4

Documentation

Index

Constants

View Source
const MetadataToolCallsSlug = "tool-calls"
View Source
const MetadataToolsSlug = "tools"

Variables

This section is empty.

Functions

func GetToolCallDelta added in v0.4.1

func GetToolCallDelta(toolCalls []go_openai.ToolCall) string

func IsOpenAiEngine

func IsOpenAiEngine(engine string) bool

Types

type ChatToolStep added in v0.4.1

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

func NewChatToolStep added in v0.4.1

func NewChatToolStep(stepSettings *settings.StepSettings, options ...ChatToolStepOption) (*ChatToolStep, error)

func (*ChatToolStep) AddPublishedTopic added in v0.4.1

func (t *ChatToolStep) AddPublishedTopic(publisher message.Publisher, topic string) error

func (*ChatToolStep) Start added in v0.4.1

type ChatToolStepOption added in v0.4.1

type ChatToolStepOption func(step *ChatToolStep)

func WithReflector added in v0.4.1

func WithReflector(reflector *jsonschema.Reflector) ChatToolStepOption

func WithToolFunctions added in v0.4.1

func WithToolFunctions(toolFunctions map[string]interface{}) ChatToolStepOption

type ExecuteToolStep added in v0.2.24

type ExecuteToolStep struct {
	Tools map[string]interface{}
	// contains filtered or unexported fields
}

func NewExecuteToolStep added in v0.4.1

func NewExecuteToolStep(
	tools map[string]interface{},
	options ...ExecuteToolStepOption,
) (*ExecuteToolStep, error)

func (*ExecuteToolStep) AddPublishedTopic added in v0.4.1

func (e *ExecuteToolStep) AddPublishedTopic(publisher message.Publisher, topic string) error

func (*ExecuteToolStep) Start added in v0.2.24

func (e *ExecuteToolStep) Start(
	ctx context.Context,
	input ToolCompletionResponse,
) (steps.StepResult[map[string]interface{}], error)

type ExecuteToolStepOption added in v0.4.1

type ExecuteToolStepOption func(*ExecuteToolStep) error

func WithExecuteToolStepMessageID added in v0.4.1

func WithExecuteToolStepMessageID(messageID conversation.NodeID) ExecuteToolStepOption

func WithExecuteToolStepParentID added in v0.4.1

func WithExecuteToolStepParentID(parentID conversation.NodeID) ExecuteToolStepOption

func WithExecuteToolStepSubscriptionManager added in v0.4.1

func WithExecuteToolStepSubscriptionManager(subscriptionManager *helpers.SubscriptionManager) ExecuteToolStepOption

type Step

type Step struct {
	Settings *settings.StepSettings
	// contains filtered or unexported fields
}

func NewStep added in v0.2.24

func NewStep(settings *settings.StepSettings, options ...StepOption) (*Step, error)

func (*Step) AddPublishedTopic added in v0.4.1

func (csf *Step) AddPublishedTopic(publisher message.Publisher, topic string) error

func (*Step) Start

func (csf *Step) Start(
	ctx context.Context,
	messages conversation.Conversation,
) (steps.StepResult[string], error)

type StepOption added in v0.4.1

type StepOption func(*Step) error

func WithSubscriptionManager added in v0.4.1

func WithSubscriptionManager(subscriptionManager *helpers.SubscriptionManager) StepOption

type ToolCallMerger added in v0.2.24

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

func NewToolCallMerger added in v0.2.24

func NewToolCallMerger() *ToolCallMerger

func (*ToolCallMerger) AddToolCalls added in v0.2.24

func (tcm *ToolCallMerger) AddToolCalls(toolCalls []go_openai.ToolCall)

func (*ToolCallMerger) GetToolCalls added in v0.2.24

func (tcm *ToolCallMerger) GetToolCalls() []go_openai.ToolCall

type ToolCompletionResponse added in v0.2.24

type ToolCompletionResponse struct {
	Role      string               `json:"role"`
	Content   string               `json:"content"`
	ToolCalls []go_openai.ToolCall `json:"tool_calls"`
}

type ToolStep added in v0.2.24

type ToolStep struct {
	Settings *settings.StepSettings
	Tools    []go_openai.Tool
	// contains filtered or unexported fields
}

func NewToolStep added in v0.4.1

func NewToolStep(
	stepSettings *settings.StepSettings,
	Tools []go_openai.Tool,
	options ...ToolStepOption,
) (*ToolStep, error)

func (*ToolStep) AddPublishedTopic added in v0.4.1

func (r *ToolStep) AddPublishedTopic(publisher message.Publisher, topic string) error

func (*ToolStep) SetStreaming added in v0.2.24

func (csf *ToolStep) SetStreaming(b bool)

func (*ToolStep) Start added in v0.2.24

type ToolStepOption added in v0.4.1

type ToolStepOption func(*ToolStep) error

func WithToolStepMessageID added in v0.4.1

func WithToolStepMessageID(messageID conversation.NodeID) ToolStepOption

func WithToolStepParentID added in v0.4.1

func WithToolStepParentID(parentID conversation.NodeID) ToolStepOption

func WithToolStepSubscriptionManager added in v0.4.1

func WithToolStepSubscriptionManager(subscriptionManager *helpers.SubscriptionManager) ToolStepOption

type Transcription added in v0.2.18

type Transcription struct {
	File     string                `json:"file"`
	Response *openai.AudioResponse `json:"response"`
	// contains filtered or unexported fields
}

type TranscriptionClient added in v0.2.18

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

func NewTranscriptionClient added in v0.2.18

func NewTranscriptionClient(apiKey, model, prompt, language string, temperature float32) *TranscriptionClient

func (*TranscriptionClient) TranscribeFile added in v0.2.18

func (tc *TranscriptionClient) TranscribeFile(mp3FilePath string, out chan<- Transcription, wg *sync.WaitGroup)

Jump to

Keyboard shortcuts

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