From 71e42f002f724f238ae558ab5c992fc4ee1c6620 Mon Sep 17 00:00:00 2001 From: Evan Mattson Date: Tue, 28 Jan 2025 07:24:51 +0900 Subject: [PATCH] Fix mypy error --- python/semantic_kernel/agents/group_chat/agent_chat.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/semantic_kernel/agents/group_chat/agent_chat.py b/python/semantic_kernel/agents/group_chat/agent_chat.py index 0aba50c891e77..e6b4da0e22426 100644 --- a/python/semantic_kernel/agents/group_chat/agent_chat.py +++ b/python/semantic_kernel/agents/group_chat/agent_chat.py @@ -3,7 +3,7 @@ import asyncio import logging import threading -from collections.abc import AsyncGenerator, AsyncIterable +from collections.abc import AsyncIterable from pydantic import Field, PrivateAttr @@ -54,13 +54,13 @@ def invoke(self, agent: Agent | None = None, is_joining: bool = True) -> AsyncIt """Invoke the agent asynchronously.""" raise NotImplementedError("Subclasses should implement this method") - async def get_messages_in_descending_order(self) -> AsyncGenerator[ChatMessageContent, None]: + async def get_messages_in_descending_order(self) -> AsyncIterable[ChatMessageContent]: """Get messages in descending order asynchronously.""" for index in range(len(self.history.messages) - 1, -1, -1): yield self.history.messages[index] await asyncio.sleep(0) # Yield control to the event loop - async def get_chat_messages(self, agent: "Agent | None" = None) -> AsyncGenerator[ChatMessageContent, None]: + async def get_chat_messages(self, agent: "Agent | None" = None) -> AsyncIterable[ChatMessageContent]: """Get chat messages asynchronously.""" self.set_activity_or_throw()