Hi There,
I am trying to replicate the code which is taught in the course however i am getting following error
root
Did not find openai_api_key, please add an environment variable OPENAI_API_KEY
which contains it, or pass openai_api_key
as a named parameter. (type=value_error)
My code is as follows:
%pip install crewai==0.28.8 crewai_tools==0.1.6 langchain_community==0.0.29
Warning control
import warnings
warnings.filterwarnings(‘ignore’)
from crewai import Agent, Task,Crew
import os
import openai
from dotenv import load_dotenv, find_dotenv
_ = load_dotenv(find_dotenv())
openai.api_key = os.getenv(‘$OPENAI_API_KEY’)
os.environ[“OPENAI_MODEL_NAME”] = ‘gpt-3.5-turbo’
planner = Agent(
role=“Content Planner”,
goal=“Plan engaging and factually accurate content on {topic}”,
backstory="You’re working on planning a blog article "
“about the topic: {topic}.”
"You collect information that helps the "
"audience learn something "
"and make informed decisions. "
"Your work is the basis for "
“the Content Writer to write an article on this topic.”,
allow_delegation=False,
verbose=True
)