[Pooling] Use semantic task validation errors (#52867)
Signed-off-by: Taneem Ibrahim <taneem.ibrahim@gmail.com>
Taneem Ibrahim committed
Aug 19, 2026 at 02:21 UTC
842dd8fd96650063e1ad32e6075742d457d39773
1 file changed
+13
-7
vllm/entrypoints/pooling/pooling/serving.py
+13
-7
@@ -5,6 +5,7 @@ from typing import cast
5
from fastapi.responses import JSONResponse, Response, StreamingResponse
6
from typing_extensions import assert_never
7
8
+from vllm.exceptions import VLLMValidationError
9
from vllm.logger import init_logger
10
from vllm.outputs import PoolingRequestOutput
11
from vllm.tasks import SupportedTask
@@ -60,7 +61,9 @@ class ServingPooling(PoolingBaseServing):
61
62
def _verify_pooling_task(self, request: PoolingRequest) -> str:
63
if getattr(request, "dimensions", None) is not None:
63
- raise ValueError("dimensions is currently not supported")
64
+ raise VLLMValidationError(
65
+ "dimensions is currently not supported", parameter="dimensions"
66
+ )
67
68
if request.task is None:
69
request.task = self.pooling_task
@@ -74,22 +77,25 @@ class ServingPooling(PoolingBaseServing):
77
# plugin task uses io_processor.parse_request to verify inputs
78
if pooling_task != "plugin" and pooling_task != self.pooling_task:
79
if pooling_task not in self.supported_tasks:
77
- raise ValueError(
80
+ raise VLLMValidationError(
81
f"Unsupported task: {pooling_task!r} "
79
- f"Supported tasks: {self.supported_tasks}"
82
+ f"Supported tasks: {self.supported_tasks}",
83
+ parameter="task",
84
)
85
else:
82
- raise ValueError(
86
+ raise VLLMValidationError(
87
"Try switching the model's pooling_task "
84
- f"via --pooler-config.task {request.task}."
88
+ f"via --pooler-config.task {request.task}.",
89
+ parameter="task",
90
)
91
92
if pooling_task == "plugin" and "plugin" not in self.io_processors:
88
- raise ValueError(
93
+ raise VLLMValidationError(
94
"No IOProcessor plugin installed. Please refer "
95
"to the documentation and to the "
96
"'prithvi_geospatial_mae_io_processor' "
92
- "offline inference example for more details."
97
+ "offline inference example for more details.",
98
+ parameter="task",
99
)
100
101
return pooling_task