Need help migrate text-davinci-003 to gpt-3.5-turbo

function AI(prompt, temperature = 0.7, model = “text-davinci-003”) {

const url = “https://api.openai.com/v1/chat/completions”;

const payload = {

model: model,

prompt: prompt,

temperature: temperature,

max_tokens: MAX_TOKENS,

};

const options = {

contentType: “application/json”,

headers: { Authorization: "Bearer " + SECRET_KEY },

payload: JSON.stringify(payload),

};

const res = JSON.parse(UrlFetchApp.fetch(url, options).getContentText());

return res.choices[0].text.trim();

}

There is no prompt param in the chat completion.

Please review the params for chat in the good ole’ API docs!

:slight_smile:

1 Like