OpenAPI-Client-OpenAI

 view release on metacpan or  search on metacpan

lib/OpenAPI/Client/OpenAI/Path/completions.pod  view on Meta::CPAN

=head4 Request body

Content-Type: application/json

Example:

    {
       "choices" : [
          {
             "finish_reason" : "length",
             "index" : 0,
             "logprobs" : null,
             "text" : "\n\nThis is indeed a test"
          }
       ],
       "created" : 1589478378,
       "id" : "cmpl-uqkvlQyYK7bGYrRHQ0eXlWi7",
       "model" : "VAR_completion_model_id",
       "object" : "text_completion",
       "system_fingerprint" : "fp_44709d6fcb",
       "usage" : {
          "completion_tokens" : 7,
          "prompt_tokens" : 5,
          "total_tokens" : 12
       }
    }

=head4 Responses

B<200 - OK>

Content-Type: application/json

Example:

    {
       "choices" : [
          {
             "finish_reason" : "length",
             "index" : 0,
             "logprobs" : null,
             "text" : "\n\nThis is indeed a test"
          }
       ],
       "created" : 1589478378,
       "id" : "cmpl-uqkvlQyYK7bGYrRHQ0eXlWi7",
       "model" : "VAR_completion_model_id",
       "object" : "text_completion",
       "system_fingerprint" : "fp_44709d6fcb",
       "usage" : {
          "completion_tokens" : 7,
          "prompt_tokens" : 5,
          "total_tokens" : 12
       }
    }

=head1 SCHEMAS

=head2 ChatCompletionStreamOptions

Options for streaming response. Only set this when you set C<stream: true> .

=head2 CompletionUsage

Properties:

=over

=item * C<completion_tokens> (integer, required) - Number of tokens in the generated completion.

Default: 0

=item * C<completion_tokens_details> (object) - Breakdown of tokens used in a completion.

=item * C<prompt_tokens> (integer, required) - Number of tokens in the prompt.

Default: 0

=item * C<prompt_tokens_details> (object) - Breakdown of tokens used in the prompt.

=item * C<total_tokens> (integer, required) - Total number of tokens used in the request (prompt + completion).

Default: 0

=back

=head2 CreateCompletionRequest

Properties:

=over

=item * C<best_of> (integer) - Generates C<best_of> completions server-side and returns the "best" (the one
with the highest log probability per token). Results cannot be streamed.

When used with C<n> , C<best_of> controls the number of candidate completions
and C<n> specifies how many to return – C<best_of> must be greater than C<n> .

B<Note:> Because this parameter generates many completions, it can quickly
consume your token quota. Use carefully and ensure that you have reasonable
settings for C<max_tokens> and C<stop> .

Default: 1

=item * C<echo> (boolean) - Echo back the prompt in addition to the completion

Default: 

=item * C<frequency_penalty> (number) - Number between -2.0 and 2.0. Positive values penalize new tokens based on
their existing frequency in the text so far, decreasing the model's likelihood
to repeat the same line verbatim.

L<See more information about frequency and presence penalties.|https://platform.openai.com/docs/guides/text-generation>

Default: 0

=item * C<logit_bias> (object) - Modify the likelihood of specified tokens appearing in the completion.

Accepts a JSON object that maps tokens (specified by their token ID in the GPT
tokenizer) to an associated bias value from -100 to 100. You can use this
L<tokenizer tool|https://platform.openai.com/tokenizer?view=bpe> to convert



( run in 0.988 second using v1.01-cache-2.11-cpan-524268b4103 )