@@ -573,7 +573,7 @@ def _parse_stream_event(event: Dict[str, Any]) -> Optional[BaseMessageChunk]:
573
573
tool_call_chunks .append (
574
574
ToolCallChunk (
575
575
name = block .get ("name" ),
576
- id = block .get ("tool_use_id " ),
576
+ id = block .get ("id " ),
577
577
args = block .get ("input" ),
578
578
index = event ["contentBlockStart" ]["contentBlockIndex" ],
579
579
)
@@ -589,7 +589,7 @@ def _parse_stream_event(event: Dict[str, Any]) -> Optional[BaseMessageChunk]:
589
589
tool_call_chunks .append (
590
590
ToolCallChunk (
591
591
name = block .get ("name" ),
592
- id = block .get ("tool_use_id " ),
592
+ id = block .get ("id " ),
593
593
args = block .get ("input" ),
594
594
index = event ["contentBlockDelta" ]["contentBlockIndex" ],
595
595
)
@@ -844,21 +844,15 @@ def _upsert_tool_calls_to_bedrock_content(
844
844
def _format_openai_image_url (image_url : str ) -> Dict :
845
845
"""
846
846
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.
848
848
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.
856
850
"""
857
851
regex = r"^data:image/(?P<media_type>.+);base64,(?P<data>.+)$"
858
852
match = re .match (regex , image_url )
859
853
if match is None :
860
854
raise ValueError (
861
- "Bedrock does not currently support OpenAI-format image urls , only "
855
+ "Bedrock does not currently support OpenAI-format image URLs , only "
862
856
"base64-encoded images. Example: data:image/png;base64,'/9j/4AAQSk'..."
863
857
)
864
858
return {
0 commit comments