diff --git a/playground/easy_example.py b/playground/easy_example.py new file mode 100644 index 00000000..8417623a --- /dev/null +++ b/playground/easy_example.py @@ -0,0 +1,8 @@ +from swarms import swarm + +# Use the function +api_key = "APIKEY" +objective = "What is the capital of the UK?" +result = swarm(api_key, objective) +print(result) # Prints: "The capital of the UK is London." + diff --git a/swarms/__init__.py b/swarms/__init__.py index b7faf9e1..78a9c461 100644 --- a/swarms/__init__.py +++ b/swarms/__init__.py @@ -1 +1 @@ -from swarms.swarms import Swarms \ No newline at end of file +from swarms.swarms import Swarms, swarm \ No newline at end of file diff --git a/swarms/swarms.py b/swarms/swarms.py index d6f61629..e4e21cf5 100644 --- a/swarms/swarms.py +++ b/swarms/swarms.py @@ -62,6 +62,32 @@ class Swarms: boss_node.execute_task(task) worker_node.run_agent(objective) + + + +# usage +def swarm(api_key, objective): + swarms = Swarms(api_key) + return swarms.run_swarms(objective) + +# # Use the function +# api_key = "APIKEY" +# objective = "What is the capital of the UK?" +# result = swarm(api_key, objective) +# print(result) # Prints: "The capital of the UK is London." + + + + + + + + + + + + + # class Swarms: # def __init__(self, num_nodes: int, llm: BaseLLM, self_scaling: bool): # self.nodes = [WorkerNode(llm) for _ in range(num_nodes)]