├── README.md ├── celeb.py ├── main.py └── test6.py /README.md: -------------------------------------------------------------------------------- 1 | ## Sponsors 2 | 3 | ✨ Find profitable ideas faster: [Exploding Insights](https://explodinginsights.com/) 4 | -------------------------------------------------------------------------------- /celeb.py: -------------------------------------------------------------------------------- 1 | from autogen import AssistantAgent, UserProxyAgent 2 | import autogen 3 | 4 | config_list = autogen.config_list_from_json( 5 | "OAI_CONFIG_LIST", 6 | filter_dict={ 7 | "model": ["gpt-4", "gpt-4-0314", "gpt4", "gpt-4-32k", "gpt-4-32k-0314", "gpt-4-32k-v0314"], 8 | }, 9 | ) 10 | config_list_gpt4 = [{ 11 | "model": "gpt-4", 12 | "api_key": "KEY" 13 | } 14 | ] 15 | gpt4_config = { 16 | "seed": 42, # change the seed for different trials 17 | "temperature": 0, 18 | "config_list": config_list_gpt4, 19 | "request_timeout": 120, 20 | } 21 | 22 | user_proxy = autogen.UserProxyAgent( 23 | name="Admin", 24 | system_message="A human admin. Interact with the planner to discuss the plan. Plan execution needs to be approved by this admin.", 25 | code_execution_config=False, 26 | ) 27 | 28 | kanye_west = autogen.AssistantAgent( 29 | name="Kanye_West", 30 | llm_config=gpt4_config, 31 | system_message='''Kanye West. Imagine you are Kanye West, inhereit all of his characterstics, desires, dreams, goals. Talk as if you were them. 32 | Give direct quotes that you've said or previous expereinces that you've been through to say what you are saying. 33 | ''', 34 | ) 35 | 36 | elon_musk = autogen.AssistantAgent( 37 | name="Elon_Musk", 38 | llm_config=gpt4_config, 39 | system_message='''Elon Musk. Imagine you are Elon Musk, inhereit all of his characterstics, desires, dreams, goals. Talk as if you were them. 40 | Give direct quotes that you've said or previous expereinces that you've been through to say what you are saying. 41 | ''', 42 | ) 43 | 44 | charlie_munger = autogen.AssistantAgent( 45 | name="Charlie_Munger", 46 | llm_config=gpt4_config, 47 | system_message='''Charlie Munger. Imagine you are Charlie Munger inhereit all of his characterstics, desires, dreams, goals. Talk as if you were them. 48 | Give direct quotes that you've said or previous expereinces that you've been through to say what you are saying. 49 | ''', 50 | ) 51 | 52 | critic = autogen.AssistantAgent( 53 | name="Critic", 54 | system_message='''Critic. Double check plan, make sure all opinions from Kanye West, Elon Musk, Charlie Munger are accounted for. 55 | Get them to argue the pros and cons of the decisions. Challenge them if they are not backing up why they are saying what they are saying, they need to justify with their previous expereinces 56 | ''', 57 | llm_config=gpt4_config, 58 | ) 59 | 60 | groupchat = autogen.GroupChat(agents=[ 61 | kanye_west, user_proxy, elon_musk, charlie_munger, critic], messages=[], max_round=50) 62 | manager = autogen.GroupChatManager(groupchat=groupchat, llm_config=gpt4_config) 63 | 64 | user_proxy.initiate_chat( 65 | manager, 66 | message="""Should I marry my gf before or after I start my startup? 67 | """, 68 | ) 69 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | from autogen import AssistantAgent, UserProxyAgent 2 | import autogen 3 | 4 | config_list_gpt4 = [{ 5 | "model": "gpt-4", 6 | "api_key": "" 7 | } 8 | ] 9 | 10 | gpt4_config = { 11 | "seed": 42, # change the seed for different trials 12 | "temperature": 0, 13 | "config_list": config_list_gpt4, 14 | "request_timeout": 120, 15 | } 16 | 17 | user_proxy = autogen.UserProxyAgent( 18 | name="Admin", 19 | system_message="A human admin. Interact with the planner to discuss the plan. Plan execution needs to be approved by this admin.", 20 | code_execution_config=False, 21 | ) 22 | fun_engineer = autogen.AssistantAgent( 23 | name="Fun_Manager", 24 | llm_config=gpt4_config, 25 | system_message='''Fun Manager. You maximize the fun when Admin is at a location - optimize for unique memorable experiences & fun stories. 26 | ''', 27 | ) 28 | 29 | gym_trainer = autogen.AssistantAgent( 30 | name="Gym_Trainer", 31 | llm_config=gpt4_config, 32 | system_message='''Gym Trainer. You make sure admin is getting the right training (lifting 4-5 times a week) and eating the right food to get to a 6-pack. 33 | ''', 34 | ) 35 | exectuvie_assistant = autogen.AssistantAgent( 36 | name="Executive_Assistant", 37 | llm_config=gpt4_config, 38 | system_message="""Executive Assistant. You make sure the daily work (like project deadlines & daily habits like design and copywriting practice) required by the Admin is done before any of the fun activities.""" 39 | ) 40 | 41 | planner = autogen.AssistantAgent( 42 | name="Planner", 43 | system_message='''Planner. Suggest a plan. Revise the plan based on feedback from admin, Executive Assistant, Fun Manager, until admin approval. 44 | Explain the plan first. Be clear which step is performed by an engineer, and which step is performed by a scientist. 45 | ''', 46 | llm_config=gpt4_config, 47 | ) 48 | 49 | critic = autogen.AssistantAgent( 50 | name="Critic", 51 | system_message="Critic. Double check plan, make sure all objectives from fun manager, executive assistant, and gym trainer are met. provide feedback.", 52 | llm_config=gpt4_config, 53 | ) 54 | 55 | groupchat = autogen.GroupChat(agents=[ 56 | user_proxy, fun_engineer, exectuvie_assistant, gym_trainer, planner, critic], messages=[], max_round=50) 57 | manager = autogen.GroupChatManager(groupchat=groupchat, llm_config=gpt4_config) 58 | 59 | user_proxy.initiate_chat( 60 | manager, 61 | message=""" 62 | plan a month long trip to bangkok. include a table of dates and activity. i will give you a list of tasks that need to be done in a particular day 63 | """, 64 | ) 65 | -------------------------------------------------------------------------------- /test6.py: -------------------------------------------------------------------------------- 1 | from PIL import Image, ImageDraw, ImageFont 2 | from IPython import get_ipython 3 | import autogen 4 | from dotenv import load_dotenv 5 | import os 6 | import openai 7 | load_dotenv() 8 | # Get the API key 9 | OPENAI_API_KEY = os.getenv('OPENAI_API_KEY') 10 | 11 | # Set the API key 12 | openai.api_key = OPENAI_API_KEY 13 | 14 | config_list = autogen.config_list_from_json( 15 | "OAI_CONFIG_LIST", 16 | filter_dict={ 17 | "model": ["gpt-3.5-turbo"], 18 | }, 19 | ) 20 | 21 | llm_config = { 22 | "request_timeout": 600, 23 | "seed": 42, 24 | "config_list": config_list, 25 | "temperature": 0, 26 | } 27 | 28 | assistant = autogen.AssistantAgent( 29 | name="assistant", 30 | llm_config=llm_config, 31 | ) 32 | 33 | # create a UserProxyAgent instance named "user_proxy" 34 | user_proxy = autogen.UserProxyAgent( 35 | name="user_proxy", 36 | human_input_mode="TERMINATE", 37 | max_consecutive_auto_reply=10, 38 | is_termination_msg=lambda x: x.get( 39 | "content", "").rstrip().endswith("TERMINATE"), 40 | code_execution_config={"work_dir": "web"}, 41 | llm_config=llm_config, 42 | system_message="""Reply TERMINATE if the task has been solved at full satisfaction. 43 | Otherwise, reply CONTINUE, or the reason why the task is not solved yet.""" 44 | ) 45 | 46 | # the assistant receives a message from the user, which contains the task description 47 | user_proxy.initiate_chat( 48 | assistant, 49 | message=""" 50 | find the cutest golden retreiver image and use that image to generate a html page for bob, 51 | and write a birthday poem in the style of kanye west 52 | """, 53 | ) 54 | --------------------------------------------------------------------------------