diff --git a/python/dify_plugin/interfaces/model/large_language_model.py b/python/dify_plugin/interfaces/model/large_language_model.py
index e239b37a..41bdaaf6 100644
--- a/python/dify_plugin/interfaces/model/large_language_model.py
+++ b/python/dify_plugin/interfaces/model/large_language_model.py
@@ -535,7 +535,7 @@ def _wrap_thinking_by_reasoning_content(self, delta: dict, is_reasoning: bool) -
"""
content = delta.get("content") or ""
- reasoning_content = delta.get("reasoning_content")
+ reasoning_content = delta.get("reasoning_content") or delta.get("reasoning")
output = content
if reasoning_content:
if not is_reasoning:
diff --git a/python/pyproject.toml b/python/pyproject.toml
index d8c7fc5d..5381cbcb 100644
--- a/python/pyproject.toml
+++ b/python/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "dify_plugin"
-version = "0.7.4"
+version = "0.7.5"
description = "Dify Plugin SDK"
authors = [{ name = "langgenius", email = "hello@dify.ai" }]
dependencies = [
diff --git a/python/tests/interfaces/model/test_wrap_think.py b/python/tests/interfaces/model/test_wrap_think.py
index 9264ca75..f226ec5a 100644
--- a/python/tests/interfaces/model/test_wrap_think.py
+++ b/python/tests/interfaces/model/test_wrap_think.py
@@ -109,3 +109,33 @@ def test_standard_reasoning_flow(self):
full_output += output
assert full_output == "\nThinking.\nHello world."
+
+ def test_reasoning_key_fallback(self):
+ """
+ Test that delta.get("reasoning") is used when reasoning_content is absent.
+ Line 538: reasoning_content = delta.get("reasoning_content") or delta.get("reasoning")
+ """
+ chunks = [
+ {"reasoning": "Using reasoning key.", "content": ""},
+ {"reasoning": None, "content": "Response text."},
+ ]
+
+ is_reasoning = False
+ full_output = ""
+ for chunk in chunks:
+ output, is_reasoning = self.llm._wrap_thinking_by_reasoning_content(chunk, is_reasoning)
+ full_output += output
+
+ assert full_output == "\nUsing reasoning key.\nResponse text."
+
+ def test_reasoning_content_takes_precedence_over_reasoning(self):
+ """
+ Test that reasoning_content takes precedence when both keys exist.
+ Line 538: reasoning_content = delta.get("reasoning_content") or delta.get("reasoning")
+ """
+ chunk = {"reasoning_content": "Primary.", "reasoning": "Fallback.", "content": ""}
+ output, is_reasoning = self.llm._wrap_thinking_by_reasoning_content(chunk, False)
+
+ assert "Primary." in output
+ assert "Fallback." not in output
+ assert is_reasoning is True