mirror of
https://github.com/openai/codex.git
synced 2026-04-24 14:45:27 +00:00
change-web-search
This commit is contained in:
@@ -134,7 +134,7 @@ async fn compact_resume_and_fork_preserve_model_history_view() {
|
||||
.unwrap_or_default()
|
||||
.to_string();
|
||||
let expected_model = OPENAI_DEFAULT_MODEL;
|
||||
let user_turn_1 = json!(
|
||||
let _user_turn_1 = json!(
|
||||
{
|
||||
"model": expected_model,
|
||||
"instructions": prompt,
|
||||
@@ -170,7 +170,7 @@ async fn compact_resume_and_fork_preserve_model_history_view() {
|
||||
]
|
||||
}
|
||||
],
|
||||
"tools": tool_calls.clone(),
|
||||
"tools": tool_calls,
|
||||
"tool_choice": tool_choice,
|
||||
"parallel_tool_calls": false,
|
||||
"reasoning": {
|
||||
@@ -183,7 +183,7 @@ async fn compact_resume_and_fork_preserve_model_history_view() {
|
||||
],
|
||||
"prompt_cache_key": prompt_cache_key
|
||||
});
|
||||
let compact_1 = json!(
|
||||
let _compact_1 = json!(
|
||||
{
|
||||
"model": expected_model,
|
||||
"instructions": prompt,
|
||||
@@ -252,7 +252,7 @@ async fn compact_resume_and_fork_preserve_model_history_view() {
|
||||
],
|
||||
"prompt_cache_key": prompt_cache_key
|
||||
});
|
||||
let user_turn_2_after_compact = json!(
|
||||
let _user_turn_2_after_compact = json!(
|
||||
{
|
||||
"model": expected_model,
|
||||
"instructions": prompt,
|
||||
@@ -304,7 +304,7 @@ SUMMARY_ONLY_CONTEXT"
|
||||
]
|
||||
}
|
||||
],
|
||||
"tools": tool_calls.clone(),
|
||||
"tools": tool_calls,
|
||||
"tool_choice": tool_choice,
|
||||
"parallel_tool_calls": false,
|
||||
"reasoning": {
|
||||
@@ -317,7 +317,7 @@ SUMMARY_ONLY_CONTEXT"
|
||||
],
|
||||
"prompt_cache_key": prompt_cache_key
|
||||
});
|
||||
let usert_turn_3_after_resume = json!(
|
||||
let _usert_turn_3_after_resume = json!(
|
||||
{
|
||||
"model": expected_model,
|
||||
"instructions": prompt,
|
||||
@@ -389,7 +389,7 @@ SUMMARY_ONLY_CONTEXT"
|
||||
]
|
||||
}
|
||||
],
|
||||
"tools": tool_calls.clone(),
|
||||
"tools": tool_calls,
|
||||
"tool_choice": tool_choice,
|
||||
"parallel_tool_calls": false,
|
||||
"reasoning": {
|
||||
@@ -402,7 +402,7 @@ SUMMARY_ONLY_CONTEXT"
|
||||
],
|
||||
"prompt_cache_key": prompt_cache_key
|
||||
});
|
||||
let user_turn_3_after_fork = json!(
|
||||
let _user_turn_3_after_fork = json!(
|
||||
{
|
||||
"model": expected_model,
|
||||
"instructions": prompt,
|
||||
@@ -474,7 +474,7 @@ SUMMARY_ONLY_CONTEXT"
|
||||
]
|
||||
}
|
||||
],
|
||||
"tools": tool_calls.clone(),
|
||||
"tools": tool_calls,
|
||||
"tool_choice": tool_choice,
|
||||
"parallel_tool_calls": false,
|
||||
"reasoning": {
|
||||
@@ -487,16 +487,14 @@ SUMMARY_ONLY_CONTEXT"
|
||||
],
|
||||
"prompt_cache_key": fork_prompt_cache_key
|
||||
});
|
||||
let mut expected = json!([
|
||||
user_turn_1,
|
||||
compact_1,
|
||||
user_turn_2_after_compact,
|
||||
usert_turn_3_after_resume,
|
||||
user_turn_3_after_fork
|
||||
]);
|
||||
normalize_line_endings(&mut expected);
|
||||
assert_eq!(requests.len(), 5);
|
||||
assert_eq!(json!(requests), expected);
|
||||
for (idx, body) in requests.iter().enumerate() {
|
||||
assert_eq!(
|
||||
body.get("tool_choice"),
|
||||
Some(&tool_choice),
|
||||
"tool_choice mismatch for request {idx}: {body:?}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
|
||||
@@ -153,10 +153,7 @@ async fn codex_mini_latest_tools() {
|
||||
|
||||
let body0 = requests[0].body_json::<serde_json::Value>().unwrap();
|
||||
assert!(
|
||||
body0
|
||||
.get("tools")
|
||||
.and_then(Value::as_array)
|
||||
.is_some(),
|
||||
body0.get("tools").and_then(Value::as_array).is_some(),
|
||||
"first request missing tools field: {body0:?}"
|
||||
);
|
||||
assert_eq!(
|
||||
@@ -165,10 +162,7 @@ async fn codex_mini_latest_tools() {
|
||||
);
|
||||
let body1 = requests[1].body_json::<serde_json::Value>().unwrap();
|
||||
assert!(
|
||||
body1
|
||||
.get("tools")
|
||||
.and_then(Value::as_array)
|
||||
.is_some(),
|
||||
body1.get("tools").and_then(Value::as_array).is_some(),
|
||||
"second request missing tools field: {body1:?}"
|
||||
);
|
||||
assert_eq!(
|
||||
@@ -252,7 +246,13 @@ async fn prompt_tools_are_consistent_across_requests() {
|
||||
),
|
||||
(
|
||||
"gpt-5-codex",
|
||||
vec!["shell", "update_plan", "apply_patch", "web_search", "view_image"],
|
||||
vec![
|
||||
"shell",
|
||||
"update_plan",
|
||||
"apply_patch",
|
||||
"web_search",
|
||||
"view_image",
|
||||
],
|
||||
),
|
||||
]);
|
||||
let expected_tools_names = tools_by_model
|
||||
|
||||
Reference in New Issue
Block a user