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 first inspect the provider architecture and existing thinking-level mappings, especially the OpenAI-compatible and HTTP wrapper paths. Then I’ll reproduce the missing DeepSeek shaping through the closest existing tests or a temporary harness, implement the provider-specific mapping, and run targeted plus broader tests.
- Assistant
rgis unavailable, so I’ll use recursivegrepto locate the same symbols and then inspect the relevant files. - Assistant
The existing OpenAI-compatible provider already contains provider-specific disable shaping and targeted tests. I’ll inspect its provider identification, request construction, and registration/configuration to determine how DeepSeek is distinguished and whether capability reporting also needs adjustment.
- Assistant
DeepSeek is already identifiable by provider name or API host, but
applyThinkingControlonly handles"off"and does not include DeepSeek. I’ll inspect the complete helper region, factory setup, metadata capability flags, and agent option gating because the requirement explicitly says"off"must pass even when generic thinking support is not advertised. - Assistant
The agent already forwards explicit
"off"unconditionally, but enabled levels are gated byThinkingCapable. Neither the OpenAI-compatible delegate norHTTPProviderimplements that interface, so DeepSeek currently dropshigh/xhigh. The issue’s named interface strongly indicates adding delegatedSupportsThinking; I’ll inspect repository history and analogous wrapper behavior to align semantics and avoid claiming support for unrelated providers. - Assistant
The recent related commit is present locally. I’ll inspect it to preserve its fallback/rewrite design and identify exactly where a DeepSeek capability method should fit.
- Assistant
The fix should have two coordinated parts: (1) make the OpenAI-compatible delegate report thinking support only when configured as DeepSeek (by provider name or official host), and expose that through
HTTPProvider; (2) shape valid DeepSeek levels beforeextra_bodymerging so user overrides retain precedence. I’ll also verify response parsing already supportsreasoning_content, then implement and format the focused changes. - Assistant
reasoning_contentis already handled in streaming; I’ll quickly check non-streaming decoding as well, then patch the request mapping and both capability methods. For unsupported"adaptive", I’ll leave fields omitted rather than invent an undocumented DeepSeek effort value; the documented/internal compatible levels in the issue arelow,medium,high, andxhigh. - Assistant
The implementation now maps DeepSeek
off,low,medium,high, andxhigh, preserves existing non-DeepSeek behavior, and keeps configuredextra_bodyas the final override. I’ll run the focused provider and agent test suites, then use a temporary external harness (not a repository test) to capture actual HTTP request JSON for every mapped level and verify capability reporting. - Assistant
The test command is blocked by environment configuration rather than code: both
GOMODCACHEandGOPATHare unset. I’ll provide a temporary writable Go cache path and rerun the same suites. - Assistant
Dependencies downloaded successfully, but Go also requires an explicit build cache because
HOMEis unset. I’ll setGOCACHE=/tmp/go-buildand rerun; downloaded modules in/tmp/gowill be reused. - Assistant
All targeted existing tests pass. I’ll now run the temporary request-capture harness to reproduce the original gap at the wire level and confirm the fix: DeepSeek must advertise support, enabled levels must reach the provider through normal agent-compatible options, and emitted JSON must exactly match the requested mapping while
"off"omitsreasoning_effort. - Assistant
The wire-level harness confirms all five requested mappings and both provider-name/host capability detection paths. As an edge-case review: invalid or non-string levels remain ignored;
adaptiveremains untouched because DeepSeek has no documented compatible mapping for it; non-DeepSeek disable mappings are unchanged; official-host and custom-base DeepSeek configurations both work; andextra_bodystill intentionally wins. I’ll run all provider-package tests and inspect the final diff/status before submission.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.