Lightweight coding agent that runs in your terminal
Rust
Send text parameter for non-gpt-5 models (#4195)
pakrym-oaie85742635f8e
diff --git a/codex-rs/code b/codex-rs/codenew file mode 100644index 0000000000..e69de29bb2diff --git a/codex-rs/core/src/client.rs b/codex-rs/core/src/client.rsindex e088f9c3ab..39a6aff8da 100644--- a/codex-rs/core/src/client.rs+++ b/codex-rs/core/src/client.rs@@ -184,19 +184,23 @@ impl ModelClient {let input_with_instructions = prompt.get_formatted_input();- // Only include `text.verbosity` for GPT-5 family models- let text = if self.config.model_family.family == "gpt-5" {- create_text_param_for_request(self.config.model_verbosity, &prompt.output_schema)- } else {- if self.config.model_verbosity.is_some() {- warn!(- "model_verbosity is set but ignored for non-gpt-5 model family: {}",- self.config.model_family.family- );+ let verbosity = match &self.config.model_family.family {+ family if family == "gpt-5" => self.config.model_verbosity,+ _ => {+ if self.config.model_verbosity.is_some() {+ warn!(+ "model_verbosity is set but ignored for non-gpt-5 model 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,// but in practice, the Azure Responses API rejects `store: false`://diff --git a/codex-rs/core/tests/suite/json_result.rs b/codex-rs/core/tests/suite/json_result.rsindex 43d5cb4b6a..86da33f7a0 100644--- a/codex-rs/core/tests/suite/json_result.rs+++ b/codex-rs/core/tests/suite/json_result.rs@@ -30,7 +30,16 @@ const SCHEMA: &str = r#""#;#[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);let server = start_mock_server().await;@@ -72,7 +81,7 @@ async fn codex_returns_json_result() -> anyhow::Result<()> {cwd: cwd.path().to_path_buf(),approval_policy: AskForApproval::Never,sandbox_policy: SandboxPolicy::DangerFullAccess,- model: "gpt-5".to_string(),+ model,effort: None,summary: ReasoningSummary::Auto,})