-
-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
73deed8
commit 5f28d67
Showing
2 changed files
with
47 additions
and
44 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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
|
||
from swarms import OpenAI, Flow | ||
from swarms.swarms.groupchat import GroupChatManager, GroupChat | ||
|
||
llm = OpenAI( | ||
openai_api_key="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", | ||
temperature=0.5, | ||
max_tokens=3000, | ||
) | ||
|
||
# Initialize the flow | ||
flow1 = Flow( | ||
llm=llm, | ||
max_loops=1, | ||
system_message="YOU ARE SILLY, YOU OFFER NOTHING OF VALUE", | ||
name='silly', | ||
dashboard=True, | ||
) | ||
flow2 = Flow( | ||
llm=llm, | ||
max_loops=1, | ||
system_message="YOU ARE VERY SMART AND ANSWER RIDDLES", | ||
name='detective', | ||
dashboard=True, | ||
) | ||
flow3 = Flow( | ||
llm=llm, | ||
max_loops=1, | ||
system_message="YOU MAKE RIDDLES", | ||
name='riddler', | ||
dashboard=True, | ||
) | ||
manager = Flow( | ||
llm=llm, | ||
max_loops=1, | ||
system_message="YOU ARE A GROUP CHAT MANAGER", | ||
name='manager', | ||
dashboard=True, | ||
) | ||
|
||
|
||
# Example usage: | ||
agents = [flow1, flow2, flow3] | ||
|
||
group_chat = GroupChat(agents=agents, messages=[], max_round=10) | ||
chat_manager = GroupChatManager(groupchat=group_chat, selector = manager) | ||
chat_history = chat_manager("Write me a riddle") |
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