openAI 在 mac os 上的问题 -- NotOpenSSLWarning: urllib3 v2.0 仅支持 OpenSSL 1.1.1+,目前 'ssl' 模块是使用 'LibreSSL 2.8.3' 编译的

问题描述 投票:0回答:1

当我在 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 包,以及我当前的 homebrew 包和 pip 包的图像。

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

python pycharm openssl urllib3 libressl
1个回答
0
投票

所以......起初我以为这是配额问题,但我将“openai.ChatCompletion.create”更改为“openai.Completion.create”并解决了问题。我想我用错方法了。

© www.soinside.com 2019 - 2024. All rights reserved.