fix(bedrock_mantle): correct grok-4.3 and gemma-4 token limits - #36385
fix(bedrock_mantle): correct grok-4.3 and gemma-4 token limits#36385xyos wants to merge 1 commit into
Conversation
Greptile SummaryThe PR corrects Bedrock Mantle context and output token metadata for Grok 4.3 and three Gemma 4 models, updating both runtime metadata copies and their local tests.
Confidence Score: 4/5The PR appears safe to merge after the non-blocking source-comment convention issue is cleaned up. The changed metadata is synchronized across both runtime sources and is covered by hermetic assertions; the only accepted concern is the newly added test docstring. Files Needing Attention: tests/test_litellm/llms/bedrock_mantle/test_bedrock_mantle_transformation.py
|
| Filename | Overview |
|---|---|
| model_prices_and_context_window.json | Updates the canonical Bedrock Mantle token-limit metadata consistently with the stated endpoint boundaries. |
| litellm/model_prices_and_context_window_backup.json | Mirrors the four canonical metadata corrections in the bundled runtime fallback. |
| tests/test_litellm/llms/bedrock_mantle/test_bedrock_mantle_transformation.py | Updates pinned Gemma limits and adds coverage for all revised entries, but introduces a docstring contrary to the repository convention. |
Reviews (1): Last reviewed commit: "fix(bedrock_mantle): correct grok-4.3 an..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Four bedrock_mantle entries advertise token limits that do not match what the service enforces. Verified by probing the live endpoint (bedrock-mantle us-east-2) and reading the caps it reports back: model field current actual xai.grok-4.3 input 131072 1048576 xai.grok-4.3 output 16384 1048576 google.gemma-4-31b in 256000 262144 google.gemma-4-26b-a4b in 256000 262144 google.gemma-4-e2b in 128000 131072 grok-4.3 is the significant one: the input limit is understated 8x. As with the GPT-5.6 entries, the non-Bedrock counterpart already carries the larger value (xai/grok-4.3 reads 1000000), which is what suggested the bedrock_mantle numbers were stale rather than deliberate. Evidence, input: "prompt tokens (1300031) exceed customer model maximum (1048576)" and a real request with 394937 prompt tokens (3x the advertised max) completed successfully on xai.grok-4.3, correctly retrieving a fact planted at 85% depth. Evidence, output: max_tokens=1048576 accepted; 1048577 -> "'max_tokens' (1048577) exceeds model maximum (1048576)" The gemma-4 models behave the same way, so their max_output_tokens and max_tokens move with the input value (they were already equal). The understated values cause premature context-window errors and early auto-compaction, and clamp max_tokens far below what the model allows. Left alone deliberately: openai.gpt-oss-* keep 131072 (they are not served on the Responses or /openai/v1 chat routes, so the cap could not be probed the same way) and the openai.gpt-5.x entries, which are handled separately.
c049253 to
c8e4b28
Compare
|
Removed the docstring — you're right, most tests in this file don't have one. Assertions and the JSON fix are unchanged. |
Title
fix(bedrock_mantle): correct grok-4.3 and gemma-4 token limits
Relevant issues
None filed — found while auditing
bedrock_mantlemetadata against the live endpoint. Same class of issue as #36299 (GPT-5.6 context window), different models.Pre-Submission checklist
tests/litellm/directoryType
🐛 Bug Fix
Changes
Four
bedrock_mantleentries advertise token limits that don't match what the service enforces:xai.grok-4.3xai.grok-4.3google.gemma-4-31bgoogle.gemma-4-26b-a4bgoogle.gemma-4-e2bxai.grok-4.3is the significant one — the input limit is understated 8x. As with #36299, the non-Bedrock counterpart already carries the larger value (xai/grok-4.3reads1000000), which is what suggested these were stale rather than deliberate.Understated limits cause premature context-window errors and early auto-compaction, and clamp
max_tokensfar below what the model accepts.Verification (live endpoint, bedrock-mantle us-east-2)
Input — the service reports its own cap:
A real request with 394,937 prompt tokens — 3x the currently advertised max — completed successfully on
xai.grok-4.3and correctly returned a fact planted at 85% depth, so the window is usable rather than merely accepted:Output — same caps apply, verified at the boundary:
The gemma-4 entries already had
max_output_tokens == max_input_tokens, so those move together.Left alone deliberately
openai.gpt-oss-*keep131072— they aren't served on the Responses or/openai/v1chat routes (model ... isn't supported on this route), so I couldn't probe their caps the same way and didn't want to guessopenai.gpt-5.xentries — handled separately in fix(bedrock_mantle): correct GPT-5.6 context window to 1M tokens #36299Tests
Added
test_context_windows_match_bedrock_limitsand updated the existingtest_gemma_4_bedrock_mantle_model_metadataparametrization, which pinned the old values.Reverting only the JSON changes fails 7 tests, confirming the coverage is meaningful:
ruffandblackclean on the touched file.Note on
ci_cd/check_files_match.pyBoth JSON files are updated identically. That check already fails on a clean
litellm_internal_stagingcheckout — the backup has unrelated drift (zai/glm-5.1,openrouter/z-ai/glm-5.1,darkbloom/*). I kept this diff to just these four entries rather than absorbing that; happy to include the full sync if you'd prefer.