feat(parser): resolve special-token suffix at runtime for compatibility (#29920)

This commit is contained in:
Xinyuan Tong
2026-07-05 00:13:46 +08:00
committed by GitHub
parent 763c6bf372
commit 854b46be99
10 changed files with 171 additions and 35 deletions
+10 -2
View File
@@ -1517,7 +1517,11 @@ async def parse_function_call_request(
A native API endpoint to parse function calls from a text.
"""
# 1) Initialize the parser based on the request body
parser = FunctionCallParser(tools=obj.tools, tool_call_parser=obj.tool_call_parser)
parser = FunctionCallParser(
tools=obj.tools,
tool_call_parser=obj.tool_call_parser,
tokenizer=get_global_state().tokenizer_manager.tokenizer,
)
# 2) Call the non-stream parsing method (non-stream)
normal_text, calls = parser.parse_non_stream(obj.text)
@@ -1541,7 +1545,11 @@ async def separate_reasoning_request(
A native API endpoint to separate reasoning from a text.
"""
# 1) Initialize the parser based on the request body
parser = ReasoningParser(model_type=obj.reasoning_parser, request=request)
parser = ReasoningParser(
model_type=obj.reasoning_parser,
request=request,
tokenizer=get_global_state().tokenizer_manager.tokenizer,
)
# 2) Call the non-stream parsing method (non-stream)
if obj.return_blocks: