diff --git a/libs/partners/deepseek/langchain_deepseek/chat_models.py b/libs/partners/deepseek/langchain_deepseek/chat_models.py index 9166e61cfa0..155b192c19a 100644 --- a/libs/partners/deepseek/langchain_deepseek/chat_models.py +++ b/libs/partners/deepseek/langchain_deepseek/chat_models.py @@ -255,12 +255,14 @@ class ChatDeepSeek(BaseChatOpenAI): if (choices := chunk.get("choices")) and generation_chunk: top = choices[0] if isinstance(generation_chunk.message, AIMessageChunk): - if reasoning_content := top.get("delta", {}).get("reasoning_content"): + if ( + reasoning_content := top.get("delta", {}).get("reasoning_content") + ) is not None: generation_chunk.message.additional_kwargs["reasoning_content"] = ( reasoning_content ) # Handle use via OpenRouter - elif reasoning := top.get("delta", {}).get("reasoning"): + elif (reasoning := top.get("delta", {}).get("reasoning")) is not None: generation_chunk.message.additional_kwargs["reasoning_content"] = ( reasoning )