Comments (13)
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>
Actually to help you even further go to your https://platform.openai.com/account/rate-limits page and you will see a list of models you can replace gpt-4 with... test out all the different models available for your account. additionally you can get on the waiting list for gpt-4 here: https://openai.com/waitlist/gpt-4-api
yeah I changed model: str = "gpt-4"
to model: str = "gpt-3.5-turbo"
which gave me acceptable results. Thanks
from gpt-engineer.
So I do have GPT-4 (on ChatGPT) and I am getting the same error.
from gpt-engineer.
@patillacode my PR also solves this for both the main.py and the rerun_edited_message_logs.py in a central file in the main repo directory called model_select.py. this way both fall back to the same fallback model and also centralizes the change out of the ai.py so that the rest of the code can reference in the future, making things easier to maintain and add to later on.
from gpt-engineer.
Try using gpt-3.5-turbo it worked best for me.
from gpt-engineer.
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>
Actually to help you even further go to your https://platform.openai.com/account/rate-limits page and you will see a list of models you can replace gpt-4 with... test out all the different models available for your account. additionally you can get on the waiting list for gpt-4 here: https://openai.com/waitlist/gpt-4-api
from gpt-engineer.
Make a PR with a fix to automatically switch over to gpt-3.5-turbo: #42
from gpt-engineer.
You should check that you have access to the GPT-4 model.
from gpt-engineer.
So I do have GPT-4 (on ChatGPT) and I am getting the same error.
I don't have access to gpt-4
so I can't replicate, the only thing that comes to mind is: are you sure the API Key you are using is a gpt-4
one?
from gpt-engineer.
In db.py I had to add utf-8 encoding because I'm on Windows:
def getitem(self, key):
with open(self.path / key, 'r', encoding='utf-8') as f:
return f.read()
And I also had to play around (didn't work the first time) with the set command (export doesn't work in Windows Anaconda):
The set command in Windows sets an environment variable only for the current terminal session. If you close the terminal and reopen it, you'll lose the environment variable that you set. It's useful if you want to set a variable temporarily for the purpose of running a specific command or script, but it's not a permanent solution.
The setx command, on the other hand, permanently sets an environment variable. The new setting will persist even after you close and reopen the terminal. However, it won't affect any currently open terminals — only new ones.
If you're having trouble with the set command, using setx might solve your problem. But remember, after setting the environment variable with setx, you'll need to start a new terminal session for the change to take effect.
If you're still having trouble, you could set the API key directly in your Python code as I suggested earlier, but be sure not to share this code with anyone or commit it to a public version control repository, as that would expose your API key.
What (I think) eventually worked was manually setting the Windows environment variable manually, closing the Anaconda, reopening it, and then I did start getting some results (though it does seem to just stop arbitrarily without warning or error...but it is digging into some of the work. Give it a try and good luck.
Manually set a windows environment variable like this:
As an alternative, you can try setting the environment variable through the Windows System Properties:
Right-click on Computer on the desktop or in the Start menu.
Choose Properties.
Click on Advanced system settings.
Click on the Advanced tab, then click on the Environment Variables button.
Under the System Variables section, click New.
Enter OPENAI_API_KEY for the Variable name.
Enter your API key for the Variable value.
Click OK in each dialog to save.
ALSO!!! If you do have gpt-4 api access, use the new model gpt-4-0613 (not just main.py, you gotta look through and find everywhere the model is defined).
from gpt-engineer.
Oh, also, I think I did have to rerun the activate command after manually setting the environment variable and reopening anaconda.
from gpt-engineer.
Update: Seems like I thought I have GPT-4 API access but apparently not. based on the below output.
Good part, I didnt need to change the model manually, it was done automatically.
Model gpt-4 not available for provided api key reverting to gpt-3.5.turbo. Sign up for the gpt-4 wait list here: https://openai.com/waitlist/gpt-4-api
from gpt-engineer.
Correct, we recently merged that functionality, falling back into model gpt-3.5-turbo
for when gpt-4
fails.
for anyone landing on this issue in the future: make sure you have a valid gpt-4
api key.
from gpt-engineer.
Open discussion related to this in #135
from gpt-engineer.
Related Issues (20)
- Update ROADMAP.md file to reflect current status
- GUI for the Open Source Project HOT 1
- Multiple Features HOT 1
- API Key Issue HOT 1
- ChatGPT is being Lazy and creates Placeholders HOT 2
- Unknow Bugs HOT 5
- Feature request: Windows script for running code generated by GPT-Engineer HOT 3
- Feature request: Integration of Code Formatting and Linting Tools for the improve Function Workflow HOT 5
- Imporvement flow generating bad source code files HOT 9
- Feature Request: Enhanced Feedback and Issue Reporting with Automated Issue Logging
- UnicodeDecodeError HOT 4
- ValueError
- Make it possible to use "copy paste" to external LLM for Gemini 1.5 experimentation HOT 5
- Set up codecov.io reporting HOT 4
- WSL2 gpte File List bad Behavior HOT 15
- Implement Vector Store for Similarity-Based Code Generation (RAG on Codebase) HOT 1
- Git diff generation marking valid diffs as invalid HOT 4
- The documentation build is failing HOT 2
- Image input
- Run against SWE-Bench HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gpt-engineer.