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()

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

send_async()

Send a request asynchronously. Returns a future that will be resolved with the decoded JSON response. See OpenAI::API::Request for an example.

SEE ALSO

OpenAI API Reference: Moderations