Skip to content

Conversation

@mochow13
Copy link
Contributor

@mochow13 mochow13 commented Dec 7, 2025

Closes #3621

@DouweM DouweM changed the title #3621 - Pass s3:// file URLs directly to API in BedrockConverseModel Pass s3:// file URLs directly to API in BedrockConverseModel Dec 9, 2025
format = item.media_type.split('/')[1]
assert format in ('jpeg', 'png', 'gif', 'webp'), f'Unsupported image format: {format}'
image: ImageBlockTypeDef = {'format': format, 'source': {'bytes': downloaded_item['data']}}
image: ImageBlockTypeDef = {'format': format, 'source': cast(DocumentSourceTypeDef, source)}
Copy link
Collaborator

Choose a reason for hiding this comment

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

We shouldn't need to cast if hint the type of source to be source: DocumentSourceTypeDef

Copy link
Contributor Author

@mochow13 mochow13 Dec 13, 2025

Choose a reason for hiding this comment

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

Good catch, I only replaced any with the type previously 🤦
Updated to use proper hints.

@DouweM DouweM merged commit d26d526 into pydantic:main Dec 15, 2025
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pass s3:// file URLs directly to API in BedrockConverseModel

4 participants