diff --git a/libs/partners/ollama/langchain_ollama/chat_models.py b/libs/partners/ollama/langchain_ollama/chat_models.py index 6f17fb2f73036..1fd35dda9ddab 100644 --- a/libs/partners/ollama/langchain_ollama/chat_models.py +++ b/libs/partners/ollama/langchain_ollama/chat_models.py @@ -66,7 +66,7 @@ def _get_tool_calls_from_response( """Get tool calls from ollama response.""" tool_calls = [] if response.get("message", None): - if "tool_calls" in response["message"]: + if response.get("tool_calls", None): for tc in response["message"]["tool_calls"]: tool_calls.append( tool_call(