Documentation
¶
Index ¶
- func RegisterBuiltinTools(registry *Registry)
- type CSVData
- type CodeFormatterTool
- func (c *CodeFormatterTool) Description() string
- func (c *CodeFormatterTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
- func (c *CodeFormatterTool) Name() string
- func (c *CodeFormatterTool) Parameters() map[string]interface{}
- func (c *CodeFormatterTool) RequiredParameters() []string
- func (c *CodeFormatterTool) SetConfirmator(confirmator Confirmator)
- type Confirmator
- type ConfirmingTool
- type CurrentTimeTool
- func (c *CurrentTimeTool) Description() string
- func (c *CurrentTimeTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
- func (c *CurrentTimeTool) Name() string
- func (c *CurrentTimeTool) Parameters() map[string]interface{}
- func (c *CurrentTimeTool) RequiredParameters() []string
- type DataEditTool
- func (d *DataEditTool) Description() string
- func (d *DataEditTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
- func (d *DataEditTool) Name() string
- func (d *DataEditTool) Parameters() map[string]interface{}
- func (d *DataEditTool) RequiredParameters() []string
- func (d *DataEditTool) SetConfirmator(confirmator Confirmator)
- type DataProcessTool
- func (d *DataProcessTool) Description() string
- func (d *DataProcessTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
- func (d *DataProcessTool) Name() string
- func (d *DataProcessTool) Parameters() map[string]interface{}
- func (d *DataProcessTool) RequiredParameters() []string
- func (d *DataProcessTool) SetConfirmator(confirmator Confirmator)
- type DiffHunk
- type DirectoryManageTool
- func (d *DirectoryManageTool) Description() string
- func (d *DirectoryManageTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
- func (d *DirectoryManageTool) Name() string
- func (d *DirectoryManageTool) Parameters() map[string]interface{}
- func (d *DirectoryManageTool) RequiredParameters() []string
- func (d *DirectoryManageTool) SetConfirmator(confirmator Confirmator)
- type FileCreationTool
- func (f *FileCreationTool) Description() string
- func (f *FileCreationTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
- func (f *FileCreationTool) Name() string
- func (f *FileCreationTool) Parameters() map[string]interface{}
- func (f *FileCreationTool) RequiredParameters() []string
- func (f *FileCreationTool) SetConfirmator(confirmator Confirmator)
- type FileEditTool
- func (f *FileEditTool) Description() string
- func (f *FileEditTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
- func (f *FileEditTool) Name() string
- func (f *FileEditTool) Parameters() map[string]interface{}
- func (f *FileEditTool) RequiredParameters() []string
- func (f *FileEditTool) SetConfirmator(confirmator Confirmator)
- type FileInsertTool
- func (f *FileInsertTool) Description() string
- func (f *FileInsertTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
- func (f *FileInsertTool) Name() string
- func (f *FileInsertTool) Parameters() map[string]interface{}
- func (f *FileInsertTool) RequiredParameters() []string
- func (f *FileInsertTool) SetConfirmator(confirmator Confirmator)
- type FileManageTool
- func (f *FileManageTool) Description() string
- func (f *FileManageTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
- func (f *FileManageTool) Name() string
- func (f *FileManageTool) Parameters() map[string]interface{}
- func (f *FileManageTool) RequiredParameters() []string
- func (f *FileManageTool) SetConfirmator(confirmator Confirmator)
- type FileReadTool
- type FileReplaceLinesTool
- func (f *FileReplaceLinesTool) Description() string
- func (f *FileReplaceLinesTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
- func (f *FileReplaceLinesTool) Name() string
- func (f *FileReplaceLinesTool) Parameters() map[string]interface{}
- func (f *FileReplaceLinesTool) RequiredParameters() []string
- func (f *FileReplaceLinesTool) SetConfirmator(confirmator Confirmator)
- type FileSearchReplaceTool
- func (f *FileSearchReplaceTool) Description() string
- func (f *FileSearchReplaceTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
- func (f *FileSearchReplaceTool) Name() string
- func (f *FileSearchReplaceTool) Parameters() map[string]interface{}
- func (f *FileSearchReplaceTool) RequiredParameters() []string
- func (f *FileSearchReplaceTool) SetConfirmator(confirmator Confirmator)
- type HttpRequestTool
- func (h *HttpRequestTool) Description() string
- func (h *HttpRequestTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
- func (h *HttpRequestTool) Name() string
- func (h *HttpRequestTool) Parameters() map[string]interface{}
- func (h *HttpRequestTool) RequiredParameters() []string
- func (h *HttpRequestTool) SetConfirmator(confirmator Confirmator)
- type Registry
- func (r *Registry) ExecuteAsync(ctx context.Context, call ToolCall, resultChan chan<- ToolResult)
- func (r *Registry) GetOpenAIToolsSpec() []map[string]interface{}
- func (r *Registry) GetTool(name string) (Tool, bool)
- func (r *Registry) ListTools() []Tool
- func (r *Registry) Register(tool Tool)
- func (r *Registry) SetConfirmator(confirmator Confirmator)
- type ShellTool
- func (s *ShellTool) Description() string
- func (s *ShellTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
- func (s *ShellTool) Name() string
- func (s *ShellTool) Parameters() map[string]interface{}
- func (s *ShellTool) RequiredParameters() []string
- func (s *ShellTool) SetConfirmator(confirmator Confirmator)
- type Tool
- type ToolCall
- type ToolResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterBuiltinTools ¶
func RegisterBuiltinTools(registry *Registry)
RegisterBuiltinTools registers all builtin tools to a registry
Types ¶
type CodeFormatterTool ¶
type CodeFormatterTool struct {
// contains filtered or unexported fields
}
CodeFormatterTool runs code formatters and linters
func (*CodeFormatterTool) Description ¶
func (c *CodeFormatterTool) Description() string
func (*CodeFormatterTool) Execute ¶
func (c *CodeFormatterTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*CodeFormatterTool) Name ¶
func (c *CodeFormatterTool) Name() string
func (*CodeFormatterTool) Parameters ¶
func (c *CodeFormatterTool) Parameters() map[string]interface{}
func (*CodeFormatterTool) RequiredParameters ¶
func (c *CodeFormatterTool) RequiredParameters() []string
func (*CodeFormatterTool) SetConfirmator ¶
func (c *CodeFormatterTool) SetConfirmator(confirmator Confirmator)
type Confirmator ¶
Confirmator is an interface for requesting user confirmation
type ConfirmingTool ¶
type ConfirmingTool interface {
Tool
SetConfirmator(confirmator Confirmator)
}
ConfirmingTool is a tool that can request user confirmation before execution
type CurrentTimeTool ¶
type CurrentTimeTool struct{}
CurrentTimeTool returns the current time
func (*CurrentTimeTool) Description ¶
func (c *CurrentTimeTool) Description() string
func (*CurrentTimeTool) Execute ¶
func (c *CurrentTimeTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*CurrentTimeTool) Name ¶
func (c *CurrentTimeTool) Name() string
func (*CurrentTimeTool) Parameters ¶
func (c *CurrentTimeTool) Parameters() map[string]interface{}
func (*CurrentTimeTool) RequiredParameters ¶
func (c *CurrentTimeTool) RequiredParameters() []string
type DataEditTool ¶
type DataEditTool struct {
// contains filtered or unexported fields
}
DataEditTool handles JSON and YAML data manipulation
func (*DataEditTool) Description ¶
func (d *DataEditTool) Description() string
func (*DataEditTool) Execute ¶
func (d *DataEditTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*DataEditTool) Name ¶
func (d *DataEditTool) Name() string
func (*DataEditTool) Parameters ¶
func (d *DataEditTool) Parameters() map[string]interface{}
func (*DataEditTool) RequiredParameters ¶
func (d *DataEditTool) RequiredParameters() []string
func (*DataEditTool) SetConfirmator ¶
func (d *DataEditTool) SetConfirmator(confirmator Confirmator)
type DataProcessTool ¶
type DataProcessTool struct {
// contains filtered or unexported fields
}
DataProcessTool handles CSV data processing and analysis
func (*DataProcessTool) Description ¶
func (d *DataProcessTool) Description() string
func (*DataProcessTool) Execute ¶
func (d *DataProcessTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*DataProcessTool) Name ¶
func (d *DataProcessTool) Name() string
func (*DataProcessTool) Parameters ¶
func (d *DataProcessTool) Parameters() map[string]interface{}
func (*DataProcessTool) RequiredParameters ¶
func (d *DataProcessTool) RequiredParameters() []string
func (*DataProcessTool) SetConfirmator ¶
func (d *DataProcessTool) SetConfirmator(confirmator Confirmator)
type DiffHunk ¶
type DiffHunk struct {
OldStart int // Starting line in original file (1-based)
OldCount int // Number of lines in original file
NewStart int // Starting line in new file (1-based)
NewCount int // Number of lines in new file
Lines []string // Diff lines with +/- prefixes
}
DiffHunk represents a single diff hunk
type DirectoryManageTool ¶
type DirectoryManageTool struct {
// contains filtered or unexported fields
}
DirectoryManageTool handles directory operations (create/delete/list)
func (*DirectoryManageTool) Description ¶
func (d *DirectoryManageTool) Description() string
func (*DirectoryManageTool) Execute ¶
func (d *DirectoryManageTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*DirectoryManageTool) Name ¶
func (d *DirectoryManageTool) Name() string
func (*DirectoryManageTool) Parameters ¶
func (d *DirectoryManageTool) Parameters() map[string]interface{}
func (*DirectoryManageTool) RequiredParameters ¶
func (d *DirectoryManageTool) RequiredParameters() []string
func (*DirectoryManageTool) SetConfirmator ¶
func (d *DirectoryManageTool) SetConfirmator(confirmator Confirmator)
type FileCreationTool ¶
type FileCreationTool struct {
// contains filtered or unexported fields
}
FileCreationTool creates new files with specified content
func (*FileCreationTool) Description ¶
func (f *FileCreationTool) Description() string
func (*FileCreationTool) Execute ¶
func (f *FileCreationTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*FileCreationTool) Name ¶
func (f *FileCreationTool) Name() string
func (*FileCreationTool) Parameters ¶
func (f *FileCreationTool) Parameters() map[string]interface{}
func (*FileCreationTool) RequiredParameters ¶
func (f *FileCreationTool) RequiredParameters() []string
func (*FileCreationTool) SetConfirmator ¶
func (f *FileCreationTool) SetConfirmator(confirmator Confirmator)
type FileEditTool ¶
type FileEditTool struct {
// contains filtered or unexported fields
}
FileEditTool edits files using git diff format
func (*FileEditTool) Description ¶
func (f *FileEditTool) Description() string
func (*FileEditTool) Execute ¶
func (f *FileEditTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*FileEditTool) Name ¶
func (f *FileEditTool) Name() string
func (*FileEditTool) Parameters ¶
func (f *FileEditTool) Parameters() map[string]interface{}
func (*FileEditTool) RequiredParameters ¶
func (f *FileEditTool) RequiredParameters() []string
func (*FileEditTool) SetConfirmator ¶
func (f *FileEditTool) SetConfirmator(confirmator Confirmator)
type FileInsertTool ¶
type FileInsertTool struct {
// contains filtered or unexported fields
}
FileInsertTool inserts content at specific positions
func (*FileInsertTool) Description ¶
func (f *FileInsertTool) Description() string
func (*FileInsertTool) Execute ¶
func (f *FileInsertTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*FileInsertTool) Name ¶
func (f *FileInsertTool) Name() string
func (*FileInsertTool) Parameters ¶
func (f *FileInsertTool) Parameters() map[string]interface{}
func (*FileInsertTool) RequiredParameters ¶
func (f *FileInsertTool) RequiredParameters() []string
func (*FileInsertTool) SetConfirmator ¶
func (f *FileInsertTool) SetConfirmator(confirmator Confirmator)
type FileManageTool ¶
type FileManageTool struct {
// contains filtered or unexported fields
}
FileManageTool handles file operations (copy/move/rename)
func (*FileManageTool) Description ¶
func (f *FileManageTool) Description() string
func (*FileManageTool) Execute ¶
func (f *FileManageTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*FileManageTool) Name ¶
func (f *FileManageTool) Name() string
func (*FileManageTool) Parameters ¶
func (f *FileManageTool) Parameters() map[string]interface{}
func (*FileManageTool) RequiredParameters ¶
func (f *FileManageTool) RequiredParameters() []string
func (*FileManageTool) SetConfirmator ¶
func (f *FileManageTool) SetConfirmator(confirmator Confirmator)
type FileReadTool ¶
type FileReadTool struct{}
FileReadTool reads file contents with advanced options
func (*FileReadTool) Description ¶
func (f *FileReadTool) Description() string
func (*FileReadTool) Execute ¶
func (f *FileReadTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*FileReadTool) Name ¶
func (f *FileReadTool) Name() string
func (*FileReadTool) Parameters ¶
func (f *FileReadTool) Parameters() map[string]interface{}
func (*FileReadTool) RequiredParameters ¶
func (f *FileReadTool) RequiredParameters() []string
type FileReplaceLinesTool ¶
type FileReplaceLinesTool struct {
// contains filtered or unexported fields
}
FileReplaceLinesTool replaces specific line ranges in files
func (*FileReplaceLinesTool) Description ¶
func (f *FileReplaceLinesTool) Description() string
func (*FileReplaceLinesTool) Execute ¶
func (f *FileReplaceLinesTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*FileReplaceLinesTool) Name ¶
func (f *FileReplaceLinesTool) Name() string
func (*FileReplaceLinesTool) Parameters ¶
func (f *FileReplaceLinesTool) Parameters() map[string]interface{}
func (*FileReplaceLinesTool) RequiredParameters ¶
func (f *FileReplaceLinesTool) RequiredParameters() []string
func (*FileReplaceLinesTool) SetConfirmator ¶
func (f *FileReplaceLinesTool) SetConfirmator(confirmator Confirmator)
type FileSearchReplaceTool ¶
type FileSearchReplaceTool struct {
// contains filtered or unexported fields
}
FileSearchReplaceTool performs search and replace operations
func (*FileSearchReplaceTool) Description ¶
func (f *FileSearchReplaceTool) Description() string
func (*FileSearchReplaceTool) Execute ¶
func (f *FileSearchReplaceTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*FileSearchReplaceTool) Name ¶
func (f *FileSearchReplaceTool) Name() string
func (*FileSearchReplaceTool) Parameters ¶
func (f *FileSearchReplaceTool) Parameters() map[string]interface{}
func (*FileSearchReplaceTool) RequiredParameters ¶
func (f *FileSearchReplaceTool) RequiredParameters() []string
func (*FileSearchReplaceTool) SetConfirmator ¶
func (f *FileSearchReplaceTool) SetConfirmator(confirmator Confirmator)
type HttpRequestTool ¶
type HttpRequestTool struct {
// contains filtered or unexported fields
}
HttpRequestTool makes HTTP requests
func (*HttpRequestTool) Description ¶
func (h *HttpRequestTool) Description() string
func (*HttpRequestTool) Execute ¶
func (h *HttpRequestTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*HttpRequestTool) Name ¶
func (h *HttpRequestTool) Name() string
func (*HttpRequestTool) Parameters ¶
func (h *HttpRequestTool) Parameters() map[string]interface{}
func (*HttpRequestTool) RequiredParameters ¶
func (h *HttpRequestTool) RequiredParameters() []string
func (*HttpRequestTool) SetConfirmator ¶
func (h *HttpRequestTool) SetConfirmator(confirmator Confirmator)
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages available tools
func (*Registry) ExecuteAsync ¶
func (r *Registry) ExecuteAsync(ctx context.Context, call ToolCall, resultChan chan<- ToolResult)
ExecuteAsync executes a tool call asynchronously
func (*Registry) GetOpenAIToolsSpec ¶
GetOpenAIToolsSpec returns OpenAI-compatible tool specifications
func (*Registry) SetConfirmator ¶
func (r *Registry) SetConfirmator(confirmator Confirmator)
SetConfirmator sets the confirmator for all confirming tools
type ShellTool ¶
type ShellTool struct {
// contains filtered or unexported fields
}
ShellTool executes shell commands (use with caution)
func (*ShellTool) Description ¶
func (*ShellTool) Parameters ¶
func (*ShellTool) RequiredParameters ¶
func (*ShellTool) SetConfirmator ¶
func (s *ShellTool) SetConfirmator(confirmator Confirmator)
type Tool ¶
type Tool interface {
Name() string
Description() string
Parameters() map[string]interface{} // JSON schema for parameters
RequiredParameters() []string // List of required parameter names
Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
}
Tool represents a function that can be called by the AI
type ToolCall ¶
type ToolCall struct {
ID string `json:"id"`
Name string `json:"name"`
Function string `json:"function,omitempty"` // For OpenAI compatibility
Args map[string]interface{} `json:"arguments"`
}
ToolCall represents a tool call request
func ParseToolCallFromJSON ¶
ParseToolCallFromJSON parses a tool call from JSON string
type ToolResult ¶
type ToolResult struct {
CallID string `json:"call_id"`
Name string `json:"name"`
Result interface{} `json:"result"`
Error string `json:"error,omitempty"`
}
ToolResult represents the result of a tool execution
func (*ToolResult) ToJSONString ¶
func (tr *ToolResult) ToJSONString() string
ToJSONString converts a tool result to JSON string