-
-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
multi agent docs + playground code quality
- Loading branch information
Kye
committed
Nov 24, 2023
1 parent
32c476e
commit 6c7de98
Showing
5 changed files
with
183 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,3 @@ | |
|
||
# Run the workflow on a task | ||
out = flow.run("Generate a 10,000 word blog on health and wellness.") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import os | ||
|
||
from dotenv import load_dotenv | ||
|
||
from swarms.models import OpenAIChat | ||
from swarms.structs import Flow | ||
from swarms.swarms.multi_agent_collab import MultiAgentCollaboration | ||
|
||
load_dotenv() | ||
|
||
api_key = os.environ.get("OPENAI_API_KEY") | ||
|
||
# Initialize the language model | ||
llm = OpenAIChat( | ||
temperature=0.5, | ||
openai_api_key=api_key, | ||
) | ||
|
||
|
||
## Initialize the workflow | ||
flow = Flow(llm=llm, max_loops=1, dashboard=True) | ||
flow2 = Flow(llm=llm, max_loops=1, dashboard=True) | ||
flow3 = Flow(llm=llm, max_loops=1, dashboard=True) | ||
|
||
|
||
swarm = MultiAgentCollaboration( | ||
agents=[flow, flow2, flow3], | ||
max_iters=4, | ||
) | ||
|
||
swarm.run("Generate a 10,000 word blog on health and wellness.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters