You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 00-course-setup/README.md
+97-54
Original file line number
Diff line number
Diff line change
@@ -4,13 +4,6 @@
4
4
5
5
This lesson will cover how to run the code samples of this course.
6
6
7
-
## Requirements
8
-
9
-
- A GitHub Account
10
-
- Python 3.12+
11
-
- Azure Subscription
12
-
- Azure AI Foundry Account
13
-
14
7
## Clone or Fork this Repo
15
8
16
9
To begin, please clone or fork the GitHub Repository. This will make your own version of the course material so that you can run, test, and tweak the code!
@@ -21,7 +14,43 @@ You should now have your own forked version of this course in the following link
21
14
22
15

23
16
24
-
## Retrieve Your GitHub Personal Access Token (PAT)
17
+
## Running the Code
18
+
19
+
This course offers a series of Jupyter Notebooks that you can run with to get hands-on experience building AI Agents.
2) AutoGen Framework + GitHub Models Marketplace. Labeled as (autogen.ipynb)
27
+
28
+
**Requires Azure Subscription**:
29
+
3) Azure AI Foundry + Azure AI Agent Service. Labeled as (azureaiagent.ipynb)
30
+
31
+
We encourage you to try out all three types of examples to see which one works best for you.
32
+
33
+
Whichever option you choose, will determine which setup steps you need to follow below:
34
+
35
+
## Requirements
36
+
37
+
- Python 3.12+
38
+
- A GitHub Account - For Acces to the GitHub Models Marketplace
39
+
- Azure Subscription - For Access to Azure AI Foundry
40
+
- Azure AI Foundry Account - For Access to the Azure AI Agent Service
41
+
42
+
We have included a `requirements.txt` file in the root of this repository that contains all the required Python packages to run the code samples.
43
+
44
+
You can install them by running the following command in your terminal at the roof of the repository:
45
+
46
+
```bash
47
+
pip install -r requirements.txt
48
+
```
49
+
We recommend creating a Python virtual environment to avoid any conflicts and issues.
50
+
51
+
## Set Up for Samples using GitHub Models
52
+
53
+
### Step 1: Retrieve Your GitHub Personal Access Token (PAT)
25
54
26
55
Currently, this course uses the Github Models Marketplace to offer free access to Large Language Models (LLMs) that will be used to create AI Agents.
27
56
@@ -35,98 +64,112 @@ Then select `Generate new token`.
35
64
36
65

