Openai moderation body 'input' is a required parameter

I have a request with a body that contains ‘input’ with the text I’m moderating to make sure it doesn’t violate terms, but I get an error that says:

{
  "error": {
    "code": null,
    "param": null,
    "message": "'input' is a required property",
    "type": "invalid_request_error"
  }
}

The input is there. Why am I seeing this issue?

I’m POSTing to https://api.openai.com/v1/moderations with this payload:

{
  "input": "I want to kill them.",
}

Content-Type: application/json
Authorization: Bearer [MY TOKEN]

It works locally, but not when I push it to a lambda. Any ideas?

Nothing? Is anybody else having this issue?

@joelAdPrompt Have you found the solution/root cause of this issue?

Please share the code if you have it, my guess is that something in your request is causing the input param to get dropped when you send the request.

1 Like

Appreciated for your response. I found the issue.
The issue was when queries the argument was not of required type. Instead of an object I was sending string instead to the llamaIndex queryEngine.

1 Like