Thank you for participating in the OpenAI Fundamentals What The Hack. Before you can hack, you will need to set up some prerequisites.
In this challenge, you will set up the necessary prerequisites and environment to complete the rest of the hack, including:
You will need an Azure subscription to complete this hack. If you don’t have one, get a free trial here…
Before you can start the hack, you will also need to apply for access to Azure OpenAI as it is currently in high-demand.
An Azure subscription is necessary to apply for Azure OpenAI access. We recommend applying as early as possible as processing times will vary, sometimes taking more than several business days.
You will be working with Jupyter Notebooks and Python to interact with Azure OpenAI for the hack.
Jupyter Notebooks are an open-source web application that allows you to create and share documents containing live code, equations, visualizations, and narrative text. It’s useful for a wide range of tasks, such as data cleaning and transformation, numerical simulation, statistical modeling, data visualization, and machine learning.
Jupyter notebooks require an environment to run in.
You can use GitHub Codespaces where we have a pre-configured Jupyter lab environment set up and ready to go for you, or you can setup a Jupyter lab environment on your local workstation.
A GitHub Codespace is a development environment that is hosted in the cloud that you access via a browser. All of the pre-requisite developer tools for this hack are pre-installed and available in the codespace.
We highly recommend using GitHub Codespaces to make it easier complete this hack.
You must have a GitHub account to use GitHub Codespaces. If you do not have a GitHub account, you can Sign Up Here.
GitHub Codespaces is available for developers in every organization. All personal GitHub.com accounts include a monthly quota of free usage each month. GitHub will provide users in the Free plan 120 core hours, or 60 hours of run time on a 2 core codespace, plus 15 GB of storage each month.
You can see your balance of available codespace hours on the GitHub billing page.
The GitHub Codespace for this hack will host the Jupyter Notebook files, configuration files, and other data files needed for this event. Here are the steps you will need to follow:
NOTE: Make sure you do not sign in with your enterprise managed Github account.
Your Codespace environment should load in a new browser tab. It will take approximately 3-5 minutes the first time you create the codespace for it to load.
You are ready to run the Jupyter Notebook files, hooray! Skip to section: Setup Azure OpenAI
NOTE: You can skip this section if are using GitHub Codespaces!
If you want to setup a Jupyter Notebooks environment on your local workstation, expand the section below and follow the requirements listed.
To work on your local workstation, please ensure you have the following tools and resources before hacking:
The Jupyter notebooks, starter code, and sample data sources for this hack are available in a Student Resources package.
Resources.zip
package to your local workstation.The rest of the challenges will refer to the relative paths inside the Resources.zip
file where you can find the various resources to complete the challenges.
Visual Studio Code is a code editor which you will work with Jupyter notebooks.
python --version
and conda --version
conda create --name <env_name>
conda activate <env_name>
requirements.txt
file in the root folder of the Resources.zip
file. We recommend using pip or Conda in a virtual environment to do so. For example, you can run pip install -r requirements.txt
code .
For more information, see Jupyter Notebooks in VS Code
While it is not necessary for this hack, you may wish to use the Azure CLI to interact with Azure in addition to the Azure Portal.
There is a THIRD way of setting up a Jupyter Notebook environment if you don’t want to set it up on your local workstation or use GitHub Codespaces. You can set one up in the cloud with Azure Machine Learning Studio and take advantage of Azure Compute power.
For more information, see: Run Jupyter Notebooks in your Workspace
Once you have an Azure Machine Learning Studio Workspace set up, you can upload the contents of the /notebooks
folder in your Resources.zip
file to it. For more information on this, see: How to create and manage files in your workspace
Once you have set up a Jupyter notebook environment, create an Azure OpenAI resource in your Azure Subscription and do some initial configuration.
gpt-4
gpt-35-turbo
text-embedding-ada-002
The code in the Jupyter notebooks retrieve their configuration values from environment variables configured in a .env
file. Some of these configuration values are secrets (such as the key to access your Azure OpenAI resource).
NOTE: A .env
file should never be stored in a Git repo. Therefore, we have provided a sample file named .env.sample
that contains a list of environment variables required by the Jupyter notebooks.
You will find the .env.sample
file in the root of the codespace. If you are working on your local workstation, you will find the .env.sample
file in the root of the folder where you have unpacked the student Resources.zip
file.
.env.sample
to .env
.Add required credentials of Azure resources in the .env
file.
HINT: You can get these credentials through the Azure Portal within your AOAI resource. Click on Keys and Endpoint
from the dropdown menu on the left side.
TIP: Learn more about using .env
files here.
NOTE: Additional Azure resources such as Azure Form Recognizer (a.k.a. Azure Document Intelligence) and Azure Cognitive Search (a.k.a. Azure AI Search) will be required for later challenges. You can add these values to the .env
file later as you progress through the challenges.
NOTE: We have also provided a .gitignore
file that should prevent you from accidentally committing your renamed .env
file to a Git repo during this hack.
NOTE: On MacOS, files that start with a .
are hidden files and are not viewable in Finder when browsing the file system. They will be visible in both VS Code or GitHub Codespaces.
To complete this challenge successfully, you should be able to:
If using GitHub Codespaces:
/data
/notebooks
.env
<= Renamed from .env.sample
.gitignore
requirements.txt
If working on a local workstation:
Resources.zip
file:
/data
/notebooks
.env
<= Renamed from .env.sample
.gitignore
requirements.txt