The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
community: [fix] add missing tool_calls kwargs of delta message in openai adapter (#27492)
Wang621f78babd03
diff --git a/libs/community/langchain_community/adapters/openai.py b/libs/community/langchain_community/adapters/openai.pyindex 8db939d5c9..673e5fa567 100644--- a/libs/community/langchain_community/adapters/openai.py+++ b/libs/community/langchain_community/adapters/openai.py@@ -180,6 +180,12 @@ def _convert_message_chunk(chunk: BaseMessageChunk, i: int) -> dict:# not missing, but None.if i == 0:_dict["content"] = None+ if "tool_calls" in chunk.additional_kwargs:+ _dict["tool_calls"] = chunk.additional_kwargs["tool_calls"]+ # If the first chunk is tool calls, the content is not empty string,+ # not missing, but None.+ if i == 0:+ _dict["content"] = Noneelse:_dict["content"] = chunk.contentelse: