mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix: set empty reasoning_content for DeepSeek when tool_calls present
When the model returns tool_calls alongside reasoning_content, some DeepSeek models (e.g., deepseek-v4-flash) include non-empty reasoning_content which can cause downstream issues. Apply the same empty-string normalization already done for Kimi models.
This commit is contained in:
parent
6fdbf2f2d7
commit
7c80dd2d22
1 changed files with 5 additions and 1 deletions
|
|
@ -7283,13 +7283,17 @@ class AIAgent:
|
|||
api_msg["reasoning_content"] = normalized_reasoning
|
||||
return
|
||||
|
||||
deepseek_requires_reasoning = (
|
||||
self.provider in {"deepseek", "custom"}
|
||||
and base_url_host_matches(self.base_url, "api.deepseek.com")
|
||||
)
|
||||
kimi_requires_reasoning = (
|
||||
self.provider in {"kimi-coding", "kimi-coding-cn"}
|
||||
or base_url_host_matches(self.base_url, "api.kimi.com")
|
||||
or base_url_host_matches(self.base_url, "moonshot.ai")
|
||||
or base_url_host_matches(self.base_url, "moonshot.cn")
|
||||
)
|
||||
if kimi_requires_reasoning and source_msg.get("tool_calls"):
|
||||
if (kimi_requires_reasoning or deepseek_requires_reasoning) and source_msg.get("tool_calls"):
|
||||
api_msg["reasoning_content"] = ""
|
||||
|
||||
@staticmethod
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue