Skip to content

The agent engineering platform.

ChatTongyi reasoning_content fix (#30694)

Mohammad Mohtashime935da0b1259
diff --git a/libs/community/langchain_community/chat_models/tongyi.py b/libs/community/langchain_community/chat_models/tongyi.py
index 645bd44b17..c28a727d8e 100644
--- a/libs/community/langchain_community/chat_models/tongyi.py
+++ b/libs/community/langchain_community/chat_models/tongyi.py
@@ -731,7 +731,7 @@ class ChatTongyi(BaseChatModel):
if (
choice["finish_reason"] == "null"
and message["content"] == ""
- and message["reasoning_content"] == ""
+ and message.get("reasoning_content", "") == ""
and "tool_calls" not in message
):
continue