Fix gpt-5-chat incorrectly classified as reasoning model #9037
+4
−1
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.
Summary
Fixes #9032 - Updates the reasoning model regex pattern to prevent
gpt-5-chatfrom being incorrectly classified as a reasoning model.Problem
The Azure
gpt-5-chatmodel was being misclassified as a reasoning model, causing it to fail with inappropriate validation requirements:ValueError: reasoning models require passing temperature=1.0 and max_tokens >= 16000reasoningparameter withBadRequestErrorRoot Cause: The regex pattern lacked an end anchor (
$), allowing any model starting withgpt-5-to match as a reasoning model.Changes
Regex Pattern Update
Before:
r"^(?:o[1345]|gpt-5)(?:-(?:mini|nano))?"After:
r"^(?:o[1345](?:-(?:mini|nano))?(?:-\d{4}-\d{2}-\d{2})?|gpt-5(?:-(?:mini|nano|pro))?)$"Improvements:
$anchor for exact matching (preventsgpt-5-chatfrom matching)provariant support (gpt-5-pronow recognized as reasoning model)o1-2023-01-01)Test Coverage
Added test cases to verify:
gpt-5-procorrectly identified as reasoning modelgpt-5-chatcorrectly identified as NON-reasoning modelazure/gpt-5-chatcorrectly identified as NON-reasoning modelVerification
Tested regex pattern against all model variants:
Reasoning Models (should match):
o1,o1-mini,o1-nano,o1-2023-01-01,o1-mini-2023-01-01o3,o3-mini,o3-mini-2023-01-01o4,o5gpt-5,gpt-5-mini,gpt-5-nano,gpt-5-proNon-Reasoning Models (should NOT match):
gpt-5-chat✓gpt-4,gpt-4oo2,o6All tests pass correctly.
Impact
Users can now use
gpt-5-chatwith standard conversational parameters (temperature < 1.0, max_tokens < 16000) without triggering incorrect reasoning model validation.