openai-python icon indicating copy to clipboard operation
openai-python copied to clipboard

Moderation bypasses proxy settings

Open jfduque opened this issue 1 year ago • 0 comments

Describe the bug

In an environment without direct access to the Internet, If you pass proxy settings to the openai object and try to perform input validation, the openai.Moderation.create() call hangs on or times out.

Those same proxies do work for openai.ChatCompletion.create() and openai.ChatCompletion.create() calls.

To Reproduce

  1. Prepare a no-internet environment that includes http&https proxy
  2. Import openai library, set api key and proxy
  3. Try to moderate a message
  4. openai.Moderation.create() hangs on forever or until timeout

Code snippets

openai.api_key = "OPENAI_API_KEY"
openai.proxy = {"http": "<PROXY>", "https": "<PROXY>"}

message = "I will kill you"
moderation_resp = openai.Moderation.create(input=message) # Times out

OS

Linux

Python version

Python v3.9

Library version

v0.27.0

jfduque avatar Mar 06 '23 15:03 jfduque