[Misc] Use VLLMValidationError consistently in ResponsesRequest#35532
Closed
umut-polat wants to merge 2 commits intovllm-project:mainfrom
Closed
[Misc] Use VLLMValidationError consistently in ResponsesRequest#35532umut-polat wants to merge 2 commits intovllm-project:mainfrom
umut-polat wants to merge 2 commits intovllm-project:mainfrom
Conversation
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>
Contributor
There was a problem hiding this comment.
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.
Member
|
Please combine this PR with #35531 |
Contributor
Author
|
combined into #35531 per feedback |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace bare
ValueErrorwithVLLMValidationErrorin three validation points inResponsesRequest:validate_background: missingparameter="background"check_cache_salt_support: missingparameter="cache_salt"to_sampling_params(structured_outputs vs text.format conflict): missingparameter="structured_outputs"The completion and chat_completion protocols already use
VLLMValidationErrorconsistently. SinceVLLMValidationErrorextendsValueError, this is backward compatible — but now clients get the parameter name in the error response for easier debugging.