Skip to content

Commit

Permalink
feat: +incremental develop
Browse files Browse the repository at this point in the history
  • Loading branch information
莘权 马 committed Dec 18, 2023
1 parent 2033db8 commit a0cd935
Show file tree
Hide file tree
Showing 13 changed files with 83 additions and 1 deletion.
84 changes: 83 additions & 1 deletion src/en/guide/in_depth_guides/incremental_development.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,85 @@
# Incremental Development

Will be updated soon, stay tuned.
By using the following parameters, it is possible to iterate continuously on the project generated by MetaGPT.

| CLI Parameter Name | Value Type | Optional/Required | Description | Examples |
| :----------------- | :--------- | :---------------- | :---------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--project-path` | path | Optional | The path where to load the project file from the previous version. | metagpt "BUG_FEEDBACK_XXX" --project-path "YOUR_PROJECT_FULL_PATH"<br/><br/>metagpt "INCREMENT_REQUIREMENTS" --project-path "YOUR_PROJECT_FULL_PATH" |
| `--project-name` | str | Optional | Specify the name of new project to be used. The project name must adhere to both folder and code variable naming conventions. | metagpt "NEW_REQUIREMENTS" --project-name "YOUR_PROJECT_NAME" |

Using the example of Snake, we will demonstrate how to incrementally carry out software iterations.

## Create a new Snake game project.

We use the following command parameters to create a Snake software project with gpt-3.5-turbo-1106.

```shell
metagpt "Write a cli snake game based on pygame" --project-name "snake_game" --run-tests --n-round 20 --max-auto-summarize-code 1
```

Among them, the functional descriptions of the relevant parameters are as follows:

| CLI Parameter Name | Value | Description |
| :------------------------ | :----------- | :---------------------------------------------------------------------------------------- |
| --project-name | "snake_game" | The folder name and project name for the newly created software project are "snake_game." |
| --run-tests | | Enable the unit testing phase. |
| --n-round | 20 | Perform 20 rounds. |
| --max-auto-summarize-code | 1 | Fixing issues found in the "summarize code" is allowed for up to 1 time. |

The entire process is as follows:
![part1](../../../public/image/guide/tutorials/inc_req_and_fixbug/20231218-165803.gif)
![part2](../../../public/image/guide/tutorials/inc_req_and_fixbug/20231218-170323.gif)

---

## Add new requirements to an existing project.

We use Azure's GPT-4 and the following parameters to append requirements:

```shell
metagpt "Add a randomly appearing enemy that lasts for 5 seconds. If the enemy is eaten, the game ends. If the enemy is not eaten, it disappears after 5 seconds." --project-path "/Users/iorishinier/github/bak/MetaGPT/workspace/snake_game" --run-tests --n-round 20 --max-auto-summarize-code 1
```

Among them, the functional descriptions of the relevant parameters are as follows:

| CLI Parameter Name | Value | Description |
| :------------------------ | :----------------------------------------------------------- | :----------------------------------------------------------------------- |
| --project-path | "/Users/iorishinier/github/bak/MetaGPT/workspace/snake_game" | Project path of the existing project. |
| --run-tests | | Enable the unit testing phase. |
| --n-round | 20 | Perform 20 rounds. |
| --max-auto-summarize-code | 1 | Fixing issues found in the "summarize code" is allowed for up to 1 time. |

The entire process is as follows:
![part1](../../../public/image/guide/tutorials/inc_req_and_fixbug/20231218-171621.gif)
![part2](../../../public/image/guide/tutorials/inc_req_and_fixbug/20231218-172141.gif)
![part3](../../../public/image/guide/tutorials/inc_req_and_fixbug/20231218-172656.gif)
![part4](../../../public/image/guide/tutorials/inc_req_and_fixbug/20231218-173215.gif)
![part5](../../../public/image/guide/tutorials/inc_req_and_fixbug/20231218-173737.gif)
The final LLM request for code generation timed out, but it won't affect the subsequent incremental iterations of the project. Since the new requirements have already accumulated in the PRD, rerunning or adding new requirements will be based on the current PRD.

---

## Fix Bug

We use Azure's GPT-4 and the following parameters to fix bugs.
To demonstrate the bug-fixing process, we directly introduce erroneous code onto the generated code to trigger a bug. Subsequently, we submit the bug information as part of the requirement content, as shown below:

```shell
metagpt "TypeError: draw() takes 1 positional argument but 2 were given" --project-path "/Users/iorishinier/github/bak/MetaGPT/workspace/snake_game" --run-tests --n-round 10 --max-auto-summarize-code 0
```

Among them, the functional descriptions of the relevant parameters are as follows:

| CLI Parameter Name | Value | Description |
| :------------------------ | :----------------------------------------------------------- | :-------------------------------------------------- |
| --project-path | "/Users/iorishinier/github/bak/MetaGPT/workspace/snake_game" | Project path of the existing project. |
| --run-tests | | Enable the unit testing phase. |
| --n-round | 10 | Perform 10 rounds. |
| --max-auto-summarize-code | 0 | Do not fixing issues found in the "summarize code". |

The entire process is as follows:
![part1](../../../public/image/guide/tutorials/inc_req_and_fixbug/20231218-213655.gif)
![part2](../../../public/image/guide/tutorials/inc_req_and_fixbug/20231218-214234.gif)
![part3](../../../public/image/guide/tutorials/inc_req_and_fixbug/20231218-214752.gif)
![part4](../../../public/image/guide/tutorials/inc_req_and_fixbug/20231218-215313.gif)
![part5](../../../public/image/guide/tutorials/inc_req_and_fixbug/20231218-215442.gif)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a0cd935

Please sign in to comment.