Skip to content

[Misc] Break chat_utils into more maintainable modules. - #60972

Merged
DarkLight1337 merged 34 commits into
vllm-project:mainfrom
noooop:split_chat_utils
Oct 13, 2026
Merged

DarkLight1337 merged 34 commits into
vllm-project:mainfrom
noooop:split_chat_utils

Conversation

@noooop

@noooop noooop commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Overview

[Misc] Break chat_utils into more maintainable modules.

#60522 (review)

Claims

Validation

Details


Pull Request Checklist
  • I used vLLM's /pr-checklist skill. (Mandatory for agents, optional for humans).

  • AI assistance was used during the creation of this PR.

  • Design Fit: Minimizes impact on core components, reuses existing functionality, and justifies added complexity.

  • Testing and Validation: Validates the change and ensures any added tests are meaningful and reliable, with CI coverage or documented CI resource constraints and validation performed outside CI.

  • Code Quality and Style: Keeps code and comments clear and concise, and updates relevant documentation and examples.

  • Pull Request Contents: Includes a brief summary and relevant links, supports claims with evidence, explains root causes and implementation trade-offs, and follows the contributing guide.

Signed-off-by: wang.yuqi <yuqi.wang@daocloud.io>
Signed-off-by: wang.yuqi <yuqi.wang@daocloud.io>
Signed-off-by: wang.yuqi <yuqi.wang@daocloud.io>
Signed-off-by: wang.yuqi <yuqi.wang@daocloud.io>
Signed-off-by: wang.yuqi <yuqi.wang@daocloud.io>
Signed-off-by: wang.yuqi <yuqi.wang@daocloud.io>
@mergify mergify Bot added the multi-modality Related to multi-modality (#4194) label Oct 12, 2026
Signed-off-by: wang.yuqi <yuqi.wang@daocloud.io>
Signed-off-by: wang.yuqi <yuqi.wang@daocloud.io>
Signed-off-by: wang.yuqi <yuqi.wang@daocloud.io>
Signed-off-by: wang.yuqi <yuqi.wang@daocloud.io>
@mergify mergify Bot added the cohere Related to Cohere models label Oct 12, 2026
Signed-off-by: wang.yuqi <yuqi.wang@daocloud.io>
Signed-off-by: wang.yuqi <yuqi.wang@daocloud.io>
Signed-off-by: wang.yuqi <yuqi.wang@daocloud.io>
Signed-off-by: wang.yuqi <yuqi.wang@daocloud.io>
Signed-off-by: wang.yuqi <yuqi.wang@daocloud.io>
Signed-off-by: wang.yuqi <yuqi.wang@daocloud.io>
@noooop
noooop marked this pull request as ready for review October 12, 2026 07:38
@noooop
noooop requested a review from DarkLight1337 October 13, 2026 09:06
Comment thread vllm/renderers/chat_utils/__init__.py Resolved
@DarkLight1337
DarkLight1337 enabled auto-merge (squash) October 13, 2026 09:22
@DarkLight1337

Copy link
Copy Markdown
Member

/ci run

@github-actions github-actions Bot added the ready ONLY add when PR is ready to merge/full CI is needed label Oct 13, 2026
@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #94432 for commit a459682447d9.

@mergify

mergify Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @noooop.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase label Oct 13, 2026
Signed-off-by: wang.yuqi <yuqi.wang@daocloud.io>
@mergify mergify Bot removed the needs-rebase label Oct 13, 2026
Signed-off-by: wang.yuqi <yuqi.wang@daocloud.io>
@noooop

noooop commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

@claude review

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nothing blocking. The comments below are optional suggestions. There is no need to push a fix for them before merging.

LGTM. The issues raised in earlier review rounds on this PR have since been fixed: ChatTemplateResolutionError is now a VLLMClientError subclass (correct 4xx mapping instead of the earlier 5xx regression), and chat_utils/__init__.py builds __all__ as a new list ([*all_types, ...]) rather than mutating types.__all__ in place. The remaining finding on this run is a stale docstring reference, not a functional issue.

Extended reasoning...

Verified in the current HEAD that vllm/exceptions.py:65 defines ChatTemplateResolutionError as a VLLMClientError (fixing the earlier 500-vs-400 regression I flagged), and vllm/renderers/chat_utils/init.py:26-41 now constructs all via [*all_types, ...] instead of mutating types.py's own all list in place (fixing the other earlier finding). The only remaining open item — missing re-export of AudioURL/VideoURL/MultiModalContentParser from the package — was discussed directly with DarkLight1337 (a maintainer, independent non-author) on the exact init.py:24 thread, which was resolved by that non-author and followed by their APPROVED review, so it reads as a reviewed-and-accepted tradeoff rather than an open objection. The change is a large but mechanical file-split refactor with renames and one exception-hierarchy relocation; no new security-sensitive surface (auth/crypto/permissions) is touched. This run's only new finding is a minor stale-docstring nit in vllm/entrypoints/cohere/serving.py, not something that should block merge.

Additional findings (outside the current diff — GitHub can't attach inline comments there):

  • 🟡 vllm/entrypoints/cohere/serving.py — nit: stale comment still names the old private helper and file. Line 514 says vLLM's shared _parse_chat_message_content_parts in vllm/renderers/chat_utils.py rejects document blocks, but that function was renamed to parse_chat_message_content_parts and chat_utils.py was split into the vllm/renderers/chat_utils/ package. Fix: update this comment to the new public name and package path, matching the one already fixed three lines above at serving.py:505.

    Why this was flagged

    vllm/entrypoints/cohere/serving.py:514-515 references _parse_chat_message_content_parts in vllm/renderers/chat_utils.py, neither of which exists post-refactor (renamed to parse_chat_message_content_parts, moved into vllm/renderers/chat_utils/content_parser.py). A maintainer reading this docstring while debugging tool-message content handling is pointed at a nonexistent symbol/path, unlike serving.py:505 a few lines above which was correctly updated in the same diff. No functional effect, documentation only.

    Verification: nit: serving.py:515-516 still reads "vLLM's shared _parse_chat_message_content_parts in vllm/renderers/chat_utils.py rejects" — both the private name and the monolithic file path are stale post-refactor. The function was renamed to the public parse_chat_message_content_parts and chat_utils.py was split into the vllm/renderers/chat_utils/ package.

@noooop

noooop commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #94477 for commit e4edbf72aef8.

Signed-off-by: wang.yuqi <yuqi.wang@daocloud.io>
@noooop

noooop commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #94480 for commit 70aee4777767.

@DarkLight1337
DarkLight1337 merged commit 669f85e into vllm-project:main Oct 13, 2026
117 checks passed
@noooop
noooop deleted the split_chat_utils branch October 13, 2026 15:23
ExtReMLapin added a commit to ExtReMLapin/vllm that referenced this pull request Oct 14, 2026
Resolve conflict with the chat_utils split (vllm-project#60972): move
normalize_reasoning_content into vllm/renderers/chat_utils/chat_message.py
next to has_non_text_content and export it from the package.

Signed-off-by: ExtReMLapin <3909752+ExtReMLapin@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fhutqf6Gos9LrhuBD6UCJv
@noooop noooop mentioned this pull request Oct 15, 2026
6 tasks
AndreasKaratzas pushed a commit to AndreasKaratzas/vllm that referenced this pull request Oct 16, 2026
…#60972)

Signed-off-by: wang.yuqi <yuqi.wang@daocloud.io>

Signed-off-by: Andreas Karatzas <AndreasKaratzas@users.noreply.github.com>
michael-gpu pushed a commit to practical-inference/vllm-ampere-extended that referenced this pull request Oct 20, 2026
wthrbtn added a commit to air-gapped/skills that referenced this pull request Nov 10, 2026
…is a package, ChatTemplateResolutionError in vllm/exceptions.py

Classification: version-drift (moved paths and symbols)
Source: vllm-project/vllm#60972 (commit 669f85e686, first in v0.33.0)
Source: vllm-project/vllm#62390 (commit 5caabdbb65, first in v0.33.0)
Before: SKILL.md cited vllm/renderers/chat_utils.py and _get_full_multimodal_text_prompt();
        debugging.md labelled five validation errors ValueError.
After:  vllm/renderers/chat_utils/{chat_template,chat_message,content_parser}.py,
        get_full_multimodal_text_prompt(), vllm/exceptions.py; the five errors raise
        VLLMValidationError (read at the v0.33.0 tag; the path-like one already did at
        v0.32.0). sources.md carries the v0.33.0 line anchors.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cohere Related to Cohere models frontend multi-modality Related to multi-modality (#4194) pooling 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.

2 participants