Skip to content

[Feature] openai_compatible provider: support enableThinking parameter for thinking-capable models (Qwen3, DeepSeek-R1) #2149

Description

@7889545

Pre-submission checklist

  • I have searched existing issues and this hasn't been mentioned before
  • I have read the project documentation and confirmed this issue doesn't already exist
  • This issue is specific to MemOS and not a general software issue

Problem

Models like Qwen3 and DeepSeek-R1 support an enable_thinking parameter to control whether the model produces <think> reasoning blocks. When thinking is enabled, output contains <think>... tags before the actual response — which breaks JSON parsing in tasks that require structured output (capture summarization, L3 abstraction, skill crystallization).

Currently, the openai_compatible provider (core/llm/providers/openai.ts) has no support for the enableThinking config option. The complete() and stream() methods build the request body without considering config.enableThinking.

PR #2079 addressed this for the qwen3 preference extractor specifically, but the provider layer itself still lacks the capability.

Use Case

Users need to configure different thinking modes per LLM instance:

llm:
  model: "Qwen/Qwen3-8B"
  enableThinking: false    # Main LLM: no thinking (JSON output tasks)

skillEvolver:
  model: "Qwen/Qwen3-8B`
  enableThinking: true     # Skill evolution: with thinking (reasoning tasks)

Without provider-level support, the enableThinking config is ignored and all models use the provider default.

Proposed Solution

Add enableThinking patch to both complete() and stream() methods in openai.ts:

// In complete() method, after building body:
if (config.enableThinking === false) body.enable_thinking = false;
if (config.enableThinking === true) body.enable_thinking = true;

// Same patch in stream() method

This is a minimal, non-breaking change — when enableThinking is undefined (not set), the body is unchanged, preserving backward compatibility.

Debug Logging

Optionally add debug logging to help diagnose thinking mode:

if (config.enableThinking !== undefined) {
    log.info("enableThinking.debug", {
        model,
        enableThinking: config.enableThinking,
        bodyEnableThinking: body.enable_thinking,
    });
}

Alternatives Considered

The provider-level approach is complementary to per-task routing — both can coexist.

Environment

  • MemOS: v2.0.20 (memos-local-plugin)
  • LLM Provider: openai_compatible (SiliconFlow)
  • Model: Qwen/Qwen3-8B (supports enable_thinking parameter)

Metadata

Metadata

Labels

area:pluginOpenClaw & Hermesstatus:readyReady for implementation; waiting for assignee or AI dispatch | 可进入实现,等待认领或派发types:enhancementNew feature or improvement | 新功能或改进

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions