Documentation
¶
Overview ¶
Package agent is the machine whose tools a model picks: the model is asked what to do, the tools it picks are run, the results go back to it, and this repeats until it answers without asking for a tool.
Index ¶
Constants ¶
const DefaultTurns = 20
DefaultTurns is how many turns an agent has unless it says otherwise.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
Model Model `json:"model"`
System string `json:"system,omitzero"`
Prompt any `json:"prompt,omitzero"`
// Tools are the agent's entries: each a tool written in place, or a
// machine, which is one tool or, where it is a toolkit, a toolkit.
Tools map[string]*Tool `json:"tools,omitzero"`
// Turns is how many turns the agent has; twenty if it says nothing.
Turns int `json:"turns,omitzero"`
// Show is the most the model is shown in place, in bytes; none means
// the default.
Show int64 `json:"show,omitzero"`
// Reply is the shape of the reply in the agent's result, where it is
// data and not text: a JSON Schema of an object.
Reply map[string]any `json:"reply,omitzero"`
// Conversation is a conversation so far, to carry on from.
Conversation any `json:"conversation,omitzero"`
// Turn is the job that makes a turn.
Turn *machine.JobSpec `json:"turn"`
}
Agent is the full form of the fields of a definition that only an agent has.
type Decision ¶ added in v0.23.0
type Decision struct {
Model Model `json:"model"`
// State is the text or data the questions are about.
State any `json:"state,omitzero"`
// Questions are the questions, each under its name, as the model's
// service takes them.
Questions any `json:"questions,omitzero"`
// Decide is the job that puts the questions to the model.
Decide *machine.JobSpec `json:"decide"`
}
Decision is the full form of the fields of a definition that only a decision has.
type Model ¶
type Model struct {
Name string `json:"name"`
// Secret is the name of the secret that is the service's key.
Secret string `json:"secret,omitzero"`
// Service is which service's way of talking is spoken; it follows from
// the model's name where it is not given.
Service string `json:"service,omitzero"`
// Address is where the service lives, for one that is not at its usual
// place.
Address string `json:"address,omitzero"`
Effort string `json:"effort,omitzero"`
// ReplyTokens is the most a reply may hold, in tokens.
ReplyTokens int `json:"reply_tokens,omitzero"`
// Own are the tools of its own that a model run as a program may use:
// tools Corbie does not run.
Own []string `json:"own,omitzero"`
// ToolChanges says tools added or removed after the first turn are
// sent to the service as messages, for a service that has that.
ToolChanges bool `json:"tool_changes,omitzero"`
}
Model names the model an agent's turns are sent to.
type Tool ¶
type Tool struct {
Description string `json:"description,omitzero"`
Args map[string]any `json:"args,omitzero"`
Job *machine.JobSpec `json:"job"`
// Agent says the tool's job is an agent: the model is shown what that
// agent replied, and not the conversation it had.
Agent bool `json:"agent,omitzero"`
// Machine is the file of the machine the entry names, and Call its
// location. Job runs it with the input the entry fixes.
Machine string `json:"machine,omitzero"`
Call string `json:"call,omitzero"`
// Toolkit says the machine the entry names is a toolkit.
Toolkit bool `json:"toolkit,omitzero"`
// Open says a toolkit is opened before the first turn.
Open bool `json:"open,omitzero"`
// When is a condition on the agent's input, checked when the run
// starts: the entry is offered only if it holds.
When string `json:"when,omitzero"`
}
Tool is an entry of an agent's tools. Written in place it is a named job a model may pick, with its description and the shape of its arguments, a JSON Schema of an object. Written machine: or call: it names a machine, whose description it takes: any machine is one tool, whose arguments are the machine's input, and a toolkit is a toolkit, which the model opens.