Conversation
|
👋 Hi! Thank you for contributing to the vLLM project. 💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels. Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run You ask your reviewers to trigger select CI tests on top of Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging. To run CI, PR reviewers can either: Add If you have any questions, please reach out to us on Slack at https://slack.vllm.ai. 🚀 |
There was a problem hiding this comment.
Code Review
This pull request introduces a tool parser for the Olmo 3 model, which uses a Pythonic function call format wrapped in XML-like tags. The implementation is accompanied by a comprehensive set of tests. My review focuses on the correctness and maintainability of the new parser. I've identified a few issues related to how the XML tags are removed, which could lead to incorrect parsing of tool calls. Additionally, there's significant code duplication from an existing parser, which could pose future maintenance challenges. I've provided suggestions to address these points.
|
|
||
|
|
||
| @ToolParserManager.register_module("olmo3") | ||
| class Olmo3PythonicToolParser(ToolParser): |
There was a problem hiding this comment.
This class duplicates a significant amount of code from PythonicToolParser. This creates a maintenance burden, as changes in one parser may need to be manually synchronized with the other. To improve maintainability, consider refactoring to share code. One approach is to have Olmo3PythonicToolParser inherit from PythonicToolParser and override specific methods. The differences in helper functions like _get_parameter_value could be handled by making them methods of the class, allowing them to be overridden as well.
| # Remove xml tags. | ||
| model_output = ( | ||
| model_output.replace("<function_calls>", "").replace("</function_calls>", "").strip() | ||
| ) |
There was a problem hiding this comment.
Using str.replace() to remove the <function_calls> tags is not safe. If the tag strings appear inside a function argument (e.g., as part of a string literal), replace() will incorrectly remove them, corrupting the tool call data. It's safer to use a regular expression to extract only the content between the outermost tags.
| # Remove xml tags. | |
| model_output = ( | |
| model_output.replace("<function_calls>", "").replace("</function_calls>", "").strip() | |
| ) | |
| # Extract content from within <function_calls> tags. | |
| match = re.search(r"<function_calls>(.*?)</function_calls>", | |
| model_output, re.DOTALL) | |
| if match: | |
| model_output = match.group(1).strip() |
| if current_text.endswith("</function_calls>"): | ||
| current_text = current_text[:current_text. | ||
| rfind("</function_calls>")] |
There was a problem hiding this comment.
Using rfind to remove the closing </function_calls> tag is unsafe. If the tag string appears within a function's string argument, rfind could find the wrong occurrence and truncate the text incorrectly. Since this is for streaming and the closing tag is expected at the very end of the complete tool call block, you can safely remove it by slicing from the end of the string.
if current_text.endswith("</function_calls>"):
current_text = current_text[:-len("</function_calls>")]Signed-off-by: Pradeep Dasigi <pradeepd@allenai.org>
…air (vllm-project#25733) Signed-off-by: yiting.jiang <yiting.jiang@daocloud.io>
…idden performance regressions (vllm-project#25738) Signed-off-by: Andrew Sansom <andrew@protopia.ai>
… is enabled (vllm-project#25739) Signed-off-by: Andrew Sansom <andrew@protopia.ai>
vllm-project#25703) Signed-off-by: xaguilar <Xavier.AguilarFruto@amd.com>
…ct#25744) Signed-off-by: Iceber Gu <caiwei95@hotmail.com>
…a stride bug in causal_conv_1d. (vllm-project#25743) Signed-off-by: Tao He <linzhu.ht@alibaba-inc.com>
…#25555) Signed-off-by: Icey <1790571317@qq.com>
Signed-off-by: zxw <1020938856@qq.com>
…vllm-project#25698) Signed-off-by: Sage Moore <sage@neuralmagic.com> Co-authored-by: Robert Shaw <114415538+robertgshaw2-redhat@users.noreply.github.com>
Signed-off-by: 许文卿 <xwq391974@alibaba-inc.com>
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: Chih-Chieh-Yang <7364402+cyang49@users.noreply.github.com> Co-authored-by: RishiAstra <40644327+RishiAstra@users.noreply.github.com>
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
Signed-off-by: wang.yuqi <noooop@126.com> Co-authored-by: Cyrus Leung <tlleungac@connect.ust.hk>
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
…llm-project#25455) Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn>
…`dbo_prefill_token_threshold`) (vllm-project#25622) Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com>
Purpose
This PR adds a tool parser for parsing the function calls made by the Olmo 3 model. Support for the model has already been merged (#24534). Olmo 3 outputs function calls in the following format
This format is similar to the one that the existing Pythonic parser expects except for the presence of xml tags and function calls being delimited by newline characters instead of being represented as a list within brackets.
Test Plan
This PR also includes tests. Existing tests have not been modified or will be impacted.
Test Result
Output:
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.