Skip to content

[responsesAPI] parser.extract_response_outputs can take in token IDs - #37130

Merged
chaunceyjiang merged 2 commits into
vllm-project:mainfrom
qandrew:token_ids_parser
Mar 18, 2026
Merged

[responsesAPI] parser.extract_response_outputs can take in token IDs#37130
chaunceyjiang merged 2 commits into
vllm-project:mainfrom
qandrew:token_ids_parser

Conversation

@qandrew

@qandrew qandrew commented Mar 16, 2026

Copy link
Copy Markdown
Contributor

Purpose

This will be needed when we move harmony into parser (https://github.com/vllm-project/vllm/blob/main/vllm/entrypoints/openai/responses/context.py#L865), or any other model that wishes to parse based on token_id instead of str.

See #32713 for more context

Test Plan

Test Result

no functional changes in this PR

Signed-off-by: Andrew Xia <axia@meta.com>
@mergify mergify Bot added the frontend label Mar 16, 2026

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request updates the extract_response_outputs method in the parser to accept token IDs in addition to the model output string. However, the implementation in DelegatingParser does not yet utilize these token IDs for parsing, which is a critical oversight. My review includes a comment to address this.

Comment thread vllm/parser/abstract_parser.py Outdated
self,
*,
model_output: str,
model_output_token_ids: list[int],

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.

critical

The model_output_token_ids parameter is introduced in the method signature but remains unused within the implementation. The parsing logic, including self.extract_reasoning and self._parse_tool_calls, continues to rely solely on the string-based model_output. To enable more robust token-based parsing, this parameter should be utilized by the underlying parsing methods.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ignore

@qandrew
qandrew marked this pull request as ready for review March 16, 2026 04:18
@qandrew

qandrew commented Mar 16, 2026

Copy link
Copy Markdown
Contributor Author

cc @chaunceyjiang @sfeng33 please take a look :)

@mergify

mergify Bot commented Mar 16, 2026

Copy link
Copy Markdown
Contributor

Hi @qandrew, the pre-commit checks have failed. Please run:

uv pip install pre-commit
pre-commit install
pre-commit run --all-files

Then, commit the changes and push to your branch.

For future commits, pre-commit will run automatically on changed files before each commit.

Tip

Is mypy failing?
mypy is run differently in CI. If the failure is related to this check, please use the following command to run it locally:
# For mypy (substitute "3.10" with the failing version if needed)
pre-commit run --hook-stage manual mypy-3.10

Signed-off-by: Andrew Xia <axia@meta.com>
@qandrew qandrew changed the title [responsesAPI] parser can take in token IDs [responsesAPI] parser.extract_response_outputs can take in token IDs Mar 16, 2026

@chaunceyjiang chaunceyjiang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

/cc @sfeng33

@sfeng33 sfeng33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@qandrew

qandrew commented Mar 17, 2026

Copy link
Copy Markdown
Contributor Author

thanks, @chaunceyjiang would you mind approving / applying "ready" tag?

@qandrew
qandrew requested a review from chaunceyjiang March 17, 2026 16:17
@chaunceyjiang chaunceyjiang added the ready ONLY add when PR is ready to merge/full CI is needed label Mar 18, 2026
@chaunceyjiang
chaunceyjiang enabled auto-merge (squash) March 18, 2026 03:44

@chaunceyjiang chaunceyjiang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks~

@chaunceyjiang
chaunceyjiang merged commit 0e95916 into vllm-project:main Mar 18, 2026
50 of 51 checks passed
wendyliu235 pushed a commit to wendyliu235/vllm-public that referenced this pull request Mar 18, 2026
SouthWest7 pushed a commit to SouthWest7/vllm that referenced this pull request Mar 27, 2026
khairulkabir1661 pushed a commit to khairulkabir1661/vllm that referenced this pull request Mar 27, 2026
JiantaoXu pushed a commit to JiantaoXu/vllm that referenced this pull request Mar 28, 2026
mtparet pushed a commit to blackfuel-ai/vllm that referenced this pull request Apr 9, 2026
mystous pushed a commit to mystous/vllm_hybrid that referenced this pull request May 10, 2026
my-other-github-account pushed a commit to my-other-github-account/vllm that referenced this pull request May 15, 2026
my-other-github-account pushed a commit to my-other-github-account/vllm that referenced this pull request May 15, 2026
0826joyce pushed a commit to 0826joyce/vllm-serving-optimization that referenced this pull request May 19, 2026
mvanhorn pushed a commit to mvanhorn/vllm that referenced this pull request Jun 4, 2026
…llm-project#37130)

Signed-off-by: Andrew Xia <axia@meta.com>
Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
plasticchris pushed a commit to plasticchris/vllm that referenced this pull request Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend ready ONLY add when PR is ready to merge/full CI is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants