@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 405f28d38d
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 7, 14:00 UTC

[Misc] Clean up ResponsesRequest model validators (#35531)

Signed-off-by: umut-polat <52835619+umut-polat@users.noreply.github.com>

Umut Polat committed Feb 28, 2026 at 04:19 UTC 405f28d38df2ea4f320635c6e87e206b3ccbea2f
1 file changed +14 -5
vllm/entrypoints/openai/responses/protocol.py
+14 -5
@@ -328,8 +328,9 @@ class ResponsesRequest(OpenAIBaseModel):
328 # Also check text.format for OpenAI-style json_schema
329 if self.text is not None and self.text.format is not None:
330 if structured_outputs is not None:
331 - raise ValueError(
332 - "Cannot specify both structured_outputs and text.format"
331 + raise VLLMValidationError(
332 + "Cannot specify both structured_outputs and text.format",
333 + parameter="structured_outputs",
334 )
335 response_format = self.text.format
336 if (
@@ -378,14 +379,19 @@ class ResponsesRequest(OpenAIBaseModel):
379 )
380
381 @model_validator(mode="before")
382 + @classmethod
383 def validate_background(cls, data):
384 if not data.get("background"):
385 return data
386 if not data.get("store", True):
385 - raise ValueError("background can only be used when `store` is true")
387 + raise VLLMValidationError(
388 + "background can only be used when `store` is true",
389 + parameter="background",
390 + )
391 return data
392
393 @model_validator(mode="before")
394 + @classmethod
395 def validate_prompt(cls, data):
396 if data.get("prompt") is not None:
397 raise VLLMValidationError(
@@ -394,16 +400,19 @@ class ResponsesRequest(OpenAIBaseModel):
400 return data
401
402 @model_validator(mode="before")
403 + @classmethod
404 def check_cache_salt_support(cls, data):
405 if data.get("cache_salt") is not None and (
406 not isinstance(data["cache_salt"], str) or not data["cache_salt"]
407 ):
401 - raise ValueError(
402 - "Parameter 'cache_salt' must be a non-empty string if provided."
408 + raise VLLMValidationError(
409 + "Parameter 'cache_salt' must be a non-empty string if provided.",
410 + parameter="cache_salt",
411 )
412 return data
413
414 @model_validator(mode="before")
415 + @classmethod
416 def function_call_parsing(cls, data):
417 """Parse function_call dictionaries into ResponseFunctionToolCall objects.
418 This ensures Pydantic can properly resolve union types in the input field.