-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmultiagent.py
More file actions
31 lines (21 loc) · 817 Bytes
/
multiagent.py
File metadata and controls
31 lines (21 loc) · 817 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from autogen import (
AssistantAgent,
UserProxyAgent,
GroupChat,
config_list_from_json,
GroupChatManager,
)
llm_config = {"config_list": config_list_from_json("OAI_CONFIG_LIST")}
# Create agents
user_proxy = UserProxyAgent(name="User")
assistant = AssistantAgent(name="Assistant", llm_config=llm_config)
researcher = AssistantAgent(name="Researcher", llm_config=llm_config)
writer = AssistantAgent(name="Writer", llm_config=llm_config)
# Create a group chat
agents = [user_proxy, assistant, researcher, writer]
groupchat = GroupChat(agents=agents, messages=[], max_round=12)
manager = GroupChatManager(groupchat=groupchat, llm_config=llm_config)
# Start the conversation
user_proxy.initiate_chat(
manager, message="Write a comprehensive report on the impact of AI on job markets."
)