I was using this for an earlier project,
const response=await openai.createChatCompletion({
Now it seems to have been changed, because i can't figure out a way to access the actual message from response. I can log it in my console, but can't figure out how to access the text value.
Trying
const response = await openai.chat.completions.create({
as per the API ref, I get
Error: TypeError: Cannot read properties of undefined (reading 'completions')