Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added codex-rs/code
Empty file.
24 changes: 14 additions & 10 deletions codex-rs/core/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't we want this for gpt-5-codex as well?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll keep the existing behavior for now and unblock exec first.

_ => {
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`:
//
Expand Down
13 changes: 11 additions & 2 deletions codex-rs/core/tests/suite/json_result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
})
Expand Down
Loading