Skip to content

Moderation bypasses proxy settings #279

@jfduque

Description

@jfduque

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions