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
Now let's check tests file for existing patterns for Doubao/Qwen thinking tests, to mimic for DeepSeek tests.
Assistant
Now let's implement the changes in provider.go.
Assistant
Now let's replace lines 205-259 with updated logic including deepseek mapping and SupportsThinking.
Assistant
Now let's check that isDeepSeekHost is not defined twice (it already exists further down in file).
Assistant
Good, only one definition remains (we didn't duplicate it). Let's check the full applied section for correctness and build.
Assistant
Good. Now let's build to check for duplicate func errors.
Assistant
This is downloading dependencies, let's wait and let it finish.
Assistant
Confirmed duplication. Let's remove the second copy (lines 321-336ish).
Assistant
Remove lines 322-340 (the duplicated block, keeping blank line separation before applyCustomHeaders).
Assistant
Now let's rebuild just this package.
Assistant
Now let's add SupportsThinking to HTTPProvider in http_provider.go.
Assistant
Now let's build again and check that setup for GetDefaultModel usage with SetProviderName("deepseek") occurs somewhere in factory to make sure providerName actually gets set to "deepseek" for the deepseek provider registration.
Assistant
That mautrix error is unrelated (missing C library), pre-existing. Let's confirm it's unrelated to our change by checking git status/build before our changes for that same error, and specifically build only affected packages.
Assistant
Good, builds fine. Now check factory_provider.go for how deepseek provider is created & SetProviderName call.
Assistant
Good, providerName gets set to "deepseek" when protocol is "deepseek". This confirms our
case "deepseek": return "deepseek_thinking"in thinkingControlKind will trigger correctly.Now let's write a quick reproduction test using a temp script or existing test patterns to validate behavior end-to-end.
Assistant
Now let's write actual Go tests within the package test file mimicking existing style, to cover the mapping including build request body test with server, similar to Doubao tests.
Assistant
Now insert new tests right after this function.
Assistant
All new tests pass. Now let's run the SupportsThinking tests and the full package test suite.
Assistant
All tests pass. Now let's also run the agent package tests since thinking.go is there, and check that agent tests pass with the new SupportsThinking behavior.
Assistant
That's fine, it's a small isolated test file unrelated to provider capability wiring. Our changes are safe. Let's view the whole diff for review.
Assistant
Diff looks clean. Now let's check the http_provider.go diff.
Assistant
Reverted the test file. Now let's verify my actual behavior changes via a temporary script instead, then remove it before finishing.
Assistant
Everything works as expected. Now delete the scratch test file.
Assistant
Now let's run full existing test suite for affected packages to ensure nothing broke.
Assistant
All passing. Let's also run the agent package tests to double check (already did, passed). Let's run go vet too for hygiene.
Assistant
Let's view the final diff for a full review.
Assistant
Good - wrapProviderWithToolSchemaTransform delegates to toolSchemaTransformProvider which already implements SupportsThinking by delegating (seen earlier in tool_schema_transform.go). Let's confirm that wrapper only wraps conditionally (based on ToolSchemaTransform config) and passes through original provider otherwise.
Assistant
Everything is consistent and wired correctly. Now let's run go vet and full relevant tests once more, then wrap up.
Assistant
All tests pass. Let's do a final review of git diff and status.
Assistant
Clean diff with only the two necessary source file changes. Let's go through the checklist explicitly.
Assistant
This implementation is complete. Let me now walk through the checklist:
Assistant
The implementation is complete and verified. Let me do one final check of git status before submitting.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.