Documentation
¶
Overview ¶
Package host is the host's broker as the Slack plugin calls it, in the plugin's own types: the items ledger, the agent and the profile layer.
Index ¶
- Variables
- func AnchorOf(a src.Anchor) unit.Anchor
- func Category(i items.Initial) string
- func ItemOf(w src.Item) items.Item
- func OpOf(w src.ItemOp) items.Op
- func PersonOf(p src.Person) items.Person
- func WireAnchor(a unit.Anchor) src.Anchor
- func WireItem(it items.Item) src.Item
- func WireOp(o items.Op) src.ItemOp
- func WirePeople(ps []items.Person) []src.Person
- func WirePerson(p items.Person) src.Person
- type Answer
- type Ask
- type Asker
- type Broker
- func (b Broker) All(ctx context.Context) (map[unit.Unit][]items.Item, error)
- func (b Broker) Apply(ctx context.Context, _ items.Provenance, ops []items.Op) (Result, error)
- func (b Broker) Ask(ctx context.Context, a Ask) (Answer, error)
- func (b Broker) Items(ctx context.Context, u unit.Unit) ([]items.Item, error)
- func (b Broker) Load(ctx context.Context, units []unit.Unit) (map[unit.Unit][]items.Item, error)
- func (b Broker) Open(ctx context.Context, units []unit.Unit) (map[unit.Unit][]items.Item, error)
- func (b Broker) Profile(ctx context.Context, path string) ([]byte, error)
- type Refused
- type Result
- type Tier
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnfit is an answer that is not JSON fitting the schema. ErrUnfit = src.ErrUnfit // ErrOverBudget is a call that ran over its cost cap. ErrOverBudget = errors.New("the call ran over its budget") ErrUnavailable = src.ErrUnavailable )
var Tiers = []Tier{TierFast, TierBalanced, TierFrontier}
Functions ¶
Types ¶
type Answer ¶
type Answer struct {
JSON []byte
Model string
// CostUSD is nil when the agent did not report it.
CostUSD *float64
Duration time.Duration
Tokens int64
}
Answer is the agent's answer and what it cost.
type Ask ¶
type Ask struct {
Tier Tier
Prompt string
// Schema is the JSON schema the answer matches.
Schema string
// MaxCostUSD caps the call; 0 leaves it to the agent.
MaxCostUSD float64
// MeterScope is the host's meter scope the call runs under.
MeterScope string
}
Ask is a prompt for the host's agent.
type Broker ¶
Broker is the host's broker, typed in the plugin's words. Its zero interfaces answer ErrUnsupported.
func (Broker) Apply ¶
Apply applies ops to the host's ledger; the host records them as the plugin's, of provenance prov.
func (Broker) Ask ¶
Ask asks the host's agent; a call over its cost cap fails with ErrOverBudget, which the host says as ResourceExhausted.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package hosttest is an in-memory host broker for the Slack plugin's tests: it records what the plugin reports, proposes and writes, applies item ops with the host ledger's rules, and answers asks from a script.
|
Package hosttest is an in-memory host broker for the Slack plugin's tests: it records what the plugin reports, proposes and writes, applies item ops with the host ledger's rules, and answers asks from a script. |