> 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.ai.openai.Moderate

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

Classify if text is potentially harmful.

## Input ports

### Port `in`

| Field | Type | Description |
| --- | --- | --- |
| Text (`input`) | textarea | - |
| Model (`model`) | text | ID of the model to use. |

## 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.ai.openai.Moderate",
  "author": "Appmixer <info@appmixer.com>",
  "description": "Classify if text is potentially harmful.",
  "auth": {
    "service": "appmixer:ai:openai"
  },
  "inPorts": [
    {
      "name": "in",
      "schema": {
        "type": "object",
        "properties": {
          "input": {
            "type": "string"
          },
          "model": {
            "type": "string"
          }
        },
        "required": [
          "input"
        ]
      },
      "inspector": {
        "inputs": {
          "input": {
            "label": "Text",
            "type": "textarea",
            "index": 1
          },
          "model": {
            "type": "text",
            "index": 2,
            "label": "Model",
            "tooltip": "ID of the model to use.",
            "defaultValue": "omni-moderation-latest",
            "source": {
              "url": "/component/appmixer/ai/openai/ListModels?outPort=out",
              "data": {
                "transform": "./ListModels#toSelectOptions"
              }
            }
          }
        }
      }
    }
  ],
  "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": false,
              "categories": {
                "sexual": false,
                "hate": false,
                "harassment": false,
                "violence": false
              },
              "category_scores": {
                "sexual": 0.0000112,
                "hate": 0.0000034,
                "harassment": 0.0000271,
                "violence": 0.0000098
              }
            }
          }
        },
        {
          "label": "Text",
          "value": "input",
          "schema": {
            "type": "string",
            "example": "I want to learn how to bake sourdough bread."
          }
        }
      ]
    },
    {
      "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,
                "violence": false
              },
              "category_scores": {
                "sexual": 0.0000112,
                "hate": 0.0000034,
                "harassment": 0.0000271,
                "violence": 0.0000098
              }
            }
          }
        },
        {
          "label": "Text",
          "value": "input",
          "schema": {
            "type": "string",
            "example": "I want to learn how to bake sourdough bread."
          }
        }
      ]
    }
  ],
  "icon": "(data URI omitted)"
}
```
