I have nearly copy-pasted the example from open ai’s node documentation. I am putting this in my Next.js project. I get the following error: TypeError: openai__WEBPACK_IMPORTED_MODULE_1__.Configuration is not a constructor
import { Configuration, OpenAIApi } from "openai";
const configuration = new Configuration({
organization: process.env.OPEN_ORG_ID,
apiKey: process.env.OPENAI_API_KEY,
});
const openai = new OpenAIApi(configuration);
export async function testOpenAi() {
openai
.createCompletion({
model: "text-davinci-003",
prompt: "Say this is a test",
max_tokens: 7,
temperature: 0,
})
.then((response) => {
// console.log(response);
})
.catch((err) => {
console.error(err);
});
}
After doing npm install openai I still get this error. What am I missing?