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::Edit - Request class for OpenAI API content editing

SYNOPSIS

    use OpenAI::API::Request::Edit;

    my $request = OpenAI::API::Request::Edit->new(
        model       => "text-davinci-edit-001",
        instruction => 'Correct the grammar in the following text:',
        input       => 'the cat sat on teh mat.',
    );

    my $res  = $request->send();            # or: my $res  = $request->send(%args)
    my $text = $res->{choices}[0]{text};    # or: my $text = "$res";

DESCRIPTION

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

ATTRIBUTES

model

ID of the model to use. You can use the text-davinci-edit-001 or code-davinci-edit-001 model with this endpoint.

input [optional]

The input text to use as a starting point for the edit.

instruction

The instruction that tells the model how to edit the prompt.

n [optional]

How many edits to generate for the input and instruction.

temperature [optional]

What sampling temperature to use, between 0 and 2.

top_p [optional]

An alternative to sampling with temperature.

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