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 analyze the issue. The goal is to implement DeepSeek-specific thinking level mapping in the PicoClaw codebase. I need to:
- First, explore the repository structure to understand the codebase
- Find the relevant files, especially
pkg/providers/httpapi/http_provider.gowhereSupportsThinkingis defined - Understand how
thinking_levelis currently handled - Implement the DeepSeek-specific mapping
Let me start by exploring the repository structure.
Assistant
I notice there's no
SupportsThinkingmethod in the currenthttp_provider.go. Let me explore theopenai_compatpackage and understand how thinking is handled:Assistant
Let me also search for
SupportsThinkingand understand the interface patterns:Assistant
Now let me look at the existing
thinkingControlKindfunction and the test file to understand the patterns better:Assistant
Let me see the full test around thinking levels to understand the existing patterns:
Assistant
Now let me look at the
thinkingControlKindfunction more closely and theapplyThinkingControlfunction to understand the full picture:Assistant
Now I understand the codebase. Let me also look at how the HTTPProvider delegates and what interfaces are involved:
Assistant
Now let me understand the full picture. I need to:
- Add
SupportsThinking()method toHTTPProviderthat delegates to the OpenAI-compatible provider - Add
SupportsThinking()method to theopenai_compat.Provider - Extend
applyThinkingControlandthinkingControlKindto handle DeepSeek-specific thinking mapping for all levels (not just "off") - Add tests
Let me first look at how the issue describes the mapping more carefully and check what
httpapi/types.gohas:- Add
Assistant
Now let me look at how the GeminiProvider implements
SupportsThinkingfor reference, and check the fallback.go to understand how providers are used:Assistant
Good, I can see there's already a
isDeepSeekHosthelper. Now let me understand the full structure of theProviderand what methods it has:Assistant
Now I have a clear picture of what I need to do. Let me create my implementation plan:
- Modify
thinkingControlKindinopenai_compat/provider.goto return a new kind"deepseek_thinking"for DeepSeek - Modify
applyThinkingControlinopenai_compat/provider.goto handle all thinking levels for DeepSeek (not just "off") - Add
SupportsThinking()toopenai_compat.Provider - Add
SupportsThinking()toHTTPProviderthat delegates to theopenai_compat.Provider - Add tests covering DeepSeek thinking mapping
Let me implement this:
- Modify
Assistant
Now let me look at the full
thinkingControlKindfunction:Assistant
Now I have a clear understanding. Let me implement the changes:
- First, modify
thinkingControlKindto add DeepSeek detection - Modify
applyThinkingControlto handle DeepSeek thinking levels - Add
SupportsThinking()to bothopenai_compat.ProviderandHTTPProvider - Add tests
Let me start with the
openai_compat/provider.gochanges:- First, modify
Assistant
Now add
SupportsThinking()method toopenai_compat.Provider:Assistant
I need to add
SupportsThinking()method to theopenai_compat.Provider. Let me add it afterSupportsNativeSearch:Assistant
Now add
SupportsThinking()toHTTPProvider:Assistant
Let me verify the changes:
Assistant
Now let me verify the provider.go changes:
Assistant
Good. Now let me run the existing tests to make sure I haven't broken anything:
Assistant
All existing thinking tests pass. Now let me run all the tests for the openai_compat package to make sure nothing is broken:
Assistant
All tests pass. Now let me also run the httpapi tests:
Assistant
Now let me write tests to verify the new DeepSeek thinking mapping behavior. Let me create a test script first:
Assistant
The
buildRequestBodyis private, so I need to add tests directly to the test file. Let me add proper tests to the existing test file:Assistant
Let me look at how the existing tests access
buildRequestBody:Assistant
Good, the test file is in the same package so it can access private methods. Now let me add the DeepSeek thinking tests. I'll add them to the existing test file:
Assistant
Now let me run all the tests:
Assistant
All DeepSeek tests pass. Now let me run all the tests for the openai_compat package to make sure nothing is broken:
Assistant
The previous command ran successfully. Now I need to continue verifying the tests and then also test the HTTPProvider's SupportsThinking method. Let me run the httpapi tests to make sure the HTTPProvider changes work correctly.
Assistant
Good, all tests pass. Now let me also run a broader test to make sure nothing else is broken across the providers package.
Assistant
All provider tests pass. Let me verify the final state of my changes by reviewing the modified files:
Assistant
Let me review the full diff to make sure everything looks correct before submitting.
Assistant
The implementation looks complete. Let me run the full test suite one more time to ensure everything is working:
Assistant
Wait, I need to re-read the instructions. The system says: "UNDER NO CIRCUMSTANCES should you modify existing tests or add new tests to the repository." I need to revert the test file changes and only keep the implementation changes.
Assistant
The instructions say I should NOT modify existing tests or add new tests to the repository. I've already reverted the test file. Let me now verify that the remaining changes work correctly by running the existing tests.
Assistant
Let me continue verifying my implementation by running the tests without cache to make sure everything works correctly.
Assistant
The tests pass. Now let me verify my changes one more time and make sure everything is correct. Let me also run the httpapi tests to make sure the HTTPProvider changes work.
Assistant
All tests pass. Let me verify the final state of my changes one more time:
Assistant
Let me verify the final diff to make sure my implementation is complete and correct:
Assistant
Let me run a final verification of all the provider tests to make sure everything is working:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.