Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Issues #966

Merged
merged 7 commits into from
Aug 31, 2024
Merged
Changes from 1 commit
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
12 changes: 4 additions & 8 deletions tests/llm/test_vertexai/test_message_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
from .util import models, modes


@pytest.mark.parametrize("model, mode", [(models[0], modes[0])])
def test_vertexai_message_parser_string_content(model, mode):
def test_vertexai_message_parser_string_content():
message = {"role": "user", "content": "Hello, world!"}
result = vertexai_message_parser(message)

Expand All @@ -17,8 +16,7 @@ def test_vertexai_message_parser_string_content(model, mode):
assert result.parts[0].text == "Hello, world!"


@pytest.mark.parametrize("model, mode", [(models[0], modes[0])])
def test_vertexai_message_parser_list_content(model, mode):
def test_vertexai_message_parser_list_content():
message = {
"role": "user",
"content": [
Expand All @@ -40,16 +38,14 @@ def test_vertexai_message_parser_list_content(model, mode):
assert result.parts[2].text == " How are you?"


@pytest.mark.parametrize("model, mode", [(models[0], modes[0])])
def test_vertexai_message_parser_invalid_content(model, mode):
def test_vertexai_message_parser_invalid_content():
message = {"role": "user", "content": 123} # Invalid content type

with pytest.raises(ValueError, match="Unsupported message content type"):
vertexai_message_parser(message)


@pytest.mark.parametrize("model, mode", [(models[0], modes[0])])
def test_vertexai_message_parser_invalid_list_item(model, mode):
def test_vertexai_message_parser_invalid_list_item():
message = {"role": "user", "content": ["Hello", 123, gm.Part.from_text("world!")]}

with pytest.raises(ValueError, match="Unsupported content type in list"):
Expand Down
Loading