When I run the following code in pyCharm IDE:
import creds
import os
import openai
os.environ["OPENAPI_KEY"] = creds.API_KEY
openai.api_key = os.environ["OPENAPI_KEY"]
keep_prompting = True
while keep_prompting:
prompt = input("Please enter in your question or prompt. Type exit if done. ")
if prompt == "exit":
keep_prompting = False
else:
response = openai.ChatCompletion.create(
model="text-davinci-003",
prompt=prompt,
max_tokens=200
)
print(response)
I get the following run-time error in the terminal window:
/Users/studywithrue/PycharmProjects/chat/venv/bin/python /Users/studywithrue/PycharmProjects/chat/chat.py
/Users/studywithrue/PycharmProjects/chat/venv/lib/python3.9/site-packages/urllib3/__init__.py:34: NotOpenSSLWarning: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020
warnings.warn(
Please enter in your question or prompt. Type exit if done. How does a chicken hatch from an egg?
Traceback (most recent call last):
File "/Users/studywithrue/PycharmProjects/chat/chat.py", line 14, in <module>
response = openai.ChatCompletion.create(
File "/Users/studywithrue/PycharmProjects/chat/venv/lib/python3.9/site-packages/openai/api_resources/chat_completion.py", line 25, in create
return super().create(*args, **kwargs)
File "/Users/studywithrue/PycharmProjects/chat/venv/lib/python3.9/site-packages/openai/api_resources/abstract/engine_api_resource.py", line 153, in create
response, _, api_key = requestor.request(
File "/Users/studywithrue/PycharmProjects/chat/venv/lib/python3.9/site-packages/openai/api_requestor.py", line 298, in request
resp, got_stream = self._interpret_response(result, stream)
File "/Users/studywithrue/PycharmProjects/chat/venv/lib/python3.9/site-packages/openai/api_requestor.py", line 700, in _interpret_response
self._interpret_response_line(
File "/Users/studywithrue/PycharmProjects/chat/venv/lib/python3.9/site-packages/openai/api_requestor.py", line 765, in _interpret_response_line
raise self.handle_error_response(
openai.error.RateLimitError: You exceeded your current quota, please check your plan and billing details.
Process finished with exit code 1
the following are images of my pycharm python packages, and my current homebrew packages and pip packages.
I've been looking at several articles on this for the past hours and nothing works. tried re-installing urllib3 and openssl and nothing works for me on mac os. currently using a mid-2015 macbook pro and i have the latest OS.
So.....at first i thought it was a quota issue but i changed "openai.ChatCompletion.create" to "openai.Completion.create" and problem solved. i guess I used the wrong method.