-
Notifications
You must be signed in to change notification settings - Fork 2k
[TRTLLM-9677][feat] Support DeepSeek-V3.2 tool parser #10126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TRTLLM-9677][feat] Support DeepSeek-V3.2 tool parser #10126
Conversation
Signed-off-by: Fanrong Li <23290157+lfr-0531@users.noreply.github.com>
Signed-off-by: Fanrong Li <23290157+lfr-0531@users.noreply.github.com>
Signed-off-by: Fanrong Li <23290157+lfr-0531@users.noreply.github.com>
778a47a to
34eff6a
Compare
|
/bot run |
📝 WalkthroughWalkthroughAdds support for DeepSeek V3.2 tool-call format parsing by introducing a new DeepSeekV32Parser class, registering it in the tool parser factory, configuring the OpenAI server to recognize the model type, and providing comprehensive test coverage. The parser supports both streaming and non-streaming parsing modes using DSML-formatted tool-call sequences. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (5)
tensorrt_llm/serve/tool_parser/deepseekv32_parser.py (4)
64-74: Initialize all instance attributes in__init__.
_tool_indices(checked viahasattrat line 184) andcurrent_tool_name_sent(set at line 270) should be initialized in__init__to ensure all externally visible members are declared upfront. Per coding guidelines, initialize all externally visible members in the constructor.🔎 Proposed fix
def __init__(self): super().__init__() self.bot_token = "<|DSML|function_calls>" self.eot_token = "</|DSML|function_calls>" self.invoke_begin_regex = r'<|DSML|invoke\s+name="([^"]+)"\s*>' self.invoke_end_token = "</|DSML|invoke>" self.parameter_regex = ( r'<|DSML|parameter\s+name="([^"]+)"\s+string="([^"]+)"\s*>(.*?)</|DSML|parameter>' ) self._last_arguments = "" self.current_tool_id = -1 + self.current_tool_name_sent = False + self._tool_indices = {}
151-154: Narrow the exception clause.Per coding guidelines, limit
exceptto the smallest set of errors possible. The broadexcept Exceptioncould mask unexpected errors. Consider catching specific exceptions likere.error,json.JSONDecodeError, orKeyError.🔎 Proposed fix
- except Exception as e: + except (re.error, json.JSONDecodeError, KeyError, AttributeError) as e: logger.error(f"Error in detect_and_parse: {e}") # return the normal text if parsing fails return StreamingParseResult(normal_text=text)
184-185: Avoidhasattrcheck for instance attribute.If
_tool_indicesis initialized in__init__, thishasattrcheck becomes unnecessary. Currently, this lazy initialization pattern makes the code harder to follow.
286-288: Narrow the exception clause.Same as the
detect_and_parsemethod - consider catching specific exceptions rather than broadException.🔎 Proposed fix
- except Exception as e: + except (re.error, json.JSONDecodeError, KeyError, AttributeError) as e: logger.error(f"Error in parse_streaming_increment: {e}") return StreamingParseResult(normal_text=current_text)tests/unittest/llmapi/apps/test_tool_parsers.py (1)
1257-1281: Note: Docstring doesn't match test purpose.The docstring says "Test streaming parser handles end token correctly" but the test is actually verifying multiple tools streaming behavior.
🔎 Proposed fix
def test_parse_streaming_increment_multiple_tools_streaming( self, sample_tools, parser): - """Test streaming parser handles end token correctly.""" + """Test streaming parser handles multiple tool calls.""" # First tool
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
tensorrt_llm/serve/openai_server.py(1 hunks)tensorrt_llm/serve/tool_parser/deepseekv32_parser.py(1 hunks)tensorrt_llm/serve/tool_parser/tool_parser_factory.py(2 hunks)tests/unittest/llmapi/apps/test_tool_parsers.py(2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
**/*.py: Code developed for TensorRT-LLM should conform to Python 3.8+
Indent Python code with 4 spaces. Do not use tabs
Always maintain the namespace when importing in Python, even if only one class or function from a module is used
Python files should use snake_case naming:some_file.py
Python classes should use PascalCase naming:class SomeClass
Python functions and methods should use snake_case naming:def my_awesome_function():
Python local variables should use snake_case naming:my_variable = ...
Python variable names that start with a number should be prefixed with 'k':k_99th_percentile = ...
Python global variables should use upper snake_case with prefix 'G':G_MY_GLOBAL = ...
Python constants should use upper snake_case naming:MY_CONSTANT = ...
Avoid shadowing variables declared in an outer scope in Python
Initialize all externally visible members of a Python class in the constructor
For Python interfaces that may be used outside a file, prefer docstrings over comments
Python comments should be reserved for code within a function, or interfaces that are local to a file
Use Google style docstrings in Python for classes and functions, which can be parsed by Sphinx
Python attributes and variables can be documented inline with type and description
Avoid using reflection in Python when functionality can be easily achieved without reflection
When using try-except blocks in Python, limit the except to the smallest set of errors possible
When using try-except blocks in Python to handle multiple possible variable types (duck-typing), keep the body of the try as small as possible, using the else block for logic
Files:
tests/unittest/llmapi/apps/test_tool_parsers.pytensorrt_llm/serve/openai_server.pytensorrt_llm/serve/tool_parser/deepseekv32_parser.pytensorrt_llm/serve/tool_parser/tool_parser_factory.py
**/*.{cpp,h,cu,cuh,py}
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
All TensorRT-LLM Open Source Software code should contain an NVIDIA copyright header that includes the year of its latest meaningful modification
Files:
tests/unittest/llmapi/apps/test_tool_parsers.pytensorrt_llm/serve/openai_server.pytensorrt_llm/serve/tool_parser/deepseekv32_parser.pytensorrt_llm/serve/tool_parser/tool_parser_factory.py
🧠 Learnings (1)
📚 Learning: 2025-08-14T06:36:40.701Z
Learnt from: timlee0212
Repo: NVIDIA/TensorRT-LLM PR: 6886
File: tensorrt_llm/_torch/models/modeling_deepseekv3.py:0-0
Timestamp: 2025-08-14T06:36:40.701Z
Learning: In DeepSeek V3 model (tensorrt_llm/_torch/models/modeling_deepseekv3.py), the disagreement between AllReduce.__init__ guard and _compute_mlp_tp_size logic for MNNVL usage is expected by design. The AllReduce component and MLP TP-size computation intentionally use different criteria for MNNVL availability decisions.
Applied to files:
tensorrt_llm/serve/openai_server.py
🧬 Code graph analysis (4)
tests/unittest/llmapi/apps/test_tool_parsers.py (1)
tensorrt_llm/serve/tool_parser/deepseekv32_parser.py (3)
DeepSeekV32Parser(13-295)parse_streaming_increment(156-288)detect_and_parse(114-154)
tensorrt_llm/serve/openai_server.py (1)
tensorrt_llm/bench/benchmark/__init__.py (1)
model_type(70-71)
tensorrt_llm/serve/tool_parser/deepseekv32_parser.py (2)
tensorrt_llm/serve/openai_protocol.py (1)
ChatCompletionToolsParam(520-522)tensorrt_llm/serve/tool_parser/core_types.py (2)
StreamingParseResult(16-20)ToolCallItem(8-13)
tensorrt_llm/serve/tool_parser/tool_parser_factory.py (1)
tensorrt_llm/serve/tool_parser/deepseekv32_parser.py (1)
DeepSeekV32Parser(13-295)
🪛 Ruff (0.14.8)
tests/unittest/llmapi/apps/test_tool_parsers.py
1189-1189: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1189-1189: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1189-1189: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1189-1189: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1189-1189: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1189-1189: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1189-1189: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1189-1189: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1189-1189: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1189-1189: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1189-1189: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1189-1189: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1193-1193: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1193-1193: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1193-1193: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1193-1193: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1193-1193: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1193-1193: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1193-1193: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1193-1193: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1193-1193: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1193-1193: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1193-1193: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1193-1193: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1206-1206: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1206-1206: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1206-1206: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1206-1206: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1206-1206: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1206-1206: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1206-1206: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1206-1206: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1206-1206: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1206-1206: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1206-1206: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1206-1206: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1206-1206: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1206-1206: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1206-1206: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1206-1206: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1212-1212: Comment contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF003)
1217-1217: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1217-1217: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1217-1217: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1217-1217: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1217-1217: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1217-1217: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1217-1217: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1217-1217: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1226-1226: Possible hardcoded password assigned to argument: "parse_streaming_increment_partial_bot_token"
(S106)
1226-1226: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1226-1226: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1228-1228: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1228-1228: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1228-1228: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1228-1228: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1228-1228: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1228-1228: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1228-1228: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1228-1228: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1228-1228: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1228-1228: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1228-1228: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1228-1228: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1234-1234: Possible hardcoded password assigned to: "bot_token"
(S105)
1234-1234: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1234-1234: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1235-1235: Possible hardcoded password assigned to: "eot_token"
(S105)
1235-1235: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1235-1235: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1236-1236: Possible hardcoded password assigned to: "invoke_end_token"
(S105)
1236-1236: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1236-1236: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1242-1242: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1242-1242: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1245-1245: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1245-1245: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1249-1249: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1249-1249: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1249-1249: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1249-1249: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1252-1252: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1252-1252: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1252-1252: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1252-1252: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1261-1261: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1261-1261: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1263-1263: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1263-1263: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1266-1266: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1266-1266: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1266-1266: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1266-1266: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1268-1268: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1268-1268: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1271-1271: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1271-1271: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1274-1274: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1274-1274: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1274-1274: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1274-1274: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1277-1277: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1277-1277: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1277-1277: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1277-1277: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1290-1290: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1290-1290: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1291-1291: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1291-1291: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1292-1292: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1292-1292: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1304-1304: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1304-1304: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1310-1310: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1310-1310: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1310-1310: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1310-1310: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1310-1310: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1310-1310: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1310-1310: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1310-1310: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1310-1310: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1310-1310: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1310-1310: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
1310-1310: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
tensorrt_llm/serve/tool_parser/deepseekv32_parser.py
21-21: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
21-21: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
22-22: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
22-22: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
23-23: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
23-23: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
23-23: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
23-23: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
25-25: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
25-25: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
26-26: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
26-26: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
31-31: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
31-31: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
32-32: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
32-32: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
36-36: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
36-36: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
37-37: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
37-37: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
42-42: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
42-42: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
43-43: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
43-43: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
44-44: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
44-44: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
44-44: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
44-44: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
45-45: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
45-45: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
46-46: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
46-46: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
48-48: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
48-48: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
49-49: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
49-49: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
51-51: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
51-51: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
52-52: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
52-52: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
56-56: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
56-56: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
56-56: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
56-56: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
57-57: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
57-57: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
57-57: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
57-57: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
66-66: Possible hardcoded password assigned to: "bot_token"
(S105)
66-66: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
66-66: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
67-67: Possible hardcoded password assigned to: "eot_token"
(S105)
67-67: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
67-67: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
68-68: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
68-68: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
69-69: Possible hardcoded password assigned to: "invoke_end_token"
(S105)
69-69: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
69-69: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
71-71: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
71-71: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
71-71: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
71-71: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
84-84: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
84-84: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
84-84: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
84-84: Docstring contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF002)
130-130: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
130-130: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
130-130: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
130-130: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
140-140: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
140-140: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
140-140: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
140-140: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
151-151: Do not catch blind exception: Exception
(BLE001)
164-164: Comment contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF003)
164-164: Comment contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF003)
166-166: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
166-166: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
170-170: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
170-170: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
170-170: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
170-170: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
174-174: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
174-174: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
193-193: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
193-193: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
193-193: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
193-193: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
203-203: Comment contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF003)
203-203: Comment contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF003)
221-221: Comment contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF003)
221-221: Comment contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF003)
280-280: Comment contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF003)
280-280: Comment contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF003)
286-286: Do not catch blind exception: Exception
(BLE001)
292-292: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
292-292: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
293-293: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
293-293: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
294-294: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
294-294: String contains ambiguous | (FULLWIDTH VERTICAL LINE). Did you mean | (VERTICAL LINE)?
(RUF001)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Pre-commit Check
🔇 Additional comments (9)
tensorrt_llm/serve/tool_parser/deepseekv32_parser.py (3)
13-62: Comprehensive docstring with clear format examples.The docstring clearly documents both supported parameter formats (XML tags and direct JSON) with examples. This follows Google style docstrings and provides excellent documentation for users of this parser.
80-112: LGTM: Parameter parsing logic handles both formats correctly.The dual-format parsing (JSON first, then XML fallback) is well-implemented with appropriate error handling for the JSON parsing attempt.
290-294: LGTM: Structure info implementation is consistent.The
structure_infomethod correctly returns a lambda that generatesStructureInfowith proper DSML tags for the given function name.tensorrt_llm/serve/openai_server.py (1)
159-160: LGTM: Consistent pattern for model type configuration.The new branch for
deepseek_v32follows the same pattern as the existingkimi_k2branch, correctly settingtool_call_id_typefor the new model type.tensorrt_llm/serve/tool_parser/tool_parser_factory.py (1)
6-6: LGTM: Parser registration follows existing pattern.The import and registration are correct. Note that the key
"deepseek_v32"uses an underscore while"deepseekv3"and"deepseekv3.1"don't - this is consistent with the model type used inopenai_server.py, so it's acceptable for this PR.Also applies to: 19-19
tests/unittest/llmapi/apps/test_tool_parsers.py (4)
28-28: LGTM: Import added for new parser.
1175-1231: Comprehensive test cases following the base class pattern.The
TestDeepSeekV32Parserclass correctly extendsBaseToolParserTestClassand provides well-structured test cases covering:
- Single and multiple tool parsing
- Malformed input handling (using wrong
|character)- Direct JSON parameter format
- Undefined tool handling
The test data accurately reflects the DSML format with fullwidth vertical line characters.
1232-1255: Good streaming test coverage.The
test_initializationandtest_parse_streaming_increment_complete_tool_calltests verify the parser's state and incremental parsing behavior correctly. The test properly validates that the parser emits both the tool name and parameters as separateToolCallItementries.
1283-1316: LGTM: Structure info and format compliance tests are well-designed.The tests validate that
structure_inforeturns correct DSML tags and that the parser correctly handles the documented format structure.
|
PR_Github #29226 [ run ] triggered by Bot. Commit: |
|
PR_Github #29226 [ run ] completed with state
|
Signed-off-by: Fanrong Li <23290157+lfr-0531@users.noreply.github.com>
|
/bot run |
|
PR_Github #29284 [ run ] triggered by Bot. Commit: |
|
PR_Github #29284 [ run ] completed with state
|
Signed-off-by: Fanrong Li <23290157+lfr-0531@users.noreply.github.com>
|
/bot run |
|
PR_Github #29298 [ run ] triggered by Bot. Commit: |
|
PR_Github #29298 [ run ] completed with state
|
|
/bot run |
|
/bot run |
|
PR_Github #29318 [ run ] triggered by Bot. Commit: |
|
PR_Github #29322 [ run ] triggered by Bot. Commit: |
|
PR_Github #29318 [ run ] completed with state |
|
PR_Github #29322 [ run ] completed with state |
LinPoly
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! THX for improving tool parser.
Signed-off-by: Fanrong Li <23290157+lfr-0531@users.noreply.github.com>
Signed-off-by: Fanrong Li <23290157+lfr-0531@users.noreply.github.com>
Signed-off-by: Fanrong Li <23290157+lfr-0531@users.noreply.github.com> Signed-off-by: Daniil Kulko <kulkodaniil@gmail.com>
Summary by CodeRabbit
New Features
Tests
✏️ Tip: You can customize this high-level summary in your review settings.
Description
Features:
Dependency: #9814
Test Coverage
PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
/bot [-h] ['run', 'kill', 'skip', 'reuse-pipeline'] ...Provide a user friendly way for developers to interact with a Jenkins server.
Run
/bot [-h|--help]to print this help message.See details below for each supported subcommand.
Details
run [--reuse-test (optional)pipeline-id --disable-fail-fast --skip-test --stage-list "A10-PyTorch-1, xxx" --gpu-type "A30, H100_PCIe" --test-backend "pytorch, cpp" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" --detailed-log --debug(experimental)]Launch build/test pipelines. All previously running jobs will be killed.
--reuse-test (optional)pipeline-id(OPTIONAL) : Allow the new pipeline to reuse build artifacts and skip successful test stages from a specified pipeline or the last pipeline if no pipeline-id is indicated. If the Git commit ID has changed, this option will be always ignored. The DEFAULT behavior of the bot is to reuse build artifacts and successful test results from the last pipeline.--disable-reuse-test(OPTIONAL) : Explicitly prevent the pipeline from reusing build artifacts and skipping successful test stages from a previous pipeline. Ensure that all builds and tests are run regardless of previous successes.--disable-fail-fast(OPTIONAL) : Disable fail fast on build/tests/infra failures.--skip-test(OPTIONAL) : Skip all test stages, but still run build stages, package stages and sanity check stages. Note: Does NOT update GitHub check status.--stage-list "A10-PyTorch-1, xxx"(OPTIONAL) : Only run the specified test stages. Examples: "A10-PyTorch-1, xxx". Note: Does NOT update GitHub check status.--gpu-type "A30, H100_PCIe"(OPTIONAL) : Only run the test stages on the specified GPU types. Examples: "A30, H100_PCIe". Note: Does NOT update GitHub check status.--test-backend "pytorch, cpp"(OPTIONAL) : Skip test stages which don't match the specified backends. Only support [pytorch, cpp, tensorrt, triton]. Examples: "pytorch, cpp" (does not run test stages with tensorrt or triton backend). Note: Does NOT update GitHub pipeline status.--only-multi-gpu-test(OPTIONAL) : Only run the multi-GPU tests. Note: Does NOT update GitHub check status.--disable-multi-gpu-test(OPTIONAL) : Disable the multi-GPU tests. Note: Does NOT update GitHub check status.--add-multi-gpu-test(OPTIONAL) : Force run the multi-GPU tests in addition to running L0 pre-merge pipeline.--post-merge(OPTIONAL) : Run the L0 post-merge pipeline instead of the ordinary L0 pre-merge pipeline.--extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx"(OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Examples: --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx".--detailed-log(OPTIONAL) : Enable flushing out all logs to the Jenkins console. This will significantly increase the log volume and may slow down the job.--debug(OPTIONAL) : Experimental feature. Enable access to the CI container for debugging purpose. Note: Specify exactly one stage in thestage-listparameter to access the appropriate container environment. Note: Does NOT update GitHub check status.For guidance on mapping tests to stage names, see
docs/source/reference/ci-overview.mdand the
scripts/test_to_stage_mapping.pyhelper.kill
killKill all running builds associated with pull request.
skip
skip --comment COMMENTSkip testing for latest commit on pull request.
--comment "Reason for skipping build/test"is required. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.reuse-pipeline
reuse-pipelineReuse a previous pipeline to validate current commit. This action will also kill all currently running builds associated with the pull request. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.