Documentation
¶
Overview ¶
Package tools describes the built-in tools agents can use: their names, what they do and the JSON schema of their arguments. The implementations live in internal/agent/functions; this package only holds the catalog, so the agent model, the API and the runner can all read it.
A tool has two names. Its implementation key (impl_key, such as "collections.patch_item") is what agents store and run. Its "use" name (such as "content.update") is the short, readable one people write. Both are accepted wherever a tool is named.
Index ¶
Constants ¶
const ( GroupContent = "content" // read and write items GroupAI = "ai" // ask a model about a text GroupSystem = "system" GroupApps = "apps" // tools of connected apps )
Group of a tool, for people choosing one.
Variables ¶
var ( Apps func(name string) (Info, bool) AppTools func() []Info )
Apps resolves the tools of connected apps ("github.create_issue"): set by the package that knows the connections. AppTools lists them all.
Functions ¶
func EmptySchema ¶
EmptySchema reports whether a parameters schema says nothing: absent, or an object without properties. Agents with such a schema get the tool's own one.
func ImplKey ¶
ImplKey returns the implementation key a name refers to; names the catalog doesn't know (functions registered by a fork) are returned as they are.
func ModelName ¶
ModelName turns a name into one model APIs accept: letters, digits, _ and -, at most 64 characters.
func SameSchema ¶
SameSchema reports whether two schemas are the same JSON.
Types ¶
type Info ¶
type Info struct {
ImplKey string `json:"impl_key"`
// Use is the short name people write ("content.update").
Use string `json:"use"`
// Name is the name the model sees when the agent doesn't give one.
Name string `json:"name"`
Label string `json:"label"`
Group string `json:"group"`
Description string `json:"description"`
Parameters models.JSONMap `json:"parameters"`
// Scoped: the tool works on collections and accepts an "on" scope.
Scoped bool `json:"scoped"`
// Writes: the tool changes content (create, update, delete), or, for a
// connected app's tool, may change something in that app.
Writes bool `json:"writes"`
// App is the connection of a connected app's tool ("github"), and
// AppLabel its name for people.
App string `json:"app,omitempty"`
AppLabel string `json:"appLabel,omitempty"`
}
Info describes a built-in tool.