add the greeting msg
Some checks failed
CI / test (push) Failing after 4m41s
CI / fixture (push) Failing after 9s

This commit is contained in:
2026-10-05 16:20:17 +05:30
parent 939598a187
commit a372340281
8 changed files with 1043 additions and 32 deletions

View File

@@ -56,6 +56,15 @@ type Limits struct {
MaxToolCalls int
MaxTokens int64
Deadline time.Duration
// MaxOutputTokens caps a SINGLE model call; MaxTokens caps the whole run.
//
// Without it the run budget was the only ceiling on any one response, so a
// balanced run could spend its 120k as eight 16k generations — and
// generation time is the wall clock a person waits through. Latency is why
// this exists; cost is a side effect. Zero means the gateway's configured
// default (`MODEL_MAX_OUTPUT_TOKENS`).
MaxOutputTokens int64
}
// LimitsForTier is what a run gets when its spec declares no limits of its own.
@@ -70,14 +79,23 @@ type Limits struct {
// expensive one: a fast run gets a third of a deep run's steps and a sixth of
// its deadline, so a misrouted spec shows up as a truncated answer rather than
// as a bill.
//
// MaxOutputTokens follows the same shape. It is sized for the longest answer a
// tier should ever give in one turn, not for the run: a tool-call step spends a
// few hundred tokens on arguments, and a chat answer past ~3k tokens is one
// nobody reads. A cap the model is not told about truncates rather than winding
// down, so these are set above any legitimate answer and not near it.
func LimitsForTier(tier string) Limits {
switch tier {
case "fast":
return Limits{MaxSteps: 3, MaxToolCalls: 4, MaxTokens: 40_000, Deadline: 20 * time.Second}
return Limits{MaxSteps: 3, MaxToolCalls: 4, MaxTokens: 40_000, Deadline: 20 * time.Second,
MaxOutputTokens: 1_500}
case "deep":
return Limits{MaxSteps: 12, MaxToolCalls: 20, MaxTokens: 300_000, Deadline: 120 * time.Second}
return Limits{MaxSteps: 12, MaxToolCalls: 20, MaxTokens: 300_000, Deadline: 120 * time.Second,
MaxOutputTokens: 4_000}
default: // balanced, and anything unrecognised — ParseTier has already normalised it
return Limits{MaxSteps: 8, MaxToolCalls: 12, MaxTokens: 120_000, Deadline: 60 * time.Second}
return Limits{MaxSteps: 8, MaxToolCalls: 12, MaxTokens: 120_000, Deadline: 60 * time.Second,
MaxOutputTokens: 3_000}
}
}