empty

package
v2.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2026 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
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

View Source
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

func Budget(on bool, cost, threshold *big.Rat) int

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

func Limit

func Limit(usd float64) *big.Rat

Limit returns the dollar threshold, or Threshold for a number that is not finite.

func Wait

func Wait(n int) time.Duration

Wait before the retry of the count, counted from 1: 5 seconds doubled with each up to a minute, up to half as long again at random

Types

type Attempt

type Attempt struct {
	// Model and provider that answered, and why the model said it stopped
	Model, Provider, Finish string
	// The reply said what it took, and that it generated no tokens, its reasoning's 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

func (s *Streak) Cost() *big.Rat

What the replies of the streak cost in dollars together, nil where nothing of it is known

func (*Streak) Deterministic

func (s *Streak) Deterministic(on bool) bool

Whether the same request keeps giving the same nothing, so no retry will help: two replies or more, all of one model, provider and finish reason, each saying it generated no tokens, or none saying what it took and nothing of any seen as it came; never while the guard is off

func (*Streak) Record

func (s *Streak) Record(attempt Attempt, cost *big.Rat)

Records one reply with nothing in it at its cost, nil where it is not known; a streak not asked again yet starts anew

func (*Streak) Reset

func (s *Streak) Reset()

A reply with something in it, or a fallback taking over, ends the streak

func (*Streak) Retried

func (s *Streak) Retried() int

Counts one more time the streak was asked again, and gives the count

func (*Streak) Retries

func (s *Streak) Retries() int

Times the streak was asked again so far

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL