> Markdown versions of all pages of this connector library are available by appending `.md` to the page URL. For the full index of connectors, see [llms.txt](https://connectors.appmixer.com/llms.txt).

# appmixer.utils.ai.Moderate

- Component: `appmixer.utils.ai.Moderate`
- Kind: Action
- Version: 1.0.0
- Visibility: Public
- Connector: [appmixer.utils.ai 1.1.4](https://connectors.appmixer.com/connector/appmixer.utils.ai/1.1.4.md)
- Component page: <https://connectors.appmixer.com/connector/appmixer.utils.ai/1.1.4/component/appmixer.utils.ai.Moderate>

Classify if text is potentially harmful.

## Input ports

### Port `in`

| Field | Type | Description |
| --- | --- | --- |
| Text (`input`) | textarea | - |

## Output ports

### Port `IsFlagged`

| Field | Type | Description |
| --- | --- | --- |
| Moderation (`moderation`) | object | - |
| Text (`input`) | string | - |

### Port `NotFlagged`

| Field | Type | Description |
| --- | --- | --- |
| Moderation (`moderation`) | object | - |
| Text (`input`) | string | - |

## Full metadata (component.json)

```json
{
  "name": "appmixer.utils.ai.Moderate",
  "author": "Appmixer <info@appmixer.com>",
  "description": "Classify if text is potentially harmful.",
  "inPorts": [
    {
      "name": "in",
      "schema": {
        "type": "object",
        "properties": {
          "input": {
            "type": "string"
          }
        },
        "required": [
          "input"
        ]
      },
      "inspector": {
        "inputs": {
          "input": {
            "label": "Text",
            "type": "textarea",
            "index": 1
          }
        }
      }
    }
  ],
  "outPorts": [
    {
      "name": "IsFlagged",
      "options": [
        {
          "label": "Moderation",
          "value": "moderation",
          "schema": {
            "type": "object",
            "properties": {
              "flagged": {
                "type": "boolean",
                "title": "Is Flagged"
              },
              "categories": {
                "type": "object",
                "title": "Categories",
                "properties": {
                  "sexual": {
                    "type": "boolean",
                    "title": "Is Sexual"
                  },
                  "hate": {
                    "type": "boolean",
                    "title": "Is Hate"
                  },
                  "harassment": {
                    "type": "boolean",
                    "title": "Is Harassment"
                  },
                  "self-harm": {
                    "type": "boolean",
                    "title": "Is Self-Harm"
                  },
                  "sexual/minors": {
                    "type": "boolean",
                    "title": "Is Sexual/Minors"
                  },
                  "hate/threatening": {
                    "type": "boolean",
                    "title": "Is Hate/Threatening"
                  },
                  "violence/graphic": {
                    "type": "boolean",
                    "title": "Is Violence/Graphic"
                  },
                  "self-harm/intent": {
                    "type": "boolean",
                    "title": "Is Self-Harm/Intent"
                  },
                  "self-harm/instructions": {
                    "type": "boolean",
                    "title": "Is Self-Harm/Instructions"
                  },
                  "harassment/threatening": {
                    "type": "boolean",
                    "title": "Is Harassment/Threatening"
                  },
                  "violence": {
                    "type": "boolean",
                    "title": "Is Violence"
                  }
                }
              },
              "category_scores": {
                "type": "object",
                "title": "Category Scores",
                "properties": {
                  "sexual": {
                    "type": "number",
                    "title": "Sexual Score"
                  },
                  "hate": {
                    "type": "number",
                    "title": "Hate Score"
                  },
                  "harassment": {
                    "type": "number",
                    "title": "Harassment Score"
                  },
                  "self-harm": {
                    "type": "number",
                    "title": "Self-Harm Score"
                  },
                  "sexual/minors": {
                    "type": "number",
                    "title": "Sexual/Minors Score"
                  },
                  "hate/threatening": {
                    "type": "number",
                    "title": "Hate/Threatening Score"
                  },
                  "violence/graphic": {
                    "type": "number",
                    "title": "Violence/Graphic Score"
                  },
                  "self-harm/intent": {
                    "type": "number",
                    "title": "Self-Harm/Intent Score"
                  },
                  "self-harm/instructions": {
                    "type": "number",
                    "title": "Self-Harm/Instructions Score"
                  },
                  "harassment/threatening": {
                    "type": "number",
                    "title": "Harassment/Threatening Score"
                  },
                  "violence": {
                    "type": "number",
                    "title": "Violence Score"
                  }
                }
              }
            },
            "example": {
              "flagged": true,
              "categories": {
                "sexual": false,
                "hate": false,
                "harassment": true,
                "self-harm": false,
                "sexual/minors": false,
                "hate/threatening": false,
                "violence/graphic": false,
                "self-harm/intent": false,
                "self-harm/instructions": false,
                "harassment/threatening": true,
                "violence": false
              },
              "category_scores": {
                "sexual": 0.0002,
                "hate": 0.0002,
                "harassment": 0.91,
                "self-harm": 0.0002,
                "sexual/minors": 0.0002,
                "hate/threatening": 0.0002,
                "violence/graphic": 0.0002,
                "self-harm/intent": 0.0002,
                "self-harm/instructions": 0.0002,
                "harassment/threatening": 0.62,
                "violence": 0.34
              }
            }
          }
        },
        {
          "label": "Text",
          "value": "input",
          "schema": {
            "type": "string",
            "example": "You are useless and you'll regret this."
          }
        }
      ]
    },
    {
      "name": "NotFlagged",
      "options": [
        {
          "label": "Moderation",
          "value": "moderation",
          "schema": {
            "type": "object",
            "properties": {
              "flagged": {
                "type": "boolean",
                "title": "Is Flagged"
              },
              "categories": {
                "type": "object",
                "title": "Categories",
                "properties": {
                  "sexual": {
                    "type": "boolean",
                    "title": "Is Sexual"
                  },
                  "hate": {
                    "type": "boolean",
                    "title": "Is Hate"
                  },
                  "harassment": {
                    "type": "boolean",
                    "title": "Is Harassment"
                  },
                  "self-harm": {
                    "type": "boolean",
                    "title": "Is Self-Harm"
                  },
                  "sexual/minors": {
                    "type": "boolean",
                    "title": "Is Sexual/Minors"
                  },
                  "hate/threatening": {
                    "type": "boolean",
                    "title": "Is Hate/Threatening"
                  },
                  "violence/graphic": {
                    "type": "boolean",
                    "title": "Is Violence/Graphic"
                  },
                  "self-harm/intent": {
                    "type": "boolean",
                    "title": "Is Self-Harm/Intent"
                  },
                  "self-harm/instructions": {
                    "type": "boolean",
                    "title": "Is Self-Harm/Instructions"
                  },
                  "harassment/threatening": {
                    "type": "boolean",
                    "title": "Is Harassment/Threatening"
                  },
                  "violence": {
                    "type": "boolean",
                    "title": "Is Violence"
                  }
                }
              },
              "category_scores": {
                "type": "object",
                "title": "Category Scores",
                "properties": {
                  "sexual": {
                    "type": "number",
                    "title": "Sexual Score"
                  },
                  "hate": {
                    "type": "number",
                    "title": "Hate Score"
                  },
                  "harassment": {
                    "type": "number",
                    "title": "Harassment Score"
                  },
                  "self-harm": {
                    "type": "number",
                    "title": "Self-Harm Score"
                  },
                  "sexual/minors": {
                    "type": "number",
                    "title": "Sexual/Minors Score"
                  },
                  "hate/threatening": {
                    "type": "number",
                    "title": "Hate/Threatening Score"
                  },
                  "violence/graphic": {
                    "type": "number",
                    "title": "Violence/Graphic Score"
                  },
                  "self-harm/intent": {
                    "type": "number",
                    "title": "Self-Harm/Intent Score"
                  },
                  "self-harm/instructions": {
                    "type": "number",
                    "title": "Self-Harm/Instructions Score"
                  },
                  "harassment/threatening": {
                    "type": "number",
                    "title": "Harassment/Threatening Score"
                  },
                  "violence": {
                    "type": "number",
                    "title": "Violence Score"
                  }
                }
              }
            },
            "example": {
              "flagged": false,
              "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": false,
                "violence": false
              },
              "category_scores": {
                "sexual": 0.0002,
                "hate": 0.0002,
                "harassment": 0.0002,
                "self-harm": 0.0002,
                "sexual/minors": 0.0002,
                "hate/threatening": 0.0002,
                "violence/graphic": 0.0002,
                "self-harm/intent": 0.0002,
                "self-harm/instructions": 0.0002,
                "harassment/threatening": 0.0002,
                "violence": 0.0002
              }
            }
          }
        },
        {
          "label": "Text",
          "value": "input",
          "schema": {
            "type": "string",
            "example": "Thanks for the quick delivery!"
          }
        }
      ]
    }
  ],
  "icon": "(data URI omitted)"
}
```
