Skip to content
TheChatArchiveThe Chat Archive
GLMz-ai/glm-5.2· unknownHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

ISSUE DESCRIPTION [Feature] Map thinkinglevel to DeepSeek thinking fields 🎯 The Goal /…

  1. 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_level abstraction 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_level config without needing manual extra_body overrides

    💡 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 / medium are kept as valid internal levels, they can follow DeepSeek's documented compatibility behavior and map to reasoning_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 thinking and reasoning_effort fields
    • ensure explicit off is sent even when DeepSeek does not advertise generic thinking support via SupportsThinking()
    • 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

    • Ask users to configure DeepSeek manually with extra_body
    • Keep DeepSeek on the generic OpenAI-compatible path without provider-specific thinking mapping

    Both alternatives are weaker because they make DeepSeek behavior inconsistent with the project-wide thinking_level abstraction.

    💬 Additional Context

    https://api-docs.deepseek.com/zh-cn/guides/thinking_mode

    DeepSeek's documented OpenAI-compatible thinking controls use:

    • thinking.type
    • reasoning_effort
    • reasoning_content in responses

    PR #2898 is closely related because it establishes the explicit-off behavior and provider-specific request shaping pattern. DeepSeek appears to still need its own mapping added on top of that work.

    Interface

    Type: Function Name: SupportsThinking Path: pkg/providers/httpapi/http_provider.go Input: () Output: bool Description: Exposes the thinking capability of the underlying provider delegate over the HTTP API. Returns true if the delegate supports thinking; otherwise false.

    ADDITIONAL ADVICE

    Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use git checkout <file> to restore the file to its original state. You can also reset all changes in the repository using git reset --hard command. Additionally, you can use git stash and git stash pop to temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call submit) using git status or git diff commands. However you don't need to use git add or git commit before submitting your changes. In fact, submit only submits currently unstaged changes because it uses git diff to get the changes that need to be submitted.

    CHECKLIST

    Before submitting your solution, please go over the following checklist and make sure you've done everything:

    • If an error was reported in the issue description, I have successfully reproduced it.
    • If an error was reported in the issue description, I have confirmed that my fix resolves the error.
    • I have thought about edge cases and made sure my fix handles them as well.
    • I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.

    Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!

    (Current directory: /picoclaw, current file: none) bash-$

  2. GLM Assistant

    I'll start by exploring the repository structure to understand the codebase.

  3. GLM Assistant

    Let me explore the providers directory structure, particularly looking at httpapi and openai-related providers.

  4. GLM Assistant

    Let me see the middle part of the file that was truncated, particularly the thinkingControlKind function and helper functions.

  5. GLM Assistant

    Let me see the full thinkingControlKind function and the helper functions like isVolcengineHost, isDashScopeHost, etc.

  6. GLM Assistant

    Now let me look at the http_provider.go to understand the SupportsThinking interface.

  7. GLM Assistant

    There's no SupportsThinking method in http_provider.go. The issue's interface mentions:

    • Type: Function
    • Name: SupportsThinking
    • Path: pkg/providers/httpapi/http_provider.go
    • Input: ()
    • Output: bool
    • Description: Exposes the thinking capability of the underlying provider delegate over the HTTP API. Returns true if the delegate supports thinking; otherwise false.

    So I need to add a SupportsThinking() method on HTTPProvider. Let me check if there's already a SupportsThinking method on the openai_compat Provider.

  8. GLM Assistant

    Let me look at the gemini_provider.go SupportsThinking for reference and the provider_test.go.

  9. GLM Assistant

    Let me check the httpapi tests directory for any existing tests, and check how the factory creates DeepSeek providers.

  10. GLM Assistant

    Let me look at how the HTTPProvider is used and whether there's a facade that wraps it.

  11. GLM Assistant

    Let me look at the finalizeProviderFromConfig and the toolSchemaTransformProvider wrapper.

  12. GLM Assistant

    Let me check existing tests for DeepSeek thinking and look at the gemini thinking test patterns.

  13. GLM Assistant

    Let me check if there's an http_provider test file in httpapi.

  14. GLM Assistant

    No http_provider test file. Only gemini_provider_test.go. Let me look at how the agent test uses SupportsThinking to understand the expected behavior.

  15. GLM Assistant

    Now let me check the legacy_provider and any other places that might need SupportsThinking.

  16. GLM Assistant

    Now I have a complete understanding. Let me implement the changes. First, let me modify openai_compat/provider.go.

  17. GLM Assistant

    Now let me edit the applyThinkingControl function and add the DeepSeek mapping:

  18. GLM Assistant

    Now let me replace the applyThinkingControl function with the DeepSeek-aware version:

  19. GLM Assistant

    Now let me add the isDeepSeekProvider helper and SupportsThinking method. Let me find the isDeepSeekHost function:

  20. GLM Assistant

    Now let me add the isDeepSeekProvider method after isDeepSeekHost, and add SupportsThinking after SupportsNativeSearch:

  21. GLM Assistant

    I see a duplicate was created. Let me fix lines 355-379 to have a single clean isDeepSeekHost plus the new isDeepSeekProvider:

  22. GLM Assistant

    Now let me add the SupportsThinking method on the openai_compat Provider, right after SupportsNativeSearch:

  23. GLM Assistant

    There's an extra closing brace at line 861. Let me remove it:

  24. GLM Assistant

    Let me add a blank line after the SupportsThinking function:

  25. GLM Assistant

    Now let me add the SupportsThinking method to the HTTPProvider in http_provider.go:

  26. GLM Assistant

    Now let me build to check for compilation errors:

  27. GLM Assistant

    The only error is a pre-existing embed pattern issue unrelated to my change. Let me build the specific packages I changed:

  28. GLM Assistant

    Build passes. Let me run the existing tests for the relevant packages:

  29. GLM Assistant

    All tests pass. Now let me write a temporary test script to verify the DeepSeek thinking mapping behavior end-to-end:

  30. GLM Assistant

    All my temporary tests pass. Let me also test that the HTTPProvider SupportsThinking is properly delegated through the wrapper, and that doubao still preserves behavior:

  31. GLM Assistant

    Let me write an integration-style test verifying the full request shaping through the HTTPProvider with a mock server:

  32. GLM Assistant

    Excellent! The full path works. Now let me remove the temporary test files and run the full relevant test suite:

  33. GLM Assistant

    All tests pass. Let me verify the temporary test files are gone and review my final diff:

  34. GLM Assistant

    The diff is clean. Let me verify the pre-existing embed error is unrelated to my change by checking it on a clean tree:

  35. GLM Assistant

    Confirmed: the pattern workspace embed error is pre-existing on the clean tree and unrelated to my changes. My affected packages build and test cleanly.

    Let me do a final review of the complete changed sections to ensure correctness:

  36. GLM Assistant

    Everything looks correct. Let me run the broader test suite one final time to be thorough, including any tests that might touch the factory:

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.