Feb 22 (edited) • 💡 Help
Help for Module 3 question
Hi there,
I'm having a problem in the class #How to Build Effective AI Agents in Pure Python from Module 3.
Dave uses the following code:
client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
But I always get this error:
--------------------------------------------------------------------------- OpenAIError Traceback (most recent call last) File /Users/andrawsstevesantos/Code/VSCode/ai-cookbook-main/patterns/workflows/1-introduction/1-basic.py:1 ----> 1 client = OpenAI(api_key=os.getenv("OPENAI_API_KEY")) File ~/Code/venv/tracking_barbell/lib/python3.12/site-packages/openai/_client.py:110, in OpenAI.__init__(self, api_key, organization, project, base_url, websocket_base_url, timeout, max_retries, default_headers, default_query, http_client, _strict_response_validation) 108 api_key = os.environ.get("OPENAI_API_KEY") 109 if api_key is None: --> 110 raise OpenAIError( 111 "The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable" 112 ) 113 self.api_key = api_key 115 if organization is None: OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
I've tried searching on ChatGPT, but I couldn't solve it.
I also have doubts about whether the .env file is in the right place or what exactly needs to be uncommented.
Thanks for your help!
7
7 comments
Andraws Santos
7
Help for Module 3 question
Data Alchemy
skool.com/data-alchemy
Your Community to Master the Fundamentals of Working with Data and AI — by Datalumina®
Leaderboard (30-day)
Powered by