Through API, how to get the rest of an uncomplete completion?

Hi,

i had made some API calls that stopped in the middle of a sentence. The finish_reason was “length”. What is the call to make to have the end of the sentence ?

Thanks in advance for your help !

Best regards,

Guillaume

Increase the max_token parameter. AFAIK there’s no way to get the uncompleted completion.

2 Likes

I have increase max_token to 2048 but the responses are still truncated.
Here is an example response. Note that finish_reason is set to length and there is np stop key

json = ["usage": {
    "completion_tokens" = 16;
    "prompt_tokens" = 4;
    "total_tokens" = 20;
}, "object": text_completion, "model": text-davinci-002, "choices": <__NSSingleObjectArrayI 0x6000021c62d0>(
{
    "finish_reason" = length;
    index = 0;
    logprobs = "<null>";
    text = " about your hometown\n\nMy hometown is a small town in upstate New York";
}

@Xerxes the playground is able to continue from where it left off when I increase the max tokens and submit again. Also, the completion endpoint returns an ID, which can probably be used to continue the completion.