line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OpenAI::API::Request::Moderation; |
2
|
|
|
|
|
|
|
|
3
|
16
|
|
|
16
|
|
129
|
use strict; |
|
16
|
|
|
|
|
43
|
|
|
16
|
|
|
|
|
504
|
|
4
|
16
|
|
|
16
|
|
102
|
use warnings; |
|
16
|
|
|
|
|
50
|
|
|
16
|
|
|
|
|
398
|
|
5
|
|
|
|
|
|
|
|
6
|
16
|
|
|
16
|
|
117
|
use Moo; |
|
16
|
|
|
|
|
49
|
|
|
16
|
|
|
|
|
107
|
|
7
|
16
|
|
|
16
|
|
5992
|
use strictures 2; |
|
16
|
|
|
|
|
159
|
|
|
16
|
|
|
|
|
676
|
|
8
|
16
|
|
|
16
|
|
3063
|
use namespace::clean; |
|
16
|
|
|
|
|
50
|
|
|
16
|
|
|
|
|
129
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
extends 'OpenAI::API::Request'; |
11
|
|
|
|
|
|
|
|
12
|
16
|
|
|
16
|
|
4758
|
use Types::Standard qw(Bool Str Num Int Map); |
|
16
|
|
|
|
|
45
|
|
|
16
|
|
|
|
|
200
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has input => ( is => 'rw', isa => Str, required => 1, ); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has model => ( is => 'rw', isa => Str, ); |
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
1
|
17
|
sub endpoint { 'moderations' } |
19
|
1
|
|
|
1
|
1
|
9
|
sub method { 'POST' } |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
1; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
__END__ |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 NAME |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
OpenAI::API::Request::Moderation - Request class for OpenAI API content moderation |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 SYNOPSIS |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
use OpenAI::API::Request::Moderation; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
my $request = OpenAI::API::Request::Moderation->new( |
34
|
|
|
|
|
|
|
input => "I like turtles", |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
my $res = $request->send(); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
if ( $res->{results}[0]{flagged} ) { |
40
|
|
|
|
|
|
|
die "Input violates our Content Policy"; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 DESCRIPTION |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
This module provides a request class for interacting with the OpenAI API's |
46
|
|
|
|
|
|
|
content moderation endpoint. It inherits from L<OpenAI::API::Request>. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 input |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
The content to be moderated. Required. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 model |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
The model to use for content moderation. Optional. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 METHODS |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 endpoint |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
This method returns the API endpoint for content moderation. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 method |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
This method returns the HTTP method for content moderation. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 INHERITED METHODS |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
This module inherits the following methods from L<OpenAI::API::Request>: |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 send(%args) |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head2 send_async(%args) |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 SEE ALSO |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
L<OpenAI::API::Request>, L<OpenAI::API::Config> |