Skip to content

Commit

Permalink
Update E1T1 to support Codespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
feaselkl committed Sep 12, 2024
1 parent 428cc15 commit 9f96575
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 25 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

# Virtual environments
openai/
aiwins/

secrets.toml
1_Chat_with_Data_solution.py
Expand Down
63 changes: 39 additions & 24 deletions docs/01_deploy_app_resources/0101.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,41 +17,56 @@ In this task, you will ensure that you have a particular set of tools installed

The key tasks are as follows:

1. Ensure that you have the following software installed:
1. [Visual Studio Code](https://code.visualstudio.com/) (Alternatively, if you have Visual Studio installed, you can use that.)
2. Install the following extensions in Visual Studio Code:
- [C# Dev Kit](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csdevkit)
- [Bicep](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-bicep)
- [Azure Functions extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurefunctions)
- [Azure Storage extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurestorage)
3. Install the [Azure Functions Core Tools](https://learn.microsoft.com/azure/azure-functions/functions-run-local), which enables an integrated local debugging experience.
4. The [Microsoft .NET 8.0 SDK](https://dotnet.microsoft.com/download/dotnet/8.0). Ensure that you have the latest version of the SDK, not the Runtime.
5. The [Azure Command Line Interface](https://learn.microsoft.com/cli/azure/install-azure-cli).
6. [A Git client](https://git-scm.com/download/). An alternative option is to install [GitHub Desktop](https://desktop.github.com/).
7. [Python 3.10 or later](https://www.python.org/downloads/). You can run all of the exercises in this lab using a standard installation of Python and do not need the Anaconda Distribution of Python. If you do have Anaconda, make sure that you can execute Python and pip commands from the command line.
1. Fork [this GitHub repository](https://github.com/microsoft/TechExcel-Integrating-Azure-PaaS-and-AI-Services-for-AI-Design-Wins) to your account. You will need to fork the repo in order to modify and use GitHub Actions workflows in later tasks.
2. Start up a GitHub Codespaces instance from your forked repository. This will likely take 5-10 minutes to complete and you may receive a message that "There are task errors" indicating that "there is no registered task type 'func'." This message is fine and is safe to ignore.

{: .note }
> Regardless of which distribution you use, make sure that you can run `python` and `pip` from your command line. If you are not sure whether you have pip installed, run `python -m ensurepip` to check.
{: .note }
> You may alternatively choose to install the necessary software on your own machine, rather than using Codespaces. If you choose to install software separately, expand the following section to see what you need to install.
<details markdown="block">
<summary>Expand this section to view software to install in lieu of using GitHub Codespaces</summary>

Ensure that you have the following software installed:

1. [Visual Studio Code](https://code.visualstudio.com/) (Alternatively, if you have Visual Studio installed, you can use that.)
2. Install the following extensions in Visual Studio Code:
- [C# Dev Kit](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csdevkit)
- [Bicep](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-bicep)
- [Azure Functions extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurefunctions)
- [Azure Storage extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurestorage)
3. Install the [Azure Functions Core Tools](https://learn.microsoft.com/azure/azure-functions/functions-run-local), which enables an integrated local debugging experience.
4. The [Microsoft .NET 8.0 SDK](https://dotnet.microsoft.com/download/dotnet/8.0). Ensure that you have the latest version of the SDK, not the Runtime.
5. The [Azure Command Line Interface](https://learn.microsoft.com/cli/azure/install-azure-cli).
6. [A Git client](https://git-scm.com/download/). An alternative option is to install [GitHub Desktop](https://desktop.github.com/).
7. [Python 3.10 or later](https://www.python.org/downloads/). You can run all of the exercises in this lab using a standard installation of Python and do not need the Anaconda Distribution of Python. If you do have Anaconda, make sure that you can execute Python and pip commands from the command line.

{: .note }
> Regardless of which distribution you use, make sure that you can run `python` and `pip` from your command line. If you are not sure whether you have pip installed, run `python -m ensurepip` to check.
If you are working from a local machine or non-Codespaces VM, you will also need to clone your forked repository to the local machine.

</details>

{: .information }
> You may receive a message stating that it "Detected an Azure Functions Project" and asks if you wish to initialize it for optimal use with VS Code. It is safe to select **Yes** when you see this message. You will then **Overwrite** the tasks.json file.
2. Fork [this GitHub repository](https://github.com/microsoft/TechExcel-Integrating-Azure-PaaS-and-AI-Services-for-AI-Design-Wins) to your account. You will need to fork the repo in order to modify and use GitHub Actions workflows in later tasks.
3. Clone your copy of the repository to your local machine.
4. Create a new virtual environment in the root directory of your cloned repository.
3. Create a new Python virtual environment called **aiwins** in the root directory of your cloned repository and activate it.

{: .note }
> A virtual environment (venv) is not absolutely necessary for this project but creating one will decrease the risk of library conflicts between this project and other Python projects you may have on your machine.
5. Install all requirements in the file `src/ContosoSuitesDashboard/requirements.txt`.
6. Create a new resource group in your subscription. This subscription **must** have access to Azure OpenAI and you should deploy the resource group to a region that supports GPT-4o.
4. Install all requirements in the file `src/ContosoSuitesDashboard/requirements.txt`.
5. Create a new resource group in your subscription. This subscription **must** have access to Azure OpenAI and you should deploy the resource group to a region that supports GPT-4o.

> **Important**: You must deploy to an Azure region that supports the **GPT-4o, 2024-05-13** model. You must create your Azure OpenAI resource in one of the [supported regions](https://learn.microsoft.com/azure/ai-services/openai/concepts/models#model-summary-table-and-region-availability).
> **Important**: Abstractive summarization in the Azure AI Services Language service is only supported in a subset of regions. You must create your Azure AI Language service in one of the [supported regions](https://learn.microsoft.com/azure/ai-services/language-service/summarization/region-support) to allow abstractive summarization to be performed in a later exercise.
7. Open the `DeployAzureResources.bicep` script in the `src/InfrastructureAsCode/` folder and change the value of **sqlAdminPassword** if you desire to have a password other than the default in the deployment script.
6. Open the `DeployAzureResources.bicep` script in the `src/InfrastructureAsCode/` folder and change the value of **sqlAdminPassword** if you desire to have a password other than the default in the deployment script.

{: .note }
> In this lab, you will use a variety of passwords and API keys for the sake of simplicity. In a production environment, you should instead make use of managed identities over passwords or keys whenever possible.
8. Use the `DeployAzureResources.bicep` script in the `src/InfrastructureAsCode/` folder to deploy resources out.
7. Use the `DeployAzureResources.bicep` script in the `src/InfrastructureAsCode/` folder to deploy resources out.

{: .note }
> You may receive an error while running this that you must accept the Responsible AI Notice before creating a TextAnalytics (Language) service. To do so, open the [Azure Portal](https://portal.azure.com) and search for "Language" in the menu. Choose the **Language** service and then select Create. On the first page of the form, select the **Continue to create your resource** button at the bottom of the screen. Then, check the box certifying that you have reviewed and acknowledge the terms in the Responsible AI Notice. You can then close the Create Language page and try running the Bicep script again.
Expand All @@ -77,11 +92,11 @@ The key tasks are as follows:
- To clone a repository, use the command `git clone https://github.com/microsoft/TechExcel-Integrating-Azure-PaaS-and-AI-Services-for-AI-Design-Wins` in the directory you would like to use.
- To create a virtual environment, perform the following steps:
- Open up a terminal to the root directory of your Git repo. **For example**, if you cloned the repo to `C:\SourceCode\TechExcel-Integrating-Azure-PaaS-and-AI-Services-for-AI-Design-Wins`, open this directory in a command prompt.
- Run the following command: `python -m venv openai`. This will create a new virtual environment in the root directory named "openai" and make it available.
- Run the following command to **activate** the virtual environment on MacOS or Linux: `source openai/bin/activate`. If you are running this in Windows Subsystem for Linux, run the command `source openai/Scripts/active`. On Windows using CMD or PowerShell, use `openai\Scripts\activate.bat` to activate the virtual environment. Be sure to have the virtual environment active in every console or terminal you use throughout this training!
- Run the following command: `python -m venv aiwins`. This will create a new virtual environment in the root directory named "aiwins" and make it available.
- Run the following command to **activate** the virtual environment on MacOS or Linux (including GitHub Codespaces): `source aiwins/bin/activate`. If you are running this in Windows Subsystem for Linux, run the command `source aiwins/Scripts/active`. On Windows using CMD or PowerShell, use `aiwins\Scripts\activate.bat` to activate the virtual environment. Be sure to have the virtual environment active in every console or terminal you use throughout this training!

{: .note }
> In a normal terminal or command prompt, you will see `(openai)` before your input prompt. This will let you know that you are working in a Python virtual environment. If you are using the Visual Studio Code terminal, [this will not appear for technical reasons](https://github.com/microsoft/vscode-python/wiki/Activate-Environments-in-Terminal-Using-Environment-Variables). You can mouse over the terminal image to ensure that the virtual environment is active for your terminal.
> In a normal terminal or command prompt, you will see `(aiwins)` before your input prompt. This will let you know that you are working in a Python virtual environment. If you are using the Visual Studio Code terminal, [this will not appear for technical reasons](https://github.com/microsoft/vscode-python/wiki/Activate-Environments-in-Terminal-Using-Environment-Variables). You can mouse over the terminal image to ensure that the virtual environment is active for your terminal.
![In Visual Studio Code, you can mouse over the terminal to view whether your virtual environment is active.](../../media/Solution/0101_VirtualEnvironment.png)

Expand Down
Binary file added media/Solution/0101_Codespace.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/InfrastructureAsCode/DeployAzureResources.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ resource languagteService 'Microsoft.CognitiveServices/accounts@2023-05-01' = {
location: location
kind: 'TextAnalytics'
sku: {
name: 'F0'
name: 'S'
}
properties: {
customSubDomainName: languageServiceName
Expand Down

0 comments on commit 9f96575

Please sign in to comment.