Repository navigation
refactor(bedrock): remove the dead BedrockLLM invoke code path - #35188
Merged
mateo-berri merged 2 commits intoJul 30, 2026
Merged
mateo-berri merged 2 commits into
mateo-berri merged 2 commits into
Conversation
Contributor
Greptile SummaryRemoves the obsolete BedrockLLM invoke implementation while retaining the live streaming helpers and decoders
Confidence Score: 5/5The PR appears safe to merge No blocking failure remains
|
| Filename | Overview |
|---|---|
| litellm/llms/bedrock/chat/invoke_handler.py | Deletes the unused BedrockLLM class and its imports while preserving live Bedrock streaming helpers, decoders, and configuration |
| litellm/llms/bedrock/common_utils.py | Uses BaseAWSLLM directly for the inherited Bedrock invoke-provider lookup |
| litellm/main.py | Removes the obsolete BedrockLLM import from the provider dispatch entrypoint |
| tests/llm_translation/test_bedrock_completion.py | Moves OpenAI-on-Bedrock response and error tests onto the live transformation config and removes dead-path coverage |
Reviews (2): Last reviewed commit: "test(bedrock): port the openai-route inv..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
Author
tin-berri
approved these changes
Jul 30, 2026
5 tasks done
Contributor
6 tasks done
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.
TLDR
Problem this solves:
BaseLLMHTTPHandlerclass #8290BedrockLLMinvoke path has been dead since Feb 2025stream_chunk_sizepopped on the wrong pathHow it solves it:
BedrockLLMclass frominvoke_handler.pymake_call,make_sync_call, stream decoders,AmazonCohereChatConfig) stayBaseAWSLLMdirectlyRelevant issues
Follow-up to the RCA on stream_chunk_size leaking into invoke request bodies: PR #8290 moved Bedrock Invoke onto
AmazonInvokeConfig(base_invoke_transformation.py) but left the oldBedrockLLMcompletion path behind, PR #17357 then poppedstream_chunk_sizeonly on that dead path, and PR #30240 fixed the live path. This removes the dead path itselfLinear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
AmazonBedrockOpenAIConfig, and the live-path regression tests from fix(bedrock): stop stream_chunk_size leaking into invoke request bodies #30240 are kept)@greptileaito re-request a review after pushing changes)Delays 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
Live proxy booted from this branch at a71d8d8 with real Bedrock calls (
us.anthropic.claude-sonnet-5, us-east-1), config has one invoke-route and one converse-route deployment:Invoke route, non-streaming:
Invoke route, streaming with
stream_chunk_sizein the request body (the exact trigger from the original regression; a leak into the invoke body would 400):Converse route, streaming with
stream_chunk_sizeand non-streaming:pytest tests/test_litellm/llms/bedrock/passes at this head (1107 passed, 1 skipped), as do the two ported openai-route tests intests/llm_translation/test_bedrock_completion.pyType
🧹 Refactoring
Changes
litellm.completionhas routed every Bedrock invoke request throughAmazonInvokeConfig+base_llm_http_handlersince PR #8290;BedrockLLM.completionand everything under it (process_response,convert_messages_to_prompt,async_completion,async_streaming,_async_anthropic_messages_completion) had no callers left. This deletes the class (951 lines) and its now-unused imports frominvoke_handler.py, and drops the stale "TODO: DELETE FILE" module docstring since the file still hosts the livemake_call/make_sync_callhelpers, the AWS event-stream decoders,MockResponseIterator, andAmazonCohereChatConfigThe only live use of the class was
common_utils.get_bedrock_chat_configcalling theget_bedrock_invoke_providerstaticmethod thatBedrockLLMinherited fromBaseAWSLLM; that call site now usesBaseAWSLLMdirectly, which is the identical code path as before.litellm/main.pyandlitellm/llms/bedrock/chat/__init__.pystop importing the classTests that exercised only the dead path are removed with it: the legacy-path re-chunk test in
tests/test_litellm/llms/bedrock/chat/test_invoke_handler.py(the live-pathmake_call/make_sync_callchunk-size regression tests from PR #30240 remain), the shallowTestBedrockLLMSSLVerifyduplicate ofTestBaseAWSLLMSSLVerify, and thetests/llm_translationprompt-conversion test, since the live openai route passes messages through with no prompt conversion. The other two openai-route tests are ported onto the live config instead:test_bedrock_openai_response_parsingnow goes throughAmazonBedrockOpenAIConfig.transform_responseandtest_bedrock_openai_error_handlingnow covers the previously untestedget_error_classBedrockError override. Two credential fixtures that only usedBedrockLLMas a vessel forBaseAWSLLM.get_credentialsnow instantiateBaseAWSLLMDeleting the untyped legacy code lowered the lint and type-check violation counts, so
ruff-strict-budget.json,type-discipline-budget.json, andbasedpyright-code-budget.jsonare ratcheted down accordingly (440 violations total)Final Attestation