From 4e1100e15a024004e70f19a248f7c1d94c94112e Mon Sep 17 00:00:00 2001 From: Kye Date: Sat, 30 Mar 2024 00:41:57 -0700 Subject: [PATCH] [CLEANUP] --- README.md | 9 +++++---- .../agents/full_stack_agent.py | 0 .../agents/tool_agent_with_llm.py | 0 playground/structs/build_your_own_swarm.py | 9 ++++++--- .../structs/swarm_network_example.py | 0 swarms/structs/base_swarm.py | 1 + 6 files changed, 12 insertions(+), 7 deletions(-) rename full_stack_agent.py => playground/agents/full_stack_agent.py (100%) rename tool_agent_with_llm.py => playground/agents/tool_agent_with_llm.py (100%) rename swarm_network_example.py => playground/structs/swarm_network_example.py (100%) diff --git a/README.md b/README.md index aaec0ba8..38ad6098 100644 --- a/README.md +++ b/README.md @@ -996,8 +996,9 @@ from swarms import AutoSwarm, AutoSwarmRouter, BaseSwarm # Build your own Swarm class MySwarm(BaseSwarm): - def __init__(self, *args, **kwargs): + def __init__(self, name="kyegomez/myswarm", *args, **kwargs): super().__init__(*args, **kwargs) + self.name = name def run(self, task: str, *args, **kwargs): # Add your multi-agent logic here @@ -1005,8 +1006,8 @@ class MySwarm(BaseSwarm): # agent 2 # agent 3 return "output of the swarm" - - + + # Add your custom swarm to the AutoSwarmRouter router = AutoSwarmRouter( swarms=[MySwarm] @@ -1015,7 +1016,7 @@ router = AutoSwarmRouter( # Create an AutoSwarm instance autoswarm = AutoSwarm( - name = "AutoSwarm, an API for all swarms", + name="kyegomez/myswarm", description="A simple API to build and run swarms", verbose=True, router=router, diff --git a/full_stack_agent.py b/playground/agents/full_stack_agent.py similarity index 100% rename from full_stack_agent.py rename to playground/agents/full_stack_agent.py diff --git a/tool_agent_with_llm.py b/playground/agents/tool_agent_with_llm.py similarity index 100% rename from tool_agent_with_llm.py rename to playground/agents/tool_agent_with_llm.py diff --git a/playground/structs/build_your_own_swarm.py b/playground/structs/build_your_own_swarm.py index 2c3e377f..a809221a 100644 --- a/playground/structs/build_your_own_swarm.py +++ b/playground/structs/build_your_own_swarm.py @@ -3,8 +3,9 @@ from swarms import AutoSwarm, AutoSwarmRouter, BaseSwarm # Build your own Swarm class MySwarm(BaseSwarm): - def __init__(self, *args, **kwargs): + def __init__(self, name="kyegomez/myswarm", *args, **kwargs): super().__init__(*args, **kwargs) + self.name = name def run(self, task: str, *args, **kwargs): # Add your multi-agent logic here @@ -15,12 +16,14 @@ class MySwarm(BaseSwarm): # Add your custom swarm to the AutoSwarmRouter -router = AutoSwarmRouter(swarms=[MySwarm]) +router = AutoSwarmRouter( + swarms=[MySwarm] +) # Create an AutoSwarm instance autoswarm = AutoSwarm( - name="AutoSwarm, an API for all swarms", + name="kyegomez/myswarm", description="A simple API to build and run swarms", verbose=True, router=router, diff --git a/swarm_network_example.py b/playground/structs/swarm_network_example.py similarity index 100% rename from swarm_network_example.py rename to playground/structs/swarm_network_example.py diff --git a/swarms/structs/base_swarm.py b/swarms/structs/base_swarm.py index f2f30b86..30012d80 100644 --- a/swarms/structs/base_swarm.py +++ b/swarms/structs/base_swarm.py @@ -68,6 +68,7 @@ class BaseSwarm(ABC): def __init__( self, + # name: str = "Swarm", agents: List[Agent] = None, models: List[Any] = None, max_loops: int = 200,