NAME

OpenAI::API::Request::Moderation - moderations endpoint

SYNOPSIS

use OpenAI::API::Request::Moderation;

my $request = OpenAI::API::Request::Moderation->new(
    input => "I like turtles",
);

my $res = $request->send();

if ( $res->{results}[0]{flagged} ) {
    die "Input violates our Content Policy";
}

DESCRIPTION

Given a input text, outputs if the model classifies it as violating OpenAI's content policy.

METHODS

new()

  • input

  • model [optional]

send()

send($openai_config)

Sends the request and returns a data structured similar to the one documented in the API reference.

SEE ALSO

OpenAI API Reference: Moderations