[PR #2341] [MERGED] feat(xinference): add think parameter to control deep thinking mode #2411

Closed
opened 2026-02-16 11:16:54 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langgenius/dify-official-plugins/pull/2341
Author: @Alysondao
Created: 12/27/2025
Status: Merged
Merged: 12/28/2025
Merged by: @crazywoola

Base: mainHead: feat/xinference-think-parameter


📝 Commits (1)

  • 7d337e0 feat(llm): add thinking mode parameter and bump version to 0.0.9

📊 Changes

2 files changed (+67 additions, -21 deletions)

View changed files

📝 models/xinference/manifest.yaml (+1 -1)
📝 models/xinference/models/llm/llm.py (+66 -20)

📄 Description

Background

Some OpenAI-compatible models (e.g. Qwen3, DeepSeek-V3.1) support a thinking / reasoning mode.
However, Xinference currently does not provide an explicit way to enable or disable this behavior at the request level.

In real-world business scenarios, we found that Xinference-deployed model plugins do not support dynamically enabling or disabling deep thinking.
Previously, the common workaround was to control this behavior via environment variables at deployment time.
This approach is coarse-grained and inflexible: within the same service, different business workflows may have different requirements — some benefit from deep reasoning, while others prioritize latency and cost and do not need it.

To address this limitation, this PR introduces a request-level parameter to explicitly control whether deep thinking is enabled.

This PR adds an optional think boolean parameter to allow explicit control of this behavior.


What’s changed

  • Add a customizable think parameter (boolean) for Xinference LLM models
  • When think=false, automatically disable deep thinking at request level by passing:
    • extra_body.chat_template_kwargs.enable_thinking = false
    • extra_body.thinking = false
  • Align behavior with Ollama’s think parameter for easier configuration and migration
  • If think is not provided, the server-side default behavior is preserved
  • This change is non-breaking and does not affect existing configurations

How to use

  • In Dify UI: New “Thinking Mode” option in model parameters switch
    image

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langgenius/dify-official-plugins/pull/2341 **Author:** [@Alysondao](https://github.com/Alysondao) **Created:** 12/27/2025 **Status:** ✅ Merged **Merged:** 12/28/2025 **Merged by:** [@crazywoola](https://github.com/crazywoola) **Base:** `main` ← **Head:** `feat/xinference-think-parameter` --- ### 📝 Commits (1) - [`7d337e0`](https://github.com/langgenius/dify-official-plugins/commit/7d337e0254c17722c843ebaa46cb70d450267198) feat(llm): add thinking mode parameter and bump version to 0.0.9 ### 📊 Changes **2 files changed** (+67 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `models/xinference/manifest.yaml` (+1 -1) 📝 `models/xinference/models/llm/llm.py` (+66 -20) </details> ### 📄 Description ## Background Some OpenAI-compatible models (e.g. Qwen3, DeepSeek-V3.1) support a thinking / reasoning mode. However, Xinference currently does not provide an explicit way to enable or disable this behavior at the request level. In real-world business scenarios, we found that Xinference-deployed model plugins do not support dynamically enabling or disabling deep thinking. Previously, the common workaround was to control this behavior via environment variables at deployment time. This approach is coarse-grained and inflexible: within the same service, different business workflows may have different requirements — some benefit from deep reasoning, while others prioritize latency and cost and do not need it. To address this limitation, this PR introduces a request-level parameter to explicitly control whether deep thinking is enabled. This PR adds an optional think boolean parameter to allow explicit control of this behavior. --- ## What’s changed - Add a customizable `think` parameter (boolean) for Xinference LLM models - When `think=false`, automatically disable deep thinking at request level by passing: - `extra_body.chat_template_kwargs.enable_thinking = false` - `extra_body.thinking = false` - Align behavior with Ollama’s `think` parameter for easier configuration and migration - If `think` is not provided, the server-side default behavior is preserved - This change is non-breaking and does not affect existing configurations --- ## How to use - **In Dify UI**: New “Thinking Mode” option in model parameters switch <img width="783" height="517" alt="image" src="https://github.com/user-attachments/assets/08e160ba-fd8e-4c19-ad3e-7be3921c54d8" /> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 11:16:54 -05:00
yindo closed this issue 2026-02-16 11:16:54 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#2411