chat : tolerate dropped tool-call wrapper in tag-based formats - #26244
Closed
jamincollins wants to merge 1 commit into
Closed
chat : tolerate dropped tool-call wrapper in tag-based formats#26244jamincollins wants to merge 1 commit into
jamincollins wants to merge 1 commit into
Conversation
Assisted-by: Claude Sonnet Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
|
Hi @jamincollins, thanks for your contribution! Per our contribution guidelines, the automated PR checker found the following issue(s) that need your attention:
Please note that maintainers reserve the right to make final decisions on PRs. If you believe there is a mistake, please comment below. |
Contributor
|
Handled in #26252 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Several chat templates use a tagged tool-call format where
<tool_call>is the wrapper around an inner<function=name>...</function>block (Qwen3-Coder, Nemotron, Seed-OSS, and others). Testing found that some models (see below) sometimes emit the well-formed inner block but skip the outer wrapper. Before this change, that was rejected entirely - the whole response fell back to plain text, dropping the tool call.What changed (
common/chat-auto-parser-generator.cpp):Test coverage (
tests/test-chat.cpp): five new cases covering the dropped-wrapper scenario, an asymmetric case (open tag missing, close tag present), and a parallel-calls case where only one of two calls is missing its wrapper - across both affected code paths.Additional information
Requirements