Documentation
¶
Index ¶
- Variables
- func DefaultSchemaCustomizer(name string, t reflect.Type, tag reflect.StructTag, schema *openapi3.Schema) error
- func Register(t *Tool)
- func WithConfig(c map[string]any) error
- func WithRepo(repo Repo)
- type Event
- type Factory
- type InvokeFunc
- type Option
- type Parameter
- type ParameterType
- type ParamsOneOf
- type Repo
- type Tool
- type ToolFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultConfig config
Functions ¶
func DefaultSchemaCustomizer ¶ added in v0.1.3
func DefaultSchemaCustomizer(name string, t reflect.Type, tag reflect.StructTag, schema *openapi3.Schema) error
DefaultSchemaCustomizer is the default schema customizer when using reflect to infer tool parameter from tagged go struct. Supported struct tags: 1. jsonschema: "description=xxx" 2. jsonschema: "enum=xxx,enum=yyy,enum=zzz" 3. jsonschema: "required" 4. can also use json: "xxx,omitempty" to mark the field as not required, which means an absence of 'omitempty' in json tag means the field is required. If this DefaultSchemaCustomizer is not sufficient or suitable to your specific need, define your own SchemaCustomizerFn and pass it to WithSchemaCustomizer during InferTool or InferStreamTool.
func WithConfig ¶
Types ¶
type Option ¶ added in v0.0.9
type Option func(*Tool)
func WithDescription ¶ added in v0.0.9
func WithFunction ¶ added in v0.0.9
func WithParameters ¶ added in v0.0.9
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" )
type ParamsOneOf ¶ added in v0.1.3
type ParamsOneOf struct {
// contains filtered or unexported fields
}
func (*ParamsOneOf) Parameters ¶ added in v0.1.3
func (p *ParamsOneOf) Parameters() any
type Tool ¶
type Tool struct {
ID int64 // 引用的工具ID
Kind string // 引用的工具类型
Name string
Description string
*ParamsOneOf `json:"parameters,omitempty"` // 参数,可选
AuthenticationType string
AuthenticationValue string
ServerURL string `json:"server_url"` // 服务器URL
Method string `json:"method"` // 方法
Body string `json:"body"` // body
// contains filtered or unexported fields
}
func NewWithToolFunc ¶ added in v0.1.3
func (*Tool) WithInvokeFunc ¶ added in v0.1.3
func (t *Tool) WithInvokeFunc(invoke InvokeFunc) *Tool
func (*Tool) WithParameters ¶ added in v0.1.3
Click to show internal directories.
Click to hide internal directories.