From c217a07d5e711c829c8b5429fc8b83052b88281a Mon Sep 17 00:00:00 2001 From: Jack Collins <6640905+jackmpcollins@users.noreply.github.com> Date: Sun, 5 May 2024 18:47:58 -0700 Subject: [PATCH] Fix: Set finish_reason to tool_calls for non-stream responses --- litellm/llms/ollama_chat.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/litellm/llms/ollama_chat.py b/litellm/llms/ollama_chat.py index b84705998b9..45aab0f9593 100644 --- a/litellm/llms/ollama_chat.py +++ b/litellm/llms/ollama_chat.py @@ -298,6 +298,7 @@ def get_ollama_response( ], ) model_response["choices"][0]["message"] = message + model_response["choices"][0]["finish_reason"] = "tool_calls" else: model_response["choices"][0]["message"] = response_json["message"] model_response["created"] = int(time.time()) @@ -480,6 +481,7 @@ async def ollama_acompletion( ], ) model_response["choices"][0]["message"] = message + model_response["choices"][0]["finish_reason"] = "tool_calls" else: model_response["choices"][0]["message"] = response_json["message"]