Liking cljdoc? Tell your friends :D
Clojure only.

openai-clj.moderations


create-moderationclj

(create-moderation params)
(create-moderation params options)

Classifies if text violates OpenAI's Content Policy

Example:

(create-moderation {:input "I want to kill them"})

Response:

{
"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,
    }
  }
]
}

Also see the OpenAI documentation

Classifies if text violates OpenAI's Content Policy

  Example:
  ```
  (create-moderation {:input "I want to kill them"})
  ```

  Response:
  ```
  {
  "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,
      }
    }
  ]
}

  ```

  Also see the [OpenAI documentation](https://platform.openai.com/docs/api-reference/moderations/create)
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close