Moderations

Create Moderation

Classifies if text is potentially harmful.

POSThttps://api.portkey.ai/v1/moderations
Body
input*one of

The input text to classify

modelany of

Two content moderations models are available: text-moderation-stable and text-moderation-latest.

The default is text-moderation-latest which will be automatically upgraded over time. This ensures you are always using our most accurate model. If you use text-moderation-stable, we will provide advanced notice before updating the model. Accuracy of text-moderation-stable may be slightly lower than for text-moderation-latest.

Example: "text-moderation-stable"
Response

OK

Body
id*string

The unique identifier for the moderation request.

model*string

The model used to generate the moderation results.

results*array of object

A list of moderation objects.

Response
{
  "id": "text",
  "model": "text",
  "results": [
    {
      "flagged": false,
      "categories": {
        "hate": false,
        "hate/threatening": false,
        "harassment": false,
        "harassment/threatening": false,
        "self-harm": false,
        "self-harm/intent": false,
        "self-harm/instructions": false,
        "sexual": false,
        "sexual/minors": false,
        "violence": false,
        "violence/graphic": false
      },
      "category_scores": {
        "hate": 0,
        "hate/threatening": 0,
        "harassment": 0,
        "harassment/threatening": 0,
        "self-harm": 0,
        "self-harm/intent": 0,
        "self-harm/instructions": 0,
        "sexual": 0,
        "sexual/minors": 0,
        "violence": 0,
        "violence/graphic": 0
      }
    }
  ]
}

Last updated