diff --git a/groupchat.py b/groupchat.py new file mode 100644 index 00000000..9150dfb6 --- /dev/null +++ b/groupchat.py @@ -0,0 +1,59 @@ +from langchain.llms import OpenAIChat +from swarms.swarms import GroupChat +from swarms.workers import Worker + +llm = OpenAIChat( + model_name='gpt-4', + openai_api_key="api-key", + temperature=0.5 +) + +node = Worker( + llm=llm, + ai_name="Optimus Prime", + ai_role="Worker in a swarm", + external_tools = None, + human_in_the_loop = False, + temperature = 0.5, +) + +node2 = Worker( + llm=llm, + ai_name="Optimus Prime", + ai_role="Worker in a swarm", + external_tools = None, + human_in_the_loop = False, + temperature = 0.5, +) + +node3 = Worker( + llm=llm, + ai_name="Optimus Prime", + ai_role="Worker in a swarm", + external_tools = None, + human_in_the_loop = False, + temperature = 0.5, +) + +nodes = [ + node, + node2, + node3 +] + +messages = [ + { + "role": "system", + "context": f"Create an a small feedforward in pytorch", + } +] + + +group = GroupChat( + nodes, + messages, +) + +output = group.run() + +print(output) diff --git a/swarms/swarms/groupchat.py b/swarms/swarms/groupchat.py index 1e66bd49..ed2d65be 100644 --- a/swarms/swarms/groupchat.py +++ b/swarms/swarms/groupchat.py @@ -92,7 +92,7 @@ class GroupChatManager(Worker): ) self.register_reply( Worker, - GroupChatManager.run_chat, + GroupChatManager.run, config=groupchat, reset_config=GroupChat.reset )