overflow

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 3 Imported by: ? 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

Overview

Package overflow supplies the pure pre-send decision for one planner step.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Size

Size measures input plus reserve at the uncalibrated default rate, so usage reported by an overflow cannot change the progress comparison.

Types

type Action

type Action uint8

Action is the pre-send decision, independent of provider I/O or recovery.

const (
	// Send permits a provider request.
	Send Action = iota
	// GuardReject asks for advisory recovery without spending the provider budget.
	GuardReject
	// NoProgress refuses a request no smaller than this model already rejected.
	NoProgress
)

func Check

func Check(step Step, facts contextmeasure.RequestFacts, guard contextmeasure.GuardCount, limits Limits) Action

Check evaluates guard rejection first, then the per-model provider baseline. It performs no state transitions and never spends ProviderLeft.

type Limits

type Limits struct {
	Budget      int
	GuardMargin contextmeasure.Rate
}

Limits supplies the input budget B and its nonnegative rational guard margin. A nonpositive Budget disables the guard. A zero margin means zero; callers supply Rate{Tokens: 1, Bytes: 10} for the default ten-percent margin.

type Step

type Step struct {
	GuardUsed, GuardOff bool
	ProviderLeft        int
	Rejected            map[string]int
}

Step carries guard eligibility and provider rejections across an overflow retry. ProviderLeft starts at two; Rejected stores the smallest whole-request Size rejected by each model in this step. Check never mutates this state.

Jump to

Keyboard shortcuts

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