Not able to run the codes in the jupyter notebook provided with the course

When I try to run the code , the same code available in the jupyter notes , it shows me error ,

and sometimes this
image

Please help me as I am very confused

1 Like

Hi @grt_learner

Welcome to the community.

Are you trying to run locally?

If so, you have to install all the packages by your own.

But, the error suggest that the get_completion() function wasn’t executed before called.~

The error suggests that the openai package wasn’t installed

Error message is rich in information. It said that a package openai is not installed. If you run the package in Coursera, it should have been installed. So it would be a temporal error so that you can rerun the kernel. If you are running this locally, it is very likely you have not installed the package. Just run “pip install openai” to fix this (make sure you have env file with your OpenAI API key in your envigonment.

1 Like