Skip to content

Commit

Permalink
handled case where or is
Browse files Browse the repository at this point in the history
  • Loading branch information
bauerem committed Nov 23, 2024
1 parent a83357d commit ef718b6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libs/partners/ollama/langchain_ollama/chat_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ def _get_tool_calls_from_response(
) -> List[ToolCall]:
"""Get tool calls from ollama response."""
tool_calls = []
if "message" in response:
if "tool_calls" in response["message"]:
if response.get("message", None):
if response["message"].get("tool_calls", None):
for tc in response["message"]["tool_calls"]:
tool_calls.append(
tool_call(
Expand Down

0 comments on commit ef718b6

Please sign in to comment.