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
- explicit
- Assistant
I'll explore the repository structure and how thinking_level is currently mapped for OpenAI-compatible providers, then implement DeepSeek-specific mapping.
- Assistant
Let me search for thinking_level related code and DeepSeek provider handling.
- Assistant
rg is not available, let me use grep.
- Assistant
I'll inspect the openai_compat thinking-level handling and related provider code.
- Assistant
Let me read the full applyThinkingControl and related code in openai_compat/provider.go, and also the tests.
- Assistant
I'll also check how SupportsThinking gates thinking_level and whether There's DeepSeek-specific handling elsewhere.
- Assistant
I'll check http_provider and whether openai_compat implements SupportsThinking.
- Assistant
Checking Gemini's SupportsThinking pattern and any related comments in provider code.
- Assistant
I'll check how factory sets provider name for DeepSeek and glance at the existing thinking tests.
- Assistant
I'll implement DeepSeek thinking mapping and SupportsThinking on the OpenAI-compatible and HTTP provider paths.
- Assistant
Next I'll add the SupportsThinking helpers next to the DeepSeek host detection.
- Assistant
I notice isDeepSeekHost was using url.Parse earlier, but I thought I saw normalizedHostname. Let me add supportsDeepSeekThinking and SupportsThinking after SetProviderName.
- Assistant
I'll fix the missing newline and remove the unreachable deepseek branch from thinkingControlKind.
- Assistant
I introduced a syntax error—I'll fix the broken section carefully.
- Assistant
Checking for leftover duplicate function definitions.
- Assistant
Provider.go looks good. Next I'll expose SupportsThinking on the HTTP provider.
- Assistant
I'll add tests for DeepSeek thinking mapping next to the existing thinking-level tests.
- Assistant
I'll write the test additions to a temporary file to avoid heredoc nesting issues.
- Assistant
I'll add an HTTPProvider SupportsThinking test if needed and run the relevant suite.
- Assistant
I shouldn't add tests to the repo — I'll revert those and use a temporary script instead.
- Assistant
I'll run the existing thinking-level tests and a temporary verification script.
- Assistant
I'll set the Go cache environment variables and rerun the tests.
- Assistant
I'll create a temporary test in the package to exercise the unexported
buildRequestBodyhelper. - Assistant
Removing temporary tests and verifying the factory path plus a broader provider test run.
- Assistant
Let me look at ModelConfig fields and factory_provider_test for how to create deepseek provider quickly. Also verify final diff is clean.
- Assistant
Running the full openai_compat and httpapi packages plus related agent thinking tests.
- Assistant
I'll re-run a temporary verification once more, then remove it and submit.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.