line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OpenAI::API::Request::Edit; |
2
|
|
|
|
|
|
|
|
3
|
16
|
|
|
16
|
|
115
|
use strict; |
|
16
|
|
|
|
|
44
|
|
|
16
|
|
|
|
|
514
|
|
4
|
16
|
|
|
16
|
|
92
|
use warnings; |
|
16
|
|
|
|
|
45
|
|
|
16
|
|
|
|
|
386
|
|
5
|
|
|
|
|
|
|
|
6
|
16
|
|
|
16
|
|
81
|
use Moo; |
|
16
|
|
|
|
|
34
|
|
|
16
|
|
|
|
|
112
|
|
7
|
16
|
|
|
16
|
|
6001
|
use strictures 2; |
|
16
|
|
|
|
|
133
|
|
|
16
|
|
|
|
|
678
|
|
8
|
16
|
|
|
16
|
|
3005
|
use namespace::clean; |
|
16
|
|
|
|
|
42
|
|
|
16
|
|
|
|
|
129
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
extends 'OpenAI::API::Request'; |
11
|
|
|
|
|
|
|
|
12
|
16
|
|
|
16
|
|
4672
|
use Types::Standard qw(Bool Str Num Int Map); |
|
16
|
|
|
|
|
40
|
|
|
16
|
|
|
|
|
148
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has model => ( is => 'rw', isa => Str, required => 1, ); |
15
|
|
|
|
|
|
|
has instruction => ( is => 'rw', isa => Str, required => 1, ); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has input => ( is => 'rw', isa => Str, ); |
18
|
|
|
|
|
|
|
has temperature => ( is => 'rw', isa => Num, ); |
19
|
|
|
|
|
|
|
has top_p => ( is => 'rw', isa => Num, ); |
20
|
|
|
|
|
|
|
has n => ( is => 'rw', isa => Int, ); |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
1
|
25
|
sub endpoint { 'edits' } |
23
|
1
|
|
|
1
|
1
|
11
|
sub method { 'POST' } |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
1; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
__END__ |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 NAME |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
OpenAI::API::Request::Edit - edits endpoint |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 SYNOPSIS |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
use OpenAI::API::Request::Edit; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
my $request = OpenAI::API::Request::Edit->new( |
38
|
|
|
|
|
|
|
model => "text-davinci-edit-001", |
39
|
|
|
|
|
|
|
input => "What day of the wek is it?", |
40
|
|
|
|
|
|
|
instruction => "Fix the spelling mistakes", |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# NOTE: the "/edits" endpoint is currently broken |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
#my $res = $request->send(); |
46
|
|
|
|
|
|
|
# |
47
|
|
|
|
|
|
|
#my $text = $res->{choices}[0]{text}; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 DESCRIPTION |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Creates a new edit for the provided input, instruction, and parameters. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 METHODS |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head2 new() |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=over 4 |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=item * model |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
ID of the model to use. You can use the text-davinci-edit-001 or |
62
|
|
|
|
|
|
|
code-davinci-edit-001 model with this endpoint. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=item * input [optional] |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
The input text to use as a starting point for the edit. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=item * instruction |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
The instruction that tells the model how to edit the prompt. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=item * n [optional] |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
How many edits to generate for the input and instruction. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=item * temperature [optional] |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
What sampling temperature to use, between 0 and 2. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item * top_p [optional] |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
An alternative to sampling with temperature. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=back |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head2 send() |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Sends the request and returns a data structured similar to the one |
89
|
|
|
|
|
|
|
documented in the API reference. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head2 send_async() |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Send a request asynchronously. Returns a L<future|IO::Async::Future> that will |
94
|
|
|
|
|
|
|
be resolved with the decoded JSON response. See L<OpenAI::API::Request> |
95
|
|
|
|
|
|
|
for an example. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 SEE ALSO |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
OpenAI API Reference: L<Edits|https://platform.openai.com/docs/api-reference/edits> |