Closed as not planned
Description
Describe the bug
I'll leave this specific to my use case but as others have reported on the forums there is a intermittent error:
Error communicating with OpenAI: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
In our case we are encountering this on the Moderation endpoint. Only started happening within the last week or so.
To Reproduce
- Make Request to Moderation endpoint using
openai.Moderation.create()
- It may work it may not, our users have found that this most often happens at the beginning of a conversation thread, the fact that it is so intermittent is what is making me believe this is a server error on OpenAI's part.
Code snippets
try:
input = body["messages"][-1]["content"]
moderation = openai.Moderation.create(input=input, model='text-moderation-latest')
moderation_flagged = moderation["results"][0]["flagged"]
except Exception as e:
print(e) #error is received here
return EventSourceResponse(error_generate(message="Error: Unable to moderate prompt", status_code=500))
OS
macOS/Windows
Python version
Python v3.9.16
Library version
0.27.2