CrewAi: installation issue and error on from utils import get_openai_api_key

Inspite of installing utils when performing the following import

from utils import get_openai_api_key
openai_api_key = get_openai_api_key()

os.environ[“OPENAI_MODEL_NAME”] = ‘gpt-3.5-turbo’
I get the following error
ImportError: cannot import name ‘get_openai_api_key’ from ‘utils’ (/usr/local/lib/python3.11/dist-packages/utils/init.py)

What am I missing in my import?

Please post your message in the forum area for that course.

The “AI Discussions” forum is for general topics - not specific courses.

Assuming for instance you are refering to the L2_research_write_article notebook - where you actually can find your snippet code - two considerations that perphaps might help you;

  • Have you properly upload the utils.py file and enclosed this in the same directory of your notebook and .env file?

  • Have you set up correctly your OPENAI_API_KEY in the .env file?