Repository navigation
feat(model): make DeepSeek thinking_enable tri-state so unset no longer force-sends thinking.type=disabled - #3398
Merged
qbc2016 merged 2 commits intoOct 29, 2026
Conversation
…r force-sends thinking.type=disabled
Contributor
|
Thanks for the pull request. One thing worth sorting out before it is reviewed:
If you think it belongs here anyway, say so and a maintainer will take a look. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
AgentScope Version
2.0.10dev (main @
7c198c5)Description
DeepSeekChatModel.Parameters.thinking_enableis declared as a non-optionalboolwithdefault=False(src/agentscope/model/_deepseek/_model.py:39), and_call_apibuildsthinking.typeunconditionally — so every request carriesextra_body["thinking"] = {"type": "disabled"}even when the caller never configured anything. There is no way to express "unset, let the server default apply", which silently disables thinking on DeepSeek hybrid-reasoning models relative to a bare DeepSeek API call.Changes (mirrors the volcengine model, whose near-identical block at
model/_volcengine/_model.py:209-222is already wrapped in the intended tri-state guard):thinking_enable: bool = Field(default=False, ...)→bool | None = Field(default=None, ...);if self.parameters.thinking_enable is not None:— verbatim volcengine style, no new patterns.None)thinking.type=disabledFalsedisabledTrueenabledComplementary to #3069 (extra_body mutation fix): that PR stopped the caller's
thinkingdict from being pinned bysetdefault; this one stops the unset case from force-sendingdisabledat all. Same tri-state direction as #3191/#3192 for DashScope. Callers who relied on the old implicit default (nothing configured → thinking disabled) must now passthinking_enable=Falseexplicitly.How to test
Regression cases added to the existing
tests/model_deepseek_test.py:test_thinking_enable_unset_not_sent— fails onmain('thinking' unexpectedly found in {'thinking': {'type': 'disabled'}}), passes with this fix;test_thinking_enable_explicit_false_sends_disabled/test_thinking_enable_explicit_true_sends_enabled— pin the explicit behavior so it cannot regress;test_extra_body_is_not_mutatedupdated to passthinking_enable=Falseexplicitly, keeping its original intent (caller's extra_body is never mutated) under the new tri-state default.python -m pytest tests/model_deepseek_test.py # 20 passed.MoonshotChatModel's non-k3 branch (model/_moonshot/_model.py:211-224) has the same gap — happy to extend this PR or follow up separately, maintainer's preference.Fixes #3396
Checklist