Created
November 17, 2023 18:13
-
-
Save john-adeojo/9e531122b281ab5b733c7fa40b47b90c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import autogen | |
user_proxy = autogen.UserProxyAgent( | |
name="user_proxy", | |
human_input_mode="NEVER", | |
llm_config=llm_config_user_proxy, | |
is_termination_msg=lambda x: x.get("content", "") and x.get("content", "").rstrip().endswith("TERMINATE"), | |
max_consecutive_auto_reply=10, | |
code_execution_config=False, | |
system_message=system_message_user_proxy, | |
) | |
data_retriever = autogen.AssistantAgent( | |
name="data_retriever", | |
system_message=system_message_data_retriever, | |
llm_config=llm_config_data_retriever | |
) | |
analyst = autogen.AssistantAgent( | |
name="analyst", | |
system_message=system_message_analyst, | |
llm_config=llm_config_analyst, | |
) | |
travel_agent = autogen.AssistantAgent( | |
name="travel_agent", | |
system_message=system_message_travel_agent, | |
llm_config=llm_config_no_tools, | |
) | |
senior_analyst = autogen.AssistantAgent( | |
name="senior_analyst", | |
system_message=system_message_senior_analyst, | |
llm_config=llm_config_no_tools, | |
) | |
user_proxy.register_function( | |
function_map={ | |
"get_flight_data": get_flight_data, | |
"run_sql":run_sql, | |
} | |
) | |
groupchat = autogen.GroupChat( | |
agents=[user_proxy, data_retriever, analyst, travel_agent, senior_analyst], | |
messages=[], | |
max_round=20 | |
) | |
manager = autogen.GroupChatManager( | |
groupchat=groupchat, | |
llm_config=llm_config_no_tools, | |
is_termination_msg=lambda x: x.get("content", "") and x.get("content", "").rstrip().endswith("TERMINATE"), | |
system_message=system_message_chat_manager | |
) | |
manager.initiate_chat( | |
manager, | |
message='''Show me the fast flights from London to Paris, leaving on the | |
16th of December 2023 and retruning after the 19th January 2024.''' | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment