Fix condition for streaming output_ids in tokenizer manager (#13759)

Signed-off-by: Xinyuan Tong <xinyuantong.cs@gmail.com>
Co-authored-by: Chang Su <chang.s.su\n@oracle.com>
Co-authored-by: Xinyuan Tong <115166877+JustinTong0323@users.noreply.github.com>
Co-authored-by: Xinyuan Tong <xinyuantong.cs@gmail.com>
This commit is contained in:
Lianmin Zheng
2025-11-29 13:56:15 -08:00
committed by GitHub
co-authored by Chang Su <chang.s.su\n@oracle.com> Xinyuan Tong Xinyuan Tong
parent d7cb08c5be
commit 155a9e7237
6 changed files with 72 additions and 30 deletions
@@ -75,6 +75,13 @@ class OpenAIServingChat(OpenAIServingBase):
f"Using default chat sampling params from model generation config: {self.default_sampling_params}",
)
# Check if the model is a GPT-OSS model
self.is_gpt_oss = (
hasattr(self.tokenizer_manager.model_config, "hf_config")
and hasattr(self.tokenizer_manager.model_config.hf_config, "model_type")
and self.tokenizer_manager.model_config.hf_config.model_type == "gpt_oss"
)
def _request_id_prefix(self) -> str:
return "chatcmpl-"
@@ -205,14 +212,8 @@ class OpenAIServingChat(OpenAIServingBase):
self, request: ChatCompletionRequest, is_multimodal: bool
) -> MessageProcessingResult:
"""Process chat messages and apply chat template"""
is_gpt_oss = (
hasattr(self.tokenizer_manager.model_config, "hf_config")
and hasattr(self.tokenizer_manager.model_config.hf_config, "model_type")
and self.tokenizer_manager.model_config.hf_config.model_type == "gpt_oss"
)
# GptOss model needs to keep special tokens for harmony parsing
if is_gpt_oss:
if self.is_gpt_oss:
request.skip_special_tokens = False
tool_call_constraint = None