[codex] Add max reasoning effort

This commit is contained in:
Ahmed Ibrahim
2026-06-05 17:02:33 -07:00
parent 4f655bc3b7
commit 8440dd056f
6 changed files with 19 additions and 10 deletions
+8 -5
View File
@@ -45,6 +45,7 @@ pub enum ReasoningEffort {
Medium,
High,
XHigh,
Max,
/// A model-defined effort value that this client does not know yet.
Custom(String),
}
@@ -59,6 +60,7 @@ impl ReasoningEffort {
Self::Medium => "medium",
Self::High => "high",
Self::XHigh => "xhigh",
Self::Max => "max",
Self::Custom(effort) => effort,
}
}
@@ -123,6 +125,7 @@ impl FromStr for ReasoningEffort {
"medium" => Ok(Self::Medium),
"high" => Ok(Self::High),
"xhigh" => Ok(Self::XHigh),
"max" => Ok(Self::Max),
"" => Err("reasoning_effort must not be empty".to_string()),
effort => Ok(Self::Custom(effort.to_string())),
}
@@ -693,8 +696,8 @@ mod tests {
#[test]
fn reasoning_effort_accepts_known_and_custom_values() {
let custom = ReasoningEffort::Custom("max".to_string());
let deserialized = from_str::<ReasoningEffort>(r#""max""#)
let custom = ReasoningEffort::Custom("future".to_string());
let deserialized = from_str::<ReasoningEffort>(r#""future""#)
.expect("custom reasoning effort should deserialize");
let serialized = to_string(&custom).expect("custom reasoning effort should serialize");
@@ -708,10 +711,10 @@ mod tests {
),
(
Ok(ReasoningEffort::High),
Ok(custom.clone()),
Ok(ReasoningEffort::Max),
custom,
r#""max""#.to_string(),
"max".to_string(),
r#""future""#.to_string(),
"future".to_string(),
)
);
}