[2/N] move responses/serving _make_response_output_items logic to parser#33281
[2/N] move responses/serving _make_response_output_items logic to parser#33281chaunceyjiang merged 19 commits intovllm-project:mainfrom
Conversation
Signed-off-by: Andrew Xia <axia@fb.com>
Signed-off-by: Andrew Xia <axia@fb.com>
Signed-off-by: Andrew Xia <axia@fb.com>
Signed-off-by: Andrew Xia <axia@fb.com>
Signed-off-by: Andrew Xia <axia@fb.com>
Signed-off-by: Andrew Xia <axia@fb.com>
There was a problem hiding this comment.
Code Review
This pull request introduces a unified Parser interface to handle both reasoning and tool parsing, consolidating logic previously spread across ReasoningParser and ToolParser. New files vllm/parser/__init__.py, vllm/parser/abstract_parser.py, vllm/parser/minimax_m2_parser.py, and vllm/parser/parser_manager.py have been added to support this new architecture. The OpenAIServing and OpenAIServingResponses classes have been updated to utilize this unified parser. While the overall goal of unifying the parsing logic is a good step towards better organization, there is a critical thread-safety concern with the _WrappedParser implementation.
|
cc @yeqcharlotte @houseroad |
|
Hi @qandrew, the pre-commit checks have failed. Please run: uv pip install pre-commit
pre-commit install
pre-commit run --all-filesThen, commit the changes and push to your branch. For future commits, Tip Is
|
|
This pull request has merge conflicts that must be resolved before it can be |
Signed-off-by: Andrew Xia <axia@fb.com>
|
Hi @qandrew, the pre-commit checks have failed. Please run: uv pip install pre-commit
pre-commit install
pre-commit run --all-filesThen, commit the changes and push to your branch. For future commits, Tip Is
|
Signed-off-by: Andrew Xia <axia@fb.com>
|
Hi @qandrew, the pre-commit checks have failed. Please run: uv pip install pre-commit
pre-commit install
pre-commit run --all-filesThen, commit the changes and push to your branch. For future commits, Tip Is
|
1 similar comment
|
Hi @qandrew, the pre-commit checks have failed. Please run: uv pip install pre-commit
pre-commit install
pre-commit run --all-filesThen, commit the changes and push to your branch. For future commits, Tip Is
|
Signed-off-by: Andrew Xia <axia@fb.com>
|
Hi @qandrew, the pre-commit checks have failed. Please run: uv pip install pre-commit
pre-commit install
pre-commit run --all-filesThen, commit the changes and push to your branch. For future commits, Tip Is
|
|
Hi @qandrew, the pre-commit checks have failed. Please run: uv pip install pre-commit
pre-commit install
pre-commit run --all-filesThen, commit the changes and push to your branch. For future commits, Tip Is
|
Signed-off-by: Andrew Xia <axia@fb.com>
vllm/parser/abstract_parser.py
Outdated
|
|
||
| # Add tool call items | ||
| if tool_calls: | ||
| for idx, tool_call in enumerate(tool_calls): |
There was a problem hiding this comment.
Keep the original comments.
There was a problem hiding this comment.
thanks for the catch, done
| return function_calls, None | ||
|
|
||
| if request.tool_choice == "required": | ||
| # Required tool calls - parse JSON |
There was a problem hiding this comment.
I remember there should be an assertion here to check that content is not None. Please keep it.
| if request.tool_choice and isinstance( | ||
| request.tool_choice, ChatCompletionNamedToolChoiceParam | ||
| ): | ||
| # Forced Function Call (Chat Completion API style) |
There was a problem hiding this comment.
I remember there should be an assertion here to check that content is not None. Please keep it.
There was a problem hiding this comment.
thanks. a lot of the code is copied from _parse_tool_calls_from_content, which is still used in the chat completions flow
I'll put in a follow up diff so chat completions can use parser also
7dceeab to
20c1e03
Compare
|
Hi @qandrew, the pre-commit checks have failed. Please run: uv pip install pre-commit
pre-commit install
pre-commit run --all-filesThen, commit the changes and push to your branch. For future commits, Tip Is
|
1 similar comment
|
Hi @qandrew, the pre-commit checks have failed. Please run: uv pip install pre-commit
pre-commit install
pre-commit run --all-filesThen, commit the changes and push to your branch. For future commits, Tip Is
|
|
Hi @qandrew, the pre-commit checks have failed. Please run: uv pip install pre-commit
pre-commit install
pre-commit run --all-filesThen, commit the changes and push to your branch. For future commits, Tip Is
|
|
Hi @qandrew, the pre-commit checks have failed. Please run: uv pip install pre-commit
pre-commit install
pre-commit run --all-filesThen, commit the changes and push to your branch. For future commits, Tip Is
|
Signed-off-by: Andrew Xia <axia@fb.com> Signed-off-by: Andrew Xia <axia@meta.com>
…ser (vllm-project#33281) Signed-off-by: Andrew Xia <axia@fb.com> Signed-off-by: Andrew Xia <axia@meta.com> Co-authored-by: Andrew Xia <axia@fb.com>
…ser (vllm-project#33281) Signed-off-by: Andrew Xia <axia@fb.com> Signed-off-by: Andrew Xia <axia@meta.com> Co-authored-by: Andrew Xia <axia@fb.com>
Purpose
as titled. by moving logic of the reasoning / tool calling into parser, each model can implement its own interpretation of how to parse. we can then migrate GPT-OSS into parser. And models that support parallel tool calling / interleaved reasoning can use the parser structure.
stacking on top of #32712, this is an implementation of #32713
Test Plan
Test Result
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.