#prompt responses getting cut off `finished_reason = length`

29 messages · Page 1 of 1 (latest)

raven tusk
#

Hello,

I am using the demo code provided in the documnetation:

    const completion = await openai.createCompletion({
      model: "text-davinci-003",
      prompt: generatePrompt(question),
      temperature: 0.6,
    });

I have updated the prompt to a more elaborate question, but the responses are always cut short.

When logging console.log(completion.data.choices)

I get the following output:

[
  {
    text: '\n\nGrilled Chicken and Cilantro Lime Rice\nIngredients:\n\n-',
    index: 0,
    logprobs: null,
    finish_reason: 'length'
  }
]

What is the reason the responses get cut off?

zealous bluff
#

I think you can try response.data.choice[0].text

#

also add .trim() to remove space before and after the text output

inner plinth
zealous bluff
#

max_tokens: 1680

#

add to the list of
model: "text-davinci-003",
prompt: generatePrompt(question),
temperature: 0.6,

inner plinth
#

2049 is max for max_tokens by the way.

zealous bluff
inner plinth
#

Oh alright. It just said max was 2049 in the docs 😄

raven tusk
#

Thank you both @inner plinth @zealous bluff , I was able to also find the max_tokens property.

Do you know how applications are handling larger outputs? Or are apps supposed to be designed around short output.

For example with ChatGPT the output can reach a few paragraphs, but with this API that would be impossible. So what are standards?

zealous bluff
zealous bluff
zealous bluff
#

You can try tell chatGPT your birthday and then ask it again after a few conversations, it may forget it

zealous bluff
raven tusk
#

@zealous bluff As I understand max tokens not only affects the size of the prompt you can provide to davinci but also the size of the response from davinci

#

Is there a way for that to be separated?

zealous bluff
#

only limit the output

zealous bluff
zealous bluff
raven tusk
raven tusk
zealous bluff
zealous bluff
raven tusk
#

?

zealous bluff