[Chore] Consolidate reasoning/tool parser attributes into unified Parser in chat serving (#45548)

Signed-off-by: sfeng33 <4florafeng@gmail.com>
This commit is contained in:
Flora Feng
2026-06-15 11:16:45 -04:00
committed by GitHub
parent 588db18362
commit 0d80979644
4 changed files with 47 additions and 45 deletions
@@ -1350,6 +1350,21 @@ class TestServingChatWithHarmony:
else serving_chat.chat_completion_full_generator
)
chat_template_kwargs = serving_chat._effective_chat_template_kwargs(req)
if stream:
extra_kwargs: dict[str, Any] = {
"chat_template_kwargs": chat_template_kwargs,
}
else:
parser = None
if serving_chat.parser_cls is not None:
parser = serving_chat.parser_cls(
tokenizer,
req.tools,
chat_template_kwargs=chat_template_kwargs,
)
extra_kwargs = {"parser": parser}
result = generator_func(
request=req,
result_generator=result_generator(),
@@ -1361,7 +1376,7 @@ class TestServingChatWithHarmony:
request_id=req.request_id,
model_name=req.model,
),
chat_template_kwargs=serving_chat._effective_chat_template_kwargs(req),
**extra_kwargs,
)
if stream: