diff --git a/python/packages/autogen-ext/src/autogen_ext/tools/graphrag/_global_search.py b/python/packages/autogen-ext/src/autogen_ext/tools/graphrag/_global_search.py index 40c8f90ca21d..ccdedb44b21c 100644 --- a/python/packages/autogen-ext/src/autogen_ext/tools/graphrag/_global_search.py +++ b/python/packages/autogen-ext/src/autogen_ext/tools/graphrag/_global_search.py @@ -95,7 +95,7 @@ async def main(): response_stream = assistant_agent.run_stream(task=query) async for msg in response_stream: - if hasattr(msg, "content"): + if isinstance(msg, TextMessage) and hasattr(msg, "content"): print(f"Agent response: {msg.content}") diff --git a/python/packages/autogen-ext/src/autogen_ext/tools/graphrag/_local_search.py b/python/packages/autogen-ext/src/autogen_ext/tools/graphrag/_local_search.py index 6380f7cfbeee..6ca3b2ae15a2 100644 --- a/python/packages/autogen-ext/src/autogen_ext/tools/graphrag/_local_search.py +++ b/python/packages/autogen-ext/src/autogen_ext/tools/graphrag/_local_search.py @@ -94,7 +94,7 @@ async def main(): query = "What does the station-master say about Dr. Becher?" response_stream = assistant_agent.run_stream(task=query) async for msg in response_stream: - if hasattr(msg, "content"): + if isinstance(msg, TextMessage) and hasattr(msg, "content"): print(f"Agent response: {msg.content}")