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 and understanding the codebase, particularly around the OpenAI-compatible provider path and thinking level handling.
Assistant
I need to make one tool call at a time.
Assistant
I see truncated lines. Let me see the middle part of the file (lines around 300-520).
Assistant
Let me look at the
applyThinkingControlandthinkingControlKindfunctions, and search forSupportsThinking.Assistant
Let me look at the full
applyThinkingControlandthinkingControlKindand the rest of the file. Let me view lines 200-280.Assistant
Let me look at the existing tests for thinking control in the openai_compat provider_test.go.
Assistant
Let me look at the types.go to understand the SupportsThinking interface.
Assistant
Let me check if openai_compat Provider has a SupportsThinking method and how HTTPProvider is used.
Assistant
Let me look at how
SupportsThinkingis invoked in the agent loop and where thinking_level comes into play.Assistant
Let me look at how the HTTPProvider is constructed and where providerName is set for DeepSeek.
Assistant
Let me look at
finalizeProviderFromConfigand the tool_schema_transform wrapper.Assistant
Let me look at the tool_schema_transform.go wrapper.
Assistant
Let me look at the turn_coord.go and pipeline_llm.go thinking_level handling.
Assistant
Let me check the git history for PR #2898 related changes to understand the intended pattern.
Assistant
Let me look at the fallback.go changes from PR #2898 and check the httpapi package imports.
Assistant
Let me check the httpapi package imports and whether there are existing tests for http_provider.
Assistant
Let me look at the httpapi_facade.go to understand the facade type.
Assistant
Let me check existing httpapi tests and the gemini test pattern for SupportsThinking.
Assistant
Now let me check the provider_metadata.go for deepseek to understand the default models.
Assistant
Now I have a thorough understanding. Let me implement the changes. First, let me modify
applyThinkingControlin openai_compat/provider.go to handle DeepSeek's full thinking mapping.Assistant
Now let me replace the
applyThinkingControlfunction to handle DeepSeek's full mapping:Assistant
Now let me add the
isDeepSeekhelper andSupportsThinkingmethod. Let me find the current location ofisDeepSeekHost:Assistant
Now let me add the
SupportsThinkingmethod andisDeepSeekhelper afterSetProviderName:Assistant
I see an issue — I may have removed the closing brace of
SetProviderName. Let me check:Assistant
I lost the closing brace of
SetProviderName. Let me fix it:Assistant
Let me add a blank line between the functions for proper formatting:
Assistant
Now let me add the
SupportsThinkingmethod to theHTTPProviderin http_provider.go:Assistant
There's a duplicate
SupportsNativeSearchdeclaration. Let me fix it:Assistant
Now let me build the project to verify everything compiles:
Assistant
The only error is a pre-existing embed issue unrelated to my changes. Let me verify the provider packages build cleanly:
Assistant
The providers packages build cleanly. Now let me run the existing tests for the openai_compat and httpapi packages:
Assistant
Existing tests pass. Now let me run the agent thinking tests and the broader providers tests:
Assistant
All tests pass. Now let me create a temporary test script to verify the DeepSeek thinking mapping works as specified in the issue:
Assistant
The last test revealed an important design consideration. Let me reconsider the
isDeepSeekdetection. The existingrequiresToolRoundReasoningReplaychecksisDeepSeekHostfor ANY provider name. Let me makeisDeepSeekconsistent with that — detecting DeepSeek by host regardless of provider name:Assistant
Now let me update the temporary test to reflect the corrected design and re-run:
Assistant
All temporary tests pass. Now let me verify the
HTTPProvider.SupportsThinking()delegation works through the chain with a temporary test in the httpapi package:Assistant
Let me verify the full chain including the
toolSchemaTransformProviderwrapper in theproviderspackage:Assistant
The test didn't run for the providers package — "no tests to run". Wait, the providers package itself (github.com/sipeed/picoclaw/pkg/providers) — let me check the output. It's not in the list! The list shows subpackages but not the
providerspackage itself. Let me run it specifically.Actually the output doesn't include
github.com/sipeed/picoclaw/pkg/providers(the root providers package). Let me run it directly.Assistant
The full chain works end-to-end. Now let me run gofmt and go vet on the changed files to ensure code quality:
Assistant
gofmt and vet are clean. Now let me run the full relevant test suites once more to confirm nothing is broken:
Assistant
All tests pass. Now let me remove the temporary test files before submitting:
Assistant
Let me review the final diff to make sure everything is correct:
Assistant
The diff looks clean. Let me do a final build and test run after removing the temp test files:
Assistant
Let me verify no temp files remain and do a final formatting check:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.