|
@@ -0,0 +1,34 @@
|
|
|
+import autogen
|
|
|
+from dotenv import load_dotenv
|
|
|
+from autogen.agentchat.contrib.agent_builder import AgentBuilder
|
|
|
+
|
|
|
+load_dotenv()
|
|
|
+
|
|
|
+config_path = "OAI_CONFIG_LIST.json"
|
|
|
+config_list = autogen.config_list_from_json(config_path)
|
|
|
+
|
|
|
+default_llm_config = {
|
|
|
+ 'temperature': 0
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+builder = AgentBuilder(config_path=config_path, builder_model='gpt-4-1106-preview', agent_model='gpt-4-1106-preview')
|
|
|
+
|
|
|
+building_task = "Find a paper on arxiv by programming, and analyze its application in some domain. For example, find a latest paper about gpt-4 on arxiv and find its potential applications in software."
|
|
|
+
|
|
|
+agent_list, agent_configs = builder.build(building_task, default_llm_config, coding=True)
|
|
|
+
|
|
|
+def start_task(execution_task: str, agent_list: list, llm_config: dict):
|
|
|
+ config_list = autogen.config_list_from_json(config_path, filter_dict={"model": ["gpt-4-1106-preview"]})
|
|
|
+
|
|
|
+ group_chat = autogen.GroupChat(agents=agent_list, messages=[], max_round=12)
|
|
|
+ manager = autogen.GroupChatManager(
|
|
|
+ groupchat=group_chat, llm_config={"config_list": config_list, **llm_config}
|
|
|
+ )
|
|
|
+ agent_list[0].initiate_chat(manager, message=execution_task)
|
|
|
+
|
|
|
+start_task(
|
|
|
+ execution_task="Find a recent paper about gpt-4 on arxiv and find its potential applications in software.",
|
|
|
+ agent_list=agent_list,
|
|
|
+ llm_config=default_llm_config
|
|
|
+)
|