ISSUE DESCRIPTION [Feature] Map thinkinglevel to DeepSeek thinking fields 🎯 The Goal /…
- User
ISSUE DESCRIPTION
[Feature] Map thinking_level to DeepSeek thinking fields
🎯 The Goal / Use Case
DeepSeek is currently treated as an OpenAI-compatible provider in PicoClaw, but its thinking-mode controls do not match the internal
thinking_levelabstraction 1:1.Please implement correct DeepSeek thinking mapping so that:
- explicit
thinking_level: "off"automatically disables DeepSeek thinking mode - thinking-enabled levels are translated to DeepSeek's documented OpenAI-compatible fields
- DeepSeek users can rely on the same
thinking_levelconfig without needing manualextra_bodyoverrides
💡 Proposed Solution
Add DeepSeek-specific request shaping on the OpenAI-compatible path.
Suggested mapping:
thinking_level: "off"->thinking: { "type": "disabled" }thinking_level: "high"->thinking: { "type": "enabled" }+reasoning_effort: "high"thinking_level: "xhigh"->thinking: { "type": "enabled" }+reasoning_effort: "max"
If
low/mediumare kept as valid internal levels, they can follow DeepSeek's documented compatibility behavior and map toreasoning_effort: "high".🛠 Potential Implementation (Optional)
PR #2898 already introduced explicit
thinking_level: "off"handling for several OpenAI-compatible providers and added provider-specific disable-field shaping.This issue is to extend that work for DeepSeek specifically:
- add DeepSeek request shaping on the OpenAI-compatible provider path
- map internal thinking levels to DeepSeek's
thinkingandreasoning_effortfields - ensure explicit
offis sent even when DeepSeek does not advertise generic thinking support viaSupportsThinking() - add tests covering both request shaping and fallback/rewrite paths if applicable
🚦 Impact & Roadmap Alignment
- This is a Core Feature
- This is a Nice-to-Have / Enhancement
- This aligns with the current Roadmap
🔄 Alternatives Considered
- Ask users to configure DeepSeek manually with
extra_body - Keep DeepSeek on the generic OpenAI-compatible path without provider-specific thinking mapping
Both alternatives are weaker because they make DeepSeek behavior inconsistent with the project-wide
thinking_levelabstraction.💬 Additional Context
https://api-docs.deepseek.com/zh-cn/guides/thinking_mode
DeepSeek's documented OpenAI-compatible thinking controls use:
thinking.typereasoning_effortreasoning_contentin responses
PR #2898 is closely related because it establishes the explicit-
offbehavior and provider-specific request shaping pattern. DeepSeek appears to still need its own mapping added on top of that work.Interface
Type: Function Name: SupportsThinking Path: pkg/providers/httpapi/http_provider.go Input: () Output: bool Description: Exposes the thinking capability of the underlying provider delegate over the HTTP API. Returns true if the delegate supports thinking; otherwise false.
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- If an error was reported in the issue description, I have successfully reproduced it.
- If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- I have thought about edge cases and made sure my fix handles them as well.
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /picoclaw, current file: none) bash-$
- explicit
- Assistant
I’ll first inspect the provider structure, existing thinking-level mappings, and related tests to identify the established request-shaping pattern before making a minimal DeepSeek-specific change.
- Assistant
The repository already contains generic/provider-specific disable shaping and tests, so I’ll examine the exact OpenAI-compatible implementation and provider construction logic to see whether DeepSeek identification and enabled-level mapping are missing.
- Assistant
I found that
applyThinkingControlcurrently handles only"off"andthinkingControlKinddoes not classify DeepSeek. Next I’ll verify capability propagation (SupportsThinking) and factory naming, because enabled levels are only forwarded by the agent when the provider advertises thinking support, while explicit"off"has special forwarding semantics. - Assistant
HTTPProvidercurrently lacks the requestedSupportsThinking()interface entirely, and its delegate also has no capability method. I’ll inspect factory branches and tests around capability/rewrite behavior to decide whether capability should be true only for DeepSeek (rather than all OpenAI-compatible providers), including host-based custom configurations. - Assistant
The safest capability boundary is DeepSeek identity by configured provider name or official host, matching existing reasoning replay detection. I’ll implement delegation plus DeepSeek-specific shaping:
offdisables;low,medium, andhighenable with"high"effort;xhighenables with"max". I’ll leaveadaptiveunshaped because the requested/documented mapping does not define an equivalent, avoiding an invented API value. Configuredextra_bodywill continue to override generated defaults by existing merge order. - Assistant
The core implementation is in place. I’ll run focused provider and agent tests now; these cover request serialization, factory/provider identity, explicit-off forwarding, fallback selection, and rewrite handling.
- Assistant
The test command is blocked by environment configuration (
GOMODCACHEandGOPATHare both unset), not by code. I’ll supply temporary standard cache paths and rerun without modifying the repository. - Assistant
Focused tests pass. I’ll additionally reproduce the feature end-to-end with a temporary HTTP server (outside the repository), checking all specified levels, case/whitespace normalization, official-host capability detection, and ensuring unrelated OpenAI-compatible providers remain non-capable and unshaped.
- Assistant
The end-to-end reproduction passes and only the two intended source files are modified. Before submission I’ll do a final review of response reasoning support and the complete diff, then run the broader provider test tree to catch any integration regressions not included in the focused set.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →