-
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?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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 |
||
if (settings?.enableReasoningEffort === false) { | ||
daniel-lxs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return false | ||
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. Is this intentional? When |
||
} | ||
|
||
// Otherwise, use reasoning if: | ||
// 1. Model supports reasoning effort AND settings provide reasoning effort, OR | ||
// 2. Model itself has a reasoningEffort property | ||
return (!!model.supportsReasoningEffort && !!settings?.reasoningEffort) || !!model.reasoningEffort | ||
} | ||
|
||
export const DEFAULT_HYBRID_REASONING_MODEL_MAX_TOKENS = 16_384 | ||
export const DEFAULT_HYBRID_REASONING_MODEL_THINKING_TOKENS = 8_192 | ||
|
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 whenenableReasoningEffort
is explicitlyundefined
(not just missing) to document that this allows reasoning to proceed - this would make the behavior more explicit.