Skip to content

Commit 98567a2

Browse files
committed
fmt
1 parent b557b7f commit 98567a2

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

libs/aws/langchain_aws/chat_models/bedrock_converse.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ def _parse_stream_event(event: Dict[str, Any]) -> Optional[BaseMessageChunk]:
573573
tool_call_chunks.append(
574574
ToolCallChunk(
575575
name=block.get("name"),
576-
id=block.get("tool_use_id"),
576+
id=block.get("id"),
577577
args=block.get("input"),
578578
index=event["contentBlockStart"]["contentBlockIndex"],
579579
)
@@ -589,7 +589,7 @@ def _parse_stream_event(event: Dict[str, Any]) -> Optional[BaseMessageChunk]:
589589
tool_call_chunks.append(
590590
ToolCallChunk(
591591
name=block.get("name"),
592-
id=block.get("tool_use_id"),
592+
id=block.get("id"),
593593
args=block.get("input"),
594594
index=event["contentBlockDelta"]["contentBlockIndex"],
595595
)
@@ -844,21 +844,15 @@ def _upsert_tool_calls_to_bedrock_content(
844844
def _format_openai_image_url(image_url: str) -> Dict:
845845
"""
846846
Formats an image of format data:image/jpeg;base64,{b64_string}
847-
to a dict for anthropic api
847+
to a dict for bedrock api.
848848
849-
{
850-
"type": "base64",
851-
"media_type": "image/jpeg",
852-
"data": "/9j/4AAQSkZJRg...",
853-
}
854-
855-
And throws an error if it's not a b64 image
849+
And throws an error if url is not a b64 image.
856850
"""
857851
regex = r"^data:image/(?P<media_type>.+);base64,(?P<data>.+)$"
858852
match = re.match(regex, image_url)
859853
if match is None:
860854
raise ValueError(
861-
"Bedrock does not currently support OpenAI-format image urls, only "
855+
"Bedrock does not currently support OpenAI-format image URLs, only "
862856
"base64-encoded images. Example: data:image/png;base64,'/9j/4AAQSk'..."
863857
)
864858
return {

0 commit comments

Comments
 (0)