Getting APIConnectionError while using AzureOpenAI

Hello. My team is using AzureOpenAI from the langchain.llms library. The code is below:

import os
import langchain.llms import AzureOpenAI

os.environ[“AZURE_OPENAI_ENDPOINT”] = ‘http s://XXX.openai. azure. com’
os.environ[“REQUESTS_CA_BUNDLE”] = ‘certificate.crt’ #expires in 2026
os.environ[“AZURE_OPENAI_API_KEY”] = ‘dvjbwdovbkldbclkdabckld’
deployment_name = ‘local_chatgpt’

llm = AzureOpenAI(

llm(“hello, please explain me …”)

When the above code is run, and the llm prompt is passed, we are getting the errorAPIConnectionError: Connection error. We did a telnet to the API endpoint, it works. Our certificate has not expired. What else can we check? Where can be the issue?

I searched for APIConnectionError and came across an OpenAI article (help.openai com en/articles/article 6897191-apiconnecterror) which asked to perform a series of check, which we have, and don’t see any issue at our end, though we are sure there should be one, but not able to zero in on it.

Kindly help.

1 Like

I’m also having this issue. @gautamsomani did you manage to figure this out?

Here’s a link to the OpenAI Help Page mentioned in the original post.

1 Like