Skip to content

fix(anthropic): map webp images explicitly#2304

Open
he-yufeng wants to merge 1 commit into
strands-agents:mainfrom
he-yufeng:fix/anthropic-webp-media-type
Open

fix(anthropic): map webp images explicitly#2304
he-yufeng wants to merge 1 commit into
strands-agents:mainfrom
he-yufeng:fix/anthropic-webp-media-type

Conversation

@he-yufeng
Copy link
Copy Markdown

Fixes the Anthropic WebP part of #2204.

The Anthropic formatter was relying on mimetypes.types_map for image media types. That map is platform/Python-install dependent, so .webp can fall back to application/octet-stream even though Strands already accepts webp as an image format.

This keeps a small explicit map for the Anthropic image formats Strands supports and falls back to mimetypes only for unknown formats.

Validation:

  • python -m pip install -e ".[anthropic]"
  • python -m pytest tests/strands/models/test_anthropic.py -q
  • python -m ruff check src/strands/models/anthropic.py tests/strands/models/test_anthropic.py
  • python -m ruff format --check src/strands/models/anthropic.py tests/strands/models/test_anthropic.py
  • git diff --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant