From 8ee0af1170223c31a90b6dcd35746c560866748b Mon Sep 17 00:00:00 2001 From: Adam Fourney Date: Wed, 29 Nov 2023 06:34:43 -0800 Subject: [PATCH] Quick fix for the str concatenation bug, but it remains to be discovered why we are getting a 'ChatCompletionMessage' rather than a str. --- autogen/agentchat/groupchat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autogen/agentchat/groupchat.py b/autogen/agentchat/groupchat.py index a59f035fb89e..0b52716f1e55 100644 --- a/autogen/agentchat/groupchat.py +++ b/autogen/agentchat/groupchat.py @@ -208,7 +208,7 @@ def _mentioned_agents(self, message_content: str, agents: List[Agent]) -> Dict: regex = ( r"(?<=\W)" + re.escape(agent.name) + r"(?=\W)" ) # Finds agent mentions, taking word boundaries into account - count = len(re.findall(regex, " " + message_content + " ")) # Pad the message to help with matching + count = len(re.findall(regex, f" {message_content} ")) # Pad the message to help with matching if count > 0: mentions[agent.name] = count return mentions