Skip to main content
Version: Next

OpenAIModerationsAPI

The OpenAIModerationsAPI is responsible for classifying if text and/or image inputs are potentially harmful.

https://platform.openai.com/docs/api-reference/moderations

Functions

create()

create(input : Variant; model : Text; parameters : OpenAIParameters) : OpenAIModerationResult

ParameterTypeDescription
inputVariantInput (or inputs) to classify. Can be a single text or a collection of OpenAIMessage.
modelTextThe content moderation model you would like to use.
parametersOpenAIParametersAdditional parameters for the request.
Function resultOpenAIModerationResultThe result of the moderation, indicating potential harm.

Classifies whether the input is potentially harmful.

https://platform.openai.com/docs/api-reference/moderations/create

Examples

Moderate a text

var $result:=$client.moderation.create("Some text to classify"; "omni-moderation-latest"; $parameters)

Moderate a text and an image

var $messages:=[{type: "text"; text: "...text to classify goes here..."}; \
{type: "image_url"; image_url: {url: "https://example.com/image.png"}}]
var $result:=$client.moderation.create($messages; "omni-moderation-latest"; $parameters)