Content Moderation

AI-powered service that analyzes a single message or chat conversations and detects toxicity

/service/translation
Detects and categorizes toxicity contained in the user message
REST API
POST /service/moderation

Input query parameters
role
required
Predefined role used to run the AI service
message
required
Required if chat parameters is missing. Message to be moderates
chat
required
Required if message parameters is missing. Chat conversation to be translated
Example of a call to translate a message:
curl https://{{ tenant }}.lightenup.ai/service/moderation\
--request POST \
--header "Authorization: Bearer xyz" \
--header "Content-Type: application/json" \
--data @- << EOF
{
  "role": "order_management_assistant",
  "message": "Como puedo cancelar mi ultimo pedido",
  "language": "en-US",
}
EOF
Outputs
Response Code
200

This API returns an array of Policies  in JSON format:

role
The role used to translate the message or conversation
message
The original message to be translated. If any,
name
The original message to be translated. If any,
language
Target translation language in ISO-639 format
output
The response from the AI service following the JSON format:
"{
 "results": [ {
               service":"translation",
               "message":"message translated"
       }]
}"
Response example:
{
    "role": "customer_assistant",
    "message": "One second please",
    "language": "fr-FR",
    "output": "{\"results\":[{\"service\":\"translation\",\"message\":\"Une seconde s'il vous plaît.\"}]}"
}

Response Code
400

Error message in JSON format:

message
Error message
Response Example:
{
  "message": "Missing parameters",
}

Response Code
500

Error message in JSON format:

message
Error message
Response exdmple:
{
  "message": "Internal server error",
}
{
    "role": "customer_assistant",
    "message": "One second please",
    "language": "fr-FR",
    "output": "{\"results\":[{\"service\":\"translation\",\"message\":\"Une seconde s'il vous plaît.\"}]}"
}