pull/58/head
Kye 1 year ago
parent b381b2caac
commit 31451c6f60

@ -1,5 +1,5 @@
from langchain.llms import OpenAIChat from langchain.llms import OpenAIChat
from swarms.swarms import GroupChat from swarms.swarms import GroupChat, GroupChatManager
from swarms.workers import Worker from swarms.workers import Worker
llm = OpenAIChat( llm = OpenAIChat(
@ -48,12 +48,27 @@ messages = [
} }
] ]
group = GroupChat( group = GroupChat(
nodes, nodes=nodes,
messages, 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) print(output)

@ -4,6 +4,7 @@ from typing import Dict, List, Optional, Union
from swarms.workers.worker import Worker from swarms.workers.worker import Worker
@dataclass @dataclass
class GroupChat: class GroupChat:
"""A group chat with multiple participants with a list of workers and a max number of rounds""" """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, self,
groupchat: GroupChat, groupchat: GroupChat,
name: Optional[str] = "chat_manager", name: Optional[str] = "chat_manager",
#unlimited auto reply
max_consecutive_auto_reply: Optional[int] = sys.maxsize, max_consecutive_auto_reply: Optional[int] = sys.maxsize,
human_input_mode: Optional[str] = "NEVER", human_input_mode: Optional[str] = "NEVER",
system_message: Optional[str] = "Group chat manager", system_message: Optional[str] = "Group chat manager",

Loading…
Cancel
Save