DougDougGithub / Babagaboosh

App that lets you have a verbal conversation with OpenAi's GPT 4

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when using without GPT-4

JOOT49 opened this issue · comments

When using this with gpt-3.5, the code spits out a ton of errors.
Here they are:
(I tried changing things in the openai_chat.py file and nothing worked)

Traceback (most recent call last):
  File "/Users/Joshua/Documents/Other/coding/Babagaboosh-main/chatgpt_character.py", line 59, in <module>
    openai_result = openai_manager.chat_with_history(mic_result)
  File "/Users/Joshua/Documents/Other/coding/Babagaboosh-main/openai_chat.py", line 74, in chat_with_history
    completion = self.client.chat.completions.create(
  File "/Users/Joshua/Documents/Other/coding/Babagaboosh-main/.venv/lib/python3.9/site-packages/openai/_utils/_utils.py", line 271, in wrapper
    return func(*args, **kwargs)
  File "/Users/Joshua/Documents/Other/coding/Babagaboosh-main/.venv/lib/python3.9/site-packages/openai/resources/chat/completions.py", line 643, in create
    return self._post(
  File "/Users/Joshua/Documents/Other/coding/Babagaboosh-main/.venv/lib/python3.9/site-packages/openai/_base_client.py", line 1112, in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
  File "/Users/Joshua/Documents/Other/coding/Babagaboosh-main/.venv/lib/python3.9/site-packages/openai/_base_client.py", line 859, in request
    return self._request(
  File "/Users/Joshua/Documents/Other/coding/Babagaboosh-main/.venv/lib/python3.9/site-packages/openai/_base_client.py", line 949, in _request
    raise self._make_status_error_from_response(err.response) from None
openai.NotFoundError: Error code: 404 - {'error': {'message': 'The model `gpt-4` does not exist or you do not have access to it. Learn more: https://help.openai.com/en/articles/7102672-how-can-i-access-gpt-4.', 'type': 'invalid_request_error', 'param': None, 'code': 'model_not_found'}}
(.venv) Joshua@Matthew's MacBook Pro Babagaboosh-main % 

You need credit to use the GPT-4 model. Visit the OpenAI platform to add credit. The lowest can be $5, but it will be almost enough. It takes a while to work after paying, then the code should be working.

Correct, as said above you will need to pay at least $1 to OpenAi to gain access to GPT 4. See here: https://help.openai.com/en/articles/7102672-how-can-i-access-gpt-4
Presumably they will open up GTP-4 to everyone in the future but for right now you do have to pay. I will update the setup instructions accordingly.

If you do want to use gpt-3.5-turbo, you would update the chat_with_history() function in the openai_chat.py script. You should just need to change this:
model="gpt-4",
to this:
model="gpt-3.5-turbo",
However, because OpenAi has been frequently changing their API over the past year and has been actively deprecating GPT3.5, I can't guarantee this will still work, you will likely have to do some debugging