raiyanyahya / prompt

🥝 A command line application to interact with OpenAI's ChatGPT API.
https://promptcli.com
MIT License
105 stars 6 forks source link

SSL Issue on VPN #6

Open jalotra opened 1 year ago

jalotra commented 1 year ago

This issue is already been discussed here : https://community.openai.com/t/ssl-certificate-verify-failed/32442/13?page=2 Tried all the methods, still not working.

StackTrace :

Traceback (most recent call last):
  File "/Users/shivam.jalotra/miniconda/lib/python3.9/site-packages/prompt/cli.py", line 43, in cli
    completion = openai.ChatCompletion.create(
  File "/Users/shivam.jalotra/miniconda/lib/python3.9/site-packages/openai/api_resources/chat_completion.py", line 25, in create
    return super().create(*args, **kwargs)
  File "/Users/shivam.jalotra/miniconda/lib/python3.9/site-packages/openai/api_resources/abstract/engine_api_resource.py", line 153, in create
    response, _, api_key = requestor.request(
  File "/Users/shivam.jalotra/miniconda/lib/python3.9/site-packages/openai/api_requestor.py", line 216, in request
    result = self.request_raw(
  File "/Users/shivam.jalotra/miniconda/lib/python3.9/site-packages/openai/api_requestor.py", line 528, 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 SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1129)')))
111
raiyanyahya commented 1 year ago

Hi,

Which OS are on ? I will try to add a flag for --no-verify in the next release. Need to check if I can overide the reuquest being sent. I will keep you posted. Thanks 😀

jalotra commented 1 year ago

hey I can contribute this change, CPU details : macOS running Monterey with Python 3.9 Processor : Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz

jalotra commented 1 year ago

Looked more into this, looks like OpenAI always checks for ssl certs. Permalink

raiyanyahya commented 1 year ago

Yup .. but there are work arounds and I am look into it

jalotra commented 1 year ago

Update : Was not able to run with https:// enabled because setting session.verify to False also didn't worked. Changed the default adapter to http:// over here, rebuild openai-python and then use the package in prompt and also disable warnings for using http:// that openai-python is throwing.

Example Conversation :

image
raiyanyahya commented 1 year ago

Great stuff! I guess I have to wait for a fix from openai-python

raiyanyahya commented 1 year ago

If you look at the dallecli that i created it uses the requests kodule to send the final request to generate images. Its not the same here. If it was i could simple provided no verify to the requests object. 🤔

jalotra commented 1 year ago

If you look at the dallecli that i created it uses the requests kodule to send the final request to generate images. Its not the same here. If it was i could simple provided no verify to the requests object. 🤔

Yes, that could be possible, but then you would have to call the API directly and not use the lib call the openai-python is providing right now, I think adding that capability is not a great use of time right now. Let's try to add more features, if more users see this issue could add them in the coming weeks.

raiyanyahya commented 1 year ago

I will follow the openai issues page and see if they have a fix for this in upcoming versions.