Documentation
¶
Index ¶
- func GetTool(name string) (interfaces.Tool, error)
- func ListTools() []interfaces.Tool
- func RegisterTool(tool interfaces.Tool) error
- type BaseToolkit
- func (t *BaseToolkit) AddTool(tool interfaces.Tool)
- func (t *BaseToolkit) GetToolByName(name string) (interfaces.Tool, error)
- func (t *BaseToolkit) GetToolNames() []string
- func (t *BaseToolkit) GetTools() []interfaces.Tool
- func (t *BaseToolkit) MergeTool(other Toolkit)
- func (t *BaseToolkit) RemoveTool(name string) error
- type DevelopmentToolkit
- type StandardToolkit
- type ToolRegistry
- type Toolkit
- type ToolkitBuilder
- func (b *ToolkitBuilder) AddTool(tool interfaces.Tool) *ToolkitBuilder
- func (b *ToolkitBuilder) AddToolkit(toolkit Toolkit) *ToolkitBuilder
- func (b *ToolkitBuilder) AddTools(tools ...interfaces.Tool) *ToolkitBuilder
- func (b *ToolkitBuilder) Build() Toolkit
- func (b *ToolkitBuilder) WithAPI(baseURL string, headers map[string]string) *ToolkitBuilder
- func (b *ToolkitBuilder) WithCalculator() *ToolkitBuilder
- func (b *ToolkitBuilder) WithSearch(engine search.SearchEngine) *ToolkitBuilder
- func (b *ToolkitBuilder) WithShell(allowedCommands []string) *ToolkitBuilder
- type ToolkitExecutor
- func (e *ToolkitExecutor) Execute(ctx context.Context, toolName string, input *interfaces.ToolInput) (*interfaces.ToolOutput, error)
- func (e *ToolkitExecutor) ExecuteMultiple(ctx context.Context, requests map[string]*interfaces.ToolInput) (map[string]*interfaces.ToolOutput, error)
- func (e *ToolkitExecutor) WithParallel(parallel bool) *ToolkitExecutor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BaseToolkit ¶
type BaseToolkit struct {
// contains filtered or unexported fields
}
BaseToolkit 基础工具集实现
func NewBaseToolkit ¶
func NewBaseToolkit(toolList ...interfaces.Tool) *BaseToolkit
NewBaseToolkit 创建基础工具集
func (*BaseToolkit) GetToolByName ¶
func (t *BaseToolkit) GetToolByName(name string) (interfaces.Tool, error)
GetToolByName 根据名称获取工具
func (*BaseToolkit) GetToolNames ¶
func (t *BaseToolkit) GetToolNames() []string
GetToolNames 获取所有工具名称
func (*BaseToolkit) RemoveTool ¶
func (t *BaseToolkit) RemoveTool(name string) error
RemoveTool 移除工具
type DevelopmentToolkit ¶
type DevelopmentToolkit struct {
*BaseToolkit
}
DevelopmentToolkit 开发工具集
包含开发常用的工具(Shell、API 等)
func NewDevelopmentToolkit ¶
func NewDevelopmentToolkit() *DevelopmentToolkit
NewDevelopmentToolkit 创建开发工具集
type ToolRegistry ¶
type ToolRegistry struct {
// contains filtered or unexported fields
}
ToolRegistry 工具注册表
全局工具管理器,支持注册和发现工具
func (*ToolRegistry) CreateToolkit ¶
func (r *ToolRegistry) CreateToolkit(names ...string) (Toolkit, error)
CreateToolkit 从注册表创建工具集
func (*ToolRegistry) Get ¶
func (r *ToolRegistry) Get(name string) (interfaces.Tool, error)
Get 获取工具
func (*ToolRegistry) Register ¶
func (r *ToolRegistry) Register(tool interfaces.Tool) error
Register 注册工具
func (*ToolRegistry) Unregister ¶
func (r *ToolRegistry) Unregister(name string) error
Unregister 注销工具
type Toolkit ¶
type Toolkit interface {
// GetTools 获取所有工具
GetTools() []interfaces.Tool
// GetToolByName 根据名称获取工具
GetToolByName(name string) (interfaces.Tool, error)
// GetToolNames 获取所有工具名称
GetToolNames() []string
}
Toolkit 工具集接口
管理一组相关的工具
type ToolkitBuilder ¶
type ToolkitBuilder struct {
// contains filtered or unexported fields
}
ToolkitBuilder 工具集构建器
func (*ToolkitBuilder) AddTool ¶
func (b *ToolkitBuilder) AddTool(tool interfaces.Tool) *ToolkitBuilder
AddTool 添加单个工具
func (*ToolkitBuilder) AddToolkit ¶
func (b *ToolkitBuilder) AddToolkit(toolkit Toolkit) *ToolkitBuilder
AddToolkit 添加整个工具集
func (*ToolkitBuilder) AddTools ¶
func (b *ToolkitBuilder) AddTools(tools ...interfaces.Tool) *ToolkitBuilder
AddTools 批量添加工具
func (*ToolkitBuilder) WithAPI ¶
func (b *ToolkitBuilder) WithAPI(baseURL string, headers map[string]string) *ToolkitBuilder
WithAPI 添加 API 工具
func (*ToolkitBuilder) WithCalculator ¶
func (b *ToolkitBuilder) WithCalculator() *ToolkitBuilder
WithCalculator 添加计算器工具
func (*ToolkitBuilder) WithSearch ¶
func (b *ToolkitBuilder) WithSearch(engine search.SearchEngine) *ToolkitBuilder
WithSearch 添加搜索工具
func (*ToolkitBuilder) WithShell ¶
func (b *ToolkitBuilder) WithShell(allowedCommands []string) *ToolkitBuilder
WithShell 添加 Shell 工具
type ToolkitExecutor ¶
type ToolkitExecutor struct {
// contains filtered or unexported fields
}
ToolkitExecutor 工具包执行器
提供工具执行的辅助功能
func NewToolkitExecutor ¶
func NewToolkitExecutor(toolkit Toolkit) *ToolkitExecutor
NewToolkitExecutor 创建工具包执行器
func (*ToolkitExecutor) Execute ¶
func (e *ToolkitExecutor) Execute(ctx context.Context, toolName string, input *interfaces.ToolInput) (*interfaces.ToolOutput, error)
Execute 执行单个工具
func (*ToolkitExecutor) ExecuteMultiple ¶
func (e *ToolkitExecutor) ExecuteMultiple(ctx context.Context, requests map[string]*interfaces.ToolInput) (map[string]*interfaces.ToolOutput, error)
ExecuteMultiple 执行多个工具
func (*ToolkitExecutor) WithParallel ¶
func (e *ToolkitExecutor) WithParallel(parallel bool) *ToolkitExecutor
WithParallel 设置并行执行
Click to show internal directories.
Click to hide internal directories.