coai/globals/tools.go
2024-02-18 18:14:41 +08:00

48 lines
1.2 KiB
Go

package globals
type ToolCallId string
type FunctionTools []ToolObject
type ToolObject struct {
Type string `json:"type"`
Function ToolFunction `json:"function"`
}
type ToolFunction struct {
Name string `json:"name"`
Description string `json:"description"`
Url *string `json:"url,omitempty"`
Parameters ToolParameters `json:"parameters"`
}
type ToolParameters struct {
Type string `json:"type"`
Properties ToolProperties `json:"properties"`
Required []string `json:"required"`
}
type ToolProperties map[string]ToolProperty
type ToolProperty struct {
Type string `json:"type"`
Description string `json:"description"`
Enum *[]string `json:"enum,omitempty"`
}
type ToolCallFunction struct {
Name string `json:"name"`
Arguments string `json:"arguments"`
}
type ToolCall struct {
Index *int `json:"index,omitempty"`
Type string `json:"type"`
Id ToolCallId `json:"id"`
Function ToolCallFunction `json:"function"`
}
type ToolCalls []ToolCall
type FunctionCall struct {
Name string `json:"name"`
Arguments string `json:"arguments"`
}