-
Notifications
You must be signed in to change notification settings - Fork 2.3k
fix: only include verbosity parameter for models that support it #7055
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
Conversation
- Check supportsVerbosity flag before adding verbosity to API request - Prevents "Unrecognized request argument" errors when switching from GPT-5 to GPT-4.1 - Add tests to verify verbosity is excluded for unsupported models Fixes #7054
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.
Reviewing my own code is like debugging in a mirror - everything looks backwards but the bugs are still mine.
// Add verbosity if supported | ||
if (verbosity) { | ||
// Add verbosity only if the model supports it | ||
if (verbosity && model.info.supportsVerbosity) { |
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.
Good fix! This correctly checks for verbosity support before adding the parameter. However, could we add a brief comment here explaining why this check is necessary? Something like:
if (verbosity && model.info.supportsVerbosity) { | |
// Add verbosity only if the model supports it | |
// GPT-5 family supports verbosity, but GPT-4.1 and other models don't | |
if (verbosity && model.info.supportsVerbosity) { |
This would help future maintainers understand the reasoning behind this check.
// Verify that verbosity is NOT included in the request | ||
const callArgs = mockCreate.mock.calls[0][0] | ||
expect(callArgs).not.toHaveProperty("verbosity") | ||
expect(callArgs.model).toBe("gpt-4.1-mini") |
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.
Great test coverage for the main GPT-4.1 family models! Consider also adding a test case for gpt-4.1-nano
to ensure complete coverage of all GPT-4.1 variants that don't support verbosity. This would make the test suite more comprehensive.
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.
LGTM
Summary
This PR fixes issue #7054 where switching from GPT-5 models (which support the verbosity parameter) to GPT-4.1 or other models (which don't support it) causes API errors.
Problem
When a user sets verbosity while using GPT-5 models and then switches to GPT-4.1, the verbosity parameter is incorrectly passed to the API, resulting in:
400 Unrecognized request argument supplied: verbosity
when verbosity was set to Medium400 Unsupported value: 'verbosity' does not support 'low' with this model
when verbosity was set to Low or HighSolution
handleDefaultModelMessage
inopenai-native.ts
to check the model'ssupportsVerbosity
flag before including the verbosity parameter in the API requestTesting
Changes
model.info.supportsVerbosity
before adding verbosity parameterFixes #7054
Important
Fixes verbosity parameter handling by checking model support before inclusion in
openai-native.ts
, with tests added inopenai-native.spec.ts
.Unrecognized request argument supplied: verbosity
when switching to another OpenAI model fromgpt-5-2025-08-07
#7054 by modifyinghandleDefaultModelMessage
inopenai-native.ts
to checkmodel.info.supportsVerbosity
before including verbosity parameter.openai-native.spec.ts
to ensure verbosity is excluded for unsupported models (gpt-4.1, gpt-4o, gpt-4.1-mini).openai-native.ts
: Added check forsupportsVerbosity
.openai-native.spec.ts
: Added test cases for verbosity handling.This description was created by
for 51b1757. You can customize this summary. It will automatically update as commits are pushed.