mirror of
https://github.com/openai/codex.git
synced 2026-11-20 22:40:37 +00:00
[codex] Add max reasoning effort
This commit is contained in:
@@ -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(),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user