-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[codex] Treat max as a first-class reasoning effort #30467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,6 +45,7 @@ pub enum ReasoningEffort { | |
| Medium, | ||
| High, | ||
| XHigh, | ||
| Max, | ||
| Ultra, | ||
| /// A model-defined effort value that this client does not know yet. | ||
| Custom(String), | ||
|
|
@@ -60,6 +61,7 @@ impl ReasoningEffort { | |
| Self::Medium => "medium", | ||
| Self::High => "high", | ||
| Self::XHigh => "xhigh", | ||
| Self::Max => "max", | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mark Max as official reasoning effort instead of treating it as a string value from the backend. |
||
| Self::Ultra => "ultra", | ||
| Self::Custom(effort) => effort, | ||
| } | ||
|
|
@@ -125,6 +127,7 @@ impl FromStr for ReasoningEffort { | |
| "medium" => Ok(Self::Medium), | ||
| "high" => Ok(Self::High), | ||
| "xhigh" => Ok(Self::XHigh), | ||
| "max" => Ok(Self::Max), | ||
| "ultra" => Ok(Self::Ultra), | ||
| "" => Err("reasoning_effort must not be empty".to_string()), | ||
| effort => Ok(Self::Custom(effort.to_string())), | ||
|
|
@@ -700,30 +703,35 @@ 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"); | ||
| let serialized_max = to_string(&ReasoningEffort::Max).expect("Max should serialize"); | ||
| let serialized_ultra = to_string(&ReasoningEffort::Ultra).expect("Ultra should serialize"); | ||
|
|
||
| assert_eq!( | ||
| ( | ||
| "high".parse(), | ||
| "ultra".parse(), | ||
| "max".parse(), | ||
| "ultra".parse(), | ||
| "future".parse(), | ||
| deserialized, | ||
| serialized, | ||
| serialized_max, | ||
| serialized_ultra, | ||
| custom.to_string(), | ||
| ), | ||
| ( | ||
| Ok(ReasoningEffort::High), | ||
| Ok(ReasoningEffort::Max), | ||
| Ok(ReasoningEffort::Ultra), | ||
| Ok(custom.clone()), | ||
| custom, | ||
| r#""future""#.to_string(), | ||
| r#""max""#.to_string(), | ||
| r#""ultra""#.to_string(), | ||
| "max".to_string(), | ||
| "future".to_string(), | ||
| ) | ||
| ); | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick found by Codex:
Now that max has a first-class variant, could we also change
reasoning_effort_for_request() in core/src/client.rs to map Ultra to ReasoningEffort::Max instead of Custom("max") (and update its test)? Leaving it unchanged conflicts with Custom’s “unknown effort” contract and means internal request objects still classify a known effort as custom, even though the wire value is the same.Comment by me: apparently this happens in
core/src/client.rslines 170-175:This suggestion is a non-blocker of course.