I’m following freecode camp tutorial on building a chatbot – https://www.freecodecamp.org/news/build-gpt-4-api-chatbot-turorial/
I tried to use their code as is, however is getting the error – Uncaught TypeError: Failed to resolve module specifier "openai". Relative references must start with either "/", "./", or "../".
. I looked up some resources at https://platform.openai.com/docs/libraries#node-js-library
it seems the usage in the code is similar as in freecode camp code – snippet below.
import { process } from '/env.js'
import { Configuration, OpenAIApi } from 'openai'
const configuration = new Configuration({
apiKey: process.env.OPENAI_API_KEY
})
const openai = new OpenAIApi(configuration)
I need help on how I can modify freecode camp code if required to make it work. Unfortunately they haven’t given steps on how to launch the app.