seanpixel / Teenage-AGI

MIT License
902 stars 109 forks source link

Dreaded "openai.error.InvalidRequestError: The model: 'gpt-4' does not exist" #12

Closed tdimino closed 1 year ago

tdimino commented 1 year ago

Hey friends,

Thank you so much for embarking on this work, and sharing your progress with the world. What I imagined as reality in 2038 is fast approaching us in 2023.

I'm trying to diagnosis why I'm receiving the error, "openai.error.InvalidRequestError: The model: gpt-4 does not exist" if I possess a paid plan and OpenAI API key (which is correctly set in my .env). Last night I successfully ran AutoGPT with it, so I'm not sure why I can't access it now. Has any anyone else encountered this specifically with Teenage-AGI?

`docker-compose run teenage-agi
[nltk_data] Downloading package punkt to /root/nltk_data...
[nltk_data]   Unzipping tokenizers/punkt.zip.
Talk to the AI!
Hi
------------INTERNAL THOUGHT PROMPT------------
You have been given the following input: Hi. 
You must think about it and plan what action to take.
For some context, here are your memories related to the query.

MEMORIES sorted in relevance:

Think of some actions you would take after hearing "Hi" based on your past thoughts and actions.
This is not shown to the outside world but only to yourself. It is just your internal thought."
Traceback (most recent call last):
  File "/app/main.py", line 28, in <module>
    print(agent.action(userInput), "\n")
          ^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/agent.py", line 164, in action
    internal_thought, top_matches = self.internalThought(query)
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/agent.py", line 153, in internalThought
    internal_thought = generate(internalThoughtPrompt) # OPENAI CALL: top_matches and query text is used here
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/agent.py", line 21, in generate
    completion = openai.ChatCompletion.create(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/openai/api_resources/chat_completion.py", line 25, in create
    return super().create(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/openai/api_resources/abstract/engine_api_resource.py", line 153, in create
    response, _, api_key = requestor.request(
                           ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/openai/api_requestor.py", line 226, in request
    resp, got_stream = self._interpret_response(result, stream)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/openai/api_requestor.py", line 619, in _interpret_response
    self._interpret_response_line(
  File "/usr/local/lib/python3.11/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`
gdoscher commented 1 year ago

Hey there, I'm having the same issue. I also have a paid plan and valid API key and AutoGPT works for me as well.

gdoscher commented 1 year ago

Found the issue, you're likely in the same boat as me and need to join the waitlist for a GPT-4 API key: https://openai.com/waitlist/gpt-4-api

tdimino commented 1 year ago

Hmm. I had been under the impression that GPT-4 could be accessed through this same API key. But that would make sense, as I signed up for the waitlist and haven't received any emails about it yet.

MichaelCarychao commented 1 year ago

In the meanwhile, while you wait for gpt-4 API access, you can use gpt-3.5-turbo:

(line 18 of agent.py): OPENAI_MODEL = os.getenv("OPENAI_MODEL") or "gpt-4" --> OPENAI_MODEL = os.getenv("OPENAI_MODEL") or "gpt-3.5-turbo"

tdimino commented 1 year ago

Thank you Michael. I intend to verse myself on more Python while I wait. I’m from a content designer’s background, and never ventured much into SWE, so all of this has been quite exciting. It’s the exact push I needed to work with terminals and repos finally.