Recently, I've been experimenting with ChatGPT and have just installed the latest version 4.8.0.
My current project is built on NextJS.
Prior to this, I successfully completed a project using v3.something last month, but I'm encountering difficulties now.
Below is a snippet of my code:
import OpenAI from "openai";
const instructionMessage = {
role: "system",
content:
"Some instructions",
};
const configuration = new OpenAI({
apiKey: process.env.OPENAI_API_KEY,
});
const prompt = "Prompt";
const temperature = 0.7;
const response = await OpenAI.Chat.Completions.create({ //issue lies in this line
model: "gpt-3.5-turbo",
message: [instructionMessage, prompt],
temperature,
max_tokens: 1000,
});
Despite meticulously following all available documentation (including the official docs with almost identical examples), the error message "create is not a function" persists. I've tried switching between uppercase and lowercase as well, but nothing seems to resolve the issue. At this point, I'm feeling quite desperate...
Any insights on what may be causing this problem?