ok so I have literally no clue what is wrong here, I might just be an idiot but can someone help me out here
const Configuration = require("openai");
const OpenAIApi = require("openai")
async function callAI() {
const configuration = new Configuration({
apiKey: "redacted",
});
const openai = new OpenAIApi(configuration);
try {
const completion = await openai.createCompletion("text-davinci-001", {
prompt: document.getElementById("sus").value
});
document.getElementById(aiResponce).value = completion.data.choices[0].text;
} catch (error) {
if (error.response) {
console.log(error.response.status);
console.log(error.response.data);
} else {
console.log(error.message);
}
}
}
heres the error that appears.
callAI.js:5:21 Uncaught (in promise) ReferenceError: Cannot access 'Configuration' before initialization
at callAI (callAI.js:5:21)