执行摘要
补全批量聊天请求缺少的请求扩展字段
PR 描述指出:批量聊天补全会将每次对话转换为普通 ChatCompletionRequest,但 BatchChatCompletionRequest 没有显式声明普通补全已支持的几个请求扩展字段,导致功能缺失。具体可通过模型字段查询验证。
变更简洁、安全,可以直接合并,无需深度精读。但对理解 vLLM 批量请求与单请求的字段对齐策略有一定参考价值。
无 reviewer 讨论。
PR 描述指出:批量聊天补全会将每次对话转换为普通 ChatCompletionRequest,但 BatchChatCompletionRequest 没有显式声明普通补全已支持的几个请求扩展字段,导致功能缺失。具体可通过模型字段查询验证。
变更简洁、安全,可以直接合并,无需深度精读。但对理解 vLLM 批量请求与单请求的字段对齐策略有一定参考价值。
无 reviewer 讨论。
protocol.py):在 BatchChatCompletionRequest 类的字段定义区(# vLLM extensions 段落后)新增四个字段 —— media_io_kwargs、mm_processor_kwargs、priority、cache_salt,默认值分别取 None、None、0、None,与 ChatCompletionRequest 中的定义对齐。batch_serving.py):将 create_batch_chat_completion 方法中传递给 engine_client.generate 的 priority=request.priority if hasattr(request, "priority") else 0 简化为 priority=request.priority,因为现在字段已稳定存在。| 文件 | 模块 | 状态 | 重要度 |
|---|---|---|---|
vllm/entrypoints/openai/chat_completion/protocol.py |
协议定义 | modified | 5.07 |
vllm/entrypoints/openai/chat_completion/batch_serving.py |
服务逻辑 | modified | 4.66 |
vllm/entrypoints/openai/chat_completion/protocol.py
core-logic
核心变更文件:在 `BatchChatCompletionRequest` 模型中新增四个请求扩展字段,与 `ChatCompletionRequest` 对齐。
# file: vllm/entrypoints/openai/chat_completion/protocol.py
# 在 BatchChatCompletionRequest 类中新增以下字段,置于 # vLLM extensions 下方
media_io_kwargs: dict[str, dict[str, Any]] | None = None
mm_processor_kwargs: dict[str, Any] | None = None
priority: int = Field(default=0, ge=_INT64_MIN, le=_INT64_MAX)
cache_salt: str | None = None
当前评论区没有形成足够清晰的争议点或结论,后续有更多讨论时会体现在这里。
风险极低:仅新增可选字段,默认值均为 None 或 0,完全向后兼容;业务层改动仅为移除 hasattr 回退逻辑,功能行为不变。
影响范围小,仅涉及批量聊天补全 API 的入参模型。用户现可直接在批量请求中设置 media_io_kwargs、mm_processor_kwargs、priority、cache_salt,无需手动转为单请求再拼装。
当前没有检测到明确关联的 Issue 链接,后续同步到相关引用后会出现在这里。
参与讨论