一、问题描述

可以fanqiang,但是使用openai的接口还是报错如下的openai.error.APIConnectionError: Error communicating with OpenAI问题:

  File "D:\Anaconda3\envs\gms\lib\site-packages\openai\api_resources\abstract\engine_api_resource.py", line 153, in create
    response, _, api_key = requestor.request(
  File "D:\Anaconda3\envs\gms\lib\site-packages\openai\api_requestor.py", line 216, in request
    result = self.request_raw(
  File "D:\Anaconda3\envs\gms\lib\site-packages\openai\api_requestor.py", line 529, in request_raw
    raise error.APIConnectionError(
openai.error.APIConnectionError: Error communicating with OpenAI: HTTPSConnectionPool(host='api.openai.com', port=443): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000002027AB1ECD0>: Failed to establish a new connectio

二、解决方案

是 urllib3的版本问题,环境内的urllib3版本是1.26.14版本,回退到1.25.11版即可。
在这里插入图片描述

Reference

[1] https://github.com/urllib3/urllib3

Logo

欢迎加入我们的广州开发者社区,与优秀的开发者共同成长!

更多推荐