[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:
Adababy
2026-09-08 06:45:40 +00:00
committed by GitHub
co-authored by shaolila
parent 755541443f
commit 5133e1d285
7 changed files with 62 additions and 8 deletions
@@ -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"