Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Function ¶
func Function[A any](h FunctionHandler[A], f ToolFunction) error
Function registers a handler of a function tool.
Types ¶
type FunctionHandler ¶
type Tool ¶
type Tool struct {
// The type of the tool. Currently, only `function` is supported.
Type string `json:"type" validate:"required,oneof=function"`
// Description of the function.
Function *ToolFunction `json:"function,omitempty"`
}
type ToolFunction ¶
type ToolFunction struct {
// The name of the function to be called. Must be a-z, A-Z, 0-9, or
// contain underscores and dashes, with a maximum length of 64.
Name string `json:"name" validate:"required"`
// A description of what the function does, used by the model to
// choose when and how to call the function.
Description string `json:"description,omitempty"`
// The parameters the functions accepts, described as a JSON Schema object.
Parameters map[string]any `json:"parameters" validate:"required"`
}
type ToolRequest ¶
type ToolRequest struct {
// Correlation ID of the tool call.
CallID string `json:"call_id" validate:"required"`
// The function that the model called.
Function ToolRequestFunction `json:"function" validate:"required"`
// Context of the tool call request.
Context ToolRequestContext `json:"context" validate:"required"`
}
type ToolRequestContext ¶
type ToolRequestContext struct {
// Full path to the current directory.
Dir string `json:"dir" validate:"required"`
}
type ToolRequestFunction ¶
type ToolResponse ¶
Click to show internal directories.
Click to hide internal directories.