[Frontend] Migrate Responses harmony input validation to VLLMValidationError (#55701)
Signed-off-by: shaolila <shaolila@buaa.edu.cn> Co-authored-by: shaolila <shaolila@buaa.edu.cn>
This commit is contained in:
@@ -16,6 +16,7 @@ from vllm.entrypoints.openai.responses.harmony import (
|
||||
harmony_to_response_output,
|
||||
response_previous_input_to_harmony,
|
||||
)
|
||||
from vllm.exceptions import VLLMValidationError
|
||||
|
||||
|
||||
class TestResponsePreviousInputToHarmony:
|
||||
@@ -92,6 +93,16 @@ class TestResponsePreviousInputToHarmony:
|
||||
assert messages[0].author.name == "functions.empty_tool"
|
||||
assert messages[0].content[0].text == ""
|
||||
|
||||
def test_chat_message_without_role_raises_validation_error(self):
|
||||
"""A chat-format message missing the 'role' key is invalid input."""
|
||||
chat_msg = {"content": "hello, no role here"}
|
||||
|
||||
with pytest.raises(
|
||||
VLLMValidationError, match="Message has no 'role' key"
|
||||
) as exc_info:
|
||||
response_previous_input_to_harmony(chat_msg)
|
||||
assert exc_info.value.parameter == "input"
|
||||
|
||||
|
||||
class TestHarmonyToResponseOutput:
|
||||
"""Tests for harmony_to_response_output function."""
|
||||
|
||||
Reference in New Issue
Block a user