Skip to content

Commit

Permalink
Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
GoldenWind8 committed Nov 4, 2023
1 parent 73deed8 commit 5f28d67
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 44 deletions.
47 changes: 47 additions & 0 deletions playground/models/groupchat.py
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")
44 changes: 0 additions & 44 deletions swarms/swarms/groupchat.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,47 +99,3 @@ def __call__(self, task: str):

return reply


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")

0 comments on commit 5f28d67

Please sign in to comment.