[Misc] Use VLLMValidationError in offline inference input validation (#53432)

Signed-off-by: Jensen Chen <a1043904820@gmail.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Jensen Chen
2026-08-23 08:43:51 -07:00
committed by GitHub
co-authored by Claude Opus 5
parent b26039b09f
commit 39eba6ac36
4 changed files with 67 additions and 7 deletions
+4 -3
View File
@@ -19,6 +19,7 @@ from vllm.entrypoints.chat_utils import (
ChatCompletionMessageParam,
ChatTemplateContentFormatOption,
)
from vllm.exceptions import VLLMValidationError
from vllm.inputs import EngineInput
from vllm.logger import init_logger
from vllm.lora.request import LoRARequest
@@ -246,7 +247,7 @@ class OfflineInferenceMixin:
) -> Sequence[_P]:
if isinstance(params, Sequence):
if len(params) != num_requests:
raise ValueError(
raise VLLMValidationError(
f"The lengths of prompts ({num_requests}) "
f"and params ({len(params)}) must be the same."
)
@@ -262,7 +263,7 @@ class OfflineInferenceMixin:
) -> Sequence[LoRARequest | None]:
if isinstance(lora_request, Sequence):
if len(lora_request) != num_requests:
raise ValueError(
raise VLLMValidationError(
f"The lengths of prompts ({num_requests}) "
f"and lora_request ({len(lora_request)}) must be the same."
)
@@ -278,7 +279,7 @@ class OfflineInferenceMixin:
) -> Sequence[int]:
if priority is not None:
if len(priority) != num_requests:
raise ValueError(
raise VLLMValidationError(
f"The lengths of prompts ({num_requests}) "
f"and priority ({len(priority)}) must be the same."
)