antonosika / gpt-engineer Goto Github PK
View Code? Open in Web Editor NEWSpecify what you want it to build, the AI asks for clarification, and then builds it.
License: MIT License
Specify what you want it to build, the AI asks for clarification, and then builds it.
License: MIT License
does it works on gpt 3.5
I will setup pre-commit
I think:
cp example -r my-new-project
Should be:
cp -r example my-new-project
running on MacOS I get this error at the end of the output of the generated code:
Traceback (most recent call last):
File "/Users/admin/Projects/gpt-engineer/main.py", line 51, in <module>
app()
File "/Users/admin/Projects/gpt-engineer/main.py", line 46, in chat
messages = step(ai, dbs)
File "/Users/admin/Projects/gpt-engineer/steps.py", line 55, in run_clarified
to_files(messages[-1]['content'], dbs.workspace)
File "/Users/admin/Projects/gpt-engineer/chat_to_files.py", line 27, in to_files
workspace[file_name] = file_content
File "/Users/admin/Projects/gpt-engineer/db.py", line 17, in __setitem__
with open(self.path / key, 'w') as f:
IsADirectoryError: [Errno 21] Is a directory: '/Users/admin/Projects/gpt-engineer/voice-assistant/workspace'
I encountered this error when prompting it to create an Angular SPA and NodeJS API server. I'd offer a pull, but I don't know python well enough to propose a robust fix.
Please note that the code implementation for each file is quite extensive and cannot be provided in this format.
However, I can provide a sample implementation for the entry point file (app.component.ts) of the Angular SPA
and the server.js file of the NodeJS server. Let me know if you would like to proceed with that.Traceback (most
recent call last):
File "/Users/redacted1/redacted2/gpt-engineer/main.py", line 49, in <module>
app()
File "/Users/redacted1/redacted2/gpt-engineer/main.py", line 44, in chat
messages = step(ai, dbs)
File "/Users/redacted1/redacted2/gpt-engineer/steps.py", line 61, in run_clarified
to_files(messages[-1]['content'], dbs.workspace)
File "/Users/redacted1/redacted2/gpt-engineer/chat_to_files.py", line 27, in to_files
workspace[file_name] = file_content
File "/Users/redacted1/redacted2/gpt-engineer/db.py", line 17, in __setitem__
with open(self.path / key, 'w', encoding='utf-8') as f:
IsADirectoryError: [Errno 21] Is a directory: '/Users/redacted1/redacted2/gpt-engineer/my-test/workspace'
gpt-engineer-main/steps.py:45 in run_clarified │
│ │
│ 42 │
│ 43 def run_clarified(ai: AI, dbs: DBs): │
│ 44 │ # get the messages from previous step │
│ ❱ 45 │ messages = json.loads(dbs.logs[clarify.name]) │
│ 46 │ │
│ 47 │ messages = ( │
│ 48 │ │ [ │
│ │
│ ╭─────────────────────── locals ───────────────────────╮ │
│ │ ai = <ai.AI object at 0x7f84091e5e80> │ │
│ │ dbs = DBs( │ │
│ │ │ memory=<db.DB object at 0x7f84091f90d0>, │ │
│ │ │ logs=<db.DB object at 0x7f84091f9220>, │ │
│ │ │ identity=<db.DB object at 0x7f84091f91c0>, │ │
│ │ │ input=<db.DB object at 0x7f84091f9190>, │ │
│ │ │ workspace=<db.DB object at 0x7f84091f9130> │ │
│ │ ) │ │
│ ╰──────────────────────────────────────────────────────╯ │
╰────────────────────────────────────────────────────────────────────────────────────────╯
NameError: name 'json' is not defined
Is it supported only python as new project language, or others instead?
I'm wondering if it's possible to enable the "gpt-engineer" to access the web for searching documentations.
With the release of gpt-3.5-turbo-0613 and gpt-4-0613, OpenAI implemented function calling which now makes it possible to call python functions via chat responses.
It can also work with GPT 3.5 for anyone not on the GPT-4 beta.
More info - https://platform.openai.com/docs/guides/gpt/function-calling
Running the example (python main.py example), produces only one file in workspace.
The file is just called 'python', (no extension), and only contains whatever file it generated last.
I should mention I'm also got an incompatibility error on pip install for having typer 0.9.0, when the project asked for 0.8.0, but I dont know if thats the problem.
The project is a bit hard to use through a command line, maybe you can add a GUI (Client). If you're planning to add it, and if you're planning to use WPF, I'll be more than happy to try to contribute to the project!
jai pas de problkeme
Is there a way to use this without an API key?
Is the gpt-engineer capable of generating python code only? If yes, is there a chance to generalize it, so we can generate e.g. C# code?
When trying to generate some things, I ran into several issues. engineer is currently targeting gpt model 4.0, which doesn't appear to be available. as mentioned in another issue, gpt-3.5-turbo
seems to work. After making this change, i noticed that the parsing of the gpt response seemed to have some issues.
It's possible that these are related to me using a different model, but I can't test it with 4.0 as this doesn't seem to work at all. Engineer can't successfully parse the response to extract the correct filenames. I managed to update the regex to fit the output.
after making this change, i noticed that GPT has extremely inconsistent output, and will switch between several different formats, seemingly at random. The only fix i could think of for this was to add some format specifiers in the prompt, but that does seem to work.
this commit seems to solve the issues, but before making this a PR, some discussion is probably needed. Is this even the right way to go about fixing this?
This keeps happening...
PS C:\Users\jews4\OneDrive\one2\OneDrive\Documents\gpt-engineer-main> python main.py gpt-zdondada-builds
Areas that need clarification:
Clarifying question:
For the main Search For Prescribers screen, how should the search results be displayed? Should they be in a table format or a card layout?
(answer in text, or "q" to move on)
table
No
Core classes, functions, and methods:
Aborted!
5. components/SearchPrescribers
ALSO, if I let it run through the project, it outputs a couple of things and then tells me the rest of the files are in a non-existent GitHub
I've tried using a prompt to improve existing code, but it doesn't seem to work. Has anyone else gotten this to work?
Something like "edit main.py in workspace to write console output to a logfile named log.txt". I tried that as a test and it will not read the simple main.py in there.
I tried something very similar to what this guy did (~9:30 mark) for referencing: https://www.youtube.com/watch?v=gWy-pJ2ofEM
OpenAI's model 3.5 breaks frequently and is low quality in general.
Falcon, Vicuna, Hermes and more should be supported as they're open source, free, and moving away from paid closed source is good practice and opens applications to huge user base who wants free access to these tools.
As a new student contributor to the project, I believe it would greatly benefit the community to have a CONTRIBUTING.md file and contributing guidelines. This document would provide clear instructions and expectations for contributing to the project, helping newcomers like myself navigate the codebase and participate effectively.
The CONTRIBUTING.md file should cover the following key topics:
Where does the api key go?
I hope to see the ability to work with an existing codebase in the near future as this will be the most common use case in the real world.
It's always good to have a backup plan.
@AntonOsika / any engineers (if Anton is busy) interested to build an AI web & app based product with gpt-engineer in collab with a non engineer?
I'm using gpt-3.5-turbo
because gpt-4
doesn't work
I asked for an angular project with a table that is generated from an API, however it generated all output in afile called all_output.txt, and file called HTML and a file called typescript,
What is expected to generate all files separately (app.component.ts, api.service.ts, table.component.ts app.component.html ...) with their corresponding content instead of generating it in the all_output.txt
Hi, I absolutely love this script. This is the most accurate auto-GPT development script I have tried yet, it's so powerful!
In the demo video it shows the script creating each of the development files, in my case .py files within the workspace folder automatically. My build isn't doing this I just get an all_output.txt file with all .py files codes in one place and a single python file.
How do I ensure that GPT-Engineer automatically creates the .py files for me. Thanks
Hey thanks for this amazing thing. It's very interesting we don't have a discussion section and contribution guideline in this repo. I'd love that and I'm sure all of the people visiting this repo would agree on that.
System: Ubuntu 20.04
Python version 3.8
I got this error after running python main.py example
:
Traceback (most recent call last):
File "main.py", line 7, in <module>
from ai import AI
File "/home/user/Projects/trending/gpt-engineer/ai.py", line 5, in <module>
class AI:
File "/home/user/Projects/trending/gpt-engineer/ai.py", line 23, in AI
def next(self, messages: list[dict[str, str]], prompt=None):
TypeError: 'type' object is not subscriptable
I already run these commands:
pip install -r requirements.txt
export OPENAI_API_KEY=[your api key]
In my venv
Is there a way to have it continue where it left off?
Using gpt3.5-turbo
But when it is creating the files, it will finish in the middle of creating a file.
Typically you can tell ChatGPT to continue. Is there a method to do that?
It keeps ending after "Now let's proceed with the file contents.", any thoughts?
I'm running gpt-3.5-turbo-16k
Using a Mac Book Air M1
I'm running on MAC, on GPT3.5, with Python 3.11.3
When i run the example main prompt (and a custom prompt too), that make the code in my terminal with success.
But on the example/workspace folder, i have just a file named "python" (without ext), with just one file content here. Any other code file.
I have tried some other prompt and same results (same for other language).
I have followed the readme file for installation.
The program exits with this error:
openai.error.InvalidRequestError: The model gpt-3
does not exist
I was previously getting the same error for gpt-4, but it made sense since I don't have access to GPT4. I changed the line in main.py from
model: str = "gpt-4",
to
model: str = "gpt-3",
Any ideas?
It seems to not be able to create a folder called templates in the workspace. I was able to create one manually and then restart the whole process.
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ key = 'templates/index.html' │ │
│ │ self = <db.DB object at 0x0000020342D50850> │ │
│ │ val = '\n\n\n \n <meta │ │
│ │ nam'+2029 │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\navy\Desktop\gpt-engineer\my-new-project\workspace\templates\index.html'
To help bring more people on board and get more eyes to further the development of gpt-engineer I have started a subreddit for people to ask questions, post help, announce advancements, and start to participate in more discussions on a friendly platform (for the average joe) outside of github.
Let me know what type of flare topics would be of interest for people. I'll add them as we go.
After adding api key and running the project for the first time, I am getting an error as follows:
C:\Users\kitkat\Desktop\gpt-engineer-main>python main.py proj
Traceback (most recent call last):
File "C:\Users\kitkat\Desktop\gpt-engineer-main\main.py", line 51, in <module>
app()
File "C:\Users\kitkat\Desktop\gpt-engineer-main\main.py", line 46, in chat
messages = step(ai, dbs)
^^^^^^^^^^^^^
File "C:\Users\kitkat\Desktop\gpt-engineer-main\steps.py", line 21, in clarify
messages = ai.next(messages, user)
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\kitkat\Desktop\gpt-engineer-main\ai.py", line 27, in next
response = openai.ChatCompletion.create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\kitkat\AppData\Local\Programs\Python\Python311\Lib\site-packages\openai\api_resources\chat_completion.py", line 25, in create
return super().create(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\kitkat\AppData\Local\Programs\Python\Python311\Lib\site-packages\openai\api_resources\abstract\engine_api_resource.py", line 153, in create
response, _, api_key = requestor.request(
^^^^^^^^^^^^^^^^^^
File "C:\Users\kitkat\AppData\Local\Programs\Python\Python311\Lib\site-packages\openai\api_requestor.py", line 226, in request
resp, got_stream = self._interpret_response(result, stream)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\kitkat\AppData\Local\Programs\Python\Python311\Lib\site-packages\openai\api_requestor.py", line 619, in _interpret_response
self._interpret_response_line(
File "C:\Users\kitkat\AppData\Local\Programs\Python\Python311\Lib\site-packages\openai\api_requestor.py", line 682, in _interpret_response_line
raise self.handle_error_response(
openai.error.InvalidRequestError: The model: `gpt-4` does not exist
C:\Users\kitkat\Desktop\gpt-engineer-main>
Hey, I was thinking that we should add an optional flag to the run command. This flag would allow us to hide the generated code on the terminal. By doing so, the terminal output would appear cleaner, and the reader could easily understand what is happening just by reading the output. Currently, with both the code and instructions displayed, it looks cluttered.
That being said, if someone wants the code to be printed, it can still be displayed based on the flag value.
Hi,
I just run python3 main.py tictactoe (tictactoe was the name of the folder, where I put main_prompt with the following content: ""We are writing tic-tac-toe game in python. MVC components split in separate files. Keyboard control.")
Unfortunately, there were no .py files generated. Only "python" (without any extension) file with:
from typing import List, Tuple
class View:
def init(self, size: int):
self.size = size
def display_board(self, board: List[List[str]]) -> None:
print('\n'.join(['|'.join(row) for row in board]))
def display_message(self, message: str) -> None:
print(message)
def get_move(self) -> Tuple[int, int]:
while True:
try:
row = int(input('Enter row: '))
col = int(input('Enter column: '))
return row, col
except ValueError:
print('Invalid input. Please enter integers for row and column.')
And all_output.txt which started with:
Core classes, functions, and methods:
__init__(self, size: int)
: initializes the game board with the given size.thus I cannot compile it.
I expected this tool to create .py files, so it's ready to be run. Is there anything I did wrong?
I find that the code may work better if you add more identities i.e. double checking and providing more feedback each step of the way
a. Carefully analyze the instructions and identify any points that are ambiguous, unclear, or could be interpreted in multiple ways.
b. Summarize these points in a list of concise bullet points, each representing a distinct area that requires clarification.
c. Choose one of these points and formulate a specific, targeted question to ask the user in order to gain the necessary clarification. This question should be clear, concise, and directly related to the point of confusion.
d. After asking the question, wait for the user's response before proceeding. Do not attempt to guess or make assumptions about the user's intent.
Remember, your goal is to ensure that the instructions are as clear and unambiguous as possible, not to carry them out. Your role is to facilitate understanding, not execution.
Begin by identifying the core classes, functions, and methods that will be necessary for the implementation. For each item, provide a brief comment explaining its purpose and role within the overall system. This will serve as a blueprint for the code generation process.
Next, start writing the code for each file. Use the 'entrypoint' file as your starting point, then proceed to the files that are imported by it, and continue in this order until all files have been covered.
Ensure that each file contains all necessary imports, types, and other dependencies. The code should be fully functional and the code in different files should be compatible with each other, working together seamlessly to implement the architecture.
As you write the code, make sure to use the following syntax:
[ADD YOUR CODE HERE]
This will ensure that the code is formatted correctly and easy to read.
As an AI, you are tasked with generating the software architecture based on the instructions provided. Your response should be extensive and detailed, ensuring that every aspect of the proposed architecture is properly implemented with a meticulous understanding of the flow of the task.
To accomplish this, follow these steps:
Identify and list the core classes, functions, and methods that will be required to implement the architecture. For each item in the list, provide a brief comment explaining its purpose and role within the overall system.
Begin writing the code for each file. Start with the 'entry point' file, then proceed to the files that are imported by it, and continue in this manner until all files are covered.
Ensure that each file contains all necessary imports, types, and other dependencies. The code in different files should be compatible with each other and work together seamlessly to implement the architecture.
If there are parts of the instructions that are unclear, make an educated guess and write a plausible implementation.
Before finalizing your response, double-check that all parts of the architecture have been implemented in the code.
Remember, your goal is to translate the architecture into a fully functional codebase.
File syntax:
[ADD YOUR CODE HERE]
Before you finish, double-check that all parts of the architecture is present in the files. Revise any potential code errors
I'm following the readme, but it seems that the application cannot mkdirs:
vscode ➜ ~/gpt-engineer (main) $ python3.10 main.py main-prompt
Traceback (most recent call last):
File "/home/vscode/gpt-engineer/main.py", line 51, in <module>
app()
File "/home/vscode/gpt-engineer/main.py", line 37, in chat
memory=DB(memory_path),
File "/home/vscode/gpt-engineer/db.py", line 10, in __init__
os.makedirs(self.path, exist_ok=True)
File "/home/vscode/.pyenv/versions/3.10.12/lib/python3.10/os.py", line 225, in makedirs
mkdir(name, mode)
NotADirectoryError: [Errno 20] Not a directory: '/home/vscode/gpt-engineer/main-prompt/memory'
I would like to use any of the open-source LLM, will it work out?
I can't get the export command to work, so an alternative solution like using an extern file or hardcoding the api in the code would be a nice solution. I personally created an external json config file and parsed the api key from that to the python script.
So a solution could be:
import json
def get_api_key(file_name: str) -> str:
with open(file_name, 'r') as f:
config = json.load(f)
return config['openai_api_key']
{
"openai_api_key": "your_api_key"
}
class AI:
def __init__(self, **kwargs):
openai.api_key = get_api_key("config.json")
self.kwargs = kwargs
Thanks for your work.
Steps I took,
pip install -r requirements.txt
python3
so ran python3 main.py example
Traceback (most recent call last):
File "/Users//Documents//gpt-engineer/./main.py", line 5, in <module>
import openai
ModuleNotFoundError: No module named 'openai'
Not a py coder, what could I be doing wrong?
Getting this error in ai.py when try to run the example:
Traceback (most recent call last):
File "main.py", line 6, in
from ai import AI
File "/workspace/AI/gpt-engineer/ai.py", line 4, in
class AI:
File "/workspace/AI/gpt-engineer/ai.py", line 30, in AI
def next(self, messages: list[dict[str, str]], prompt=None):
TypeError: 'type' object is not subscriptable
Line 30:
def next(self, messages: list[dict[str, str]], prompt=None):
if prompt:
messages = messages + [{"role": "user", "content": prompt}]
response = openai.ChatCompletion.create(
messages=messages, stream=True, **self.kwargs
)
chat = []
for chunk in response:
delta = chunk['choices'][0]['delta']
msg = delta.get('content', '')
print(msg, end="")
chat.append(msg)
return messages + [{"role": "assistant", "content": "".join(chat)}]
I'm using python 3.9
Any idea?
Would you specify a license please?
Is there any plan or example to integrate the gpt-engineer with reflection? In order to complete the templates it generates. Because for me it generated just templates of the files only with the class and function names without the actual implementation.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.