Skip to content

Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)

Python

Change OpenAI image detail default from "auto" to "high"

Claude1c4a5667b159
diff --git a/backend/agent/providers/openai.py b/backend/agent/providers/openai.py
index e3a0c3d5..28c6d2cf 100644
--- a/backend/agent/providers/openai.py
+++ b/backend/agent/providers/openai.py
@@ -42,7 +42,7 @@ def _convert_message_to_responses_input(
{
"type": "input_image",
"image_url": image_url.get("url", ""),
- "detail": image_url.get("detail", "auto"),
+ "detail": image_url.get("detail", "high"),
}
)
diff --git a/backend/tests/test_openai_reasoning_parser.py b/backend/tests/test_openai_reasoning_parser.py
index 2af1eb97..61e7213b 100644
--- a/backend/tests/test_openai_reasoning_parser.py
+++ b/backend/tests/test_openai_reasoning_parser.py
@@ -1,6 +1,10 @@
import pytest
-from agent.providers.openai import OpenAIResponsesParseState, parse_event
+from agent.providers.openai import (
+ OpenAIResponsesParseState,
+ _convert_message_to_responses_input,
+ parse_event,
+)
from agent.providers.types import StreamEvent
@@ -57,3 +61,30 @@ async def test_reasoning_summary_part_added_and_done_emits_once() -> None:
thinking_text = [event.text for event in events if event.type == "thinking_delta"]
assert thinking_text == ["Refining layout and assets."]
+
+
+def test_convert_image_url_defaults_to_high_detail() -> None:
+ message = {
+ "role": "user",
+ "content": [
+ {"type": "image_url", "image_url": {"url": "data:image/png;base64,abc"}},
+ ],
+ }
+ result = _convert_message_to_responses_input(message) # type: ignore
+ image_part = result["content"][0]
+ assert image_part["detail"] == "high"
+
+
+def test_convert_image_url_preserves_explicit_detail() -> None:
+ message = {
+ "role": "user",
+ "content": [
+ {
+ "type": "image_url",
+ "image_url": {"url": "data:image/png;base64,abc", "detail": "low"},
+ },
+ ],
+ }
+ result = _convert_message_to_responses_input(message) # type: ignore
+ image_part = result["content"][0]
+ assert image_part["detail"] == "low"