Small Fix in Moderation JSON example

In the documentation of OPENAI we have moderation JSON with wrong format.

The current JSON is this :

{
  "id": "modr-XXXXX",
  "model": "text-moderation-005",
  "results": [
    {
      "flagged": true,
      "categories": {
        "sexual": false,
        "hate": false,
        "harassment": false,
        "self-harm": false,
        "sexual/minors": false,
        "hate/threatening": false,
        "violence/graphic": false,
        "self-harm/intent": false,
        "self-harm/instructions": false,
        "harassment/threatening": true,
        "violence": true,
      },
      "category_scores": {
        "sexual": 1.2282071e-06,
        "hate": 0.010696256,
        "harassment": 0.29842457,
        "self-harm": 1.5236925e-08,
        "sexual/minors": 5.7246268e-08,
        "hate/threatening": 0.0060676364,
        "violence/graphic": 4.435014e-06,
        "self-harm/intent": 8.098441e-10,
        "self-harm/instructions": 2.8498655e-11,
        "harassment/threatening": 0.63055265,
        "violence": 0.99011886,
      }
    }
  ]
}

The correct JSON format is this :

{
  "id": "modr-XXXXX",
  "model": "text-moderation-005",
  "results": [
    {
      "flagged": true,
      "categories": {
        "sexual": false,
        "hate": false,
        "harassment": false,
        "self-harm": false,
        "sexual/minors": false,
        "hate/threatening": false,
        "violence/graphic": false,
        "self-harm/intent": false,
        "self-harm/instructions": false,
        "harassment/threatening": true,
        "violence": true
      },
      "category_scores": {
        "sexual": 1.2282071e-06,
        "hate": 0.010696256,
        "harassment": 0.29842457,
        "self-harm": 1.5236925e-08,
        "sexual/minors": 5.7246268e-08,
        "hate/threatening": 0.0060676364,
        "violence/graphic": 4.435014e-06,
        "self-harm/intent": 8.098441e-10,
        "self-harm/instructions": 2.8498655e-11,
        "harassment/threatening": 0.63055265,
        "violence": 0.99011886
      }
    }
  ]
}
1 Like

It took me a moment to spot the difference, but for everyone else looking, the difference is the , after "violence": true and the "violence": <score>

1 Like

Yup that’s the one. I often use Jsonpathdotcom and found this right away

1 Like

Smart!

And welcome to the developer community forum btw :heart:

I’ll post the link for you it seems like a usable tool
https://jsonpath.com/

I’ll have to say that I cheated a bit, and used https://www.diffchecker.com/ to find the difference :laughing:

2 Likes

Haha. that’s more like it. Thanks for the warm welcome. I didn’t know about this community and found this outta nowhere. Looks like I’m gonna be here for a while. :slight_smile:

3 Likes

Great! I highly recommend you do. You really get deep into the whole topic.
Welcome!

2 Likes

Hi and welcome to the Developer Forum!

Can I ask where you did find it?

1 Like

At the bottom of the “overview page” for the moderation endpoint :laughing:

1 Like