Documentation
¶
Index ¶
- Variables
- func CheckTools(specs agentModels.FunctionSpecs) error
- func ConnectionNameTaken(name string) bool
- func IsAppTool(implKey string) bool
- func IsImplementationAvailable(implKey string) bool
- func RegisterFunction(implKey string, fn ToolFunc)
- func WithWriteMode(ctx context.Context, mode WriteMode) context.Context
- type FunctionDefinition
- type Info
- type Registry
- type RegistryTool
- type ToolFunc
- type ToolSpec
- type WriteMode
Constants ¶
This section is empty.
Variables ¶
var StaticFunctionMap = make(map[string]ToolFunc)
Functions ¶
func CheckTools ¶ added in v0.7.0
func CheckTools(specs agentModels.FunctionSpecs) error
CheckTools refuses tools whose implementation doesn't exist.
func ConnectionNameTaken ¶ added in v0.7.0
ConnectionNameTaken reports whether built-in tools already use name as their prefix ("content", or "shop" for a fork's "shop.check_stock").
func IsImplementationAvailable ¶
IsImplementationAvailable checks if a function implementation exists
func RegisterFunction ¶
RegisterFunction allows runtime registration of functions (optional feature)
Types ¶
type FunctionDefinition ¶
type FunctionDefinition struct {
Name string `json:"name"`
Description string `json:"description"`
Parameters any `json:"parameters"`
}
FunctionDefinition defines a function that can be called by the LLM
type Info ¶ added in v0.5.0
Info describes a built-in tool for people configuring agents (see internal/agent/tools).
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry maps a tool's name to its executable function.
func NewRegistry ¶
func NewRegistry(agentFuncs agentModels.FunctionSpecs) *Registry
NewRegistry creates a new tool registry from a list of agent function specs.
func (*Registry) ImplKey ¶ added in v0.5.0
ImplKey returns the implementation key of a registered tool.
func (*Registry) ListFunctions ¶
ListFunctions returns a list of registered function names (for debugging)
func (*Registry) ToLangchainTools ¶
ToLangchainTools converts the registry to langchain-compatible []llms.Tool
type RegistryTool ¶
type RegistryTool struct {
// contains filtered or unexported fields
}
RegistryTool implements langchain's tools.Tool interface
func (*RegistryTool) Description ¶
func (t *RegistryTool) Description() string
Description returns the tool description (implements tools.Tool interface)
func (*RegistryTool) Name ¶
func (t *RegistryTool) Name() string
Name returns the tool name (implements tools.Tool interface)
type ToolSpec ¶
type ToolSpec struct {
Type string `json:"type"`
Function *FunctionDefinition `json:"function"`
}
ToolSpec represents a function specification for the LLM
type WriteMode ¶ added in v0.6.0
type WriteMode int
WriteMode is how content functions handle writes in a run.
const ( // WriteLive applies writes. WriteLive WriteMode = iota // WriteDryRun validates writes and reports what they would do, without // writing anything (test runs). WriteDryRun // WritePropose validates writes and stores them as proposals an editor // approves (agents with require_approval). WritePropose )