fix: set OpenAI Responses image detail to auto

This commit is contained in:
leookun
2026-08-24 12:00:49 +08:00
parent 81a1afdae9
commit 1a0cf89fe1
2 changed files with 3 additions and 0 deletions
+2
View File
@@ -453,6 +453,7 @@ fn responses_content(parts: &[ContentPart], text_type: &str) -> Result<Vec<Value
ContentPart::Text { text } => Some(Ok(json!({"type":text_type, "text":text}))),
ContentPart::Image { mime_type, data } => Some(Ok(json!({
"type":"input_image",
"detail":"auto",
"image_url":format!("data:{mime_type};base64,{}", STANDARD.encode(data)),
}))),
})
@@ -539,5 +540,6 @@ mod tests {
assert_eq!(input[0]["call_id"], "call");
assert_eq!(input[0]["output"][0]["type"], "input_text");
assert_eq!(input[0]["output"][1]["type"], "input_image");
assert_eq!(input[0]["output"][1]["detail"], "auto");
}
}
+1
View File
@@ -305,6 +305,7 @@ async fn openai_responses_raw_stream_does_not_invent_reasoning_effort() {
assert!(body.get("service_tier").is_none());
assert_eq!(body["max_output_tokens"], 4096);
assert_eq!(body["input"][0]["content"][1]["type"], "input_image");
assert_eq!(body["input"][0]["content"][1]["detail"], "auto");
assert_eq!(
body["input"][0]["content"][1]["image_url"],
"data:image/png;base64,AQID"