Tonic commited on
Commit
12aeefe
1 Parent(s): 51df93c

Upload 5 files

Browse files

Updated Application

Files changed (5) hide show
  1. .gitignore +5 -0
  2. OAI_CONFIG_LIST.json +48 -0
  3. README.md +71 -0
  4. requirements.txt +1 -0
  5. snake_dev_team.py +88 -0
.gitignore ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ ./
2
+
3
+ .cache/
4
+
5
+ .env
OAI_CONFIG_LIST.json ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "model": "gpt-3.5-turbo",
4
+ "api_key": ""
5
+ },
6
+ {
7
+ "model": "gpt-3.5-turbo-0301",
8
+ "api_key": ""
9
+ },
10
+ {
11
+ "model": "gpt-3.5-turbo-0613",
12
+ "api_key": ""
13
+ },
14
+ {
15
+ "model": "gpt-3.5-turbo-16k",
16
+ "api_key": ""
17
+ },
18
+ {
19
+ "model": "gpt-3.5-turbo-16k-0613",
20
+ "api_key": ""
21
+ },
22
+ {
23
+ "model": "gpt-4",
24
+ "api_key": ""
25
+ },
26
+ {
27
+ "model": "gpt-4-0314",
28
+ "api_key": ""
29
+ },
30
+ {
31
+ "model": "gpt-4-0613",
32
+ "api_key": ""
33
+ },
34
+ {
35
+ "model": "gpt-4-32k",
36
+ "api_key": "",
37
+ "api_base": "https://*.openai.azure.com/openai/deployments/*/chat/completions",
38
+ "api_type": "azure",
39
+ "api_version": "2023-06-01-preview"
40
+ },
41
+ {
42
+ "model": "gpt-35-turbo-16k",
43
+ "api_key": "",
44
+ "api_base": "https://*.openai.azure.com/openai/deployments/*/chat/completions",
45
+ "api_type": "azure",
46
+ "api_version": "2023-06-01-preview"
47
+ }
48
+ ]
README.md ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Snake Game Development with AutoGen
2
+
3
+ Welcome to the Snake Game Development project. In this project, we aim to design, implement, and test a snake game that is both entertaining and challenging. We leverage the power of the `autogen` library, a framework by Microsoft, to facilitate collaboration between different agents, each with its unique role.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Overview](#overview)
8
+ - [About AutoGen](#about-autogen)
9
+ - [Roles and Responsibilities](#roles-and-responsibilities)
10
+ - [Setup and Configuration](#setup-and-configuration)
11
+ - [Usage](#usage)
12
+ - [Contributing](#contributing)
13
+ - [License](#license)
14
+
15
+ ## Overview
16
+
17
+ The project is structured around a group chat setup where different agents collaborate to bring the snake game to life. Each agent has a specific role and responsibility, and they communicate and collaborate through the group chat.
18
+
19
+ ## About AutoGen
20
+
21
+ [AutoGen](https://microsoft.github.io/autogen/docs/Getting-Started) is a framework developed by Microsoft that enables the development of LLM (Language Model) applications using multiple agents. These agents can converse with each other to solve tasks. AutoGen agents are known for their customizability, conversational capabilities, and the seamless integration of human participation. They can operate in various modes, employing combinations of LLMs, human inputs, and tools. For more details, refer to the [official documentation](https://microsoft.github.io/autogen/docs/Getting-Started).
22
+
23
+ ## Roles and Responsibilities
24
+
25
+ - **Player**: Provides feedback on the gameplay and collaborates with the Game Designer to ensure the game meets desired expectations.
26
+
27
+ - **Game Designer**: Designs the snake game, ensuring all details are documented in 'game_design.txt'. Collaborates with the Player to align the design with feedback and expectations.
28
+
29
+ - **Programmer**: Responsible for coding the snake game. Collaborates with the Code Executor for code execution and consults the Game Tester for feedback.
30
+
31
+ - **Game Tester**: Playtests the game, providing feedback on gameplay mechanics and user experience. Reports any bugs or glitches and collaborates with the Programmer for necessary adjustments.
32
+
33
+ - **Code Executor**: Executes the provided code in a designated environment, ensuring it follows best practices. Collaborates with the Programmer for any necessary code adjustments.
34
+
35
+ ## Setup and Configuration
36
+
37
+ 1. **Dependencies**: Before running the project, ensure you have all the required dependencies installed. You can install them using:
38
+
39
+ ```bash
40
+ pip install -r requirements.txt
41
+ ```
42
+
43
+ 2. **OpenAI Key**: Make sure to add your OpenAI key to the `OAI_CONFIG_LIST.json` file. This is crucial for the proper functioning of the GPT-4 configurations.
44
+
45
+ 3. **Configuration**: The project uses a configuration file `OAI_CONFIG_LIST.json` for GPT-4 settings. Ensure this file is present in the root directory and has the necessary OpenAI key added.
46
+
47
+ 4. **Working Directory**: All relevant game files, including the game's code and design document, are stored in the `game_files` directory.
48
+
49
+ ## Usage
50
+
51
+ To initiate the project on Windows, navigate to the project directory in your terminal or command prompt and run the following command:
52
+
53
+ ```bash
54
+ python snake_dev_team.py
55
+ ```
56
+
57
+ This will start the group chat, and the Player will initiate the conversation with the message:
58
+
59
+ ```plaintext
60
+ "Let's design and implement a snake game. I aim for it to be entertaining and challenging."
61
+ ```
62
+
63
+ From there, the agents will collaborate based on their roles and responsibilities.
64
+
65
+ ## Contributing
66
+
67
+ Contributions are welcome! Please read the contributing guidelines to get started.
68
+
69
+ ## License
70
+
71
+ This project is licensed under the MIT License. See the `LICENSE` file for details.
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ pyautogen
snake_dev_team.py ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from autogen import AssistantAgent, UserProxyAgent, config_list_from_json, GroupChat, GroupChatManager
2
+
3
+ # Load the configuration for GPT-4 from a JSON file
4
+ config_list_gpt4 = 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
+ # Define the GPT-4 configuration parameters
12
+ gpt4_config = {
13
+ "seed": 42,
14
+ "temperature": 0,
15
+ "config_list": config_list_gpt4,
16
+ "request_timeout": 1200,
17
+ }
18
+
19
+ # Define the common working directory for all agents
20
+ working_directory = "game_files"
21
+
22
+ # Initialize the Player agent, responsible for providing gameplay feedback
23
+ player = UserProxyAgent(
24
+ name="Player",
25
+ system_message="Player: Your role is to provide feedback on the gameplay. Collaborate with the Game Designer to ensure the game meets desired expectations.",
26
+ code_execution_config={
27
+ "work_dir": working_directory,
28
+ "use_docker": False,
29
+ "timeout": 120,
30
+ "last_n_messages": 1,
31
+ },
32
+ )
33
+
34
+ # Initialize the Game Designer agent, responsible for designing the game
35
+ game_designer = AssistantAgent(
36
+ name="Game_Designer",
37
+ llm_config=gpt4_config,
38
+ system_message="Game Designer: Design the snake game, ensuring all details are documented in 'game_design.txt'. Collaborate with the Player to align the design with feedback and expectations."
39
+ )
40
+
41
+ # Initialize the Programmer agent, responsible for coding the game
42
+ programmer = AssistantAgent(
43
+ name="Programmer",
44
+ llm_config=gpt4_config,
45
+ system_message="Programmer: Code the snake game and save it in the working directory. For code execution, collaborate with the Code Executor. If feedback is needed, consult the Game Tester."
46
+ )
47
+
48
+ # Initialize the Game Tester agent, responsible for playtesting the game
49
+ game_tester = UserProxyAgent(
50
+ name="Game_Tester",
51
+ system_message="Game Tester: Playtest the game and provide feedback on gameplay mechanics and user experience. Report any bugs or glitches. Collaborate with the Programmer for any necessary adjustments.",
52
+ code_execution_config={
53
+ "work_dir": working_directory,
54
+ "use_docker": False,
55
+ "timeout": 120,
56
+ "last_n_messages": 3,
57
+ },
58
+ human_input_mode="ALWAYS",
59
+ )
60
+
61
+ # Initialize the Code Executor agent, responsible for executing the game code
62
+ code_executor = UserProxyAgent(
63
+ name="Code_Executor",
64
+ system_message="Code Executor: Execute the provided code from the Programmer in the designated environment. Report outcomes and potential issues. Ensure the code follows best practices and recommend enhancements to the Programmer.",
65
+ code_execution_config={
66
+ "work_dir": working_directory,
67
+ "use_docker": False,
68
+ "timeout": 120,
69
+ "last_n_messages": 3,
70
+ },
71
+ human_input_mode="NEVER",
72
+ )
73
+
74
+ # Set up the group chat with all the agents
75
+ groupchat = GroupChat(
76
+ agents=[player, game_tester, game_designer, programmer, code_executor],
77
+ messages=[],
78
+ max_round=150
79
+ )
80
+
81
+ # Create a manager for the group chat using the GPT-4 configuration
82
+ manager = GroupChatManager(groupchat=groupchat, llm_config=gpt4_config)
83
+
84
+ # Start the conversation with the Player's message
85
+ player.initiate_chat(
86
+ manager,
87
+ message="Let's design and implement a snake game. I aim for it to be entertaining and challenging."
88
+ )