T. Evgeniou, Professor INSEAD GitHub | LinkedIn
During the course we will be using Google Collab (browser based) to run python scripts that will be calling openAI LLMs through the openAI API. This is why you will need to have a Gmail account (see information here) as well as an OpenAI one (see information here) - in case you do not have these yet, please make sure you create them. Github
You will find here instructions on how to prepare for the course. You will need to:
- Purchase some openAI credit (e.g., worth $10) that you can use for API calls to the openAI LLM models
- Open a sample Google Colab notebook
- Create your secret (do not share with anyone) OpenAI API Key
- Add your openAI API key in your colab notebook
- Run your first example of using API calls to the openAI LLMs
Note: This material was initially developed with the support of Olivier Mertens, Developer Audience, Azure Open AI Service, Microsoft [Github](https://github.com/olivMertens) | [LinkedIn](https://linkedin.com/in/mertensolivier/)
- Log in your openAI account
- Go to billing - Note: in case the links change, please search for "billing" or "API credit" or equivalent.
- Purchase $10 worth of credit
- You can see information about pricing here and you will also be able to monitor your spending in your billing dashboard.
Note: This is different from being an openAI subsrciber for using GPT, and you need to purchase credit even if you are a premium GPT user.
First you need to have loged in both to your Gmail and your OpenAI accounts. Make sure you are logged in at Google Colab.
Let's now start our first Colab Python notebook! All you need to do is to click on this notebook, which will open a browser tab with a python notebook on Google Colab. Once open, you can make a copy of the file in your personal Google drive (select "File -> Save a Copy in Drive"), that you will then be able to edit and use.
Open the copy of the file from you own drive (select "File --> Open Notebook"). Then, as indicated in the screenshot below, add your OpenAI API key. You can get your API key folowing the steps below.
- Log in your openAI account
- Go to the OpenAI playground dashboard
- Click on the "API keys" located on the left menu
- Create a new API key by clicking on the "Create new secret key" button, and give it a name (e.g., INSEAD_BGenAIPB). Before selecitng "Done", copy the key and save it in a safe place! Important: Never share your API key with others! Whoever has access to your API key can be charging your account when using it! It's also a good practice to regularly rotate your API keys, or create a new one for each application or usage.
.
You can now also paste the API key in the Colab notebook as indicated in the previous step. When you create new Colab notebooks, the key will be automatically added.
To use/run a notebook you have to click on every small "play button" inside the notebook on the left of each code chunk. You may encounter warning pop-up windows - click ok or execute to continue.
[Note] The very first "code chunk" (that installs the openai package) may take a few seconds to run and will be generating some messages. Simply wait till it completes running.
Here are three colab notebooks as starting examples:
- Interview questions generation https://aka.ms/inseadGenAi-1
- Web article generation https://aka.ms/inseadGenAi-2
- (This one will require some more steps, see below) Extract audio with whisper and process the text https://aka.ms/inseadGenAi-3
For the third (audio analysis) Notebook, you can import you own mp4 file video or audio to analyse. To do so:
- Click on the folder button on the left
- Import your file inside the current path - click yes to the pop up warning. Note that you have to respect the file naming ("interview.mp4") or else you will have to change the name in the notebook itself in the line inputFile = "/content/interview.mp4"
Don't be afraid of python you will also get help!
🥰