#max_tokens parameter breaking my netlify build's completion function

1 messages · Page 1 of 1 (latest)

sick pier
#

I have created a GPT rap generator, and it works fine locally when run with node.js. However, when i host it on netlify/vercel, it builds fine, but when i submit the request, after waiting about 30 seconds for the generation, i get a 401 error and no text is displayed.

I have managed to track down the cause of the error to be the max_tokens parameter in my completion code. When i remove the max_tokens parameter the completion is successful, but only with a small amount of tokens being used. However, when i add max_tokens: 300, the 401 error occurs. Very weird to me. not sure why this is happening.

Completion code shown below:

  try {
    const completion = await openai.createCompletion({
      model: "text-davinci-003",
      prompt: generatePrompt(inputRapper, userInput),
      temperature: 0.6,
      max_tokens: 300, // problem here
    });

Any help is much appreciated :)