mirror of
https://github.com/openai/codex.git
synced 2026-05-01 11:52:10 +03:00
go back to auto-enabling web_search for azure (#10820)
###### What Remove special-casing that prevented auto-enabling `web_search` for Azure model provider users. Addresses #10071, #10257. ###### Why Azure fixed their responsesapi implementation; `web_search` is now supported on models it wasn't before (like `gpt-5.1-codex-max`). This request now works: ``` curl "$AZURE_API_ENDPOINT" -H "Content-Type: application/json" -H "Authorization: Bearer $AZURE_API_KEY" -d '{ "model": "gpt-5.1-codex-max", "tools": [ { "type": "web_search" } ], "tool_choice": "auto", "input": "Find the sunrise time in Paris today and cite the source." }' ``` ###### Tests Tested with above curl, removed Azure-specific tests.
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
#![allow(clippy::unwrap_used)]
|
||||
|
||||
use codex_core::WireApi;
|
||||
use codex_core::built_in_model_providers;
|
||||
use codex_core::features::Feature;
|
||||
use codex_core::protocol::SandboxPolicy;
|
||||
use codex_protocol::config_types::WebSearchMode;
|
||||
@@ -22,15 +20,6 @@ fn find_web_search_tool(body: &Value) -> &Value {
|
||||
.expect("tools should include a web_search tool")
|
||||
}
|
||||
|
||||
#[allow(clippy::expect_used)]
|
||||
fn has_web_search_tool(body: &Value) -> bool {
|
||||
body["tools"]
|
||||
.as_array()
|
||||
.expect("request body should include tools array")
|
||||
.iter()
|
||||
.any(|tool| tool.get("type").and_then(Value::as_str) == Some("web_search"))
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn web_search_mode_cached_sets_external_web_access_false() {
|
||||
skip_if_no_network!();
|
||||
@@ -198,48 +187,3 @@ async fn web_search_mode_updates_between_turns_with_sandbox_policy() {
|
||||
"danger-full-access policy should default web_search to live"
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn web_search_mode_defaults_to_disabled_for_azure_responses() {
|
||||
skip_if_no_network!();
|
||||
|
||||
let server = start_mock_server().await;
|
||||
let sse = responses::sse(vec![
|
||||
responses::ev_response_created("resp-1"),
|
||||
responses::ev_completed("resp-1"),
|
||||
]);
|
||||
let resp_mock = responses::mount_sse_once(&server, sse).await;
|
||||
|
||||
let mut builder = test_codex()
|
||||
.with_model("gpt-5-codex")
|
||||
.with_config(|config| {
|
||||
let base_url = config.model_provider.base_url.clone();
|
||||
let mut provider = built_in_model_providers()["openai"].clone();
|
||||
provider.name = "Azure".to_string();
|
||||
provider.base_url = base_url;
|
||||
provider.wire_api = WireApi::Responses;
|
||||
config.model_provider_id = provider.name.clone();
|
||||
config.model_provider = provider;
|
||||
config.web_search_mode = None;
|
||||
config.features.disable(Feature::WebSearchCached);
|
||||
config.features.disable(Feature::WebSearchRequest);
|
||||
});
|
||||
let test = builder
|
||||
.build(&server)
|
||||
.await
|
||||
.expect("create test Codex conversation");
|
||||
|
||||
test.submit_turn_with_policy(
|
||||
"hello azure default web search",
|
||||
SandboxPolicy::DangerFullAccess,
|
||||
)
|
||||
.await
|
||||
.expect("submit turn");
|
||||
|
||||
let body = resp_mock.single_request().body_json();
|
||||
assert_eq!(
|
||||
has_web_search_tool(&body),
|
||||
false,
|
||||
"azure responses requests should disable web_search by default"
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user