OpenAPI::Client::OpenAI::Path::moderations(3)

NAME
OpenAPI::Client::OpenAI::Path::moderations - Documentation for the /moderations path.

DESCRIPTION
This document describes the API endpoint at "/moderations".

PATHS

  "POST /moderations"
Classifies if text and/or image inputs are potentially harmful. Learn more in the moderation guide <https://platform.openai.com/docs/guides/moderation>.

Operation ID

"createModeration"

    $client->createModeration( ... );

Parameters

Request Body

Content Type: "application/json"

Models

The content moderation model you would like to use. Learn more in the moderation guide <https://platform.openai.com/docs/guides/moderation>, and learn about available models here <https://platform.openai.com/docs/models#moderation>.

•   "omni-moderation-latest"

•   "omni-moderation-2024-09-26"

•   "text-moderation-latest"

•   "text-moderation-stable"

Example:

    {
       "model" : "omni-moderation-2024-09-26"
    }

Responses

Status Code: 200

OK

Content Types:

•   "application/json"

    Example (See the OpenAI spec for more detail <https://github.com/openai/openai-openapi/blob/master/openapi.yaml>):

        {
          "id": "modr-0d9740456c391e43c445bf0f010940c7",
          "model": "omni-moderation-latest",
          "results": [
            {
              "flagged": true,
              "categories": {
                "harassment": true,
                "harassment/threatening": true,
                "sexual": false,
                "hate": false,
                "hate/threatening": false,
                "illicit": false,
                "illicit/violent": false,
                "self-harm/intent": false,
                "self-harm/instructions": false,
                "self-harm": false,
                "sexual/minors": false,
                "violence": true,
                "violence/graphic": true
              },
              "category_scores": {
                "harassment": 0.8189693396524255,
                "harassment/threatening": 0.804985420696006,
                "sexual": 1.573112165348997e-6,
                "hate": 0.007562942636942845,
                "hate/threatening": 0.004208854591835476,
                "illicit": 0.030535955153511665,
                "illicit/violent": 0.008925306722380033,
                "self-harm/intent": 0.00023023930975076432,
                "self-harm/instructions": 0.0002293869201073356,
                "self-harm": 0.012598046106750154,
                "sexual/minors": 2.212566909570261e-8,
                "violence": 0.9999992735124786,
                "violence/graphic": 0.843064871157054
              },
              "category_applied_input_types": {
                "harassment": [
                  "text"
                ],
                "harassment/threatening": [
                  "text"
                ],
                "sexual": [
                  "text",
                  "image"
                ],
                "hate": [
                  "text"
                ],
                "hate/threatening": [
                  "text"
                ],
                "illicit": [
                  "text"
                ],
                "illicit/violent": [
                  "text"
                ],
                "self-harm/intent": [
                  "text",
                  "image"
                ],
                "self-harm/instructions": [
                  "text",
                  "image"
                ],
                "self-harm": [
                  "text",
                  "image"
                ],
                "sexual/minors": [
                  "text"
                ],
                "violence": [
                  "text",
                  "image"
                ],
                "violence/graphic": [
                  "text",
                  "image"
                ]
              }
            }
          ]
        }

SEE ALSO
OpenAPI::Client::OpenAI::Path

COPYRIGHT AND LICENSE
Copyright (C) 2023-2025 by Nelson Ferraz

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.0 or, at your option, any later version of Perl 5 you may have available.