Unverified Commit 48a5fff6 authored by Peng-YM's avatar Peng-YM Committed by GitHub
Browse files

[Bugfix] Missing tokens in `return_token_ids` when tool parsers is enabled in...


[Bugfix] Missing tokens in `return_token_ids` when tool parsers is enabled in streaming mode (#29074)
Signed-off-by: default avatarPeng-YM <1048217874pengym@gmail.com>
parent 1119f6e4
...@@ -1072,9 +1072,14 @@ class OpenAIServingChat(OpenAIServing): ...@@ -1072,9 +1072,14 @@ class OpenAIServingChat(OpenAIServing):
# wasn't ready to send a token, then # wasn't ready to send a token, then
# get the next token without streaming a chunk # get the next token without streaming a chunk
if delta_message is None: if delta_message is None:
if output.finish_reason is None: # NOTE: If return_token_ids is enabled, we still need to
# send a chunk with token_ids even if delta_message is None
# to ensure all tokens are included in the response
if (
output.finish_reason is None
and not request.return_token_ids
):
continue continue
else:
delta_message = DeltaMessage() delta_message = DeltaMessage()
# Log streaming delta if output logging is enabled # Log streaming delta if output logging is enabled
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment