Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleToolCall ¶
Handles a single openai.ToolCall using the provided Tool.
Types ¶
type Tool ¶
type Tool interface {
// Name of the tool.
Name() string
// Description of the tool.
Description() string
// Type of the request.
// The type should have struct tags as specified in https://pkg.go.dev/github.com/swaggest/jsonschema-go#Reflector.Reflect.
RequestType() reflect.Type
// Accepts argument of the type returned by RequestType(). Returns any value or an error.
CallFunction(args any) (any, error)
}
A Tool is an interface that can be used to derive an openai.Tool and also handle openai.ToolCall.
type ToolSet ¶
type ToolSet struct {
// contains filtered or unexported fields
}
A collection of Tool.
func NewToolSet ¶
func (ToolSet) HandleToolCalls ¶
func (t ToolSet) HandleToolCalls( ctx context.Context, toolCalls []openai.ToolCall, ) ([]openai.ChatCompletionMessage, error)
Process a list of openai.ToolCall and return a list of openai.ChatCompletionMessage corresponding to the results of those calls.
func (ToolSet) OpenAITools ¶
Get a list of openai.Tool from the ToolSet.
Click to show internal directories.
Click to hide internal directories.