mirror of
https://github.com/aljazceru/gpt-engineer.git
synced 2025-12-17 12:45:26 +01:00
Refactoring and suggestions (#334)
This commit is contained in:
2
.github/CODE_OF_CONDUCT.md
vendored
2
.github/CODE_OF_CONDUCT.md
vendored
@@ -60,7 +60,7 @@ representative at an online or offline event.
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders responsible for enforcement at
|
||||
anton.osika@gmail.com.
|
||||
<anton.osika@gmail.com>.
|
||||
All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of reporters of incidents.
|
||||
|
||||
10
.github/CONTRIBUTING.md
vendored
10
.github/CONTRIBUTING.md
vendored
@@ -15,7 +15,6 @@ To get started with contributing, please follow these steps:
|
||||
7. Push to the branch: `git push origin my-branch-name`.
|
||||
8. Submit a pull request to the `main` branch of the original repository.
|
||||
|
||||
|
||||
## Code Style
|
||||
|
||||
Please make sure to follow the established code style guidelines for this project. Consistent code style helps maintain readability and makes it easier for others to contribute to the project.
|
||||
@@ -37,13 +36,13 @@ pre-commit installed at .git/hooks/pre-commit
|
||||
|
||||
Or you could just run `make dev-install` to install the dependencies and the hooks!
|
||||
|
||||
|
||||
If you are not familiar with the concept of [git hooks](https://git-scm.com/docs/githooks) and/or [`pre-commit`](https://pre-commit.com/) please read the documentation to understand how they work.
|
||||
|
||||
As an introduction of the actual workflow, here is an example of the process you will encounter when you make a commit:
|
||||
|
||||
Let's add a file we have modified with some errors, see how the pre-commit hooks run `black` and fails.
|
||||
`black` is set to automatically fix the issues it finds:
|
||||
|
||||
```bash
|
||||
$ git add chat_to_files.py
|
||||
$ git commit -m "commit message"
|
||||
@@ -58,6 +57,7 @@ All done! ✨ 🍰 ✨
|
||||
```
|
||||
|
||||
You can see that `chat_to_files.py` is both staged and not staged for commit. This is because `black` has formatted it and now it is different from the version you have in your working directory. To fix this you can simply run `git add chat_to_files.py` again and now you can commit your changes.
|
||||
|
||||
```bash
|
||||
$ git status
|
||||
On branch pre-commit-setup
|
||||
@@ -71,8 +71,8 @@ Changes not staged for commit:
|
||||
modified: chat_to_files.py
|
||||
```
|
||||
|
||||
|
||||
Now let's add the file again to include the latest commits and see how `ruff` fails.
|
||||
|
||||
```bash
|
||||
$ git add chat_to_files.py
|
||||
$ git commit -m "commit message"
|
||||
@@ -86,6 +86,7 @@ Found 2 errors (2 fixed, 0 remaining).
|
||||
```
|
||||
|
||||
Same as before, you can see that `chat_to_files.py` is both staged and not staged for commit. This is because `ruff` has formatted it and now it is different from the version you have in your working directory. To fix this you can simply run `git add chat_to_files.py` again and now you can commit your changes.
|
||||
|
||||
```bash
|
||||
$ git add chat_to_files.py
|
||||
$ git commit -m "commit message"
|
||||
@@ -100,13 +101,10 @@ Now your file has been committed and you can push your changes.
|
||||
|
||||
At the beginning this might seem like a tedious process (having to add the file again after `black` and `ruff` have modified it) but it is actually very useful. It allows you to see what changes `black` and `ruff` have made to your files and make sure that they are correct before you commit them.
|
||||
|
||||
|
||||
|
||||
## Issue Tracker
|
||||
|
||||
If you encounter any bugs, issues, or have feature requests, please [create a new issue](https://github.com/AntonOsika/gpt-engineer/issues/new) on the project's GitHub repository. Provide a clear and descriptive title along with relevant details to help us address the problem or understand your request.
|
||||
|
||||
|
||||
## Licensing
|
||||
|
||||
By contributing to GPT Engineer, you agree that your contributions will be licensed under the [LICENSE](../LICENSE) file of the project.
|
||||
|
||||
3
.github/ISSUE_TEMPLATE/issue-template.md
vendored
3
.github/ISSUE_TEMPLATE/issue-template.md
vendored
@@ -4,12 +4,11 @@ about: All templates should use this format unless there is a reason not to
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**YOU MAY DELETE THE ENTIRE TEMPLATE BELOW.**
|
||||
|
||||
# Issue Template
|
||||
## Issue Template
|
||||
|
||||
## Expected Behavior
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
## How Has This Been Tested?
|
||||
|
||||
Please describe if you have either:
|
||||
|
||||
- Generated the "example" project
|
||||
- Ran the entire benchmark suite
|
||||
- Something else
|
||||
|
||||
16
.github/workflows/ci.yaml
vendored
16
.github/workflows/ci.yaml
vendored
@@ -1,25 +1,23 @@
|
||||
name: Pytest Execution
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
branches: [main]
|
||||
paths:
|
||||
- "**.py"
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
branches: [main]
|
||||
paths:
|
||||
- "**.py"
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version:
|
||||
- "3.10"
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
python-version: "3.10"
|
||||
cache: pip
|
||||
|
||||
- name: Install package
|
||||
|
||||
8
.github/workflows/pre-commit.yaml
vendored
8
.github/workflows/pre-commit.yaml
vendored
@@ -8,7 +8,15 @@ on:
|
||||
jobs:
|
||||
pre-commit:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/setup-python@v4
|
||||
|
||||
- uses: pre-commit/action@v3.0.0
|
||||
with:
|
||||
extra_args: --all-files
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
# See https://pre-commit.com for more information
|
||||
# See https://pre-commit.com/hooks.html for more hooks
|
||||
fail_fast: true
|
||||
|
||||
default_stages: [commit]
|
||||
|
||||
repos:
|
||||
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: v1.3.0
|
||||
hooks:
|
||||
@@ -27,8 +26,7 @@ repos:
|
||||
rev: v4.4.0
|
||||
hooks:
|
||||
- id: check-toml
|
||||
id: check-yaml
|
||||
id: detect-private-key
|
||||
id: end-of-file-fixer
|
||||
id: trailing-whitespace
|
||||
|
||||
- id: check-yaml
|
||||
- id: detect-private-key
|
||||
- id: end-of-file-fixer
|
||||
- id: trailing-whitespace
|
||||
|
||||
1
Makefile
1
Makefile
@@ -50,4 +50,3 @@ run:
|
||||
@echo -e "$(COLOR_CYAN)Running GPT Engineer on $(COLOR_GREEN)$(name)$(COLOR_CYAN) folder...$(COLOR_RESET)" && \
|
||||
source venv/bin/activate && \
|
||||
gpt-engineer projects/$(name)
|
||||
|
||||
|
||||
16
README.md
16
README.md
@@ -1,9 +1,9 @@
|
||||
# GPT Engineer
|
||||
|
||||
[](https://discord.gg/4t5vXHhu)
|
||||
[](https://github.com/AntonOsika/gpt-engineer)
|
||||
[](https://twitter.com/AntonOsika)
|
||||
|
||||
|
||||
**Specify what you want it to build, the AI asks for clarification, and then builds it.**
|
||||
|
||||
GPT Engineer is made to be easy to adapt, extend, and make your agent learn how you want your code to look. It generates an entire codebase based on a prompt.
|
||||
@@ -11,6 +11,7 @@ GPT Engineer is made to be easy to adapt, extend, and make your agent learn how
|
||||
[Demo](https://twitter.com/antonosika/status/1667641038104674306) 👶🤖
|
||||
|
||||
## Project philosophy
|
||||
|
||||
- Simple to get value
|
||||
- Flexible and easy to add new own "AI steps". See `steps.py`.
|
||||
- Incrementally build towards a user experience of:
|
||||
@@ -39,19 +40,20 @@ With an api key that has GPT4 access run:
|
||||
|
||||
- `export OPENAI_API_KEY=[your api key]`
|
||||
|
||||
|
||||
**Run**:
|
||||
|
||||
- Create an empty folder. If inside the repo, you can run:
|
||||
- `cp -r projects/example/ projects/my-new-project`
|
||||
- Fill in the `main_prompt` file in your new folder
|
||||
- `gpt-engineer projects/my-new-project`
|
||||
- (Note, `gpt-engineer --help` lets you see all available options. For example `--steps use_feedback` lets you improve/fix code in a project)
|
||||
|
||||
**Results**
|
||||
**Results**:
|
||||
|
||||
- Check the generated files in `projects/my-new-project/workspace`
|
||||
|
||||
|
||||
## Features
|
||||
|
||||
You can specify the "identity" of the AI agent by editing the files in the `identity` folder.
|
||||
|
||||
Editing the identity, and evolving the `main_prompt`, is currently how you make the agent remember things between projects.
|
||||
@@ -59,13 +61,13 @@ Editing the identity, and evolving the `main_prompt`, is currently how you make
|
||||
Each step in `steps.py` will have its communication history with GPT4 stored in the logs folder, and can be rerun with `scripts/rerun_edited_message_logs.py`.
|
||||
|
||||
## Contributing
|
||||
|
||||
We are building the open platform for devs to tinker with and build their personal code-generation toolbox.
|
||||
|
||||
If you want to contribute, please check out the [roadmap](https://github.com/AntonOsika/gpt-engineer/blob/main/ROADMAP.md), [projects](https://github.com/AntonOsika/gpt-engineer/projects?query=is%3Aopen) or [issues tab](https://github.com/AntonOsika/gpt-engineer/issues) in the GitHub repo. You are welcome to read the [contributing document](.github/CONTRIBUTING.md) and join our [Discord 💬](https://discord.gg/4t5vXHhu).
|
||||
|
||||
We are currently looking for more maintainers and community organisers. Email anton.osika@gmail.com if you are interested in an official role.
|
||||
|
||||
We are currently looking for more maintainers and community organisers. Email <anton.osika@gmail.com> if you are interested in an official role.
|
||||
|
||||
## Example
|
||||
|
||||
https://github.com/AntonOsika/gpt-engineer/assets/4467025/6e362e45-4a94-4b0d-973d-393a31d92d9b
|
||||
<https://github.com/AntonOsika/gpt-engineer/assets/4467025/6e362e45-4a94-4b0d-973d-393a31d92d9b>
|
||||
|
||||
@@ -7,7 +7,6 @@ There are three main milestones we believe will 2x gpt-engineer's reliability an
|
||||
- Make code generation become small, verifiable steps
|
||||
- Run tests and fix errors with GPT4
|
||||
|
||||
|
||||
## Steps to achieve our roadmap
|
||||
|
||||
- [ ] Continuous evaluation of our progress
|
||||
@@ -32,10 +31,10 @@ performance over time
|
||||
task, by giving it few shot example of what are usually "the right-sized steps" to carry
|
||||
out for other projects
|
||||
|
||||
|
||||
|
||||
# How you can help out
|
||||
|
||||
You can:
|
||||
|
||||
- Submit your first PR to address an [issue](https://github.com/AntonOsika/gpt-engineer/issues)
|
||||
- Submit PRs to address one of the items in the roadmap
|
||||
- Review your first PR/issue and propose next steps (further review, merge, close)
|
||||
@@ -48,4 +47,3 @@ Volunteer work in any of these gets acknowledged.
|
||||
|
||||
### Ad hoc experiments
|
||||
- [ ] Try Microsoft guidance, and benchmark if this helps improve performance
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# Benchmarks
|
||||
|
||||
```bash
|
||||
$ python scripts/benchmark.py
|
||||
python scripts/benchmark.py
|
||||
```
|
||||
|
||||
# 2023-06-21
|
||||
## 2023-06-21
|
||||
|
||||
| Benchmark | Ran | Works | Perfect |
|
||||
|--------------------|-----|-------|---------|
|
||||
@@ -20,8 +20,8 @@ $ python scripts/benchmark.py
|
||||
| password_generator | ✅ | ✅ | ✅ |
|
||||
| todo_list | ✅ | ✅ | ✅ |
|
||||
|
||||
## Notes on the errors
|
||||
|
||||
# Notes on the errors
|
||||
Most errors come from that the "generate entrypoint" are incorrect. Ignoring
|
||||
those, we get 8/11 fully correct.
|
||||
|
||||
@@ -31,8 +31,7 @@ One error was trying to modify a constant.
|
||||
One error was that the html template was not fully filled in.
|
||||
One error is that a dependency was used incorrectly and easy to fix
|
||||
|
||||
|
||||
# 2023-06-19
|
||||
## 2023-06-19
|
||||
|
||||
| Benchmark | Ran | Works | Perfect |
|
||||
|--------------------|-----|-------|---------|
|
||||
@@ -48,9 +47,10 @@ One error is that a dependency was used incorrectly and easy to fix
|
||||
| password_generator | ✅ | ✅ | ✅ |
|
||||
| todo_list | ✅ | ❌ | ❌ |
|
||||
|
||||
## Notes on the errors
|
||||
|
||||
# Notes on the errors
|
||||
**timer_app** almost works with unit tests config
|
||||
|
||||
- failure mode: undefined import/conflicting names
|
||||
|
||||
**file_explorer** works
|
||||
@@ -58,17 +58,17 @@ One error is that a dependency was used incorrectly and easy to fix
|
||||
**file organiser**: works
|
||||
|
||||
**image_resizer** almost works with unit tests config
|
||||
|
||||
- failure mode: undefined import
|
||||
|
||||
**todo_list** runs. doesn't really work with unit tests config
|
||||
Uncaught ReferenceError: module is not defined
|
||||
- failure mode: placeholder text
|
||||
|
||||
- failure mode: placeholder text
|
||||
|
||||
url_shortner starts but gets the error:
|
||||
SQLite objects created in a thread can only be used in that same thread. The object was created in thread id 8636125824 and this is thread id 13021003776.
|
||||
|
||||
|
||||
markdown_editor:
|
||||
failing tests, 'WebDriver' object has no attribute 'find_element_by_id'
|
||||
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
Create a basic file explorer CLI tool in Python that allows users to navigate through directories, view file contents, and perform basic file operations (copy, move, delete).
|
||||
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
Create a CLI tool in Python that allows users to resize images by specifying the desired width and height. Use the Pillow library for image manipulation.
|
||||
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
Create a simple timer app using HTML, CSS, and JavaScript that allows users to set a countdown timer and receive an alert when the time is up.
|
||||
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
Create a simple to-do list app using HTML, CSS, and JavaScript. Store tasks in local storage and allow users to add, edit, and delete tasks.
|
||||
|
||||
|
||||
@@ -6,4 +6,3 @@ pytest==7.3.1
|
||||
ruff==0.0.272
|
||||
termcolor==2.3.0
|
||||
typer==0.9.0
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# list all folders in benchmark folder
|
||||
# for each folder, run the benchmark
|
||||
|
||||
import contextlib
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
@@ -59,7 +60,7 @@ def main(
|
||||
print(f.read())
|
||||
print()
|
||||
|
||||
try:
|
||||
with contextlib.suppress(KeyboardInterrupt):
|
||||
subprocess.run(
|
||||
[
|
||||
"python",
|
||||
@@ -70,8 +71,6 @@ def main(
|
||||
"execute_only",
|
||||
],
|
||||
)
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user