[Frontend] Parse tool calls and reasoning from checkpoint response templates (#58604)

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Bugen Zhao <i@bugenzhao.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Yoni Gozlan <yonigozlan@users.noreply.github.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
This commit is contained in:
Yoni Gozlan
2026-10-02 02:33:00 +00:00
committed by GitHub
co-authored by Cursor Bugen Zhao Claude Opus 5.5
parent 5a661487e2
commit 9bd993564f
18 changed files with 2298 additions and 21 deletions
+3
View File
@@ -79,6 +79,7 @@ class OnlineDerenderer:
tool_strict_level=tool_strict_level,
model_name=model_config.model,
is_harmony=self.use_harmony,
tokenizer=renderer.tokenizer,
)
self.chat_template = chat_template
@@ -160,6 +161,8 @@ class OnlineDerenderer:
chat_template_kwargs=chat_template_kwargs,
model_config=self.model_config,
)
if generate_response.prompt_token_ids is not None:
parser.set_prompt_token_ids(generate_response.prompt_token_ids)
reasoning, content, tool_calls = parser.parse(
decoded_text,
chat_request,
+3 -1
View File
@@ -183,6 +183,7 @@ class OnlineRenderer:
tool_strict_level=tool_strict_level,
model_name=model_config.model,
is_harmony=self.use_harmony,
tokenizer=renderer.tokenizer,
)
self.chat_template = chat_template
@@ -825,7 +826,8 @@ class OnlineRenderer:
and tokenizer.supports_grammar
)
should_adjust_request = (
parser.reasoning_parser_cls is not None
parser.always_adjust_request
or parser.reasoning_parser_cls is not None
or tool_choice != "none"
or is_mistral_grammar_eligible
)