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
Let me start by exploring the repository structure to understand the codebase.
Assistant
Now let me look at the rest of the provider.go and the tests to understand patterns.
Assistant
Let me check the
SupportsThinkingfunction and where it's expected.Assistant
Let me look at the Gemini provider for the pattern of SupportsThinking.
Assistant
Assistant
Now let me look at the rest of the provider.go to understand applyThinkingControl context and the
isDeepSeekhelper. Let me also check the SupportsNativeSearch in openai_compat provider.Assistant
Let me look at the rest of the provider_test.go to understand the test patterns and check for any DeepSeek thinking tests.
Assistant
Let me view the exact applyThinkingControl and surrounding code once more.
Assistant
Let me check the git history to understand PR #2898's pattern.
Assistant
Let me check how the HTTPProvider/openai_compat provider gets its providerName set (to ensure DeepSeek detection works).
Assistant
Good. So for "deepseek" protocol, the providerName is set to "deepseek" via SetProviderName(protocol). And the apiBase would be the default DeepSeek base or a custom one. So both
providerName == "deepseek"andisDeepSeekHost(apiBase)would detect DeepSeek.Now let me check the
finalizeProviderFromConfigto see if it wraps with tool_schema_transform.Assistant
Now I have a clear understanding. Let me check for any existing tests that assert DeepSeek behavior for thinking_level that my change might break.
Assistant
Let me check the DeepSeek tests around line 467-733 to ensure none assert thinking_level request shaping that my change might affect.
Assistant
These tests use
niloptions (no thinking_level), so my change won't affect them (ok=false → early return). Good. Now let me implement the changes.Assistant
Now let me add the
isDeepSeekProviderhelper andSupportsThinkingmethod. Let me add them nearSetProviderNameandisDeepSeekHost.Assistant
Now let me add the
SupportsThinkingmethod to the HTTPProvider.Assistant
Now let me build and run the existing tests.
Assistant
The build error is unrelated (an embed
workspacepattern issue). Let me build the specific packages I modified.Assistant
Build succeeds. Now let me run the existing tests for the affected packages.
Assistant
Existing tests pass. Now let me write a temporary test to verify the new behavior, then run it.
Assistant
All my temporary tests pass. Now let me verify the HTTPProvider.SupportsThinking delegates correctly through the tool_schema_transform wrapper. Let me write a quick test for the HTTPProvider.
Assistant
Let me run the agent tests too, since the
applyThinkingOptionlogic interacts withSupportsThinking.Assistant
All tests pass. Now let me remove the temporary test files I created (so they don't get submitted).
Assistant
Let me review the final diff.
Assistant
Let me run
go veton the affected packages to ensure no issues.Assistant
Let me run the broader providers test suite to ensure nothing broke.
Assistant
All provider tests pass. Let me do a final review of the modified files to ensure correctness.
Assistant
Let me verify the
wrapProviderWithToolSchemaTransformbehavior to ensure the wrapping (which delegates SupportsThinking) always applies.Assistant
When the transform is "off" (default), the wrapper is not applied and the HTTPProvider is returned directly — which now implements
SupportsThinkingitself. So both wrapped and unwrapped paths work. Let me do a final compile check across the relevant packages including the factory and agent.Assistant
Let me run
go vetacross the agent and providers packages once more for completeness.Assistant
All checks pass. Let me clean up any leftover temp files and do a final git status.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.