From 54cc37ba872950acdae7078662d1e5d70967857e Mon Sep 17 00:00:00 2001 From: Kye Date: Wed, 20 Sep 2023 20:57:22 -0400 Subject: [PATCH] orchestrate Former-commit-id: 93f2cb58d3926c6ac7335b61fdb59ed6a9f888c4 --- swarms/swarms/orchestrate.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/swarms/swarms/orchestrate.py b/swarms/swarms/orchestrate.py index 812ebe8b..7065af49 100644 --- a/swarms/swarms/orchestrate.py +++ b/swarms/swarms/orchestrate.py @@ -69,7 +69,25 @@ class Orchestrator: / | | \ (Task Assignment) (Task Completion) (Task Assignment) (Task Completion) + + ###Usage + ``` + from exa import Orchestrator + + # Instantiate the Orchestrator with 10 agents + orchestrator = Orchestrator(llm, agent_list=[llm]*10, task_queue=[]) + # Add tasks to the Orchestrator + tasks = [{"content": f"Write a short story about a {animal}."} for animal in ["cat", "dog", "bird", "fish", "lion", "tiger", "elephant", "giraffe", "monkey", "zebra"]] + orchestrator.assign_tasks(tasks) + + # Run the Orchestrator + orchestrator.run() + + # Retrieve the results + for task in tasks: + print(orchestrator.retrieve_result(id(task))) + ``` """ def __init__( self,