feat: add /output-limit for a per-model max output budget - #5
Open
elijahwander wants to merge 1 commit into
Open
elijahwander wants to merge 1 commit into
elijahwander wants to merge 1 commit into
Conversation
Generalize the rule engine so a budget can target either `limit.context` or `limit.output`. `/output-limit` shares `/context-limit`'s parsing and pattern matching (tokens, `16K`, `1M`, `50%`, `0` clears, and `*` / `provider/*` / exact patterns) and clamps to the field's catalog value so it only lowers, never raises. Rules for each field are stored separately under `context-limit` and `output-limit`, and one catalog transform applies both.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
limit.context(existing/context-limit) orlimit.output(new/output-limit)./output-limitshares the same parsing and pattern matching: plain tokens,16K,1M,50%,0clears, and*/provider/*/ exact patterns (longest match wins).context-limit/output-limit); one catalog transform applies both.Motivation
A per-model max output budget caps reply length/cost, complementing the existing context budget that moves the compaction point.
Test plan
bun test— 20 pass, 0 fail (addedapplyBudgetoutput lowering + ceiling clamp, and/output-limitset/separate-storage/display tests).{ id, setup }object.Notes
VERSIONandpackage.jsonto0.2.0.## OpenCodereferral section unchanged.