37
66
67
+
You will be prompted to enter a name for your token, select the expiration date (Recommended: 30 Days), and select the scopes for your token (Public Repositories).
68
+
38
69
Copy your new token that you have just created. You will now add this to your `.env` file included in this course.
39
70
40
-
## Setting Up Your `.env` File for Azure AI Foundry
41
71
42
-
To create your `.env` file run the following command in your terminal:
72
+
### Step 2: Create Your `.env` File
73
+
74
+
To create your `.env` file run the following command in your terminal.
43
75
44
76
```bash
45
77
cp .env.example .env
46
78
```
47
79
48
-
This will copy the example file and create a `.env` in your directory, fill in the values for the environment variables.
80
+
This will copy the example file and create a `.env` in your directory and where you fill in the values for the environment variables.
49
81
50
-
Here's where you can find each value in Azure AI Foundry, the portal, or other relevant locations.
82
+
With your token copied, open the `.env` file in your favorite text editor and paste your token into the `GITHUB_TOKEN` field.
51
83
52
-
### GitHub
53
-
-`GITHUB_TOKEN` - Create a personal access token in GitHub, then paste it into the `GITHUB_TOKEN=` field in your `.env` file.
84
+
You should now be able to run the code samples of this course.
54
85
55
-
### Overview Page (Project)
56
-
-`AZURE_SUBSCRIPTION_ID` - Check **Project details** on the **Overview** page of your project.
57
-
-`AZURE_AI_PROJECT_NAME` - Look at the top of the **Overview** page for your project.
58
-
-`AZURE_OPENAI_SERVICE` - Find this in the **Included capabilities** tab for **Azure OpenAI Service** on the **Overview** page.
59
-
-`PROJECT_CONNECTION_STRING` - On the **Overview** page, go to **Project details** connection and copy the **Project connection string**. Please assert that the string starts with **https://** and has four parts separated with **;** (semicolon). Currently in Azure AI Foundry the string is missing the leading **https://**
86
+
## Set Up for Samples using Azure AI Foundry and Azure AI Agent Service
60
87
61
-
### Management Center
62
-
-`AZURE_OPENAI_RESOURCE_GROUP` - Go to **Project properties** on the **Overview** page of the **Management Center**.
63
-
-`GLOBAL_LLM_SERVICE` - Under **Connected resources**, find the **Azure AI Services** connection name. If not listed, check the **Azure portal** under your resource group for the AI Services resource name.
88
+
### Step 1: Retrieve Your Azure Project Connection String
64
89
65
-
### Models + Endpoints Page
66
-
-`AZURE_OPENAI_EMBEDDING_DEPLOYMENT_NAME` - Select your embedding model (e.g., `text-embedding-ada-002`) and note the **Deployment name** from the model details.
67
-
-`AZURE_OPENAI_CHAT_DEPLOYMENT_NAME` - Select your chat model (e.g., `gpt-4o-mini`) and note the **Deployment name** from the model details.
90
+
Follow the steps to creating a project and agent in Azure AI Foundry found here: [Create a project in Azure AI Foundry](https://learn.microsoft.com/en-us/azure/ai-services/agents/quickstart?pivots=ai-foundry-portal?WT.mc_id=academic-105485-koreyst)
68
91
69
-
### Azure Portal
70
-
-`AZURE_OPENAI_ENDPOINT` - Look for **Azure AI services**, click on it, then go to **Resource Management**, **Keys and Endpoint**, scroll down to the "Azure OpenAI endpoints", and copy the one that says "Language APIs".
71
-
-`AZURE_OPENAI_API_KEY` - From the same screen, copy KEY 1 or KEY 2.
72
-
-`AZURE_SEARCH_SERVICE_ENDPOINT` - Find your **Azure AI Search** resource, click it, and see **Overview**.
73
-
-`AZURE_SEARCH_API_KEY` - Then go to **Settings** and then **Keys** to copy the primary or secondary admin key.
92
+
Once you have created your project, you will need to retrieve the connection string for your project.
74
93
94
+
This can be done by going to the **Overview** page of your project in the Azure AI Foundry portal.
75
95
76
-
### External Webpage
77
-
-`AZURE_OPENAI_API_VERSION` - Visit the [API version lifecycle](https://learn.microsoft.com/en-us/azure/ai-services/openai/api-version-deprecation#latest-ga-api-release) page under **Latest GA API release**.
To ensure you have all the required Python packages to run the code, run the following command in your terminal.
98
+
### Step 2: Create Your `.env` File
82
99
83
-
We recommend creating a Python virtual environment to avoid any conflicts and issues.
100
+
To create your `.env` file run the following command in your terminal.
84
101
85
102
```bash
86
-
pip install -r requirements.txt
103
+
cp .env.example .env
87
104
```
88
105
89
-
This should install the required Python packages.
106
+
This will copy the example file and create a `.env` in your directory and where you fill in the values for the environment variables.
107
+
108
+
With your token copied, open the `.env` file in your favorite text editor and paste your token into the `PROJECT_CONNECTION_STRING` field.
90
109
91
-
# Sign in to Azure
110
+
### Step 3: Sign in to Azure
92
111
93
112
As a security best practice, we'll use [keyless authentication](https://learn.microsoft.com/azure/developer/ai/keyless-connections?tabs=csharp%2Cazure-cli?WT.mc_id=academic-105485-koreyst) to authenticate to Azure OpenAI with Microsoft Entra ID. Before you can do so, you'll first need to install the **Azure CLI** per the [installation instructions](https://learn.microsoft.com/cli/azure/install-azure-cli?WT.mc_id=academic-105485-koreyst) for your operating system.
94
113
95
-
Next, open a terminal and run `az login` to sign in to your Azure account.
114
+
Next, open a terminal and run `az login --use-device-code` to sign in to your Azure account.
96
115
97
-
## Sign in to Azure
116
+
Once you've logged in, select your subscription in the terminal.
98
117
99
-
Login with your Azure AI account used to provision the Azure resources.
100
118
101
-
Open a new terminal and enter the following command and follow the instructions in the terminal:
119
+
## Additional Envionment Variables - Azure Search and Azure OpenAI
102
120
103
-
`az login --use-device-code`
121
+
For the Agentic RAG Lesson - Lesson 5 - there are samples that use Azure Search and Azure OpenAI.
104
122
105
-
Once you've logged in, select your subscription in the terminal.
123
+
If you want to run these samples, you will need to add the following environment variables to your `.env` file:
106
124
107
-
##Access the environment variables.
125
+
### Overview Page (Project)
108
126
109
-
We'll import `os` and `load_dotenv` so that you can access the environment variables.
127
+
-`AZURE_SUBSCRIPTION_ID` - Check **Project details** on the **Overview** page of your project.
110
128
111
-
```python
112
-
import os
113
-
from dotenv import load_dotenv
129
+
-`AZURE_AI_PROJECT_NAME` - Look at the top of the **Overview** page for your project.
114
130
115
-
load_dotenv()
116
-
```
131
+
-`AZURE_OPENAI_SERVICE` - Find this in the **Included capabilities** tab for **Azure OpenAI Service** on the **Overview** page.
132
+
133
+
### Management Center
117
134
118
-
## Setup keyless authentication
135
+
-`AZURE_OPENAI_RESOURCE_GROUP` - Go to **Project properties** on the **Overview** page of the **Management Center**.
136
+
137
+
-`GLOBAL_LLM_SERVICE` - Under **Connected resources**, find the **Azure AI Services** connection name. If not listed, check the **Azure portal** under your resource group for the AI Services resource name.
138
+
139
+
### Models + Endpoints Page
140
+
141
+
-`AZURE_OPENAI_EMBEDDING_DEPLOYMENT_NAME` - Select your embedding model (e.g., `text-embedding-ada-002`) and note the **Deployment name** from the model details.
142
+
143
+
-`AZURE_OPENAI_CHAT_DEPLOYMENT_NAME` - Select your chat model (e.g., `gpt-4o-mini`) and note the **Deployment name** from the model details.
144
+
145
+
### Azure Portal
146
+
147
+
-`AZURE_OPENAI_ENDPOINT` - Look for **Azure AI services**, click on it, then go to **Resource Management**, **Keys and Endpoint**, scroll down to the "Azure OpenAI endpoints", and copy the one that says "Language APIs".
148
+
149
+
-`AZURE_OPENAI_API_KEY` - From the same screen, copy KEY 1 or KEY 2.
150
+
151
+
-`AZURE_SEARCH_SERVICE_ENDPOINT` - Find your **Azure AI Search** resource, click it, and see **Overview**.
152
+
153
+
-`AZURE_SEARCH_API_KEY` - Then go to **Settings** and then **Keys** to copy the primary or secondary admin key.
154
+
155
+
### External Webpage
156
+
157
+
-`AZURE_OPENAI_API_VERSION` - Visit the [API version lifecycle](https://learn.microsoft.com/en-us/azure/ai-services/openai/api-version-deprecation#latest-ga-api-release) page under **Latest GA API release**.
158
+
159
+
### Setup keyless authentication
119
160
120
161
Rather than hardcode your credentials, we'll use a keyless connection with Azure OpenAI. To do so, we'll import `DefaultAzureCredential` and later call the `DefaultAzureCredential` function to get the credential.
121
162
122
163
```python
123
164
from azure.identity import DefaultAzureCredential, InteractiveBrowserCredential
124
165
```
125
166
126
-
You are now ready to run the code of this course, happy learning more about the world of AI Agents!
167
+
## Stuck Somewhere?
127
168
128
169
If you have any issues running this setup, hop into our <ahref="https://discord.gg/kzRShWzttr"target="_blank">Azure AI Community Discord</a> or <ahref="https://github.com/microsoft/ai-agents-for-beginners/issues?WT.mc_id=academic-105485-koreyst"target="_blank">create an issue</a>.
129
170
130
171
## Next Lesson
131
172
173
+
You are now ready to run the code of this course, happy learning more about the world of AI Agents!
174
+
132
175
[Introduction to AI Agents and Agent Use Cases](../01-intro-to-ai-agents/README.md)
0 commit comments