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 inspect the provider implementation and existing thinking-level tests first, then identify the OpenAI-compatible request shaping hooks and DeepSeek provider detection. I’ll implement the narrowest provider-specific mapping, add no repository tests per instruction, run the relevant existing test suite (and temporary checks if needed), review the diff, and submit only after verification.
- Assistant
rgis unavailable in the environment, so I’ll usegrep/findinstead. The repository is Go-based and the relevant code is underpkg; I’m locating all thinking and provider-name handling now. - Assistant
The OpenAI-compatible provider currently shapes only
offfor a few providers and has no DeepSeek branch. More importantly, the HTTP wrapper does not exposeSupportsThinking, so the agent can discard configured thinking levels before the request reaches DeepSeek. I’ll add capability detection for DeepSeek by provider name or API host, expose it through both layers, and shape DeepSeek levels as:offdisabled;low/medium/highenabled + high effort;xhighenabled + max effort. I’ll preserve the existingextraBodymerge precedence. - Assistant
The implementation is in place. I’m tightening one edge case before testing: model names can contain
deepseekwhile being served by another provider (for example OpenRouter), so DeepSeek shaping should be based only on the configured provider or endpoint host, not model text. This avoids sending DeepSeek-only fields to unrelated gateways. - Assistant
The first test attempt was blocked by repository/environment configuration (
GOMODCACHEandGOPATHare unset), not by compilation or test failures. I’ll inspect the Go environment and available cache, then rerun with a temporary cache location if dependencies are already present; otherwise I’ll use the project’s normal setup as far as the environment permits. - Assistant
The affected provider, HTTP API, agent, and all provider-package tests pass with temporary Go cache variables. I’ll do one cleanup pass to remove the now-unneeded model parameter from the DeepSeek detector, then run formatting/diff checks and a focused test run once more.
- Assistant
The final focused tests pass, and
git diff --checkis clean. The behavior also aligns with the agent flow:thinking_level: offis forwarded regardless of capability, while DeepSeek now advertises capability so enabled levels are not dropped. No existing tests were modified or added. I’m submitting the two source changes now.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.