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 understanding the repository structure and the issue. The issue is about mapping
thinking_levelto DeepSeek's thinking fields in PicoClaw. Let me explore the repository first.Key points:
- DeepSeek is treated as an OpenAI-compatible provider
- Need to map internal
thinking_levelto DeepSeek'sthinkingandreasoning_effortfields - Mapping:
off->{type: "disabled"},high->{type: "enabled"}+reasoning_effort: "high",xhigh->{type: "enabled"}+reasoning_effort: "max" low/medium->reasoning_effort: "high"- PR #2898 introduced explicit thinking_level: "off" handling
- Need to add DeepSeek request shaping on the OpenAI-compatible provider path
Let me explore the repository structure first.
Assistant
Let me look at the relevant files. First, let me find the DeepSeek-related code and the HTTP provider.
Assistant
Let me look at the key files:
pkg/providers/openai_compat/provider.go- this is likely where the OpenAI-compatible provider lives, and where DeepSeek handling would gopkg/providers/httpapi/http_provider.go- where SupportsThinking is definedpkg/providers/factory_provider.go- where providers are created
Assistant
I need to use bash_terminal to run open command.
Assistant
Let me read more of this file to understand the structure:
Assistant
Let me continue reading to find the
applyThinkingControlfunction:Assistant
Now I need to understand how DeepSeek is constructed and see the full picture. Let me look at the factory provider and the HTTP provider.
Assistant
Let me continue reading to find where DeepSeek provider is created.
Assistant
Let me continue reading:
Assistant
Now let me look at the http_provider.go to see SupportsThinking and how thinking level is used
Assistant
Let me search for
SupportsThinkingin the codeAssistant
Let me look at the types.go and the thinking.go in agent to understand the full flow:
Assistant
Let me look at agent/thinking.go:
Assistant
Now let me look at the test file for openai_compat:
Assistant
Let me search for existing DeepSeek tests and also check the rest of the provider file for important
Assistant
Let me search for tests related to
applyThinkingControland the existing patternsAssistant
Let me read the tests around lines 85-130 more:
Assistant
Let me navigate to the relevant lines
Assistant
Now let me see the rest of the applyThinkingControl and thinkingControlKind functions area:
Assistant
Looks like the open command only takes file and line_number, not additional args. Let me just goto the right line in provider.go.
Assistant
Now I have a clear picture. Let me check how the HTTPProvider and its delegate interact, and look for other places that need changes
Assistant
Let me look at the tool_schema_transform provider to see how it delegates SupportsThinking
Assistant
Let me use goto instead
Assistant
Let me now check the agent_test.go for thinking tests
Assistant
Let me check
SupportsNativeSearchon the openai_compat provider to understandAssistant
Let me check that function
Assistant
Let me switch back to provider
Assistant
Now let me look at the HTTPProvider's SupportsNativeSearch delegation
Assistant
Now I have a complete understanding. Let me implement the changes. Here's my plan:
- Add
SupportsThinking()toopenai_compat.Provider- returns true when providerName is "deepseek" - Add
SupportsThinking()toHTTPProvider- delegates to delegate - Update
thinkingControlKind- add "deepseek" case - Update
applyThinkingControl- handle deepseek for all levels (off, low, medium, high, xhigh) - Add tests
Let me start with the provider.go changes
- Add
Assistant
Now let me make the changes. First, update
thinkingControlKindto add DeepSeAssistant
Now update
applyThinkingControlto handle DeepSeek levelsAssistant
Now add
SupportsThinking()to theopenai_compat.Provider. Let me find theSupportsNativeSearcharea:Assistant
Now add
SupportsThinking()to the openai_compat.ProviderAssistant
Now add
SupportsThinking()toHTTPProviderin http_provider.goAssistant
Add
SupportsThinking()to HTTPAssistant
Let me fix the formatting - add blank line before SetProviderName
Assistant
Let me verify the code comp
Assistant
Let me check the environment and fix the build
Assistant
Let me try building with the cached modules
Assistant
Let me set up the environment properly
Assistant
The code compiles. Now let me add tests. Let me look at the existing tests and then run the existing tests:
Assistant
Now let me add DeepSeek-specific tests. Let me look at the thinking tests area to add new tests:
Assistant
Now let me add DeepSeek-specific tests. I'll add them right after the existing thinking tests (after line 126):
Assistant
Let me also verify the full test I added. Let me scroll down to see the remaining
Assistant
I see a duplicate line. Let me fix the duplicate function declaration:
Assistant
Now let me run the tests:
Assistant
All new tests pass. Let me run all tests in the provider packages to make sure nothing is broken:
Assistant
Let me also run the agent tests to make sure nothing is broken there
Assistant
All tests pass. Let me also run the httpapi tests to make sure those pass:
Assistant
Let me verify the entire project builds:
Assistant
That seems like a pre-existing issue unrelated to my changes. Let me verify by checking git:
Assistant
The build error is pre-existing. Let me verify just the packages I changed build correctly
Assistant
Let me verify my changes are correct by reviewing the diff
Assistant
Now let me review the checklist:
-
If an error was reported in the issue description, I have successfully reproduced it. - The issue was a feature request, not a bug. No error to reproduce. ✓
-
If an error was reported in the issue description, I have confirmed that my fix resolves the error. - The feature has been implemented. ✓
-
I have thought about edge cases and made sure my fix handles them as well. - I handled:
off→thinking: {type: "disabled"}low/medium/high→thinking: {type: "enabled"}+reasoning_effort: "high"xhigh→thinking: {type: "enabled"}+reasoning_effort: "max"adaptive→ no-op (not a DeepSeek concept)- No
thinking_level→ no-op (no thinking fields injected) SupportsThinking()returns true only for DeepSeek, enabling the thinking option pass-through ✓
-
I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. - All existing tests pass. ✓
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.