Skip to content

Tool definition - response removing input processing | Qwen3-Next, Qwen3-Coder-Next and more - #4506

Open
przepeck wants to merge 9 commits into
mainfrom
przepeck/qwen3_next_templates
Open

Tool definition - response removing input processing | Qwen3-Next, Qwen3-Coder-Next and more#4506
przepeck wants to merge 9 commits into
mainfrom
przepeck/qwen3_next_templates

Conversation

@przepeck

@przepeck przepeck commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

🛠 Summary

CVS-187934
Input processing for Qwen3 Next and Qwen3 Coder Next and more chat templates
Removing response field from tool definitions.

🧪 Checklist

  • Unit tests added.
  • The documentation updated.
  • Change follows security best practices.
    ``

Copilot AI lite review requested due to automatic review settings September 3, 2026 11:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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::removeResponseFromToolDefinition and 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.

Comment thread src/llm/io_processing/chat_template/caps.hpp
Comment thread src/llm/io_processing/chat_template/probe.cpp Outdated
Comment thread src/llm/io_processing/input_processors/chat_template_adapter.cpp Outdated
Comment thread src/llm/io_processing/input_processors/chat_template_adapter.cpp
Comment thread src/test/llm/chat_template_adapter_test.cpp Outdated
@dtrawins dtrawins added the 2026.4 label Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants