Send text parameter for non-gpt-5 models (#4195)
We had a hardcoded check for gpt-5 before. Fixes: https://github.com/openai/codex/issues/4181
This commit is contained in:
0
codex-rs/code
Normal file
0
codex-rs/code
Normal file
@@ -184,19 +184,23 @@ impl ModelClient {
|
|||||||
|
|
||||||
let input_with_instructions = prompt.get_formatted_input();
|
let input_with_instructions = prompt.get_formatted_input();
|
||||||
|
|
||||||
// Only include `text.verbosity` for GPT-5 family models
|
let verbosity = match &self.config.model_family.family {
|
||||||
let text = if self.config.model_family.family == "gpt-5" {
|
family if family == "gpt-5" => self.config.model_verbosity,
|
||||||
create_text_param_for_request(self.config.model_verbosity, &prompt.output_schema)
|
_ => {
|
||||||
} else {
|
if self.config.model_verbosity.is_some() {
|
||||||
if self.config.model_verbosity.is_some() {
|
warn!(
|
||||||
warn!(
|
"model_verbosity is set but ignored for non-gpt-5 model family: {}",
|
||||||
"model_verbosity is set but ignored for non-gpt-5 model family: {}",
|
self.config.model_family.family
|
||||||
self.config.model_family.family
|
);
|
||||||
);
|
}
|
||||||
|
|
||||||
|
None
|
||||||
}
|
}
|
||||||
None
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Only include `text.verbosity` for GPT-5 family models
|
||||||
|
let text = create_text_param_for_request(verbosity, &prompt.output_schema);
|
||||||
|
|
||||||
// In general, we want to explicitly send `store: false` when using the Responses API,
|
// In general, we want to explicitly send `store: false` when using the Responses API,
|
||||||
// but in practice, the Azure Responses API rejects `store: false`:
|
// but in practice, the Azure Responses API rejects `store: false`:
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -30,7 +30,16 @@ const SCHEMA: &str = r#"
|
|||||||
"#;
|
"#;
|
||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||||
async fn codex_returns_json_result() -> anyhow::Result<()> {
|
async fn codex_returns_json_result_for_gpt5() -> anyhow::Result<()> {
|
||||||
|
codex_returns_json_result("gpt-5".to_string()).await
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||||
|
async fn codex_returns_json_result_for_gpt5_codex() -> anyhow::Result<()> {
|
||||||
|
codex_returns_json_result("gpt-5-codex".to_string()).await
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn codex_returns_json_result(model: String) -> anyhow::Result<()> {
|
||||||
non_sandbox_test!(result);
|
non_sandbox_test!(result);
|
||||||
|
|
||||||
let server = start_mock_server().await;
|
let server = start_mock_server().await;
|
||||||
@@ -72,7 +81,7 @@ async fn codex_returns_json_result() -> anyhow::Result<()> {
|
|||||||
cwd: cwd.path().to_path_buf(),
|
cwd: cwd.path().to_path_buf(),
|
||||||
approval_policy: AskForApproval::Never,
|
approval_policy: AskForApproval::Never,
|
||||||
sandbox_policy: SandboxPolicy::DangerFullAccess,
|
sandbox_policy: SandboxPolicy::DangerFullAccess,
|
||||||
model: "gpt-5".to_string(),
|
model,
|
||||||
effort: None,
|
effort: None,
|
||||||
summary: ReasoningSummary::Auto,
|
summary: ReasoningSummary::Auto,
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user