[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_level abstraction 1:1.
Please implement correct DeepSeek thinking mapping so that:
If low / medium are kept as valid internal levels, they can follow DeepSeek's documented compatibility behavior and map to reasoning_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 thinking and reasoning_effort fields
ensure explicit off is sent even when DeepSeek does not advertise generic thinking support via SupportsThinking()
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
Assistant
Now implement in openai_compat provider.
Assistant
Now add SupportsThinking to HTTPProvider.
Assistant
Downloads work. Run tests.
Assistant
Now re-run the temp verification with adaptive expecting "high".
Assistant
All changes are in place. Final diff review:
Assistant
Checklist review:
"If an error was reported in the issue description, I have successfully reproduced it." — The issue is a feature request, not a bug with a stack trace. I still reproduced the gap with a temporary test in pkg/providers/openai_compat: before the change, a DeepSeek provider with thinking_level: "high" produced no thinking/reasoning_effort fields, and did not exist (so the agent even dropped non- levels with a warning).
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
PR #2898 is closely related because it establishes the explicit-off behavior 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 using git reset --hard command.
Additionally, you can use git stash and git stash pop to temporarily save your changes and restore them later.
Finally, you can see the changes that you've made (which will be submitted when you call submit) using git status or git diff commands.
However you don't need to use git add or git commit before submitting your changes. In fact,
submit only submits currently unstaged changes because it uses git diff to 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-$
SupportsThinking()
off
"If an error was reported in the issue description, I have confirmed that my fix resolves the error." — With the fix, my temporary test verified all mappings: off -> thinking{type:disabled}, low/medium/high/adaptive -> thinking{type:enabled} + reasoning_effort:"high", xhigh -> thinking{type:enabled} + reasoning_effort:"max", plus SupportsThinking() == true for DeepSeek (by provider name or *.deepseek.com host) and false for other OpenAI-compatible endpoints. The temp test file was removed afterwards so no tests were added to the repo.
"I have thought about edge cases and made sure my fix handles them as well." — Handled: no thinking_level option at all (request untouched); unrecognized levels (ignored via normalizedThinkingLevel); nil receiver / nil delegate / nil request body; DeepSeek detected either by protocol name (SetProviderName is called after construction, so detection is dynamic) or by API host; explicit off remains sent by the agent even independent of SupportsThinking(); extra_body is still merged last so manual overrides keep precedence; other providers' existing off-only shaping (Doubao/Qwen/Zhipu/ModelScope) is unchanged; DeepSeek models routed through other providers (e.g. SiliconFlow) are not shaped.
"I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass." — go test ./pkg/providers/... ./pkg/agent/ all pass, gofmt -l pkg/providers is clean, and go vet ./pkg/providers/... reports nothing. (go build ./... shows a pre-existing embed error in cmd/picoclaw/internal/onboard that requires the repo's generate step and is unrelated to my change.)