题意:OpenAI Chat Completions API 错误:“openai.createChatCompletion 不是一个函数”
问题背景:
I have this in my MERN stack code file, and it works well.
我在我的 MERN 栈代码文件中有这个代码,它运行良好。
exports.chatbot = async (req, res) => {
console.log("OpenAI Chatbot Post");
const { textInput } = req.body;
try {
const response = await openai.createCompletion({
model: "text-davinci-003",
prompt: `
What is your name?
My name is Chatbot.
How old are you?
I am 900 years old.
${textInput}`,
max_tokens: 100,
temperature: 0,
});
if (response.data) {
if (response.data.choices[0].text) {
return res.status(200).