The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

OpenAI::API::Request::Moderation - Request class for OpenAI API content moderation

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

This module provides a request class for interacting with the OpenAI API's content moderation endpoint. It inherits from OpenAI::API::Request.

ATTRIBUTES

input

The content to be moderated. Required.

model

The model to use for content moderation. Optional.

METHODS

endpoint

This method returns the API endpoint for content moderation.

method

This method returns the HTTP method for content moderation.

INHERITED METHODS

This module inherits the following methods from OpenAI::API::Request:

send(%args)

send_async(%args)

SEE ALSO

OpenAI::API::Request, OpenAI::API::Config