Skip to content

Commit b9be6ea

Browse files
authored
OpenAI API: image input should have default "detail" field.
This is to be compatible with OpenAI API official document: https://platform.openai.com/docs/api-reference/responses/create?lang=curl ``` curl https://api.openai.com/v1/responses \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -d '{ "model": "gpt-4.1", "input": [ { "role": "user", "content": [ {"type": "input_text", "text": "what is in this image?"}, { "type": "input_image", "image_url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg" } ] } ] }' ``` where `detail` is NOT specified. Deserializing the above JSON request would result in pydantic error without the fix.
1 parent f94256d commit b9be6ea

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/openai/types/responses/response_input_image_param.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class ResponseInputImageParam(TypedDict, total=False):
1414
Learn about [image inputs](https://platform.openai.com/docs/guides/vision).
1515
"""
1616

17-
detail: Required[Literal["low", "high", "auto"]]
17+
detail: Optional[Literal["low", "high", "auto"]] = "auto"
1818
"""The detail level of the image to be sent to the model.
1919
2020
One of `high`, `low`, or `auto`. Defaults to `auto`.

0 commit comments

Comments
 (0)