Skip to content

chukmunnlee/jul13-2024-geekshacking-genai-workshop

Repository files navigation

GeeksHacking GenAI Workshop

IMPORTANT Please complete the setup before you attend the workshop.

[0] Pre-requisite

[1] Create OpenAI Platform Account

[1.1] Add Credit

Create an OpenAI account. After your account has been created, you will now need to add USD$5 your account. Click on the gear icon on the top menu bar. This will bring you to the Settings page. From the left menu bar, click on Billing. The Billing page is shown below.

OpenAI Platform Billing

Click on Add to credit balance which brings up the Add to credit balance dialog box. Add your payment method and enter a minimum of USD$5. Once you have confirmed the payment, the billing page will display the amount you have entered.

[1.2] Generate an OpenAI Secret Key

Click on Dashboard on the top menu bar. Click on API keys to create a new secret key as shown below.

OpenAI Create secret key

After you have generated your key, keep a copy of the key. You will not be able to view the key again once you dismissed the dialog.

[2] Setup the Workshop's Environment

This is a template repository. Clone it to create your own repository based on this template.

You will now need to select ONE of the following methods for running the workshop; either directly on your notebook or in a container.

If you are running the workshop locally, then perform step [2.1] Notebook Setup; otherwise setup according to [2.3] DevContainer Setup. The advantage of running in a container is that there are no Python installation on your notebook.

[2.1] Notebook Setup

Open a terminal and to create and activate your environment, eg. for Conda,

conda create geekshacking-workshop
conda activate geekshacking-workshop 

Once the environment has been activated, install the packages from the requirements.txt file eg.

pip install -r requirements.txt

Depending on your notebook and your network throughput, this can be anywhere from 5 to 20 minutes.

After you have successfully installed all the packages, test your environment. Open a terminal, if you have not done so. For Windows user, use the cmd rather than PowerShell.

[2.2] Test OpenAI Secret Key

Set the environment variable OPENAI_API_KEY to your OpenAI key that you have generated in step [1.2].

For Windows (case sensitive)

set OPENAI_API_KEY=_secret_key_

For Linux and OSX (case sensitive)

export OPENAI_API_KEY='_secret_key_'

After setting the keys, change directory into 0_test_setup directory and run main.py.

## Linux and OSX
export OPENAI_API_KEY='_secret_key_'
## Windows
set OPENAI_API_KEY=_secret_key_

cd 0_test_setup
python main.py

If you see the following output, the you have successfully setup your environment.

Test run

[2.3] ALTERNATIVE - Setup DevContainer

If you are using DevContainer, then open this repository in VSC after install all the required pre-requisites from step [0]. VSC will setup the Python environment and installed all the required packages. This can take about 5 to 20 minutes.

DevContainer installation

Open a terminal from within VSC, choose cmd for Windows, and perform the OpenAI test as described in step [2.2] above.

DevContainer test

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages