Skip to content

Commit

Permalink
adds mm carryover tests
Browse files Browse the repository at this point in the history
  • Loading branch information
WaelKarkoub committed Mar 23, 2024
1 parent 69d6f28 commit 5c1dc1c
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions test/agentchat/test_conversable_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -1263,6 +1263,43 @@ def test_messages_with_carryover():
with pytest.raises(InvalidCarryOverType):
agent1.generate_init_message(**context)

# Test multimodal messages
mm_message = [
{"type": "text", "text": "hello"},
{"type": "text", "text": "goodbye"},
{
"type": "image_url",
"image_url": {"url": "https://example.com/image.png"},
},
]
context = dict(
message=mm_message,
carryover="Testing carryover.",
)
generated_message = agent1.generate_init_message(**context)
assert isinstance(generated_message, dict)

context = dict(message=mm_message, carryover=["Testing carryover.", "This should pass"])
generated_message = agent1.generate_init_message(**context)
assert isinstance(generated_message, dict)

context = dict(message=mm_message, carryover=3)
with pytest.raises(InvalidCarryOverType):
agent1.generate_init_message(**context)

# Test without carryover
context = dict(message=mm_message)
generated_message = agent1.generate_init_message(**context)
assert isinstance(generated_message, dict)

# Test without text in multimodal message
mm_message = [
{"type": "image_url", "image_url": {"url": "https://example.com/image.png"}},
]
context = dict(message=mm_message)
generated_message = agent1.generate_init_message(**context)
assert isinstance(generated_message, dict)


if __name__ == "__main__":
# test_trigger()
Expand Down

0 comments on commit 5c1dc1c

Please sign in to comment.