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
This commit is contained in:
Orion 2025-01-28 09:53:22 +10:00 committed by GitHub
parent ce6e8d1264
commit 95f4d99e3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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