From 31451c6f603dfa4e4e5be9a39718a39f3d0dc574 Mon Sep 17 00:00:00 2001 From: Kye Date: Fri, 6 Oct 2023 13:29:04 -0400 Subject: [PATCH] clean up --- groupchat.py | 25 ++++++++++++++++++++----- swarms/swarms/groupchat.py | 2 +- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/groupchat.py b/groupchat.py index 9150dfb6..9d0e0fb9 100644 --- a/groupchat.py +++ b/groupchat.py @@ -1,5 +1,5 @@ from langchain.llms import OpenAIChat -from swarms.swarms import GroupChat +from swarms.swarms import GroupChat, GroupChatManager from swarms.workers import Worker llm = OpenAIChat( @@ -48,12 +48,27 @@ messages = [ } ] - group = GroupChat( - nodes, - messages, + nodes=nodes, + max_rounds=3, + max_consecutive_auto_reply=3, + human_input_mode="NEVER", + system_message="Group chat manager", ) -output = group.run() + +manager = GroupChatManager( + groupchat=group, + name="chat_manager", + max_consecutive_auto_reply=3, + human_input_mode="NEVER", + system_message="Group chat manager", +) + +output = group.run( + messages, + sender=node, + config=group, +) print(output) diff --git a/swarms/swarms/groupchat.py b/swarms/swarms/groupchat.py index ed2d65be..1efcbc58 100644 --- a/swarms/swarms/groupchat.py +++ b/swarms/swarms/groupchat.py @@ -4,6 +4,7 @@ from typing import Dict, List, Optional, Union from swarms.workers.worker import Worker + @dataclass class GroupChat: """A group chat with multiple participants with a list of workers and a max number of rounds""" @@ -77,7 +78,6 @@ class GroupChatManager(Worker): self, groupchat: GroupChat, name: Optional[str] = "chat_manager", - #unlimited auto reply max_consecutive_auto_reply: Optional[int] = sys.maxsize, human_input_mode: Optional[str] = "NEVER", system_message: Optional[str] = "Group chat manager",