openai-python
openai-python copied to clipboard
Moderation bypasses proxy settings
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
- Prepare a no-internet environment that includes http&https proxy
- Import openai library, set api key and proxy
- Try to moderate a message
-
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