So im using the new chat gpt api model in my discord bot (using discord.js library) with openai node.js library. i coded the main function in messageCreate event limiting it to a specific channel but after triggering it about 4 times, the bot came with an error from the api that you are rate limited (RPM). i didnt have this problem using text-davinci and now i have no idea why it got rate limited.
here is the code:
const question = message.content
let conversation = [{role: "system", content: instructions}, {role: "user", content: question}]
// instructions already defined (string)
openai.createChatCompletion({
model: "gpt-3.5-turbo",
messages: conversation,
max_tokens: 2048,
temperature: 0.5
}).then(async (response) => {
message.reply(`${response.data.choices[0].message.content}\n\n\`Used ${response.data.usage.total_tokens} tokens\``)
}).catch(async (error) => {
console.error(error);
if (error.response) await message.reply({ content: error.response.data.error.message });
else if (error.message) await message.reply({ content: error.message });
});