[Frontend] Replace return_mm_kwargs with an mm_payload enum on render requests (#61427)

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
This commit is contained in:
Martin Hickey
2026-10-15 12:41:46 +00:00
committed by GitHub
parent c6b772cf6b
commit 252be28c18
9 changed files with 171 additions and 44 deletions
@@ -24,11 +24,13 @@ from vllm.entrypoints.generate.base.protocol import (
DeltaMessage,
FunctionCall,
FunctionDefinition,
MMPayload,
PerRequestMetrics,
StopParam,
StreamOptions,
ToolCall,
TopLogprobsParam,
resolve_return_mm_kwargs_alias,
structured_outputs_from_response_format,
validate_cache_salt,
validate_structural_tag_response_format,
@@ -458,15 +460,25 @@ class ChatCompletionRequest(OpenAIBaseModel):
),
)
return_mm_kwargs: bool = Field(
default=True,
mm_payload: MMPayload = Field(
default="tensors",
description=(
"If false, the render response's `features` set `kwargs_data` "
"and `mm_metadata` to null, for callers that need only the token "
"layout and item hashes, such as cache-aware routers. Do not send "
"such a response to `/inference/v1/generate`, which reads a null "
"`kwargs_data` as every item being cached. Only supported on the "
"render endpoints; ignored on regular generation endpoints."
"What the render response's `features` carry for multimodal "
"items. 'tensors' serializes the processed tensors into "
"`kwargs_data` and `mm_metadata`. 'none' sets both to null for "
"callers that need only the token layout and item hashes, such as "
"cache-aware routers. Do not send a 'none' response to "
"`/inference/v1/generate` which reads a null `kwargs_data` as "
"every item being cached. Only supported on the render endpoints. "
"Ignored on regular generation endpoints."
),
)
return_mm_kwargs: bool | None = Field(
default=None,
deprecated="return_mm_kwargs is deprecated in favor of the mm_payload field",
description=(
"Deprecated alias: false is the same as `mm_payload='none'`. "
"Ignored when `mm_payload` is set."
),
)
@@ -526,6 +538,11 @@ class ChatCompletionRequest(OpenAIBaseModel):
# --8<-- [end:chat-completion-extra-params]
@model_validator(mode="before")
@classmethod
def apply_return_mm_kwargs_alias(cls, data: Any) -> Any:
return resolve_return_mm_kwargs_alias(data)
@model_validator(mode="before")
@classmethod
def check_cache_salt_support(cls, data: Any) -> Any: