Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/anthropic/lib/bedrock/_beta_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

class Messages(SyncAPIResource):
create = FirstPartyMessagesAPI.create
tool_runner = FirstPartyMessagesAPI.tool_runner
stream = FirstPartyMessagesAPI.stream
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
stream = FirstPartyMessagesAPI.stream
stream = FirstPartyMessagesAPI.stream
if TYPE_CHECKING:
...
else:
# parse is used by stream and tool_runner internally
parse = FirstPartyMessagesAPI.parse

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion! Done - added the parse method internally while keeping it hidden from type checkers.


@cached_property
def with_raw_response(self) -> MessagesWithRawResponse:
Expand All @@ -36,6 +38,8 @@ def with_streaming_response(self) -> MessagesWithStreamingResponse:

class AsyncMessages(AsyncAPIResource):
create = FirstPartyAsyncMessagesAPI.create
tool_runner = FirstPartyAsyncMessagesAPI.tool_runner
stream = FirstPartyAsyncMessagesAPI.stream
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
stream = FirstPartyAsyncMessagesAPI.stream
stream = FirstPartyAsyncMessagesAPI.stream
if TYPE_CHECKING:
...
else:
# parse is used by stream and tool_runner internally
parse = FirstPartyMessagesAPI.parse

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied the same fix here for AsyncMessages - parse is now available internally.


@cached_property
def with_raw_response(self) -> AsyncMessagesWithRawResponse:
Expand Down