Skip to content

Commit

Permalink
Warn if GroupChat is underpopulatd. (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
afourney authored Oct 9, 2023
1 parent d8ebf6c commit 4522900
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions autogen/agentchat/groupchat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
from typing import Dict, List, Optional, Union
from .agent import Agent
from .conversable_agent import ConversableAgent
import logging

logger = logging.getLogger(__name__)


@dataclass
Expand Down Expand Up @@ -42,6 +45,14 @@ def select_speaker_msg(self):
def select_speaker(self, last_speaker: Agent, selector: ConversableAgent):
"""Select the next speaker."""
selector.update_system_message(self.select_speaker_msg())

# Warn if GroupChat is underpopulated, without established changing behavior
n_agents = len(self.agent_names)
if n_agents < 3:
logger.warning(
f"GroupChat is underpopulated with {n_agents} agents. Direct communication would be more efficient."
)

final, name = selector.generate_oai_reply(
self.messages
+ [
Expand Down

0 comments on commit 4522900

Please sign in to comment.