diff --git a/autogen/messages/agent_messages.py b/autogen/messages/agent_messages.py index 914d61dc0c..91c8ec18bc 100644 --- a/autogen/messages/agent_messages.py +++ b/autogen/messages/agent_messages.py @@ -189,7 +189,7 @@ def print(self, f: Optional[Callable[..., Any]] = None) -> None: @wrap_message class TextMessage(BasePrintReceivedMessage): - content: Optional[Union[str, int, float, bool, list[dict[str, str]]]] = None # type: ignore [assignment] + content: Optional[Union[str, int, float, bool, list[dict[str, Union[str, dict[str, Any]]]]]] = None # type: ignore [assignment] def print(self, f: Optional[Callable[..., Any]] = None) -> None: f = f or print diff --git a/test/messages/test_agent_messages.py b/test/messages/test_agent_messages.py index 396b7d77dc..6974031261 100644 --- a/test/messages/test_agent_messages.py +++ b/test/messages/test_agent_messages.py @@ -319,6 +319,19 @@ class TestTextMessage: }, "Please extract table from the following image and convert it to Markdown.", ), + ( + { + "content": [ + { + "type": "image_url", + "image_url": { + "url": "https://media.githubusercontent.com/media/ag2ai/ag2/refs/heads/main/website/static/img/autogen_agentchat.png" + }, + } + ] + }, + "", + ), ], ) def test_print_messages(