Skip to content

Commit

Permalink
Aitour docs update v2 (#180)
Browse files Browse the repository at this point in the history
* 1. Refactored docs - v1 complete

* refactored / added DS changes, added explainers

* fixed link
  • Loading branch information
nitya authored Sep 19, 2024
1 parent 4ce2db0 commit b8081cc
Show file tree
Hide file tree
Showing 22 changed files with 356 additions and 347 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ src/api/result_evaluated.jsonl
src/api/result.jsonl
src/api/eval_results.jsonl
src/api/eval_results.md
docs/workshop/site
70 changes: 33 additions & 37 deletions docs/workshop/docs/00-Before-You-Begin/index.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,48 @@
# 0️⃣ | Pre-Requisites

!!! warning "PRE-REQUISITES FOR THIS WORKSHOP"

To participate in this workshop you will need the following:

1. **Your own laptop.** Should have a modern browser, preferably Microsoft Edge.
1. **A GitHub account.** A personal account with GitHub Codespaces access.
1. **An Azure subscription.** With access to Azure OpenAI Model deployments.

!!! info "GOOD-TO-HAVE SKILLS FOR DEVELOPMENT"

1. **Familiarity with VS Code.** Our default development environment.
1. **Familiarity with Python**. Our default coding language.
1. **Familiarity with Azure CLIs.** Our default deployment tooling.

!!! warning "To participate in this workshop you will need the following"

1. **Your own laptop.**
* It need only be capable of running a browser and GitHub Codespaces, so almost any laptop will do.
* A recent version of the Edge, Chrome or Safari browser is recommended.
1. **A GitHub Account.**
* If you don't have one, you can [sign up for a free account](https://github.com/signup) now.
* After this workshop is complete, you will have a fork of the "contoso-chat" repository in your GitHub account, which includes all the materials you will need to reproduce this workshop at home.
1. (recommended) **Familiarity with Visual Studio Code.**
* We will run all code in GitHub Codespaces, a virtualized Linux machine, instead of your local laptop. We won't be running anything on your laptop directly.
* VS Code Online will be our development environment in GitHub Codespaces.
* If you are familiar with running Codespaces within VS Code Desktop on your laptop, feel free to do so.
1. (preferred) **Familiarity with the `bash` shell.**
* We'll be using `bash` to run commands in the VS Code terminal, including Azure CLI commands.
1. (preferred) **Familiarity with Python and Jupyter Notebooks**
* We'll be creating Python scripts and running them from the command line and from Notebooks.

## What You Learn

In this hands-on workshop, you will learn to:

* Use the Azure AI platform for code-first development of custom copilot solutions
* **Infrastructure**: Simplified provisioning and deployment with Azure Developer CLI
* **Ideation**: Rapid prototyping with Prompty asset and Azure AI model deployments
* **Evaluation**: Manual and AI-assisted testing with custom evaluators (for quality, safety)
* **Operationalization**: Deployment using Azure Container Apps (next: monitoring & actions)
* **Customization**: adapt to your application needs (data, prompts, models, evaluators)
In this hands-on workshop, you will learn to use the Azure AI platform for code-first development of custom copilot solutions:

The workshop is designed for delivery in two formats:
* **Infrastructure** → Simplified provisioning and deployment with Azure Developer CLI
* **Ideation** → Rapid prototyping with Prompty asset and Azure AI model deployments
* **Evaluation** → Manual and AI-assisted testing with custom evaluators (for quality, safety)
* **Deployment** → Deployment using Azure Container Apps (plus: monitoring & actions)
* **Customization** → adapt sample to your app needs (data, prompts, models, evaluators)

- **Tour-guided** where you join an instructor-led session (e.g., on Microsoft AI Tour)
- **Self-guided** where you walk through instructions on your own (e.g., at home)

## Tour-Guided Version
## Pick Your Path

Offered as instructor-led sessions on the [Microsoft AI Tour](https://aka.ms/aitour).
The workshop is designed for delivery on the Microsoft AI Tour as an **instructor-guided** session lasting 75 minutes. It can also be completed as a **self-guided** lab where you walk through the instructions on your own at home. Pick the relevant option and let's get started.

- [X] You will be provided with an Azure subscription (just bring your laptop)
- [X] The infrastructure will be pre-provisioned for you to save you time (just launch lab VM)
- [X] You will have a fixed time (**75 minutes**) to complete the workshop (in venue)
_Tip: every page will have these handy **Next →** markers to help you navigate the sections_.

!!! info "Start Here: 01 | Tour Guided: Setup → [1️⃣ | Getting Started](./../01-Tour-Guide-Setup/01-setup.md)"
??? example "**Next** → Joining the instructor-led session at Microsoft AI Tour? [Get Started Here](./../01-Tour-Guide-Setup/01-setup.md)"

## Self-Guided Version
- [X] You will be provided with an Azure subscription. Just bring your laptop.
- [X] The infrastructure is pre-provisioned for you. Just launch the lab to get started.
- [X] The sessions run for a fixed time. You have 75 minutes to complete the lab.

Work through the instructions on your own
??? example "**Next** → Doing a self-guided walkthrough of the workshop? [Get Started Here](./../02-Self-Guide-Setup/02-provision.md)"

- [X] You will use your own Azure subscription and laptop (see pre-requisites)
- [X] You will provision Azure infrastructure and deploy the application yourself.
- [X] You can work at your own pace and explore todebase with no time constraints.
- [X] You will use your own Azure subscription and laptop.
- [X] You will provision Azure infrastructure and deploy the application yourself.
- [X] Work at your own pace. Explore the codebase without time constraints.

!!! info "Start Here: 02 | Self Guided: Setup → [1️⃣ | Getting Started](./../02-Self-Guide-Setup/01-setup.md)"
106 changes: 61 additions & 45 deletions docs/workshop/docs/01-Tour-Guide-Setup/01-setup.md
Original file line number Diff line number Diff line change
@@ -1,85 +1,102 @@
# 1️⃣ | Getting Started


Thie instructions are for participants of the instructor-led **"WRK550: Build a Retail Copilot Code-First on Azure AI"** workshop offered on the Microsoft AI Tour (2024-2025). If you're not at an AI Tour event right now, you can register for an upcoming event in a city near you.

- [**Register to attend**](https://aitour.microsoft.com/) at a tour stop near you.
- [**View Lab resources**](https://aka.ms/aitour/wrk550) to continue your journey.

!!! info "First → Review [ 0️⃣ | Pre-requisites](./../00-Before-You-Begin/index.md) before you begin setup"

!!! quote "Did you already check the [Pre-requisites](./../00-Before-You-Begin/index.md) and verify you met the requirements?"

---

## 1. Launch Skillable Lab

Your instructor should have shared a _Skillable Lab Link_ with you at this time. In this section, we'll launch the Skillable VM and verify that we have the right credentials for the workshop.
The **WRK550 Lab** is run using the Skillable platform which provides you with an active Azure account (_username_, _password_, _subscription_) that comes pre-provisioned with the resources you need for this lab (_Azure AI project_, _Azure OpenAI models_, supporting _Azure resources_, and data).

**Important:** Once the Skillable VM is activated, you will have a fixed time limit (75 minutes) to complete the workshop before the VM shuts down. You can track the remaining time in the display at the top-right corner of the Skillable VM.

??? note "Step 0: Launch Browser Window In Incognito Mode"
_If you are currently in an AI Tour session and have already launched the Skillable lab and verified credentials - move on to Section 2 below! Otherwise, complete these two steps now_.

??? abstract "Step 0: Launch Browser Window In Incognito Mode (window A)"

The workshop is conducted completely within a browser environment. You may have an enterprise Azure or GitHub account that you are logged into that may cause conflicts. To avoid this, we recommend opening a new browser window in **incognito mode** (private mode) with your preferred browser.

- Open a new browser window in incognito or private mode
- **Tip**: If you're using Microsoft Edge, we recommend creating 2 tab groups as follows:
- Group 1 = **"Skillable"** - open tabs A and B below for Skillable setup
- Group 2 = **"Development"** - open tabs 1️⃣-4️⃣ below for all workshop development

??? note "Step 1: Launch Skillable Lab"
**✅ | CONGRATULATIONS!** - Your Learning journey has begun!

??? abstract "Step 1: Launch Skillable VM and log in (window B)"

1. Navigate to the **WRK550 Lab** link
1. Click `Launch` - open new window with split panes (window B)
1. **Check**: You see `Login` prompt in left pane
1. **Check**: You see a "Resources" tab in right pane
1. **Check**: You see an `Azure Portal` section under Resources
1. **Check**: You see `Subscription`, `Username`, `Password` in that section
1. **Check**: You see an `Admin`/`Password` section lower in Resources tab
1. Click login (left), then click admin `Password` (right) and confirm
1. **Check**: You see a Windows 11 Desktop in the left pane
1. Keep window B open - you will need credentials in the next step.

**✅ | CONGRATULATIONS!** - Your Skillable VM is live!

1. Open a new browser window (in incognito mode)
1. Navigate to Skillable Lab (**use insrtuctor provided link**) = Tab A
1. Click `Launch` - opens window with Login, Instructions = Tab B
1. Click `Resources` tab - find admin `Password`
1. Click to fill password for login - confirm
1. You should see: Windows 11 Desktop ✅
1. Revisit `Resources` tab - look for `Azure Portal` section
1. Verify `Subscription`, `Username`, `Password` assigned ✅
1. Keep this browser open - you will need the credentials in the next step

**🌟 | CONGRATULATIONS!** - Your Skillable VM is live!

## 2. Setup Dev Environment

## 4. Setup Development Env
The **WRK550 Lab** requires a Python development runtime (with package dependencies), Visual Studio Code (with specific extensions) and Azure CLI tooling - before we can begin building. The sample comes pre-configured with a [`devcontainer.json`](https://containers.dev), allowing us to get a **pre-built development environment** using GitHub Codespaces, with no manual effort required.

??? note "Step 2: Open GitHub in tab 1️⃣, Launch Codespaces in tab 2️⃣"
_In this section, we'll fork the sample repo to our personal profiles - then launch GitHub Codespaces to activate that environment with a Visual Studio Code editor, right in the browser_.

??? info "Step 2: Open GitHub in tab 1️⃣"

1. Open a new browser tab = Tab 1️⃣
1. Navigate to the workshop sample ([Contoso Chat](https://aka.ms/aitour/contoso-chat))
1. Navigate to the workshop sample with this link - [Contoso Chat](https://aka.ms/aitour/contoso-chat)
1. Log into GitHub - use a personal login account
1. Fork this sample to your profile - uncheck `main` to get branches
1. Switch to `WRK-550` branch in your fork
1. Click green `Code` button, select `Codespaces` tab
1. Click `Create new codespaces on WRK-550`
1. Fork the sample to your profile - uncheck `main` to get all branches
1. Switch to your fork of the repo - check that you have the `aitour-WRK550` branch

**✅ | CONGRATULATIONS!** - Your have a personal copy of the sample to explore!

??? info "Step 3: Launch Codespaces in tab 2️⃣"

1. Use the branch dropdown - switch to the `aitour-WRK550` branch
1. Click the green `Code` button - select the `Codespaces` tab
1. Click the `Create new codespaces on aitour-WRK550` button
1. This should launch a new browser tab = Tab 2️⃣
1. Verify the new tab shows a VS Code editor
1. Codespaces is loading ... this take a while
1. **Check:** The loading tab should show a VS Code editor
1. Codespaces is loading ... this may take a while (leave it open)

**🌟 | CONGRATULATIONS!** - Your Codespaces is running
** | CONGRATULATIONS!** - Your Codespaces is running!

??? note "Step 3: View Azure Portal in tab 3️⃣"

??? info "Step 4: Open Azure Portal in tab 3️⃣"

1. Open a new browser tab = Tab 3️⃣
1. Navigate to the [Azure Portal](https://portal.azure.com)
1. Sign in with Skillable `Username`-`Password` from Step 1.
1. Sign in with Skillable `Username`-`Password` from **Step 1** (above).
1. Click `Resource Groups` - refresh it periodically if needed
1. See: resource group `rg-AITOUR` created ✅
1. **Check:** A resource group `rg-AITOUR` is created
1. Click resource group item - see 'Overview' in details page
1. View `Deployments` under **Essentials** - see 35 deployments
1. View `Overview` resources listed - veriify 15 resources created
1. **Check:** Deployments (under "Essentials") - **has 35 deployments**
1. **Check:** Resources (in Overview) - **has 15 resources created**

**🌟 | CONGRATULATIONS!** - Your Azure Infra is Provisioned!
** | CONGRATULATIONS!** - Your Azure Infra is Provisioned!

??? note "Step 4: View Azure AI Studio in tab 4️⃣"
??? info "Step 5: Open Azure AI Studio in tab 4️⃣"

1. Open a new browser tab = Tab 4️⃣
1. Navigate to the [Azure AI Studio](https://ai.azure.com)
1. Click `Sign in` - should auto-login with Azure credentials
1. Click `All resources` - see: a hub resource listed
1. Click hub resource - see: a project resource listed
1. Click `Deployments` tab - see: 4 models under `aoai-connection`
1. Check: `gpt-4`, `gpt-35-turbo`, `text-embedding-ada-002` listed ✅
1. Click `All resources` - **Check:** one hub resource listed
1. Click hub resource - **Check:** one project resource listed
1. Click `Deployments` tab - **Check:** 4 models under `aoai-connection`
1. **Check:** Models include - `gpt-4`, `gpt-35-turbo`, `text-embedding-ada-002`

**🌟 | CONGRATULATIONS!** - Your Azure AI Project was created!
** | CONGRATULATIONS!** - Your Azure AI Project is ready!

??? note "Step 5: View Container Apps Endpoint in tab 5️⃣"
??? info "Step 5: View Container Apps Endpoint in tab 5️⃣"

1. Return to Azure Portal = Tab 3️⃣
1. Visit the `rg-AITOUR` Resource group page
Expand All @@ -90,9 +107,8 @@ Your instructor should have shared a _Skillable Lab Link_ with you at this time.

**🌟 | CONGRATULATIONS!** - Your ACA Endpoint is alive!


We verified our Skillable credentials worked, and launched our Codespaces environment!

---

!!! info "Next → 2️⃣ [Validate Setup](./02-validate.md) before you begin building"
> We verified our Skillable credentials worked, and launched our Codespaces environment!
!!! example "Next → Let's [Validate Our Setup](./02-validate.md) before we begin building"
83 changes: 60 additions & 23 deletions docs/workshop/docs/01-Tour-Guide-Setup/02-validate.md
Original file line number Diff line number Diff line change
@@ -1,62 +1,99 @@
# 2️⃣ | Validate Setup

!!! info "Let's Review: We should have these tabs open in browser"
!!! success "Let's Review where we are right now"

1. Tab A = Skillable Lab
2. Tab B = Skillable VM
3. Tab 1️⃣ = GitHub Repo
4. Tab 2️⃣ = GitHub Codespaces
5. Tab 3️⃣ = Azure Portal
6. Tab 4️⃣ = Azure AI Studio
7. Tab 5️⃣ = Azure Container Apps.
We should have the following windows and tabs open in our device:

_In this section we'll authenticate with Azure from our GitHub Codespaces environment, and do some post-provisioning steps to get us ready for development_.
1. Window A = Skillable Lab (starting point)
2. Window B = Skillable VM (with our Azure credentials)
3. Tab 1️⃣ = GitHub Repo (starting point)
4. Tab 2️⃣ = GitHub Codespaces (development environment)
5. Tab 3️⃣ = Azure Portal (provisioned resources)
6. Tab 4️⃣ = Azure AI Studio (AI project & models)
7. Tab 5️⃣ = Azure Container Apps (Deployment target)

_We have our Azure infrastructure resources pre-provisioned, but we need to populate our data and deploy the initial application to Azure. Let's get this done_.

## On GitHub Codespaces

Lets authenticate with Azure and configure local development environment to use infrastructure.
## 1. Check: VS Code Ready

_We had left GitHub Codespaces in loading mode - let's verify that loading completed and our Visual Studio Code IDE is ready!_.

??? note "Step 1: Validate Codespaces Ready in 2️⃣"
??? info "Step 1: Validate Codespaces Ready in 2️⃣"

1. Return to GitHub Codespaces tab
1. See: VS Code editor with terminal open
1. Verify: `Prompty Extension` in sidebar (left, bottom)
1. Verify: Cursor ready in VS Code terminal (bottom)
1. Verify Python installed: `python --version` ✅
1. Verify Azure CLI installed: `az version` ✅
1. Verify Azure Developer CLI installed: `azd version` ✅
1. Verify Prompty installed: `prompty --version` ✅
1. Verify FastAPI installed: `fastapi --version` ✅

??? note "Step 2: Authenticate with Azure via CLIs in 2️⃣"

## 2. Check: Tools Installed

_We need specific tools for running, testing & deploying our app. Let's verify we have these installed_.

??? info "Step 2: Verify tools installed in 2️⃣"

Copy/paste these commands into the VS Code terminal to verify required tools are installed

```bash
python --version
```
```bash
az version
```

```bash
azd version
```

```bash
python --version
```
```bash
fastapi --version
```


## 3. Authenticate: with Azure

_To access our Azure resources, we need to be authenticated from VS Code. Let's do that now. Since we'll be using both the `az` and `azd` tools, we'll authenticate in both_.

??? info "Step 3: Authenticate with Azure via CLIs in 2️⃣"

1. Log into Azure CLI - `az login --use-device-code`
1. Complete authflow - use default tenant, subscription
1. You are now logged into Azure CLI ✅
1. Log into Azure Developer CLI - `azd auth login`
1. Complete authflow - see: "Logged in to Azure" ✅

??? note "Step 3: Refresh Azure Dev Env in local env in 2️⃣"
## 4. Configure Azure Env Vars

_To build code-first solutions, we will need to use the Azure SDK from our development environment. This requires configuration information for the various resources we've provisioned. Let's retrieve those here._

??? info "Step 4: Refresh Azure Dev Env in local env in 2️⃣"

1. Run `azd env refresh -e AITOUR` in terminal
1. Select default subscription
1. Select `francecentral` as Azure location
1. See: `SUCCESS: Environment refresh completed`
1. See: `.azure/AITOUR/.env` created with values ✅

??? note "Step 4: Run post-provisioning hooks in 2️⃣"
## 5. Run Postprovision Hooks

_We can now use these configured tools and SDK to perform some post-provisioning tasks. This includes populating data in Azure AI Search (product indexes) and Azure Cosmos DB (customer data), and deploying the initial version of our application to Azure Container Apps_.

??? info "Step 5: Run post-provisioning hooks in 2️⃣"

1. Run `bash workspaces/src/azd-update-roles.sh` in terminal
1. Run `bash ./docs/workshop/src/0-setup/azd-update-roles.sh ` in terminal
1. This will take a few minutes ....
1. Run `azd hooks run postprovision` in terminal
1. This will take a few minutes ....
1. Builds and deploys container app ..
1. Verify that you see a `.env` file in your repo ✅
1. Refresh Container App in tab 5️⃣ - verify that you see "Hello world" ✅

---

## On Azure Portal
_We are ready to start the development workflow segment of our workshop. But let's first check that all these setup operations were successful!_.

Verify Azure CosmosDB, Azure AI Search and Azure Container App updates occured.
!!! example "Next → [Let's Validate our Infra](./../03-Workshop-Build/03-infra.md) before we start building!"
Loading

0 comments on commit b8081cc

Please sign in to comment.