diff --git a/README.md b/README.md index 5fe897e2..25fc6b09 100644 --- a/README.md +++ b/README.md @@ -44,17 +44,47 @@ We have a small gallery of examples to run here, [for more check out the docs to - `MultiAgentDebate` is a simple class that enables multi agent collaboration. ```python -from swarms import Worker, MultiAgentDebate, select_speaker +from swarms.workers import Worker +from swarms.swarms import MultiAgentDebate, select_speaker +from langchain.models import OpenAIChat -# Initialize agents -worker1 = Worker(openai_api_key="", ai_name="Optimus Prime") -worker2 = Worker(openai_api_key="", ai_name="Bumblebee") -worker3 = Worker(openai_api_key="", ai_name="Megatron") +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="Bumble Bee", + ai_role="Worker in a swarm", + external_tools = None, + human_in_the_loop = False, + temperature = 0.5, +) + +node3 = Worker( + llm=llm, + ai_name="Bumble Bee", + ai_role="Worker in a swarm", + external_tools = None, + human_in_the_loop = False, + temperature = 0.5, +) agents = [ - worker1, - worker2, - worker3 + node, + node2, + node3 ] # Initialize multi-agent debate with the selection function diff --git a/omni_ui.py b/apps/omni_ui.py similarity index 100% rename from omni_ui.py rename to apps/omni_ui.py diff --git a/llm.py b/llm.py deleted file mode 100644 index 93907c0b..00000000 --- a/llm.py +++ /dev/null @@ -1,4 +0,0 @@ -from swarms.models import OpenAIChat - -llm = OpenAIChat(openai_api_key="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") -out = llm("Hello, I am a robot and I like to talk about robots.") \ No newline at end of file diff --git a/playground/swarms/group_chat.py b/playground/swarms/group_chat.py new file mode 100644 index 00000000..d6dc5f1b --- /dev/null +++ b/playground/swarms/group_chat.py @@ -0,0 +1 @@ +from swarms.swarms import GroupChatManager diff --git a/swarms/models/mistral.py b/swarms/models/mistral.py index 79eee1e3..2940be28 100644 --- a/swarms/models/mistral.py +++ b/swarms/models/mistral.py @@ -1,7 +1,9 @@ import torch from transformers import AutoModelForCausalLM, AutoTokenizer + from swarms.agents.message import Message + class Mistral: """ Mistral @@ -150,4 +152,3 @@ class Mistral: for token in response.split(): yield token - diff --git a/swarms/structs/nonlinear_workflow.py b/swarms/structs/nonlinear_workflow.py index 2eebcb9b..077b0b7d 100644 --- a/swarms/structs/nonlinear_workflow.py +++ b/swarms/structs/nonlinear_workflow.py @@ -2,3 +2,20 @@ from typing import List, Dict, Any, Union from concurrent.futures import Executor, ThreadPoolExecutor, as_completed from graphlib import TopologicalSorter +class Task: + def __init__( + self, + id: str, + parents: List["Task"] = None, + children: List["Task"] = None + ): + self.id = id + self.parents = parents + self.children = children + + def can_execute(self): + raise NotImplementedError + + def execute(self): + raise NotImplementedError + diff --git a/swarms/swarms/groupchat.py b/swarms/swarms/groupchat.py index 7fac70f2..69b13402 100644 --- a/swarms/swarms/groupchat.py +++ b/swarms/swarms/groupchat.py @@ -70,7 +70,8 @@ class GroupChat: return "\n".join( [f"{worker.ai_name}: {worker.system_message}" for worker in self.workers] ) - + + class GroupChatManager(Worker): def __init__(