[Bugfix] Streamed tool calls now more strictly follow OpenAI's format; ensures Vercel AI SDK compatibility (#8272)

This commit is contained in:
Kyle Mistele
2024-09-09 10:45:11 -04:00
committed by GitHub
parent 4ef41b8476
commit 08287ef675
6 changed files with 19 additions and 44 deletions
+5 -1
View File
@@ -271,9 +271,13 @@ class OpenAIServingChat(OpenAIServing):
# NOTE num_choices defaults to 1 so this usually executes
# once per request
for i in range(num_choices):
choice_data = ChatCompletionResponseStreamChoice(
index=i,
delta=DeltaMessage(role=role),
delta=DeltaMessage(
role=role,
content="",
),
logprobs=None,
finish_reason=None)
chunk = ChatCompletionStreamResponse(