pycharm mac os上的openAI问题--不是OpenSSL警告:urllib 3 v2.0仅支持OpenSSL 1.1.1+,当前“ssl”模块使用“LibreSSL 2.8.3”进行编译

vmdwslir  于 8个月前  发布在  PyCharm
关注(0)|答案(1)|浏览(384)

当我在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)

我在终端窗口中得到以下运行时错误:

/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

下面是我的pycharm python软件包的图片,以及我当前的自制软件包和pip软件包。

在过去的几个小时里,我一直在看几篇关于这方面的文章,没有任何效果。尝试重新安装urllib3和openssl,在mac os上没有任何效果。目前使用的是2015年年中的MacBook Pro,我有最新的操作系统。

rseugnpd

rseugnpd1#

所以.....起初我以为这是一个配额问题,但我改变了“openai.ChatCompletion.create”到“openai.Completion.create”和问题解决。我想我用错了方法。

相关问题