Documentation
¶
Index ¶
- func ToOpenAITool(tool Tool) map[string]interface{}
- func ToOpenAITools(tools []Tool) []map[string]interface{}
- type FunctionTool
- func (t *FunctionTool) Execute(ctx context.Context, params map[string]interface{}) (interface{}, error)
- func (t *FunctionTool) GetDescription() string
- func (t *FunctionTool) GetName() string
- func (t *FunctionTool) GetParametersSchema() map[string]interface{}
- func (t *FunctionTool) WithDescription(description string) *FunctionTool
- func (t *FunctionTool) WithName(name string) *FunctionTool
- func (t *FunctionTool) WithSchema(schema map[string]interface{}) *FunctionTool
- type Tool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToOpenAITool ¶
ToOpenAITool converts a Tool to the OpenAI tool format
func ToOpenAITools ¶
ToOpenAITools converts a slice of Tools to the OpenAI tool format
Types ¶
type FunctionTool ¶
type FunctionTool struct {
// contains filtered or unexported fields
}
FunctionTool is a tool implemented as a Go function
func NewFunctionTool ¶
func NewFunctionTool(name, description string, fn interface{}) *FunctionTool
NewFunctionTool creates a new function tool
func (*FunctionTool) Execute ¶
func (t *FunctionTool) Execute(ctx context.Context, params map[string]interface{}) (interface{}, error)
Execute executes the tool with the given parameters
func (*FunctionTool) GetDescription ¶
func (t *FunctionTool) GetDescription() string
GetDescription returns the description of the tool
func (*FunctionTool) GetName ¶
func (t *FunctionTool) GetName() string
GetName returns the name of the tool
func (*FunctionTool) GetParametersSchema ¶
func (t *FunctionTool) GetParametersSchema() map[string]interface{}
GetParametersSchema returns the JSON schema for the tool parameters
func (*FunctionTool) WithDescription ¶
func (t *FunctionTool) WithDescription(description string) *FunctionTool
WithDescription updates the description of the tool
func (*FunctionTool) WithName ¶
func (t *FunctionTool) WithName(name string) *FunctionTool
WithName updates the name of the tool
func (*FunctionTool) WithSchema ¶
func (t *FunctionTool) WithSchema(schema map[string]interface{}) *FunctionTool
WithSchema sets a custom schema for the tool parameters
type Tool ¶
type Tool interface {
// GetName returns the name of the tool
GetName() string
// GetDescription returns the description of the tool
GetDescription() string
// GetParametersSchema returns the JSON schema for the tool parameters
GetParametersSchema() map[string]interface{}
// Execute executes the tool with the given parameters
Execute(ctx context.Context, params map[string]interface{}) (interface{}, error)
}
Tool represents a capability that can be used by an agent
Click to show internal directories.
Click to hide internal directories.