Documentation
¶
Index ¶
Constants ¶
const ( // Times a streak of replies with nothing in them is asked again while an attempt costs less than the threshold, and once one costs as // much Retries = 3 Costly = 1 // Times a reply of reasoning alone is asked to go on to its answer before it counts as nothing Prefills = 2 )
Variables ¶
var Threshold = big.NewRat(1, 4)
Dollars one attempt must cost for the streak to be asked again once alone, while no setting says
Functions ¶
func Budget ¶
Times a streak whose last reply cost the amount is asked again: Retries, Costly where one attempt costs the threshold or more; Retries while the guard is off or the cost is not known
Types ¶
type Attempt ¶
type Attempt struct {
// Model and provider that answered, and why the model said it stopped
Model, Provider, Finish string
// Counted reports that the reply included its token usage, and Nothing that the usage was zero tokens, reasoning included
Counted, Nothing bool
// Something of the reply was seen as it came, such as its reasoning, though it ended with nothing
Seen bool
}
One reply in a streak that came back with nothing in it
type Streak ¶
type Streak struct {
// contains filtered or unexported fields
}
The replies with nothing in them of one reply of the agent, in a row, and what they cost
func (*Streak) Cost ¶
What the replies of the streak cost in dollars together, nil where nothing of it is known
func (*Streak) Deterministic ¶
Deterministic reports whether the same request keeps returning the same empty reply, so retrying will not help: two or more replies, all from the same model, provider and finish reason, where each reported zero generated tokens, or none reported its usage and nothing from any reply was seen while it streamed. It returns false while the guard is off.
func (*Streak) Record ¶
Records one reply with nothing in it at its cost, nil where it is not known. A streak not asked again yet starts again
func (*Streak) Reset ¶
func (s *Streak) Reset()
A reply with something in it, or a fallback taking over, ends the streak