Skip to content

Commit

Permalink
fix: resolve issue langchain-ai#29513 - cannot retrieve reasoning_con…
Browse files Browse the repository at this point in the history
…tent while streaming

Extract reasoning_content in the _convert_delta_to_message_chunk function
  • Loading branch information
codergma committed Feb 2, 2025
1 parent 0c782ee commit 0b9c888
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libs/partners/openai/langchain_openai/chat_models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,9 @@ def _convert_delta_to_message_chunk(
except KeyError:
pass

if _dict.get("reasoning_content"):
additional_kwargs["reasoning_content"] = _dict["reasoning_content"]

if role == "user" or default_class == HumanMessageChunk:
return HumanMessageChunk(content=content, id=id_)
elif role == "assistant" or default_class == AIMessageChunk:
Expand Down

0 comments on commit 0b9c888

Please sign in to comment.