Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

Update default media type to JPEG in messages and serializer

Magnus Müller4a78c64dcf68
diff --git a/browser_use/llm/anthropic/serializer.py b/browser_use/llm/anthropic/serializer.py
index d9a09b823..b7fa638b8 100644
--- a/browser_use/llm/anthropic/serializer.py
+++ b/browser_use/llm/anthropic/serializer.py
@@ -45,8 +45,8 @@ class AnthropicMessageSerializer:
# Ensure it's a supported media type
supported_types = ['image/jpeg', 'image/png', 'image/gif', 'image/webp']
if media_type not in supported_types:
- # Default to png if not recognized
- media_type = 'image/png'
+ # Default to jpeg if not recognized
+ media_type = 'image/jpeg'
return media_type, data # type: ignore
diff --git a/browser_use/llm/messages.py b/browser_use/llm/messages.py
index 75a5d8f6e..f2b09ac75 100644
--- a/browser_use/llm/messages.py
+++ b/browser_use/llm/messages.py
@@ -61,7 +61,7 @@ class ImageURL(BaseModel):
[Vision guide](https://platform.openai.com/docs/guides/vision#low-or-high-fidelity-image-understanding).
"""
# needed for Anthropic
- media_type: SupportedImageMediaType = 'image/png'
+ media_type: SupportedImageMediaType = 'image/jpeg'
def __str__(self) -> str:
url_display = _format_image_url(self.url)