NAME

OpenAI::API::Request::Edit - edits endpoint

SYNOPSIS

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

my $request = OpenAI::API::Request::Edit->new(
    model       => "text-davinci-edit-001",
    input       => "What day of the wek is it?",
    instruction => "Fix the spelling mistakes",
);

# NOTE: the "/edits" endpoint is currently broken

#my $res = $request->send();
#
#my $text = $res->{choices}[0]{text};

DESCRIPTION

Creates a new edit for the provided input, instruction, and parameters.

METHODS

new()

  • 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.

send()

Sends the request and returns a data structured similar to the one documented in the API reference.

send_async()

Send a request asynchronously. Returns a future that will be resolved with the decoded JSON response. See OpenAI::API::Request for an example.

SEE ALSO

OpenAI API Reference: Edits