Skip to content

Commit 96ee3c6

Browse files
committed
upgraded sk in requirements, improved setup steps
1 parent a706277 commit 96ee3c6

File tree

5 files changed

+109
-61
lines changed

5 files changed

+109
-61
lines changed

.env.example

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
GLOBAL_LLM_SERVICE="AzureOpenAI"
2+
3+
# Only Used For Running Samples Using GitHub Models
4+
GITHUB_TOKEN="..."
5+
6+
# For Running Samples Using Azure AI Agent Service
7+
PROJECT_CONNECTION_STRING="..."
8+
9+
# Only Used For Running Samples Using Azure OpenAI Service + Azure Search
210
AZURE_OPENAI_API_KEY="..."
311
AZURE_OPENAI_ENDPOINT="https://..."
412
AZURE_OPENAI_EMBEDDING_DEPLOYMENT_NAME="..."
513
AZURE_OPENAI_CHAT_DEPLOYMENT_NAME=
614
AZURE_OPENAI_API_VERSION="..."
7-
PROJECT_CONNECTION_STRING="..."
8-
GITHUB_TOKEN="..."
915
AZURE_SEARCH_SERVICE_ENDPOINT = "https://..."
1016
AZURE_SEARCH_API_KEY = "..."
1117
AZURE_SUBSCRIPTION_ID="..."

00-course-setup/README.md

+97-54
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,6 @@
44

55
This lesson will cover how to run the code samples of this course.
66

7-
## Requirements
8-
9-
- A GitHub Account
10-
- Python 3.12+
11-
- Azure Subscription
12-
- Azure AI Foundry Account
13-
147
## Clone or Fork this Repo
158

169
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
2114

2215
![Forked Repo](./images/forked-repo.png)
2316

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.
20+
21+
The code samples use either:
22+
23+
**Requires GitHub Accont - Free**:
24+
25+
1) Semantic Kernel Agent Framework + GitHub Models Marketplace. Labeled as (semantic-kernel.ipynb)
26+
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)
2554

2655
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.
2756

@@ -35,98 +64,112 @@ Then select `Generate new token`.
3564

3665
![Generate Token](./images/generate-token.png)
3766

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+
3869
Copy your new token that you have just created. You will now add this to your `.env` file included in this course.
3970

40-
## Setting Up Your `.env` File for Azure AI Foundry
4171

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.
4375

4476
```bash
4577
cp .env.example .env
4678
```
4779

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.
4981

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.
5183

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.
5485

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
6087

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
6489

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)
6891

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.
7493

94+
This can be done by going to the **Overview** page of your project in the Azure AI Foundry portal.
7595

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**.
78-
79-
## Install Required Packages
96+
![Project Connection String](./images/project-connection-string.png)
8097

81-
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
8299

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.
84101

85102
```bash
86-
pip install -r requirements.txt
103+
cp .env.example .env
87104
```
88105

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.
90109

91-
# Sign in to Azure
110+
### Step 3: Sign in to Azure
92111

93112
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.
94113

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.
96115

97-
## Sign in to Azure
116+
Once you've logged in, select your subscription in the terminal.
98117

99-
Login with your Azure AI account used to provision the Azure resources.
100118

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
102120

103-
`az login --use-device-code`
121+
For the Agentic RAG Lesson - Lesson 5 - there are samples that use Azure Search and Azure OpenAI.
104122

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:
106124

107-
## Access the environment variables.
125+
### Overview Page (Project)
108126

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.
110128

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.
114130

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
117134

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
119160

120161
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.
121162

122163
```python
123164
from azure.identity import DefaultAzureCredential, InteractiveBrowserCredential
124165
```
125166

126-
You are now ready to run the code of this course, happy learning more about the world of AI Agents!
167+
## Stuck Somewhere?
127168

128169
If you have any issues running this setup, hop into our <a href="https://discord.gg/kzRShWzttr" target="_blank">Azure AI Community Discord</a> or <a href="https://github.com/microsoft/ai-agents-for-beginners/issues?WT.mc_id=academic-105485-koreyst" target="_blank">create an issue</a>.
129170

130171
## Next Lesson
131172

173+
You are now ready to run the code of this course, happy learning more about the world of AI Agents!
174+
132175
[Introduction to AI Agents and Agent Use Cases](../01-intro-to-ai-agents/README.md)
Loading

01-intro-to-ai-agents/code_samples/01-semantic-kernel.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@
204204
"name": "python",
205205
"nbconvert_exporter": "python",
206206
"pygments_lexer": "ipython3",
207-
"version": "3.11.11"
207+
"version": "3.12.10"
208208
}
209209
},
210210
"nbformat": 4,

requirements.txt

+3-4
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ mcp[cli]
1212
mistralai~=0.4.2
1313
openai
1414
pillow==11.0.0
15-
pydantic
1615
python-dotenv~=1.0.1
17-
semantic-kernel>=1.27.2
18-
semantic-kernel[azure]>=1.27.2
19-
semantic-kernel[mcp]>=1.27.2
16+
semantic-kernel>=1.29.0
17+
semantic-kernel[azure]
18+
semantic-kernel[mcp]

0 commit comments

Comments
 (0)