[Misc] Use VLLMValidationError consistently in SamplingParams._verify_args#35664
[Misc] Use VLLMValidationError consistently in SamplingParams._verify_args#35664umut-polat wants to merge 1 commit intovllm-project:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request correctly refactors the validation logic in SamplingParams._verify_args to consistently use VLLMValidationError. This change improves structured error reporting for API clients. The implementation is accurate and aligns with the pull request's goal. For future work, you might consider extending this refactoring to other validation methods within the SamplingParams class (e.g., _verify_greedy_sampling, _validate_spec_decode) to achieve full consistency.
|
Hi @umut-polat, the pre-commit checks have failed. Please run: uv pip install pre-commit
pre-commit install
pre-commit run --all-filesThen, commit the changes and push to your branch. For future commits, Tip Is
|
354e339 to
7301905
Compare
129a654 to
31bae87
Compare
|
Hi @umut-polat, the pre-commit checks have failed. Please run: uv pip install pre-commit
pre-commit install
pre-commit run --all-filesThen, commit the changes and push to your branch. For future commits, Tip Is
|
31bae87 to
988884b
Compare
some parameter checks in _verify_args raised plain ValueError or TypeError while others already used VLLMValidationError. the custom exception carries parameter name and value which the api layer uses to build structured error responses for clients. migrated all remaining ValueError/TypeError raises in _verify_args to VLLMValidationError with appropriate parameter and value kwargs. no changes to error message text or validation logic. Signed-off-by: Umut Polat <52835619+umut-polat@users.noreply.github.com> Signed-off-by: umut-polat <52835619+umut-polat@users.noreply.github.com>
988884b to
cc67c0e
Compare
some parameter checks in
_verify_argsraised plainValueErrororTypeErrorwhile others already usedVLLMValidationError. the custom exception carriesparameterandvaluewhich the api layer uses to build structured error responses for clients.migrated all remaining
ValueError/TypeErrorraises in_verify_argstoVLLMValidationErrorwith appropriateparameterandvaluekwargs:n(type check + range)presence_penaltyfrequency_penaltyrepetition_penaltytop_k(range + type check)min_pmin_tokens(range + max_tokens comparison)stop_token_idsstop(empty string + detokenize)no changes to error message text or validation logic.