[Bugfix] Return None for empty reasoning_content outside K2 Horizon (#42962)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Po-Han Huang (NVIDIA)
2026-10-07 21:02:40 +08:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 492dbd0807
commit 1e86143bf0
2 changed files with 18 additions and 1 deletions
@@ -2453,7 +2453,12 @@ class OpenAIServingChat(OpenAIServingBase):
role="assistant",
content=text if text else "",
tool_calls=tool_calls,
reasoning_content=reasoning_text,
# Only K2 templates replay empty reasoning; other parsers report None.
reasoning_content=(
reasoning_text
if reasoning_text or self.reasoning_parser == "k2_horizon"
else None
),
),
logprobs=choice_logprobs,
finish_reason=finish_reason["type"] if finish_reason else None,