Documentation
¶
Overview ¶
Package api serves the HTTP API other programs reach the agent through: the requests an OpenAI client makes, answered by the agent with its tools, the sessions and the runs of each profile, and the routes plugins bring, such as those of the scheduled jobs. Its routes are served by icebath server beside the services, each profile under a key of its own
Index ¶
Constants ¶
const Source = "api_server"
Surface of the runs and the sessions the API starts
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
Reads the JSON a request carries into the value, at most as many bytes as a request may be; what it failed for is answered in the shape an OpenAI client reads
Types ¶
type API ¶
type API struct {
Registry
// contains filtered or unexported fields
}
The HTTP API of the profiles of this icebath
func (*API) Listing ¶
Has the API tell programs of the providers of a profile and the models each offers what the listing tells, such as the service of the providers tells the app
func (*API) Mount ¶
Mounts the routes of the API on the mux: each as it is for the profile the server runs on, and under /p/<profile> for any other. Keyed wraps a handler so that it answers only a request that carries the key of its profile
func (*API) Register ¶
func (a *API) Register(registrant Registrant)
Adds a registrant; a registry nested in the host reaches it through Host
type Agent ¶
type Agent interface {
// Answers the approval prompt of the id with one of the choices it takes, deny among them
Approve(ctx context.Context, session, id, choice string) error
// Answers one question of the set the agent asked: the choices picked or the text typed
Answer(ctx context.Context, session, set, question string, values []string) error
// Has the reply being written take the guidance into account
Steer(ctx context.Context, session, text string) error
// The provider and the model the agent of the profile answers with while nothing names another, as the settings write them, every
// ${NAME} kept: what a program is told of them
Main(cfg *config.Config) (provider, model string)
// Holds the session to the model of the provider for every later answer in it, thinking as hard and answering as fast as the hold
// says where it says so. With neither a provider nor a model it lets go of all of it, so the model of the profile answers in the
// session again
Hold(ctx context.Context, session string, to Hold) error
// What the session is held to, nothing for one that takes the model of the profile as the profile has it
Held(session *sessionsv1.Session) Hold
}
What answers the prompts of a run that goes on and takes guidance for it, the agent. The registrant that runs sessions says so by having this too
type Apps ¶
type Apps interface {
Platforms(cfg *config.Config) []gateway.Platform
Connection(profile, name string) (gateway.Connection, error)
Statuses(profile string) []gateway.Status
}
The chat apps of the profiles, as far as the API tells how they stand and hands them what they are posted: the host of the chat apps
type Handler ¶
What answers one request, for the profile the request names. What it returns it failed for, which is answered in the shape an OpenAI client reads
type Hold ¶
type Hold struct {
Provider, Model, Effort, Speed string
}
What a session is held to for every answer in it: the model of a provider, how hard it thinks and how fast it answers. Empty for what the session takes from the profile
type Providers ¶
type Providers interface {
List(ctx context.Context, request *providerv1.ListRequest) (*providerv1.ListResponse, error)
Models(ctx context.Context, request *providerv1.ModelsRequest) (*providerv1.ModelsResponse, error)
}
What lists the providers of a profile and the models each offers, as the model picker of the app reads them: the service of the providers, which Listing names
type Registrant ¶
type Registrant interface {
// Routes the registrant serves beside those of the API, none for one that only brings an ability, such as the agent
Routes() []Route
}
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func (*Registry) Host ¶
Host the registry is nested in, through which plugins reach what the API keeps
func (*Registry) Register ¶
func (r *Registry) Register(registrant Registrant)
type Route ¶
type Route struct {
// What it is called in what the API tells of itself, such as run_status
Name string
Method, Path string
// Answers a request for the profile the request names
Handle Handler
// It answers anyone, with or without the key
Open bool
}
One thing the API serves, by how it is asked for and where