The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
feat(community): add support for tool_calls response (#23765)
Igor Drozdovb664dbcc3654
diff --git a/libs/community/langchain_community/chat_models/litellm.py b/libs/community/langchain_community/chat_models/litellm.pyindex 3788b911ff..cb26cf7739 100644--- a/libs/community/langchain_community/chat_models/litellm.py+++ b/libs/community/langchain_community/chat_models/litellm.py@@ -83,10 +83,14 @@ def _convert_dict_to_message(_dict: Mapping[str, Any]) -> BaseMessage:# Fix for azure# Also OpenAI returns None for tool invocationscontent = _dict.get("content", "") or ""++ additional_kwargs = {}if _dict.get("function_call"):- additional_kwargs = {"function_call": dict(_dict["function_call"])}- else:- additional_kwargs = {}+ additional_kwargs["function_call"] = dict(_dict["function_call"])++ if _dict.get("tool_calls"):+ additional_kwargs["tool_calls"] = _dict["tool_calls"]+return AIMessage(content=content, additional_kwargs=additional_kwargs)elif role == "system":return SystemMessage(content=_dict["content"])