Documentation
¶
Overview ¶
Package preflight evaluates token-accounting admission checks before a backend attempt.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Checker ¶
type Checker struct {
// contains filtered or unexported fields
}
func NewChecker ¶
func (*Checker) CheckWire ¶
CheckWire evaluates token preflight over bounded wire facts and replay source without constructing a full lipapi.Call or materializing prompt text (Requirements 6.2, 15.5, 21; Task 10.4). If the counter only supports CountCall, or exact tokenizer semantics do not exist, or counting is expensive/unbounded, CheckWire returns ReasonCountUnavailable, signaling that dynamic assessment must decline to canonical processing under the same permit.
type Counter ¶
type Counter interface {
CountCall(context.Context, app.CountCallInput) (app.CountResult, error)
}
type Decision ¶
type Decision struct {
Allowed bool
Reason Reason
Warnings []string
Err error
Count app.CountResult
AdjustedMaxOutputTokens *int
// RequireMaxOutputEnforcement is set when preflight applied a max-output
// clamp that must be enforceable on the selected backend before Open.
RequireMaxOutputEnforcement bool
}
type Input ¶
type Input struct {
Backend string
Model string
CallID string
Call lipapi.Call
RequestedMaxOutputTokens *int
Facts modelcatalog.ModelFacts
}
type Reason ¶
type Reason string
const ( ReasonAllowed Reason = "allowed" ReasonDisabled Reason = "disabled" ReasonInputLimitExceeded Reason = "input_limit_exceeded" ReasonContextLimitExceeded Reason = "context_limit_exceeded" ReasonOutputLimitExceeded Reason = "output_limit_exceeded" ReasonUnknownOutputDenied Reason = "unknown_output_denied" )
type UnknownOutputPolicy ¶
type UnknownOutputPolicy string
UnknownOutputPolicy bounds future output exposure when the client omits max output.
const ( UnknownOutputRequireClientLimit UnknownOutputPolicy = "require_client_limit" UnknownOutputConfiguredDefault UnknownOutputPolicy = "configured_default" UnknownOutputModelBackendMaximum UnknownOutputPolicy = "model_backend_maximum" UnknownOutputClamp UnknownOutputPolicy = "clamp" UnknownOutputDeny UnknownOutputPolicy = "deny" )
type WireInput ¶
type WireInput struct {
Backend string
Model string
CallID string
ProfileID string
Source largebody.Source
RequestedMaxOutputTokens *int
Facts modelcatalog.ModelFacts
Semantics largebody.ExactTokenizerSemantics
MaxScanBytes int64
MaxPermitHoldCPU time.Duration
}
WireInput supplies bounded wire facts and replay source to CheckWire (Task 10.4).