Anyone get this error for get_completion(prompt) - “InvalidRequestError: Must provide an ‘engine’ or ‘deployment_id’ parameter to create a <class ‘openai.api_resources.chat_completion.ChatCompletion’>”
Hi @dragupta, two questions:
-
Have you executed all the cells up to the one you are working on? specially the first 3 cells?
-
Have you done any change in the cells?
What chapter are you in right now? (actually 3 questions )
Hello @Juan_Olano1
- Yes all three cells executed without errors.
- I did not make any change in the cells
- I just started Chapter 1
However, it looks like I need an Azure openai api key (I am using the standard openai API key). It would be great to get a list of prerequisites before jumping on experimenting with the code.
Hi,
You don’t need to enter any OpenAI key. The api key is provided by the course. If you entered your key in the apparent key placeholder, then that’s the cause of the errror you are getting.
The first cell should remain as this:
import openai
import os
from dotenv import load_dotenv, find_dotenv
_ = load_dotenv(find_dotenv())
openai.api_key = os.getenv('OPENAI_API_KEY')
Where it says ‘OPENAI_API_KEY’ you don’t have to change it with your key. That is actually an ‘env variable name’ with the api key provided by the course.
I hope this clarifies the issue.
Please confirm.
Thanks,
Juan
Unfortunately I get a different error, I just recreated a new notebook by just copying and pasting the first three cells. I may be missing something but I get the following error
“AuthenticationError: No API key provided. You can set your API key in code using ‘openai.api_key = ’, or you can set the environment variable OPENAI_API_KEY=). If your API key is stored in a file, you can point the openai module at it with ‘openai.api_key_path = ’. You can generate API keys in the OpenAI web interface. See OpenAI API for details, or email support@openai.com if you have any questions.”
Are you running this locally or in the course’s notebook?
If you are running it in the course’s notebook, just by refreshing your browser it reloads the notebook and it should run fine.
I am running this on a local notebook not on the course notebook. Thanks for this guidance. How do I run it on a local notebook? Any ideas what I need to do that?
Lets try a few things.
First, you can remove this:
Next, you can modify this…
… as this:
openai.api_key = <YOUR_API_KEY>
Please try these changes and let me know how it goes.
This may work but it appears I have exceed my quote by just trying so many times. Thanks for your help, I will continue using the course notebooks.