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 finding the relevant files mentioned in the issue description.
Assistant
Let me find the relevant files mentioned in the issue description.
Assistant
Let me explore the key files mentioned in the issue
Assistant
I need to make only one tool call at a time. Let me look at the files one by one.
Assistant
I notice that
SupportsThinkingis not currently defined on HTTPProvider. Let me look at the openai_compat provider to understand the current state.Assistant
Now let me look at the test file and see how the thinking control is tested
Assistant
Let me see the full provider.go file to understand the complete thinking control logic:
Assistant
Let me see lines around the thinkingControlKind function to see it complete.
Assistant
Let me see the rest of thinkingControlKind.
Assistant
Now let me check how
SupportsThinkingis used in the codebase and what theHTTPProviderdelegates to:Assistant
Let me look at the types and the thinking flow.
Assistant
Let me look at the agent/thinking.go and factory_provider.go to understand how thinking support is checked.
Assistant
Let me check the factory provider to understand how DeepSeek provider is created
Assistant
Let me look at provider_metadata.go to see provider options.
Assistant
Let me check how the GeminiProvider implements SupportsThinking.
Assistant
Let me look at the tool_schema_transform.go to see how SupportsThinking flows through the wrapper.
Assistant
Let me also check how deepseek is identified in the codebase for the OpenAI-compat
Assistant
Let me see the
isDeepSeekHostfunction and therequiresToolRoundReasoningReplayfunction.Assistant
Now I have a good understanding of the codebase. Let me plan and implement the solution:
Plan:
- Add
SupportsThinking()method toopenai_compat.Providerthat returns true for deepseek - Add
SupportsThinking()method toHTTPProviderthat delegates to the delegate - Modify
applyThinkingControlinopenai_compat/provider.goto handle all thinking levels for DeepSeek
Let me first look at how the buildRequestBody is used to make sure my changes fit properly
- Add
Assistant
Now let me implement the changes. First, let me open the provider.go file:
Assistant
Let me go to the
applyThinkingControlfunction:Assistant
Let me scroll down to see the applyThinkingControl function.
Assistant
Now I have a clear plan. Let me implement the changes step by step. First, let me edit the
applyThinkingControlfunction to add DeepSeek supportAssistant
Now I need to add the
isDeepSeek()method. It should go near the existingisDeepSeekHostfunction. Let me look at the area aroundisDeepSeekHost:Assistant
Now let me add the
isDeepSeek()method right afterisDeepSeekHostAssistant
I see there's a problem - the edit replaced the wrong line. Let me check the current state
Assistant
I need to fix the broken
isDeepSeekHostfunction. Let me replace lines 332-341 properlyAssistant
Good, now the
isDeepSeekHostandisDeepSeekare correct. Now let me addSupportsThinking()to theopenai_compat.Provider. Let me find whereSetProviderNameis.Assistant
Let me look at the
SupportsNativeSearchmethod and addSupportsThinkingafter itAssistant
Now let me add
SupportsThinking()toopenai_compat.Providerright after `SupportsNativeSearch()Assistant
I see there's a duplicate comment. Let me fix it
Assistant
The function signature for
isNativeOpenAIOrAzureEndpointis missing. Let me fixAssistant
Good, the openai_compat provider is now updated. Now let me add
SupportsThinking()to HTTPProviderAssistant
Now let me add
SupportsThinking()to HTTPAssistant
Now let me verify that the code compiles and the tests pass.
Assistant
Let me check the Go environment
Assistant
Let me set the Go module cache properly
Assistant
Let me set up all the necessary environment variables for Go.
Assistant
The code compiles. Now let me run the tests.
Assistant
All relevant tests pass. Let me run all tests in the openai_compat package
Assistant
All tests pass. Let me also run the httpapi tests and the full test suite for the providers
Assistant
Let me also run the agent tests and the full provider tests
Assistant
Let me now verify all changes look correct by reviewing the diff
Assistant
The diff looks good. Let me also clean up that extra blank line and run the full test suite
Assistant
All provider-related tests pass. The failures are pre-existing and unrelated to my changes. Let me clean up the extra blank line I noticed in the diff.
Assistant
Let me fix the extra blank line
Assistant
There's a duplicate comment. Let me fix it
Assistant
Good, the duplicate is fixed. Let me verify compilation and run the tests one final
Assistant
Let me run the tests separately to check
Assistant
Let me verify the final 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.