Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix: set enable_thinking to True for qwen3.8-2.4t-a95b (#18442)

Lynneb4e1aa2a434
diff --git a/rag/llm/chat_model.py b/rag/llm/chat_model.py
index bb50d49c1f..577b9a84a9 100644
--- a/rag/llm/chat_model.py
+++ b/rag/llm/chat_model.py
@@ -152,9 +152,10 @@ def _apply_model_family_policies(
# Qwen3 keeps RAGFlow's system default of disabling thinking unless explicitly overridden.
if "qwen3" in model_name_lower:
_pop_thinking_controls()
- # -preview variants (e.g. qwen3.8-max-preview) only accept
+ # -preview variants (e.g. qwen3.8-max-preview) and the flagship
+ # reasoning model qwen3.8-2.4t-a95b only accept
# enable_thinking=True; the API rejects any other value.
- if "-preview" in model_name_lower:
+ if "-preview" in model_name_lower or "2.4t-a95b" in model_name_lower:
enable_thinking = True
else:
enable_thinking = thinking_type == "enabled" if thinking_type else False
diff --git a/test/unit_test/rag/llm/test_chat_model_thinking_policy.py b/test/unit_test/rag/llm/test_chat_model_thinking_policy.py
index ae512abcee..32ea723905 100644
--- a/test/unit_test/rag/llm/test_chat_model_thinking_policy.py
+++ b/test/unit_test/rag/llm/test_chat_model_thinking_policy.py
@@ -73,6 +73,33 @@ def test_qwen3_preview_ignores_disabled_thinking():
assert kwargs["extra_body"]["enable_thinking"] is True
+def test_qwen3_24t_a95b_forces_thinking_true():
+ """qwen3.8-2.4t-a95b (flagship reasoning model) only accepts enable_thinking=True."""
+ gen_conf, kwargs = _apply_model_family_policies(
+ "qwen3.8-2.4t-a95b",
+ backend="base",
+ gen_conf={},
+ request_kwargs={},
+ )
+
+ assert gen_conf == {}
+ assert kwargs["extra_body"]["enable_thinking"] is True
+
+
+def test_qwen3_24t_a95b_ignores_disabled_thinking():
+ """Even with thinking=disabled, qwen3.8-2.4t-a95b still forces enable_thinking=True."""
+ gen_conf, kwargs = _apply_model_family_policies(
+ "qwen3.8-2.4t-a95b",
+ backend="base",
+ gen_conf={"thinking": "disabled", "temperature": 0.2},
+ request_kwargs={},
+ )
+
+ assert "thinking" not in gen_conf
+ assert gen_conf == {"temperature": 0.2}
+ assert kwargs["extra_body"]["enable_thinking"] is True
+
+
@pytest.mark.parametrize(
"provider",
[SupportedLiteLLMProvider.Tongyi_Qianwen, SupportedLiteLLMProvider.Dashscope],