Skip to content

Commit

Permalink
Update base.py
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonHonKL authored Mar 9, 2025
1 parent f20d60e commit a14cf48
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions libs/partners/openai/langchain_openai/chat_models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ def _convert_dict_to_message(_dict: Mapping[str, Any]) -> BaseMessage:
# Also OpenAI returns None for tool invocations
content = _dict.get("content", "") or ""
reasoning_content = _dict.get("reasoning_content") or ""
if reasoning_content != "":
content = content[:] + reasoning_content[:]
additional_kwargs: Dict = {}
if function_call := _dict.get("function_call"):
additional_kwargs["function_call"] = dict(function_call)
Expand All @@ -152,8 +154,7 @@ def _convert_dict_to_message(_dict: Mapping[str, Any]) -> BaseMessage:
name=name,
id=id_,
tool_calls=tool_calls,
invalid_tool_calls=invalid_tool_calls,
reasoning_content = reasoning_content
invalid_tool_calls=invalid_tool_calls
)
elif role in ("system", "developer"):
if role == "developer":
Expand Down

0 comments on commit a14cf48

Please sign in to comment.