Repository navigation
[Feat] Add streaming support for using bedrock invoke models with /v1/messages - #10710
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds streaming support for using Bedrock invoke models via the /v1/messages endpoint by updating the asynchronous handlers and streaming iterators. Key changes include adding a new test for Bedrock invoke streaming, refactoring the async handler in llm_http_handler.py to utilize get_async_streaming_response_iterator, and updating various transformation and invoke handler modules to properly parse streaming chunks.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/pass_through_unit_tests/test_anthropic_messages_passthrough.py | Added a new test to verify streaming support for Bedrock invoke models. |
| litellm/llms/custom_httpx/llm_http_handler.py | Updated async handler to use get_async_streaming_response_iterator for streaming responses. |
| litellm/llms/bedrock/messages/invoke_transformations/anthropic_claude3_transformation.py | Introduced asynchronous streaming iterator support for Bedrock invoke responses. |
| litellm/llms/bedrock/chat/invoke_handler.py | Modified _chunk_parser to include dict in its union return type for unparsed cases. |
| litellm/llms/base_llm/anthropic_messages/transformation.py | Extended the base transformation with an abstract get_async_streaming_response_iterator. |
| litellm/llms/anthropic/experimental_pass_through/messages/transformation.py | Implemented get_async_streaming_response_iterator for handling Anthropic streaming responses. |
| litellm/llms/anthropic/experimental_pass_through/messages/handler.py | Removed the deprecated static streaming method in favor of the new implementation. |
Comments suppressed due to low confidence (2)
tests/pass_through_unit_tests/test_anthropic_messages_passthrough.py:161
- [nitpick] Consider adding assertions to verify that the streaming chunks are processed as expected, rather than solely printing them.
async def test_anthropic_messages_streaming_bedrock_invoke():
litellm/llms/bedrock/chat/invoke_handler.py:1416
- It would be beneficial to include a docstring or inline comment explaining the conditions under which this method returns a dict, to improve clarity and maintainability.
def _chunk_parser(self, chunk_data: dict) -> Union[GChunk, ModelResponseStream, dict]:
fzowl
pushed a commit
to fzowl/litellm
that referenced
this pull request
Jun 24, 2026
…/messages (BerriAI#10710) * add basic bedrock transform * test_anthropic_messages_streaming_bedrock_invoke * fix: typing ant * fix: get async response iterator * fix: code quality check
Merged
6 of 7 tasks
This branch was successfully deployed
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.
[Feat] Add streaming support for using bedrock invoke models with /v1/messages
This PR adds streaming support for using Bedrock invoke models via the /v1/messages endpoint by updating the asynchronous handlers and streaming iterators. Key changes include adding a new test for Bedrock invoke streaming, refactoring the async handler in llm_http_handler.py to utilize get_async_streaming_response_iterator, and updating various transformation and invoke handler modules to properly parse streaming chunks.
Relevant issues
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
tests/litellm/directory, Adding at least 1 test is a hard requirement - see detailsmake test-unitType
🆕 New Feature
✅ Test
Changes