fix(core/client): switch tool type to 'web_search' to avoid 400 Unsupported tool error\n\nThe Responses API rejects 'web_search_preview' with 400 (Unsupported tool type).\nUse the supported 'web_search' tool id. Update test payload generator accordingly.

This commit is contained in:
James Peter
2025-09-13 13:47:34 +10:00
parent dd3ee63e2d
commit a00308b391
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -192,7 +192,7 @@ impl ModelClient {
if map.get("type").and_then(|v| v.as_str()) == Some("web_search") {
map.insert(
"type".to_string(),
serde_json::Value::String("web_search_preview".to_string()),
serde_json::Value::String("web_search".to_string()),
);
}
}
+2 -2
View File
@@ -124,10 +124,10 @@ function makePayload(kind, model, stream, store, variant) {
tools = [ { type: 'web_search' } ];
if (kind === 'chatgpt') {
// Match Codex behavior: convert to preview tool for ChatGPT backend
tools = [ { type: 'web_search_preview' } ];
tools = [ { type: 'web_search' } ];
}
} else if (variant === 'tools-web-search-preview') {
tools = [ { type: 'web_search_preview' } ];
tools = [ { type: 'web_search' } ];
}
let text = undefined;
if (variant === 'json-schema') {