Skip to content

fix(anthropic): map webp images explicitly - #2304

Merged
chaynabors merged 2 commits into
strands-agents:mainfrom
he-yufeng:fix/anthropic-webp-media-type
Jun 26, 2026
Merged

chaynabors merged 2 commits into
strands-agents:mainfrom
he-yufeng:fix/anthropic-webp-media-type

Conversation

@he-yufeng

Copy link
Copy Markdown
Contributor

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

@he-yufeng
he-yufeng force-pushed the fix/anthropic-webp-media-type branch from 4f45551 to 2ba48cb Compare May 27, 2026 09:50
@github-actions github-actions Bot added size/s and removed size/s labels May 27, 2026
@he-yufeng

Copy link
Copy Markdown
Contributor Author

Rebased this onto current main and revalidated the Anthropic model path. Current head is 2ba48cb. Validation from strands-py: uv sync --extra dev --extra anthropic; uv run pytest tests/strands/models/test_anthropic.py -q --basetemp ...tmp\pytest-2304 -p no:cacheprovider: 58 passed; uv run ruff check src/strands/models/anthropic.py tests/strands/models/test_anthropic.py; uv run ruff format --check src/strands/models/anthropic.py tests/strands/models/test_anthropic.py; python -m py_compile strands-py\src\strands\models\anthropic.py strands-py\tests\strands\models\test_anthropic.py; git diff --check origin/main...HEAD.

@yonib05 yonib05 added area-model Related to models or model providers bug Something isn't working python Pull requests that update python code labels May 27, 2026
@codecov

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@chaynabors
chaynabors enabled auto-merge (squash) June 26, 2026 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-model Related to models or model providers bug Something isn't working python Pull requests that update python code size/s

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants