Documentation
¶
Overview ¶
Package llm is the plugin that calls a model. Its chat gives the conversation so far, the tools on offer and what is wanted, and gets back what the model said, the tools it asked for, why it stopped and how many tokens were used. Its decide gives a System One model text or data and named questions about it, and gets back the answers.
Index ¶
- Constants
- Variables
- func Having(call func(*Service) bool) []string
- func Names() []string
- func Of(model string) string
- func Register(s *Service)
- func ResultText(result any) (string, bool)
- func Schema(args any) map[string]any
- func Text(v any) string
- type Accept
- type Answers
- type Call
- type File
- type Questions
- type Reply
- type Service
Constants ¶
const ( StopEnd = "end" // it finished StopTools = "tools" // it asked for tools StopLength = "length" // it ran out of room )
Why a model stopped.
Variables ¶
var ( Images = []Accept{{"image/png", 5 << 20}, {"image/jpeg", 5 << 20}, {"image/gif", 5 << 20}, {"image/webp", 5 << 20}} Documents = []Accept{{"application/pdf", 32 << 20}} )
The types of content the services take beside text, and the largest of each, as the services say.
Functions ¶
func Having ¶ added in v0.3.0
Having gives the services that make a call: those with Chat, or those with Decide.
func ResultText ¶
Types ¶
type Accept ¶
Accept is one type of content a service takes beside text, and the largest of it that it takes.
type Answers ¶ added in v0.3.0
Answers is what a System One model gave back: an answer under each question's name, as the service wrote it.
type Call ¶
type Call struct {
Model string
System string
Said []any // the conversation so far
Tools []any
Effort string
Room int // the most a reply may hold
// Address and Key are where a service on the web is and what opens it.
Address string
Key any
Limit time.Duration
// Own are the tools of its own that a program may use.
Own []string
// Shape is the shape of answer wanted, for a service that takes it
// itself.
Shape map[string]any
}
Call is one call to a model.
type File ¶
A File is content beside text that a part of the conversation carries: an image or a document, under the name the model knows it by.
type Questions ¶ added in v0.3.0
type Questions struct {
Model string
State any
Questions map[string]any
Address string
Key any
Limit time.Duration
}
Questions is one call to a System One model: the text or data the questions are about, and the questions under their names.
type Reply ¶
type Reply struct {
Text string
Calls []any // each { id, name, args }
Stop string
Usage map[string]any
Kept any // parts the service wants back unchanged
}
Reply is what a model gave back.
type Service ¶
type Service struct {
Name string
// Address is where a service on the web usually lives. Program is,
// for one that is a program, the program that is started.
Address string
Program string
// Models are how the names of the models it is the usual service of
// begin. It takes any name.
Models []string
// Efforts are the levels of effort it takes, and Accepts the kinds of
// content it takes beside text.
Efforts []string
Accepts []Accept
// Needs says, for a program, what a tool of the program's own could
// use: a group of permissions. Corbie does not run such a tool, so it
// is allowed only where that whole group is.
Needs func(tool string) string
// Shapes says the service has a way of its own to be given the shape
// of answer wanted. One that has none is told it in the system text.
Shapes bool
// Chat holds a conversation: one call. Decide puts questions with fixed
// answers to a System One model. A service has one or both.
Chat func(job *plugin.Job, c *Call) (*Reply, error)
Decide func(job *plugin.Job, q *Questions) (*Answers, error)
}
A Service is one way of reaching a model: an extension. One on the web speaks one service's way of talking; one that is a program starts it.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package claudecode is the model service that is a program: it starts Claude Code on the runner's machine and has it write one reply.
|
Package claudecode is the model service that is a program: it starts Claude Code on the runner's machine and has it write one reply. |
|
Package standin is a model service for tests: it speaks Anthropic's Messages API, streams each reply as server-sent events, and keeps every call it is sent.
|
Package standin is a model service for tests: it speaks Anthropic's Messages API, streams each reply as server-sent events, and keeps every call it is sent. |