From 37b2c577bd1abef9192cc0dae43ba832611c7ef4 Mon Sep 17 00:00:00 2001 From: florian Date: Mon, 6 Jan 2025 14:27:05 +0100 Subject: [PATCH] fix for 'NoneType' object has no attribute 'tool_calls' issue --- sgpt/handlers/handler.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sgpt/handlers/handler.py b/sgpt/handlers/handler.py index a17d8024..1dd7e0f4 100644 --- a/sgpt/handlers/handler.py +++ b/sgpt/handlers/handler.py @@ -116,6 +116,8 @@ def get_completion( for chunk in response: delta = chunk.choices[0].delta + if not delta: continue + # LiteLLM uses dict instead of Pydantic object like OpenAI does. tool_calls = ( delta.get("tool_calls") if use_litellm else delta.tool_calls