Disable DeepSeek thinking when a tool is forced.

Auto-resolve of passives was 400ing because thinking mode cannot be combined with named tool_choice. Also strip BOM descriptions after an em dash before DigiKey search.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-28 01:58:22 +02:00
co-authored by Cursor
parent 776d714754
commit 27a3ce8bd0
5 changed files with 76 additions and 6 deletions
+8 -2
View File
@@ -253,10 +253,16 @@ class DeepSeekSession(LLMSession):
]
oai_messages.extend(messages_to_openai(messages, vision=self._vision))
# DeepSeek rejects forced tool_choice while thinking is on
# ("Thinking mode does not support this tool_choice"). Auto-resolve
# and extraction always force a save_* tool, so drop thinking there.
forced_tool = isinstance(tool_choice, dict) and "name" in tool_choice
thinking = self._thinking and not forced_tool
extra_body: dict[str, Any] = {
"thinking": {"type": "enabled" if self._thinking else "disabled"},
"thinking": {"type": "enabled" if thinking else "disabled"},
}
if self._thinking:
if thinking:
extra_body["reasoning_effort"] = self._reasoning_effort
kwargs: dict[str, Any] = {
"model": self.model,