Repository navigation
ci(cost map): classify token_count_framing and token_count_fallback_model in the schema generator - #46784
Conversation
…odel in the schema generator
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
Automatic reviews are disabled for this repository. |
|
@litereview code-review |
✅ code-review5/5 · Ready for human reviewScope: full · Full PR review. No correctness findings. Checks and execution details
View review · Reviewed |
|
bugbot run |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…nt_fallback_model to non-empty
|
@litereview code-review |
|
@litereview code-review |
|
bugbot run |
|
@litereview code-review |
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 8ae2d71. Configure here.
|
@litellm-stampbot |
litellm-stampbot: risk lowApproved at Rules (
Judge (gpt-6-luna): low, probability of high 0.00 (high at or above 0.90)
Pushes do not re-run this check. Comment |
kerry-berri
left a comment
There was a problem hiding this comment.
Low risk by rule and by judgement at 8ae2d71
Keep #43900, #45301, #46121, #46784, #46759, #46767, #46772, #46815, #47057 and #46777. Port only the Gemini prerequisites from #46430. Remove the deferred Bedrock Mantle behavior and unrelated picks from the final tree. Restore the PDF test provider fixture and deployment, and retain required test imports.
TLDR
Problem this solves:
token_count_framingandtoken_count_fallback_modelto the cost mapHow it solves it:
token_count_framingas a non-negative integer key, since it counts the tokens a provider adds around a requesttoken_count_fallback_modelas a non-empty string keymodel_infovalue in a proxy config is the operator's own, and feat(count_tokens)!: configurable token_count_framing and token_count_model, count source in the response #46777 reads it as writtenUser Flow
Before: a PR that adds the two token count keys to the cost map always fails the required Cost map guard
token_count_framingortoken_count_fallback_model, with the generator key tables updated in the same PRpull_request_targetAfter: the same PR passes the guard
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or moreDelays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Last updated: 8ae2d71. QA and /live-pr-risk ran on 6dd2eee, the last commit with a product diff
The client is the guard script itself, run the way the workflow runs it, against #46777's merge base (e65e5ab) and head (59ad554). Before is
ci_cd/from main at b907975, after is this branch's copy at 6dd2eeeBefore (main b907975)
python main-ci_cd/cost_map_guard.py --base e65e5abc4e --head 59ad554b2d --head-ref litellm_count_tokens_source_framing_fallbackAfter (this branch 6dd2eee)
python ci_cd/cost_map_guard.py --base e65e5abc4e --head 59ad554b2d --head-ref litellm_count_tokens_source_framing_fallbackpython ci_cd/generate_model_prices_schema.py --checkon main's own cost map, showing the committed schema is unchangedType
🚄 Infrastructure
Caveats (if any)
Low
pull_request_target, so it checks out main and can only run this generator after this PR mergestoken_count_fallback_modelnames a real modelFinal Attestation
The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR
6dd2eee passes /live-pr-risk
Note
Low Risk
CI/schema-generator-only change with no runtime behavior until a follow-up cost map PR uses the new keys.
Overview
Teaches the model prices schema generator about two upcoming cost-map fields so the required Cost map guard stops failing on PRs that add them.
token_count_framingis classified as a non-negative integer (per-request framing tokens for local count estimates).token_count_fallback_modelis a non-empty string naming another model used when the provider cannot count tokens. Unit tests assert valid values pass and bad types/empty fallback names are rejected.The committed
model_prices_and_context_window.schema.jsonstays unchanged until entries actually use these keys.Reviewed by Cursor Bugbot for commit 8ae2d71. Bugbot is set up for automated code reviews on this repo. Configure here.