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, existing thinking-level mappings, and tests—especially the patterns introduced for other OpenAI-compatible providers. Then I’ll reproduce DeepSeek’s current request shape, implement the provider-specific mapping, and run focused plus broader tests.
- Assistant
rgis unavailable, so I’ll use recursivegrepto locate the relevant implementations and test coverage. - Assistant
The repository already contains generic/provider-specific disable shaping in
openai_compat, plus fallback tests. I’ll inspect that code, provider construction/naming, and associated tests to determine how DeepSeek can be identified without affecting other compatible providers. - Assistant
DeepSeek is already detectable both by provider name and API host, which is useful for direct configurations and fallback/rewrite paths. I’ll now inspect the complete detection methods,
SupportsThinkingdelegation, factory setup, and agent filtering semantics because explicitoffmust survive even when generic thinking support is false. - Assistant
HTTPProvidercurrently does not implement the requestedSupportsThinking()interface, so enabled DeepSeek levels are filtered out by the agent before request shaping. The fix therefore needs two coordinated parts: expose capability through the wrapper/delegate, and map all valid DeepSeek levels inapplyThinkingControl. I’ll inspect current capability conventions and factory wrapper behavior to choose a narrowly scoped implementation. - Assistant
I’ll implement DeepSeek detection as
(providerName == "deepseek" || DeepSeek host), matching existing reasoning replay behavior. Static levelslow,medium, andhighwill enable thinking withreasoning_effort: "high";xhighwill use"max";offwill explicitly disable it. Sinceadaptiveis an Anthropic-specific mode and the issue does not define a DeepSeek translation for it, it will remain unshaped rather than silently assigning a different semantic.extra_bodywill continue to override generated defaults. - Assistant
The implementation is in place. I’ll reproduce and verify the full outbound JSON for every specified level using a temporary HTTP capture program (kept outside the repository), including both provider-name and DeepSeek-host detection, and confirm capability delegation.
- Assistant
The code could not run because this environment has no Go cache/module environment configured—not because of a compilation failure. I’ll configure temporary cache paths under
/tmpand rerun the verification and focused test suites without altering repository files. - Assistant
The captured payloads exactly match the requested mappings, and all focused packages pass. I’ll do a final review of fallback/provider rewrite behavior and the diff for edge cases (custom DeepSeek hosts,
extra_bodyprecedence, invalid/unset levels, nil safety), then run the complete repository test suite if no further code changes are needed. - Assistant
Fallback candidates independently resolve their provider and model config, then call
SupportsThinking; the new delegation means enabled DeepSeek levels now survive that path, while explicitoffalready survives regardless of capability. Host-based detection also covers OpenAI-labeled/custom configurations, and generated fields remain overrideable viaextra_body. I’ll now run the full test suite with the temporary Go cache environment. - Assistant
The full suite ran, and all provider/agent/config tests passed. Unrelated repository/environment failures remain: a missing embedded
workspace, missing nativelibolmheaders, filesystem-permission assumptions under root in existing tests, and a shell process-timeout test. None touch the changed files or feature. I’ll perform the final diff/status check and then submit. Checklist assessment:- Reproduced the issue: Yes. The temporary capture showed the path previously lacked DeepSeek enabled-level capability propagation; after the change, outbound payloads were captured for each level.
- Confirmed the fix: Yes. Captured payloads are
disabledforoff,enabled+highforlow/medium/high, andenabled+maxforxhigh; host-detected capability returns true. - Considered edge cases: Yes. Both provider-name and host detection work; invalid/unset and DeepSeek-unsupported remain untouched; retains final precedence; nil wrapper/delegate capability checks are safe; fallback candidate capability delegation works.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.