Create Moderation (OpenAI) v1.0.0 Help
Classifies if provided text violates OpenAI's Content Policy.
How can I use the Step?
The Step lets you check whether the provided text complies with OpenAI's usage policies. You can use the Step for various purposes, such as moderating user-generated content, filtering offensive or inappropriate text messages or emails, and more.
How does the Step work?
You authorize the Step and provide text to classify. The Step requests the moderation endpoint to classify text into predefined categories. The response includes a classification label and confidence score for each category.
To learn more, review the Moderation guide.
Prerequisites
To get started, you need an OpenAI API key. You can retrieve it from your API Keys page if you don't have one.
Authorization
To authorize the Step, you have two options:
- Inherit from previous Step (default): Use the same authorization as the previous Step in the Flow.
- Select authorization in the current Step: Choose an existing authorization or create a new one.
In case you need to create a new authorization, follow these steps:
- Choose Select authorization in the current Step and then select
Create a new authorization
from the list. - In the Add authorization modal window, provide the required details:
- Authorization name: Name your new authorization.
- API Key: Enter your OpenAI API key.
- Click Add to confirm settings and add your new authorization.
Request settings
To ensure accurate classification, the Step uses the text-moderation-latest
model.
To set up a request, enter the text you want to classify.
Merge field settings
The Step returns the result as a JSON object and stores it in the Merge field variable. Thus you can access the output JSON object from any point of your Flow.
Output example
The output includes a classification label and confidence score for each category and has the following structure:
{
"id": "modr-5MWoLO",
"model": "text-moderation-001",
"results": [
{
"categories": {
"hate": false,
"hate/threatening": true,
"self-harm": false,
"sexual": false,
"sexual/minors": false,
"violence": true,
"violence/graphic": false
},
"category_scores": {
"hate": 0.22714105248451233,
"hate/threatening": 0.4132447838783264,
"self-harm": 0.005232391878962517,
"sexual": 0.01407341007143259,
"sexual/minors": 0.0038522258400917053,
"violence": 0.9223177433013916,
"violence/graphic": 0.036865197122097015
},
"flagged": true
}
]
}
{
"id": "modr-5MWoLO",
"model": "text-moderation-001",
"results": [
{
"categories": {
"hate": false,
"hate/threatening": true,
"self-harm": false,
"sexual": false,
"sexual/minors": false,
"violence": true,
"violence/graphic": false
},
"category_scores": {
"hate": 0.22714105248451233,
"hate/threatening": 0.4132447838783264,
"self-harm": 0.005232391878962517,
"sexual": 0.01407341007143259,
"sexual/minors": 0.0038522258400917053,
"violence": 0.9223177433013916,
"violence/graphic": 0.036865197122097015
},
"flagged": true
}
]
}
To learn more, review Moderation Quickstart.
Error Handling
By default, the Handle error toggle is on, and the Step handles errors with a separate exit. If any error occurs during the Step execution, the Flow proceeds down the error
exit.
If the Handle error toggle is disabled, the Step does not handle errors. In this case, if any error occurs during the Step execution, the Flow fails immediately after exceeding the Flow timeout. To prevent the Flow from being suspended and continue handling errors, you can place the Flow Error Handling Step before the main logic or your Flow.
Reporting
After the Step completes, it generates a report that includes its execution status and other details. You can customize the report by adjusting the Step's log level and adding tags.
Log level
By default, the Step's log level matches that of the Flow. You can change the Step's log level by selecting an appropriate option from the Log level dropdown.
Tags
Tags provide a way to classify and search for sessions based on their attributes. To create a new tag, specify its category, label, and value. You can then use tags to filter and group the sessions in the report.
Service dependencies
- flow builder - v2.28.3
- event-manager - v2.3.0
- deployer - v2.6.0
- library v2.11.3
- studio v2.64.1
Release notes
v1.0.0
- Initial release