Skip to content

Commit

Permalink
Merge branch 'main' into warn_if_python_docker_is_na
Browse files Browse the repository at this point in the history
  • Loading branch information
qingyun-wu authored Oct 9, 2023
2 parents 174c1eb + 4522900 commit 24551fd
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 24551fd

Please sign in to comment.