codeinterpreter-api icon indicating copy to clipboard operation
codeinterpreter-api copied to clipboard

Error communicating with OpenAI

Open Vluptronic opened this issue 2 years ago • 2 comments

Very strange, I tried to use other plugins such as chapyter, but apparently there is an API ConnectionError. I already passed in the API key as an environment variable.

Vluptronic avatar Aug 14 '23 11:08 Vluptronic

An error occurred with the following message while using a proxy environment:

Retrying langchain.chat_models.openai.acompletion_with_retry.<locals>._completion_with_retry in 1.0 seconds as it raised APIConnectionError: Error communicating with OpenAI.
Retrying langchain.chat_models.openai.acompletion_with_retry.<locals>._completion_with_retry in 2.0 seconds as it raised APIConnectionError: Error communicating with OpenAI.

To address this issue, it was confirmed that the problem can be avoided by adding the following code:

import os
import openai
# openai.proxy = 'http://proxy.example.org'
openai.proxy = os.getenv('https_proxy')

It seems that in the asynchronous API used internally, it is necessary to specify the proxy directly instead of using proxy settings through environment variables.

#19 #22

JunEnomoto avatar Aug 15 '23 06:08 JunEnomoto

I checked that my openai proxy, when printing it out, was none. I put in the code but the issue remains

Vluptronic avatar Aug 15 '23 08:08 Vluptronic