feat(deepseek): plumb V4 thinking + reasoning_effort via provider profile#24130
Closed
zkl2333 wants to merge 1 commit into
Closed
feat(deepseek): plumb V4 thinking + reasoning_effort via provider profile#24130zkl2333 wants to merge 1 commit into
zkl2333 wants to merge 1 commit into
Conversation
…file
The DeepSeek provider profile registered in
plugins/model-providers/deepseek/__init__.py was a bare-bones
ProviderProfile — no build_api_kwargs_extras override — so on the
post-refactor profile path reasoning_effort was silently dropped before
the request left Hermes, and there was no way to explicitly toggle V4
thinking mode from config.
Subclass ProviderProfile as DeepSeekProfile and override
build_api_kwargs_extras to emit the V4 contract:
- extra_body.thinking = {"type": "enabled" | "disabled"} (default enabled)
- top-level reasoning_effort = "high" | "max"
(low/medium/high → "high", xhigh/max → "max" — DeepSeek's documented
compatibility mapping for the wider OpenAI-style vocabulary)
- omit reasoning_effort entirely when thinking is disabled
(mirrors KimiProfile)
Also refresh fallback_models from the legacy deepseek-chat/reasoner
aliases to the first-class V4 ids, with the legacy names retained for
the deprecation window.
Reference: https://api-docs.deepseek.com/guides/thinking_mode
2 tasks
Collaborator
Contributor
Author
|
Acknowledged — closing as a duplicate of #22218 (earliest open profile-architecture PR with the same DeepSeekProfile + |
This was referenced May 13, 2026
Closed
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.
Summary
The DeepSeek provider profile registered in plugins/model-providers/deepseek/__init__.py was a bare-bones
ProviderProfile— nobuild_api_kwargs_extrasoverride — so on the post-refactor profile pathreasoning_effortis silently dropped before the request leaves Hermes, and there's no way to explicitly toggle V4 thinking mode from config. Kimi's profile already implements this pattern; this PR adds the symmetric override for DeepSeek.Official V4 contract
DeepSeek V4 exposes thinking mode as an explicit API contract (https://api-docs.deepseek.com/guides/thinking_mode):
extra_body.thinking{"type": "enabled"}/{"type": "disabled"}enabledreasoning_effort"high"/"max""high"(auto"max"for complex agents)Hermes → DeepSeek effort mapping
DeepSeek accepts only two effort values, so the wider Hermes vocabulary compatibility-maps:
reasoning_effortreasoning_effortlowhighmediumhighhighhighxhighmaxmaxmaxChanges
ProviderProfileasDeepSeekProfile, overridebuild_api_kwargs_extras(mirrorsKimiProfile); refreshfallback_modelsto the first-class V4 ids with legacy aliases retained for the deprecation windowTestDeepSeekProfilecovering registration, V4 fallback models, default-enabled thinking, explicit disable, full effort mapping (low/medium/high/xhigh/max/case/whitespace/unknown/empty)Note for reviewers
This supersedes #14958 (closed), which added
is_deepseekas a transport-level boolean flag — pre-dating theprovider_profilemigration. The contract emitted by both PRs is identical and was verified live againstapi.deepseek.com(request returns HTTP 200 withreasoning_contentpopulated when thinking is enabled, empty when disabled). This rewrite simply lands the fix on the architecturemainis using now.Test plan
pytest tests/providers/test_provider_profiles.py::TestDeepSeekProfile tests/providers/test_provider_profiles.py::TestKimiProfile— 21 passed (13 new + 8 Kimi regression)extra_body.thinking.type=enabled+ top-levelreasoning_effort=maxproduces a 200 response with populatedreasoning_content;thinking.type=disabledproduces a 200 with emptyreasoning_content