From 95f4d99e3b54c6cca308136b496900e391d813d6 Mon Sep 17 00:00:00 2001 From: Orion Date: Tue, 28 Jan 2025 09:53:22 +1000 Subject: [PATCH] Update misc.py Include empty delta object on openai_chat_chunk_message_template per OpenAI API documentation. https://platform.openai.com/docs/api-reference/chat/streaming#chat/streaming --- backend/open_webui/utils/misc.py | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/open_webui/utils/misc.py b/backend/open_webui/utils/misc.py index a83733d63..8792b1cfc 100644 --- a/backend/open_webui/utils/misc.py +++ b/backend/open_webui/utils/misc.py @@ -149,6 +149,7 @@ def openai_chat_chunk_message_template( template["choices"][0]["delta"] = {"content": message} else: template["choices"][0]["finish_reason"] = "stop" + template["choices"][0]["delta"] = {} if usage: template["usage"] = usage