Skip to content

[Misc] Use VLLMValidationError consistently in ResponsesRequest#35532

Closed
umut-polat wants to merge 2 commits intovllm-project:mainfrom
umut-polat:fix/responses-validation-error-consistency
Closed

[Misc] Use VLLMValidationError consistently in ResponsesRequest#35532
umut-polat wants to merge 2 commits intovllm-project:mainfrom
umut-polat:fix/responses-validation-error-consistency

Conversation

@umut-polat
Copy link
Copy Markdown
Contributor

Replace bare ValueError with VLLMValidationError in three validation points in ResponsesRequest:

  • validate_background: missing parameter="background"
  • check_cache_salt_support: missing parameter="cache_salt"
  • to_sampling_params (structured_outputs vs text.format conflict): missing parameter="structured_outputs"

The completion and chat_completion protocols already use VLLMValidationError consistently. Since VLLMValidationError extends ValueError, this is backward compatible — but now clients get the parameter name in the error response for easier debugging.

The four model validators on ResponsesRequest (validate_background,
validate_prompt, check_cache_salt_support, function_call_parsing) were
missing the @classmethod decorator. All other model validators in the
codebase (completion, chat_completion protocols) use @classmethod
with @model_validator(mode='before') for consistency.

Signed-off-by: umut-polat <52835619+umut-polat@users.noreply.github.com>
Replace bare ValueError with VLLMValidationError in three places in
ResponsesRequest for consistency with the completion and chat_completion
protocols. VLLMValidationError includes the parameter name, giving
clients more actionable 400 responses.

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

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors error handling in ResponsesRequest to consistently use VLLMValidationError instead of ValueError. This change enhances error responses by including the name of the invalid parameter, which aids in debugging. Additionally, @classmethod decorators have been correctly applied to several Pydantic model validators. The changes are implemented as described and appear correct.

@mergify mergify bot added the frontend label Feb 27, 2026
@DarkLight1337
Copy link
Copy Markdown
Member

Please combine this PR with #35531

@umut-polat
Copy link
Copy Markdown
Contributor Author

combined into #35531 per feedback

@umut-polat umut-polat closed this Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants