[Frontend] Migrate Responses API validation errors to VLLMValidationError (#50257)
Signed-off-by: shaolila <shaolila@buaa.edu.cn> Co-authored-by: shaolila <shaolila@buaa.edu.cn>
This commit is contained in:
@@ -20,6 +20,7 @@ from vllm.entrypoints.openai.responses.harmony import (
|
||||
response_input_to_harmony,
|
||||
response_previous_input_to_harmony,
|
||||
)
|
||||
from vllm.exceptions import VLLMValidationError
|
||||
|
||||
_TOOL_PARAMETERS = {
|
||||
"type": "object",
|
||||
@@ -975,10 +976,11 @@ class TestGetSystemMessage:
|
||||
|
||||
def test_unsupported_reasoning_effort_raises_clear_error(self) -> None:
|
||||
with pytest.raises(
|
||||
ValueError,
|
||||
VLLMValidationError,
|
||||
match="reasoning_effort='max' is not supported by Harmony",
|
||||
):
|
||||
) as exc_info:
|
||||
get_system_message(reasoning_effort="max")
|
||||
assert exc_info.value.parameter == "reasoning_effort"
|
||||
|
||||
|
||||
class TestResponseInputToHarmonyReasoningItem:
|
||||
|
||||
@@ -22,6 +22,7 @@ from vllm.entrypoints.openai.responses.utils import (
|
||||
construct_input_messages,
|
||||
should_continue_final_message,
|
||||
)
|
||||
from vllm.exceptions import VLLMValidationError
|
||||
|
||||
|
||||
def _single_chat_message(item):
|
||||
@@ -223,8 +224,9 @@ class TestResponsesUtils:
|
||||
encrypted_content="TOP_SECRET_MESSAGE",
|
||||
status=None,
|
||||
)
|
||||
with pytest.raises(ValueError):
|
||||
with pytest.raises(VLLMValidationError) as exc_info:
|
||||
construct_chat_messages_with_tool_call([item])
|
||||
assert exc_info.value.parameter == "input"
|
||||
|
||||
output_item = ResponseOutputMessage(
|
||||
id="msg_bf585bbbe3d500e0",
|
||||
@@ -350,7 +352,7 @@ class TestReasoningItemContentPriority:
|
||||
assert formatted["reasoning"] == ""
|
||||
|
||||
def test_encrypted_content_raises(self):
|
||||
"""Encrypted content should still raise ValueError."""
|
||||
"""Encrypted content should raise VLLMValidationError."""
|
||||
item = ResponseReasoningItem(
|
||||
id="reasoning_6",
|
||||
summary=[
|
||||
@@ -369,8 +371,9 @@ class TestReasoningItemContentPriority:
|
||||
encrypted_content="ENCRYPTED",
|
||||
status=None,
|
||||
)
|
||||
with pytest.raises(ValueError):
|
||||
with pytest.raises(VLLMValidationError) as exc_info:
|
||||
construct_chat_messages_with_tool_call([item])
|
||||
assert exc_info.value.parameter == "input"
|
||||
|
||||
@patch("vllm.entrypoints.openai.responses.utils.logger")
|
||||
def test_summary_with_multiple_entries_uses_first(self, mock_logger):
|
||||
|
||||
Reference in New Issue
Block a user