Skip to content
Merged
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
8 changes: 8 additions & 0 deletions tests/entrypoints/openai/responses/test_harmony_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,3 +368,11 @@ def test_non_assistant_message_returns_empty(self):
output_items = harmony_to_response_output(message, frozenset())

assert len(output_items) == 0

@pytest.mark.parametrize("channel", ["comment", "commentaryanalysis"])
def test_unknown_channel_raises_validation_error(self, channel):
message = Message.from_role_and_content(Role.ASSISTANT, "some text")
message = message.with_channel(channel)

with pytest.raises(VLLMValidationError, match=f"Unknown channel: {channel}"):
harmony_to_response_output(message, frozenset())
2 changes: 1 addition & 1 deletion vllm/entrypoints/openai/responses/harmony.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ def _parse_message_no_recipient(
# See: https://cookbook.openai.com/articles/openai-harmony
return [_parse_final_message(message, incomplete=incomplete)]

raise ValueError(f"Unknown channel: {message.channel}")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest keeping the current behavior and simply replacing ValueError with VLLMValidationError.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in daddc24: kept the current behaviour and replaced ValueError with VLLMValidationError (the import already exists), with a test asserting the raise for comment / commentaryanalysis; the drop logic and its tests are gone, so the PR is now +9/-1. Title and description are updated. One note for later, not part of this PR: with stream=true the raise still happens at final assembly after the deltas were sent, so the SSE stream ends without response.completed; I can follow up separately if you want an error event emitted there. @chaunceyjiang could you take another look?

raise VLLMValidationError(f"Unknown channel: {message.channel}")


# ---------------------------------------------------------------------------
Expand Down
Loading