-
Notifications
You must be signed in to change notification settings - Fork 2.1k
fix: respect enableReasoningEffort setting when determining reasoning usage #7049
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
base: main
Are you sure you want to change the base?
Conversation
… usage - Modified shouldUseReasoningEffort to return false when enableReasoningEffort is explicitly set to false - This ensures reasoning is disabled when the setting is false, regardless of reasoningEffort value - Added comprehensive tests to verify the fix Fixes #7048
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 because apparently I trust no one, not even myself.
}): boolean => { | ||
// If enableReasoningEffort is explicitly set to false, reasoning should be disabled | ||
if (settings?.enableReasoningEffort === false) { | ||
return false |
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.
Is this intentional? When enableReasoningEffort
is undefined
(not explicitly set), reasoning can still be enabled if other conditions are met. Should we consider treating undefined
the same as false
for a more conservative approach, or is the current behavior where only an explicit false
disables reasoning the desired one?
@@ -63,7 +63,17 @@ export const shouldUseReasoningEffort = ({ | |||
}: { | |||
model: ModelInfo | |||
settings?: ProviderSettings | |||
}): boolean => (!!model.supportsReasoningEffort && !!settings?.reasoningEffort) || !!model.reasoningEffort | |||
}): boolean => { | |||
// If enableReasoningEffort is explicitly set to false, reasoning should be disabled |
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.
Consider adding a JSDoc comment above the function to document the precedence rules. This would help future developers understand that enableReasoningEffort: false
takes absolute precedence over all other settings.
reasoningEffort: "medium", | ||
} | ||
|
||
expect(shouldUseReasoningEffort({ model, settings })).toBe(false) |
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 test coverage for the explicit false
case! Consider also adding a test for when enableReasoningEffort
is explicitly undefined
(not just missing) to document that this allows reasoning to proceed - this would make the behavior more explicit.
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
}): boolean => (!!model.supportsReasoningEffort && !!settings?.reasoningEffort) || !!model.reasoningEffort | ||
}): boolean => { | ||
// If enableReasoningEffort is explicitly set to false, reasoning should be disabled | ||
if (settings?.enableReasoningEffort === false) { |
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.
Roomote makes a good point about the default. Should this be:
if (settings?.enableReasoningEffort === false) { | |
if (!settings?.enableReasoningEffort) { |
Summary
This PR fixes an issue where the
reasoningEffort
parameter would override theenableReasoningEffort
setting, causing reasoning to be enabled even when explicitly disabled.Problem
When
enableReasoningEffort
was set tofalse
in the API configuration, the model would still perform reasoning ifreasoningEffort
(e.g., "medium") was present. This behavior was unexpected as theenableReasoningEffort
setting should take precedence.Solution
Modified the
shouldUseReasoningEffort
function insrc/shared/api.ts
to:enableReasoningEffort
is explicitly set tofalse
false
immediately, disabling reasoning regardless of other settingsTesting
enableReasoningEffort
isfalse
Related Issue
Fixes #7048
Important
Fix
shouldUseReasoningEffort
to respectenableReasoningEffort
setting, ensuring reasoning is disabled when explicitly set tofalse
.shouldUseReasoningEffort
inapi.ts
to respectenableReasoningEffort
setting, returningfalse
if set tofalse
.enableReasoningEffort
isfalse
, regardless ofreasoningEffort
value.api.spec.ts
to verify reasoning is disabled whenenableReasoningEffort
isfalse
.This description was created by
for d4bc592. You can customize this summary. It will automatically update as commits are pushed.