-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix: disable reasoning by default for DeepSeek V3.1 Terminus on OpenRouter #8272
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
…outer - Added explicit reasoning exclusion for deepseek/deepseek-v3.1-terminus when reasoning is not enabled - Ensures consistent behavior with user expectations where reasoning should be opt-in - Added comprehensive tests to verify the fix works correctly - Fixes #8270
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.
Self-review complete. Found some code duplication that my copy-paste skills are particularly proud of.
| typeof reasoning === "undefined" && | ||
| !this.options.enableReasoningEffort | ||
| ) { | ||
| reasoning = { exclude: true } |
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 extracting this reasoning exclusion logic into a helper method to avoid duplication with the same logic in completePrompt() (lines 262-268). For example:
private shouldExcludeReasoning(modelId: string, reasoning: any): boolean {
return modelId === "deepseek/deepseek-v3.1-terminus" &&
typeof reasoning === "undefined" &&
!this.options.enableReasoningEffort;
}| } | ||
|
|
||
| // DeepSeek V3.1 Terminus also has reasoning enabled by default on OpenRouter | ||
| // We need to explicitly disable it when the user hasn't enabled reasoning |
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 comment explaining why DeepSeek V3.1 Terminus needs special handling, similar to the Gemini comment above. This would help future maintainers understand the reasoning behind this exclusion.
| vi.clearAllMocks() | ||
| }) | ||
|
|
||
| it("should exclude reasoning for DeepSeek V3.1 Terminus when reasoning is not enabled", async () => { |
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 test case for when reasoning is already defined in the model configuration. The current tests cover enableReasoningEffort true/false, but not the case where typeof reasoning !== "undefined".
| @@ -0,0 +1,214 @@ | |||
| import { describe, it, expect, vi, beforeEach } from "vitest" | |||
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 integrating these tests into the main openrouter.spec.ts file or following a consistent naming pattern. Other provider-specific tests are typically included in the main provider test file.
Description
This PR attempts to address Issue #8270 by fixing the DeepSeek V3.1 Terminus model on OpenRouter to allow users to disable reasoning/thinking mode.
Problem
When using DeepSeek V3.1 Terminus via OpenRouter, reasoning appears to be enabled by default with no way to turn it off. This leads to:
Solution
Added explicit reasoning exclusion logic for the model when:
This follows the same pattern already established for Gemini 2.5 Pro models.
Changes
Testing
Expected Behavior
Fixes #8270
Feedback and guidance are welcome!
Important
Disables reasoning by default for DeepSeek V3.1 Terminus on OpenRouter unless explicitly enabled by the user, with tests added to verify behavior.
DeepSeek V3.1 TerminusinOpenRouterHandlerunlessenableReasoningEffortis true.createMessage()andcompletePrompt()inopenrouter.ts.openrouter-deepseek-terminus.spec.tswith tests for reasoning exclusion and inclusion.anthropic/claude-3-sonnet.This description was created by
for 389c96a. You can customize this summary. It will automatically update as commits are pushed.