From d02e9618f8a64835d915e32503fc4e9e88fb228c 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 b84705998b..45aab0f959 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"]