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

Signed-off-by: wang.yuqi <yuqi.wang@daocloud.io>
This commit is contained in:
wang.yuqi
2026-10-13 15:08:07 +00:00
committed by GitHub
parent f395a6b1ad
commit 669f85e686
21 changed files with 2533 additions and 2375 deletions
+2 -2
View File
@@ -502,7 +502,7 @@ class CohereServingChatV2(OpenAIServingChat):
# Map every content block to a plain ``{"type": "text", "text":
# ...}`` part, mirroring the shape :meth:`_convert_user_message`
# emits for multi-part user content. vLLM's
# ``_parse_chat_message_content`` collapses a text-only tool
# ``parse_chat_message_content`` collapses a text-only tool
# part list back into ``"\n".join(...)`` on the way to the
# renderer, so simple chat templates that expect string tool
# content still work; keeping the list here just preserves the
@@ -512,7 +512,7 @@ class CohereServingChatV2(OpenAIServingChat):
# Tool message content uses ``ToolMessageV2Content``, a union of
# ``TextToolContent`` and ``DocumentToolContent``. The latter
# produces ``{"type": "document", "document": {...}}`` blocks,
# which vLLM's shared ``_parse_chat_message_content_parts`` in
# which vLLM's shared ``parse_chat_message_content_parts`` in
# ``vllm/renderers/chat_utils.py`` rejects because the OpenAI
# ``ChatCompletionContentPartParam`` union only knows text /
# image / audio / etc. Emitting them anyway triggers a Pydantic