InseadDataAnalytics / BuildGenAIprodandBiz

MIT License
11 stars 1 forks source link

Building genAI Products and Businesses

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 that you can use for API calls to the openAI LLM models

  1. Log in your openAI account
  2. Go to billing - Note: in case the links change, please search for "billing" or "API credit" or equivalent.
  3. Purchase $10 worth of credit
  4. 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.

Open a sample Google Colab notebook

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.

Add your openAI API key in your colab notebook

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.

Add API Key Colab

Create your secret (do not share with anyone) OpenAI API Key

  1. Log in your openAI account

  2. Go to the OpenAI playground dashboard

  3. Click on the "API keys" located on the left menu

    API Keys
  4. 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.
    Create API Key.

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.

Run the Google Colab notebook

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.

Alt text


[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.



Exploring genAI: Three More Examples

Here are three colab notebooks as starting examples:

For the third (audio analysis) Notebook, you can import you own mp4 file video or audio to analyse. To do so:


Alt Text



You are now ready to explore! Have Fun!

Don't be afraid of python you will also get help!

:smiling_face_with_three_hearts: