feat(agent): pass reasoning_effort + thinking to DeepSeek API#16448
Open
zhanglpg wants to merge 2 commits into
Open
feat(agent): pass reasoning_effort + thinking to DeepSeek API#16448zhanglpg wants to merge 2 commits into
zhanglpg wants to merge 2 commits into
Conversation
Collaborator
Closed
12 tasks
DeepSeek V4 Pro/Flash thinking mode requires both:
- reasoning_effort as a top-level API parameter
- thinking: {type: enabled/disabled} in extra_body
Previously, Hermes only passed these for Kimi providers. DeepSeek
direct API usage was relying on DeepSeek's own defaults (enabled,
effort=high) with no way to control effort level.
Changes:
- run_agent.py: detect _is_deepseek (provider name or api.deepseek.com host)
- chat_completions.py: pass reasoning_effort + thinking extra_body for DeepSeek
- hermes_constants.py: add 'max' to VALID_REASONING_EFFORTS (DeepSeek native)
b31b2aa to
b00fd49
Compare
Author
|
@alt-glitch New to this repo, mind letting me know if this can be approved, or you would prefer a competing PR to be chosen. Let me know. |
This was referenced May 8, 2026
Closed
2 tasks
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.
Problem
DeepSeek V4 Pro/Flash thinking mode requires two parameters to control thinking effort:
high/max){"type": "enabled/disabled"}inextra_bodyPer DeepSeek API docs:
Previously, Hermes only passed these parameters for Kimi (
api.kimi.com/moonshot.ai). When using DeepSeek via a custom provider or thedeepseekprovider name, no reasoning parameters were sent — the API relied on DeepSeek's own defaults (thinking=enabled, effort=high). Users had no way to control the effort level.Changes
3 files, +34 −2
run_agent.py_is_deepseek(provider namedeepseekorapi.deepseek.combase URL) and pass to transportagent/transports/chat_completions.pyreasoning_efforttop-level +thinkinginextra_bodyhermes_constants.pymaxtoVALID_REASONING_EFFORTS(DeepSeek accepts it natively)How It Works
reasoning_effort: maxinconfig.yamldeepseekorapi.deepseek.combase URL)reasoning_effort="max"+extra_body={"thinking": {"type": "enabled"}}Testing
test_chat_completions.pytests passtest_deepseek_reasoning_content_echo.py, not caused by this change)Tested on