Find answers from the community

Updated 2 years ago

Cert

At a glance

The community member is running an example from the llama_index library and is encountering an error related to an SSL certificate verification failure when querying the OpenAI API. The community member has provided the OpenAPI key correctly in a .env file. A fellow community member asks if the issue is related to running on a VPN or work laptop, to which the original poster responds that it is their personal machine. The issue is later resolved, as indicated by a comment from the original poster.

Useful resources
Hi, I am running the following example: https://github.com/jerryjliu/llama_index/blob/main/docs/examples/usecases/10k_sub_question.ipynb

I have provided the OpenAPI key like this in my python file and it is stored in a .env file like this: OPENAI_API_KEY=sk on the project root:

import os from dotenv import load_dotenv load_dotenv() OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")

I get this error in the console from this line response = s_engine.query("question") when running the query if you refer to the example link above:

Exception has occurred: RetryError RetryError[<Future at 0x16a336b90 state=finished raised APIConnectionError>] ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002) The above exception was the direct cause of the following exception: aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host api.openai.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002)')] The above exception was the direct cause of the following exception: openai.error.APIConnectionError: Error communicating with OpenAI


Any ideas how to resolve this issue. Thanks
L
z
3 comments
Are you running on a VPN or work laptop?
@Logan M no this is my personal machine
@Logan M This issue is now resolved. Thanks
Add a reply
Sign up and join the conversation on Discord