Upload snake_dev_team.py
Browse files- snake_dev_team.py +106 -0
snake_dev_team.py
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from flaml import autogen
|
| 2 |
+
|
| 3 |
+
# Configuration for GPT-4
|
| 4 |
+
config_list_gpt4 = autogen.config_list_from_json(
|
| 5 |
+
"../OAI_CONFIG_LIST.json",
|
| 6 |
+
filter_dict={
|
| 7 |
+
"model": ["gpt-4-0613, gpt-4-32k, gpt-4, gpt-4-0314"],
|
| 8 |
+
},
|
| 9 |
+
)
|
| 10 |
+
|
| 11 |
+
gpt4_config = {
|
| 12 |
+
"seed": 42,
|
| 13 |
+
"temperature": 0,
|
| 14 |
+
"config_list": config_list_gpt4,
|
| 15 |
+
"request_timeout": 1200,
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
working_directory = "game_files" # Common working directory for relevant agents
|
| 19 |
+
|
| 20 |
+
# Player - UserProxyAgent
|
| 21 |
+
player = autogen.UserProxyAgent(
|
| 22 |
+
name="Player",
|
| 23 |
+
system_message="Player: Provide feedback on gameplay. Collaborate with the Game Designer for enhancing the game.",
|
| 24 |
+
code_execution_config={
|
| 25 |
+
"work_dir": working_directory,
|
| 26 |
+
"use_docker": False,
|
| 27 |
+
"timeout": 120,
|
| 28 |
+
"last_n_messages": 1,
|
| 29 |
+
},
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
# Game Designer - AssistantAgent
|
| 33 |
+
game_designer = autogen.AssistantAgent(
|
| 34 |
+
name="Game_Designer",
|
| 35 |
+
llm_config=gpt4_config,
|
| 36 |
+
system_message="Game Designer: Craft the design for the snake game. Document details in 'game_design.txt'. Collaborate for a comprehensive design."
|
| 37 |
+
)
|
| 38 |
+
|
| 39 |
+
# Programmer - AssistantAgent
|
| 40 |
+
programmer = autogen.AssistantAgent(
|
| 41 |
+
name="Programmer",
|
| 42 |
+
llm_config=gpt4_config,
|
| 43 |
+
system_message="Programmer: Develop the snake game. Save code in the working directory. Use a venv for dependency management and create/maintain 'requirements.txt'."
|
| 44 |
+
)
|
| 45 |
+
|
| 46 |
+
# Game Tester - UserProxyAgent
|
| 47 |
+
game_tester = autogen.UserProxyAgent(
|
| 48 |
+
name="Game_Tester",
|
| 49 |
+
system_message="Game Tester: Playtest the game. Share feedback on gameplay, mechanics, and possible bugs.",
|
| 50 |
+
code_execution_config={
|
| 51 |
+
"work_dir": working_directory,
|
| 52 |
+
"use_docker": False,
|
| 53 |
+
"timeout": 120,
|
| 54 |
+
"last_n_messages": 3,
|
| 55 |
+
},
|
| 56 |
+
human_input_mode="ALWAYS",
|
| 57 |
+
)
|
| 58 |
+
|
| 59 |
+
# Code Executor - UserProxyAgent
|
| 60 |
+
code_executor = autogen.UserProxyAgent(
|
| 61 |
+
name="Code_Executor",
|
| 62 |
+
system_message="Code Executor: Run the given code in the specified environment. Report outcomes and potential problems.",
|
| 63 |
+
code_execution_config={
|
| 64 |
+
"work_dir": working_directory,
|
| 65 |
+
"use_docker": False,
|
| 66 |
+
"timeout": 120,
|
| 67 |
+
"last_n_messages": 3,
|
| 68 |
+
},
|
| 69 |
+
human_input_mode="NEVER",
|
| 70 |
+
)
|
| 71 |
+
|
| 72 |
+
# Code Reviewer - AssistantAgent
|
| 73 |
+
code_reviewer = autogen.AssistantAgent(
|
| 74 |
+
name="Code_Reviewer",
|
| 75 |
+
llm_config=gpt4_config,
|
| 76 |
+
system_message="Code Reviewer: Inspect the given code. Ensure its quality, efficiency, and adherence to best practices. Recommend enhancements."
|
| 77 |
+
)
|
| 78 |
+
|
| 79 |
+
# Internet Researcher - AssistantAgent
|
| 80 |
+
internet_researcher = autogen.AssistantAgent(
|
| 81 |
+
name="Internet_Researcher",
|
| 82 |
+
llm_config=gpt4_config,
|
| 83 |
+
system_message="Internet Researcher: Explore relevant game development trends. Offer insights and references."
|
| 84 |
+
)
|
| 85 |
+
|
| 86 |
+
# File Management Agent - AssistantAgent
|
| 87 |
+
file_manager = autogen.AssistantAgent(
|
| 88 |
+
name="File_Manager",
|
| 89 |
+
llm_config=gpt4_config,
|
| 90 |
+
system_message="File Manager: Create, read, and write local files as needed. Save work and progress of the team."
|
| 91 |
+
)
|
| 92 |
+
|
| 93 |
+
# Group Chat Setup
|
| 94 |
+
groupchat = autogen.GroupChat(
|
| 95 |
+
agents=[player, game_tester, game_designer, programmer,
|
| 96 |
+
code_executor, code_reviewer, internet_researcher, file_manager],
|
| 97 |
+
messages=[],
|
| 98 |
+
max_round=150 # Increased max_round for extended interaction
|
| 99 |
+
)
|
| 100 |
+
manager = autogen.GroupChatManager(groupchat=groupchat, llm_config=gpt4_config)
|
| 101 |
+
|
| 102 |
+
# Initiating Chat
|
| 103 |
+
player.initiate_chat(
|
| 104 |
+
manager,
|
| 105 |
+
message="Let's design and implement a snake game. I aim for it to be entertaining and challenging."
|
| 106 |
+
)
|