[Tool Parser]Add tool parser for NVIDIA-Nemotron-Nano-9B-v2 model#42255
Open
sniper35 wants to merge 4 commits into
Open
[Tool Parser]Add tool parser for NVIDIA-Nemotron-Nano-9B-v2 model#42255sniper35 wants to merge 4 commits into
sniper35 wants to merge 4 commits into
Conversation
Register a built-in parser for Nemotron <TOOLCALL> JSON payloads, add a matching chat template example, and cover streaming extraction for content-plus-tool and parallel-call chunk boundaries. Signed-off-by: Dong Wang <dongw2019@gmail.com>
…unk boundaries Signed-off-by: Dong Wang <dongw2019@gmail.com>
Contributor
|
Documentation preview: https://vllm--42255.org.readthedocs.build/en/42255/ |
Contributor
There was a problem hiding this comment.
Code Review
This PR adds the NemotronJSONToolParser and a corresponding Jinja2 chat template to support tool calling for Nemotron models. It includes documentation and tests for streaming and non-streaming tool extraction. Feedback points out a potential JSON escaping issue in the Jinja2 template, recommending the tojson filter for function names instead of manual quoting.
Signed-off-by: Dong Wang <dongw2019@gmail.com>
Signed-off-by: Dong Wang <dongw2019@gmail.com>
sniper35
commented
May 11, 2026
| class ExampleToolParser(ToolParser): | ||
| def __init__(self, tokenizer: TokenizerLike): | ||
| super().__init__(tokenizer) | ||
| def __init__(self, tokenizer: TokenizerLike, tools=None): |
Contributor
Author
There was a problem hiding this comment.
This is to align with with the latest code base
|
I am from the Nemotron team and had worked on this model. The tool-parser implementation looks correct and the tests show it functions correctly. |
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.
Purpose
Closes #42065
Nemotron cookbook updated to align with vllm codebase: NVIDIA-NeMo/Nemotron#196
Related: HF repo update: https://huggingface.co/nvidia/NVIDIA-Nemotron-Nano-9B-v2/discussions/37
Test Plan
start the server with the new registered tool parser:
Non-streming:
Streaming:
Test Result
Non-streming:
Streaming:
test_nanotron_streaming.py
test_nanotron_non_streaming.py
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.