Fix Harmony reasoning parser for and auto-separation for gpt-oss models (#9190)
Co-authored-by: Chang Su <chang.s.su@oracle.com> Co-authored-by: Chayenne <zhaochen20@outlook.com> Co-authored-by: zhaochenyang20 <zhaochenyang20@gmail.com> Co-authored-by: minleminzui <2969413251@qq.com> Co-authored-by: maocheng23 <maocheng@berkeley.edu> Co-authored-by: Xinyuan Tong <xinyuantong.cs@gmail.com>
This commit is contained in:
@@ -148,6 +148,16 @@ 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:
|
||||
request.skip_special_tokens = False
|
||||
|
||||
tool_call_constraint = None
|
||||
|
||||
# Apply chat template and its stop strings
|
||||
|
||||
Reference in New Issue
Block a user