メインコンテンツまでスキップ
バージョン: 次へ

OpenAIModerationsAPI

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

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

関数

create()

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

引数説明
入力VariantInput (or inputs) to classify. Can be a single text or a collection of OpenAIMessage.
modelTextThe content moderation model you would like to use.
引数OpenAIParametersAdditional parameters for the request.
戻り値OpenAIModerationResultThe result of the moderation, indicating potential harm.

Classifies whether the input is potentially harmful.

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

例題

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)