Remove exclude_unset in streaming response (#3143)

This commit is contained in:
Seonghyeon 2024-03-02 02:59:06 +09:00 committed by GitHub
parent 54d3544784
commit 27ca23dc00
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -96,7 +96,7 @@ async def completion_stream_generator(
logprobs=logprobs, logprobs=logprobs,
finish_reason=finish_reason, finish_reason=finish_reason,
) )
]).model_dump_json(exclude_unset=True) ]).model_dump_json()
yield f"data: {response_json}\n\n" yield f"data: {response_json}\n\n"
if output.finish_reason is not None: # return final usage if output.finish_reason is not None: # return final usage
@ -121,7 +121,7 @@ async def completion_stream_generator(
) )
], ],
usage=final_usage, usage=final_usage,
).model_dump_json(exclude_unset=True) ).model_dump_json()
yield f"data: {response_json}\n\n" yield f"data: {response_json}\n\n"
yield "data: [DONE]\n\n" yield "data: [DONE]\n\n"
@ -306,7 +306,7 @@ class OpenAIServingCompletion(OpenAIServing):
request, prompt=prompt) request, prompt=prompt)
generators.append( generators.append(
self.engine.generate(None, self.engine.generate(prompt,
sampling_params, sampling_params,
f"{request_id}-{i}", f"{request_id}-{i}",
prompt_token_ids=input_ids, prompt_token_ids=input_ids,