Skip to content

fix: add missing stream() method to Bedrock beta.messages#1230

Open
MaxwellCalkin wants to merge 1 commit intoanthropics:mainfrom
MaxwellCalkin:fix/bedrock-beta-messages-stream
Open

fix: add missing stream() method to Bedrock beta.messages#1230
MaxwellCalkin wants to merge 1 commit intoanthropics:mainfrom
MaxwellCalkin:fix/bedrock-beta-messages-stream

Conversation

@MaxwellCalkin
Copy link

Summary

Fixes #1210

The Bedrock beta.messages class is missing the .stream() method, causing AttributeError when users try to call client.beta.messages.stream(...) with AnthropicBedrock.

The fix adds the stream alias to both Messages (sync) and AsyncMessages (async) classes in src/anthropic/lib/bedrock/_beta_messages.py, following the exact same pattern already used in:

  • The Vertex beta messages (src/anthropic/lib/vertex/_beta_messages.py) which already has stream = FirstPartyMessagesAPI.stream
  • The existing create alias in the same Bedrock file

Changes

  • Added stream = FirstPartyMessagesAPI.stream to the sync Messages class
  • Added stream = FirstPartyAsyncMessagesAPI.stream to the async AsyncMessages class

Test plan

  • Verified the fix matches the existing pattern in lib/vertex/_beta_messages.py
  • Verified the stream method exists on FirstPartyMessagesAPI and FirstPartyAsyncMessagesAPI (defined in resources/beta/messages/messages.py)
  • client = AnthropicBedrock(); client.beta.messages.stream(...) should no longer raise AttributeError

The Bedrock beta.messages class was missing the stream() method alias,
unlike its Vertex counterpart which already had it. This caused
AttributeError when calling client.beta.messages.stream() with the
Bedrock client.

Fixes anthropics#1210

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@MaxwellCalkin MaxwellCalkin requested a review from a team as a code owner March 8, 2026 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bedrock beta.messages missing .stream() method

1 participant