Skip to content

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

Merged
chaunceyjiang merged 2 commits intovllm-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 intovllm-project:mainfrom
qandrew:token_ids_parser

Conversation

@qandrew
Copy link
Copy Markdown
Contributor

@qandrew qandrew commented Mar 16, 2026

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
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

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.

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
Copy link
Copy Markdown
Contributor Author

qandrew commented Mar 16, 2026

cc @chaunceyjiang @sfeng33 please take a look :)

@mergify
Copy link
Copy Markdown

mergify bot commented Mar 16, 2026

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
Copy link
Copy Markdown
Collaborator

@chaunceyjiang chaunceyjiang left a comment

Choose a reason for hiding this comment

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

LGTM

/cc @sfeng33

Copy link
Copy Markdown
Contributor

@sfeng33 sfeng33 left a comment

Choose a reason for hiding this comment

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

LGTM

@qandrew
Copy link
Copy Markdown
Contributor Author

qandrew commented Mar 17, 2026

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
Copy link
Copy Markdown
Collaborator

@chaunceyjiang chaunceyjiang left a comment

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
fxdawnn pushed a commit to fxdawnn/vllm that referenced this pull request Mar 19, 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
Monishver11 pushed a commit to Monishver11/vllm that referenced this pull request Mar 27, 2026
…llm-project#37130)

Signed-off-by: Andrew Xia <axia@meta.com>
Signed-off-by: Monishver Chandrasekaran <monishverchandrasekaran@gmail.com>
JiantaoXu pushed a commit to JiantaoXu/vllm that referenced this pull request Mar 28, 2026
vrdn-23 pushed a commit to vrdn-23/vllm that referenced this pull request Mar 30, 2026
…llm-project#37130)

Signed-off-by: Andrew Xia <axia@meta.com>
Signed-off-by: Vinay Damodaran <vrdn@hey.com>
EricccYang pushed a commit to EricccYang/vllm that referenced this pull request Apr 1, 2026
…llm-project#37130)

Signed-off-by: Andrew Xia <axia@meta.com>
Signed-off-by: EricccYang <yangyang4991@gmail.com>
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