Skip to content
Open
Changes from all commits
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/strands/models/bedrock.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,8 @@ def _stream(
logger.debug("got response from model")
if streaming:
response = self.client.converse_stream(**request)
request_id = response.get('ResponseMetadata', {}).get('RequestId')
logger.info(f"Bedrock converse_stream requestId: {request_id}")
Copy link
Member

Choose a reason for hiding this comment

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

Hi, thanks for this.

If we are going to do this we should also make sure we are logging on exceptions, as that is generally when people want to inspect the request ids anyway.

I am also a bit curious about the need for info here, for exceptional cases I would understand info, but for happy path curious if debug is acceptable for your needs? More so probing at this point than recommending a change.

Thanks

# Track tool use events to fix stopReason for streaming responses
has_tool_use = False
for chunk in response["stream"]:
Expand Down Expand Up @@ -715,6 +717,8 @@ def _stream(

else:
response = self.client.converse(**request)
request_id = response.get('ResponseMetadata', {}).get('RequestId')
logger.info(f"Bedrock converse requestId: {request_id}")
for event in self._convert_non_streaming_to_streaming(response):
callback(event)

Expand Down