Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions components/src/dynamo/vllm/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3479,7 +3479,11 @@ async def generate(self, request, context):
routing = request.get("routing") or {}
if self._first_token_source is not None:
self._first_token_source.bind(context, routing.get("dp_rank"))
self._multimodal_request_processor.validate_multimodal_request(request)
try:
self._multimodal_request_processor.validate_multimodal_request(request)
except ValueError as exc:
logger.error(f"Request {request_id}: {exc}")
raise InvalidArgument(str(exc)) from exc
first_token = True
first_token_output_seen = False
with time_and_log_code_section(
Expand Down Expand Up @@ -4039,12 +4043,7 @@ async def generate(self, request, context):
self._multimodal_request_processor.validate_multimodal_request(request)
except ValueError as exc:
logger.error("Request %s: %s", request_id, exc)
yield {
"status": "error",
"message": str(exc),
"disaggregated_params": None,
}
return
raise InvalidArgument(str(exc)) from exc

# Token-in-token-out mode: internal protocol format
with time_and_log_code_section(f"[PREFILL] request: {request_id} generate"):
Expand Down
15 changes: 5 additions & 10 deletions components/src/dynamo/vllm/tests/test_vllm_worker_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ async def test_text_mode_rejects_multimodal_input_when_disabled(
handler.use_vllm_tokenizer = True
handler._multimodal_request_processor.enable_multimodal = False

with pytest.raises(ValueError, match="--enable-multimodal"):
with pytest.raises(mod.InvalidArgument, match="--enable-multimodal"):
async for _ in handler.generate(request_payload, MagicMock()):
pass

Expand Down Expand Up @@ -984,7 +984,7 @@ async def test_prefill_delegates_mode_policy_to_shared_processor():


@pytest.mark.asyncio
async def test_prefill_returns_structured_error_when_multimodal_is_disabled():
async def test_prefill_raises_typed_error_when_multimodal_is_disabled():
handler = mod.PrefillWorkerHandler.__new__(mod.PrefillWorkerHandler)
processor = SimpleNamespace(
validate_multimodal_request=MagicMock(
Expand All @@ -995,15 +995,10 @@ async def test_prefill_returns_structured_error_when_multimodal_is_disabled():
context = MagicMock()
context.id.return_value = "request-prefill-disabled"

chunks = [chunk async for chunk in handler.generate({}, context)]
with pytest.raises(mod.InvalidArgument, match="use --enable-multimodal"):
[chunk async for chunk in handler.generate({}, context)]

assert chunks == [
{
"status": "error",
"message": "use --enable-multimodal",
"disaggregated_params": None,
}
]
processor.validate_multimodal_request.assert_called_once_with({})


# ── Deferred abort (disagg decode KV-transfer safety) tests ────────
Expand Down
Loading