OpenAI::API::Request::Moderation - moderations endpoint
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"; }
Given a input text, outputs if the model classifies it as violating OpenAI's content policy.
input
model [optional]
Sends the request and returns a data structured similar to the one documented in the API reference.
OpenAI API Reference: Moderations
To install OpenAI::API, copy and paste the appropriate command in to your terminal.
cpanm
cpanm OpenAI::API
CPAN shell
perl -MCPAN -e shell install OpenAI::API
For more information on module installation, please visit the detailed CPAN module installation guide.