[Frontend] Migrate input-validation errors to VLLMValidationError (harmony/mistral/chat_utils/params) (#55735)
Signed-off-by: shaolila <shaolila@buaa.edu.cn> Co-authored-by: shaolila <shaolila@buaa.edu.cn>
This commit is contained in:
@@ -29,6 +29,7 @@ from vllm.entrypoints.openai.chat_completion.protocol import ChatCompletionReque
|
||||
from vllm.entrypoints.openai.responses.protocol import ResponsesRequest
|
||||
from vllm.entrypoints.openai.responses.serving import OpenAIServingResponses
|
||||
from vllm.entrypoints.serve.engine.protocol import ErrorResponse
|
||||
from vllm.exceptions import VLLMValidationError
|
||||
from vllm.inputs import tokens_input
|
||||
from vllm.renderers.online_renderer import OnlineRenderer
|
||||
from vllm.renderers.params import ChatParams
|
||||
@@ -427,6 +428,19 @@ class TestReasoningRenderParity:
|
||||
},
|
||||
)
|
||||
|
||||
async def test_reasoning_effort_none_rejected_by_harmony(self, online_renderer):
|
||||
"""Harmony rejects reasoning_effort="none" as invalid user input."""
|
||||
request = ChatCompletionRequest(
|
||||
model=_MODEL,
|
||||
messages=_USER,
|
||||
reasoning_effort="none",
|
||||
)
|
||||
with pytest.raises(
|
||||
VLLMValidationError, match="Harmony does not support"
|
||||
) as exc_info:
|
||||
online_renderer._make_request_with_harmony(request)
|
||||
assert exc_info.value.parameter == "reasoning_effort"
|
||||
|
||||
async def test_explicit_enable_thinking_not_overridden(
|
||||
self, online_renderer, serving_responses
|
||||
):
|
||||
|
||||
@@ -21,6 +21,7 @@ from vllm.entrypoints.chat_utils import (
|
||||
_postprocess_messages,
|
||||
parse_chat_messages,
|
||||
parse_chat_messages_async,
|
||||
validate_chat_template,
|
||||
)
|
||||
from vllm.exceptions import VLLMValidationError
|
||||
from vllm.inputs import MultiModalDataDict, MultiModalUUIDDict
|
||||
@@ -3138,3 +3139,12 @@ def test_tool_call_arguments_multiple_independent(caplog):
|
||||
|
||||
assert len(caplog.records) == 1
|
||||
assert "bad" in caplog.records[0].message
|
||||
|
||||
|
||||
def test_validate_chat_template_rejects_invalid_type():
|
||||
"""A non-str/Path chat_template is invalid user input."""
|
||||
with pytest.raises(
|
||||
VLLMValidationError, match="not a valid chat template type"
|
||||
) as exc_info:
|
||||
validate_chat_template(123) # type: ignore[arg-type]
|
||||
assert exc_info.value.parameter == "chat_template"
|
||||
|
||||
Reference in New Issue
Block a user