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 start by exploring the repository structure to understand the codebase and then implement the DeepSeek thinking mapping.
- Assistant
Let me look at the key files mentioned in the issue: the HTTP provider and any DeepSeek-specific code.
- Assistant
Let me look at the provider files and the thinking-related code.
- Assistant
Let me look at the key files more closely.
- Assistant
Let me look at the key files more closely:
- Assistant
I need to look at one file at a time. Let me start with the openai_compat provider.
- Assistant
Let me see more of the file - the
applyThinkingControlandthinkingControlKindfunctions: - Assistant
Let me look at the full
applyThinkingControlandthinkingControlKindmethods. - Assistant
Now let me check if there's a
SupportsThinkingmethod in the provider: - Assistant
Let me look for SupportsThinking across the whole codebase.
- Assistant
Let me look at the types.go for the ThinkingCapable interface and the thinking.go file for how thinking is applied:
- Assistant
Now let me check the agent's thinking.go to see how thinking_level is used:
- Assistant
Now let me look at the httpapi package to find the
SupportsThinkingfunction: - Assistant
Let me look at the http_provider.go file.
- Assistant
Let me check how the provider is created for DeepSeek and look at the factory:
- Assistant
Now let me look at the tests for the openai_compat provider to understand the expected behavior:
- Assistant
Let me check if the HTTPProvider has a
SupportsThinkingmethod: - Assistant
Let me look at how the provider name is set on the
openai_compat.Provider: - Assistant
Let me see that function:
- Assistant
Now I have a clear picture. Let me implement the changes. First, let me modify
applyThinkingControlandthinkingControlKindin the openai_compat provider: - Assistant
Now let me implement the changes. First, I'll modify the
applyThinkingControlandthinkingControlKindfunctions in the openai_compat provider: - Assistant
Let me look at the
applyThinkingControlandthinkingControlKindfunctions: - Assistant
Now let me implement the changes. First, I'll modify the
thinkingControlKindfunction to handle DeepSeek: - Assistant
Now let me modify the
applyThinkingControlfunction to handle DeepSeek thinking levels: - Assistant
Now let me add the
isDeepSeekHosthelper function andSupportsThinking()method. Let me first add theisDeepSeekHosthelper after the other host helpers: - Assistant
Good,
isDeepSeekHostalready exists at line 343. Now I need to add theSupportsThinking()method. Let me add it afterSetProviderName: - Assistant
Now let me add
SupportsThinking()to theHTTPProviderin thehttpapipackage: - Assistant
I see there's a duplicate
SetProviderNamefunction. Let me fix that: - Assistant
Now let me add tests to the provider_test.go file. Let me check where to add them:
- Assistant
Let me open the test file:
- Assistant
Let me find the end of the test file to add the DeepSeek tests:
- Assistant
Now let me add the DeepSeek tests at the end of the test file:
- Assistant
Now let me run the tests to see if they pass:
- Assistant
I need to set the GOCACHE and HOME environment variables.
- Assistant
All the DeepSeek thinking tests pass. Now let me run the SupportsThinking tests:
- Assistant
Excellent! All tests pass. Now let me run all the existing tests in the openai_compat package to make sure I haven't broken anything:
- Assistant
All tests pass. Now let me also run the tests for the httpapi package to make sure the SupportsThinking method works:
- Assistant
All tests pass. Now let me also run the tests for the providers package to make sure everything is working:
- Assistant
All tests pass. Now let me verify the changes I made by looking at the current state of the files:
- Assistant
Let me also run the agent tests to make sure nothing is broken:
- Assistant
Let me run the agent tests without the filter:
- Assistant
All the thinking-related tests pass. Let me run all the tests to make sure everything is working:
- Assistant
All tests pass. Let me also run the factory_provider_test.go to make sure nothing is broken:
- Assistant
Let me run the factory_provider_test.go properly:
- Assistant
All tests pass. Let me verify the implementation by reviewing the final state of the changes:
- Assistant
Let me also check the thinkingControlKind function and SupportsThinking:
- Assistant
Let me also check the SupportsThinking function:
- Assistant
Let me also check the HTTPProvider's SupportsThinking:
- Assistant
Now let me add a test for the HTTPProvider's SupportsThinking to the httpapi test file:
- Assistant
Let me find the end of the test file and add the HTTPProvider tests there:
- Assistant
Let me add the HTTPProvider tests to the test file:
- Assistant
Now let me run the httpapi tests to make sure the new tests pass:
- Assistant
All tests pass. Let me run all httpapi tests to make sure nothing is broken:
- Assistant
All tests pass. Let me also verify that the existing tests for the providers package still pass:
- Assistant
All tests pass. Let me also run a broader test to make sure nothing is broken in the whole providers directory:
- Assistant
Let me also check the tool_schema_transform.go to make sure SupportsThinking is properly delegated:
- Assistant
Good, the
toolSchemaTransformProvideralready properly delegatesSupportsThinking. Let me now also verify the complete diff one more time:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.