Tool definition - response removing input processing | Qwen3-Next, Qwen3-Coder-Next and more - #4506
Open
przepeck wants to merge 9 commits into
Open
Tool definition - response removing input processing | Qwen3-Next, Qwen3-Coder-Next and more#4506przepeck wants to merge 9 commits into
przepeck wants to merge 9 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
There are confirmed logic/template issues (workaround gating via needsWorkarounds() and a broken example template with stray wq plus incomplete response stripping) that can prevent the new behavior from working correctly.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds support for chat templates (notably Qwen3-* Next and related parsers) that require removing the response schema from tool definitions, and extends template analysis/probing plus tests to cover this capability.
Changes:
- Introduces
ChatTemplateCaps::removeResponseFromToolDefinitionand wires it through template analysis, probing, and input adaptation. - Adds a new Qwen3-Coder-Next chat template fixture and updates analyzer/unit tests to validate detection and adaptation behavior.
- Updates example templates to align with the “response removed from tool definitions” behavior.
File summaries
| File | Description |
|---|---|
| src/test/llm/chat_templates/chat_template_qwen3coder_next.jinja | Adds a Qwen3-Coder-Next template fixture for tests/detection. |
| src/test/llm/chat_template_analyzer_test.cpp | Extends analyzer tests to assert removeResponseFromToolDefinition and adds Qwen3-Coder-Next coverage. |
| src/test/llm/chat_template_adapter_test.cpp | Adds adapter tests ensuring response is removed from tool definitions. |
| src/llm/servable_initializer.cpp | Runs an additional probe to validate tool-definition “response” handling and warns if unsupported. |
| src/llm/io_processing/input_processors/chat_template_adapter.cpp | Implements removal of function.response from tool definitions when the cap is enabled. |
| src/llm/io_processing/chat_template/probe.hpp | Declares the new probeChatTemplateToolResponse probe. |
| src/llm/io_processing/chat_template/probe.cpp | Implements the tool-response probe that toggles the new cap. |
| src/llm/io_processing/chat_template/caps.hpp | Adds the new capability flag and prints it in toString(). |
| src/llm/io_processing/chat_template/analyzer.cpp | Sets the new cap for detected template families that render tool “response” definitions. |
| extras/chat_template_examples/chat_template_qwen3coder_next.jinja | Updates example rendering of tool-call arguments. |
| extras/chat_template_examples/chat_template_qwen3_next.jinja | Adds an example template intended to remove response from tool definitions. |
Review details
- Files reviewed: 9/9 changed files
- Comments generated: 5
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
🛠 Summary
CVS-187934
Input processing for Qwen3 Next and Qwen3 Coder Next and more chat templates
Removing response field from tool definitions.
🧪 Checklist
``