Documentation
¶
Index ¶
- Variables
- func Register(name string, tool *CodeTool)
- func WithRepo(repo Repo)
- type APITool
- func (t *APITool) Description() string
- func (t *APITool) Invoke(ctx context.Context, params map[string]any) (string, error)
- func (t *APITool) Kind() string
- func (t *APITool) Name() string
- func (t *APITool) Parameters() map[string]any
- func (t *APITool) Stream(ctx context.Context, params map[string]any) (<-chan any, error)
- func (t *APITool) ToolName() string
- type APIToolBundle
- type CodeTool
- func (t *CodeTool) Description() string
- func (t *CodeTool) Invoke(ctx context.Context, args map[string]any) (string, error)
- func (t *CodeTool) Kind() string
- func (t *CodeTool) Name() string
- func (t *CodeTool) Parameters() map[string]any
- func (t *CodeTool) Stream(ctx context.Context, args map[string]any) (<-chan any, error)
- type Event
- type Factory
- type Meta
- type NilTool
- func (t *NilTool) Description() string
- func (t *NilTool) Invoke(ctx context.Context, params map[string]any) (string, error)
- func (t *NilTool) Kind() string
- func (t *NilTool) Name() string
- func (t *NilTool) Parameters() map[string]any
- func (t *NilTool) Stream(ctx context.Context, params map[string]any) (<-chan any, error)
- type Parameter
- type ParameterType
- type Repo
- type Tool
Constants ¶
This section is empty.
Variables ¶
CodeTools 工具注册表
Functions ¶
Types ¶
type APITool ¶
type APITool struct { // Bundle APIToolBundle APIToolBundle }
APITool 结构体,用于表示基于API的工具
type APIToolBundle ¶
type APIToolBundle struct { Meta Type int AuthenticationType string AuthenticationValue string PostCode string `json:"post_code"` // 代码 ServerURL string `json:"server_url"` // 服务器URL Method string `json:"method"` // 方法 Summary string `json:"summary,omitempty"` // 摘要,可选 Body string `json:"body"` // body OperationID string `json:"operation_id,omitempty"` // 操作ID,可选 Parameters []Parameter `json:"parameters,omitempty"` // 参数,可选 Author string `json:"author"` // 作者 Icon string `json:"icon,omitempty"` // 图标,可选 }
APIToolBundle 结构体,用于存储基于API的工具的schema信息
type CodeTool ¶
type CodeTool struct { Meta Invokex func(context.Context, map[string]any) (string, error) Streamx func(context.Context, map[string]any) (chan any, error) }
CodeTool 结构体,用于表示基于API的工具
type Meta ¶
type Meta struct { ID int64 // 引用的工具ID Kind string // 引用的工具类型 Operation string // 操作名称(唯一) Name string Description string Parameters []Parameter }
Meta ...
type Parameter ¶
type Parameter struct { Name string Label string HumanDescription string Placeholder string Type ParameterType LLMDescrition string Required bool Default any Min float64 Max float64 Options []string }
Parameter 用于描述API参数的结构体
type ParameterType ¶
type ParameterType string
ParameterType 枚举类型
const ( Array ParameterType = "array" String ParameterType = "string" Number ParameterType = "number" Boolean ParameterType = "boolean" Select ParameterType = "select" SecretInput ParameterType = "secret-input" File ParameterType = "file" )
Click to show internal directories.
Click to hide internal directories.