Skip to content

Latest commit

 

History

History
285 lines (175 loc) · 8.74 KB

File metadata and controls

285 lines (175 loc) · 8.74 KB
title Course Setup
subtitle AI Agents for Beginners
theme seriph
transition slide-left
class text-center
highlighter shiki
lineNumbers false
drawings
persist
download true
exportFilename 00-course-setup-slides
info ## Course Setup This lesson covers how to run the code samples of this course.
layout intro
hideInToc true

Course Setup

Introduction

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


layout: two-cols hideInToc: true

Table of contents

::right::


layout: default

Clone or Fork this Repo

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!

This can be done by clicking the link to fork the repo.

You should now have your own forked version of this course in the following link:

Forked Repo


layout: default

Running the Code

This course offers a series of Jupyter Notebooks that you can run with to get hands-on experience building AI Agents.

The code samples use either:

Requires GitHub Account - Free:

  1. Semantic Kernel Agent Framework + GitHub Models Marketplace. Labeled as (semantic-kernel.ipynb)

  2. AutoGen Framework + GitHub Models Marketplace. Labeled as (autogen.ipynb)

Requires Azure Subscription:

  1. Azure AI Foundry + Azure AI Agent Service. Labeled as (azureaiagent.ipynb)

We encourage you to try out all three types of examples to see which one works best for you.

Whichever option you choose, will determine which setup steps you need to follow below.


layout: default

Requirements

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.

You can install them by running the following command in your terminal at the roof of the repository:

  • Python 3.12+
  • A GitHub Account - For Access to the GitHub Models Marketplace
  • Azure Subscription - For Access to Azure AI Foundry
  • Azure AI Foundry Account - For Access to the Azure AI Agent Service
pip install -r requirements.txt

We recommend creating a Python virtual environment to avoid any conflicts and issues.


layout: default

Set Up for Samples using GitHub Models

<template #1>

Step 1: Retrieve Your GitHub Personal Access Token (PAT)

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.

To access this service, you will need to create a GitHub Personal Access Token.

This can be done by going to your Personal Access Tokens settings in your GitHub Account.

Select the Fine-grained tokens option on the left side of your screen.

Then select Generate new token.

<template #2>

Generate Token

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

Copy your new token that you have just created. You will now add this to your .env file included in this course.

<template #3>

Step 2: Create Your .env File

To create your .env file run the following command in your terminal.

cp .env.example .env

This will copy the example file and create a .env in your directory and where you fill in the values for the environment variables.

With your token copied, open the .env file in your favorite text editor and paste your token into the GITHUB_TOKEN field.

You should now be able to run the code samples of this course.


layout: default

Set Up for Samples using Azure AI Foundry and Azure AI Agent Service

<template #1>

Step 1: Retrieve Your Azure Project Connection String

Follow the steps to creating a project and agent in Azure AI Foundry found here: Create a project in Azure AI Foundry

Once you have created your project, you will need to retrieve the connection string for your project.

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

Project Connection String

<template #2>

Step 2: Create Your .env File

To create your .env file run the following command in your terminal.

cp .env.example .env

This will copy the example file and create a .env in your directory and where you fill in the values for the environment variables.

With your token copied, open the .env file in your favorite text editor and paste your token into the PROJECT_CONNECTION_STRING field.

Step 3: Sign in to Azure

As a security best practice, we'll use keyless authentication 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 for your operating system.

Next, open a terminal and run az login --use-device-code to sign in to your Azure account.

Once you've logged in, select your subscription in the terminal.


layout: two-cols

Additional Environment Variables

Azure Search and Azure OpenAI

For the Agentic RAG Lesson - Lesson 5 - there are samples that use Azure Search and Azure OpenAI.

If you want to run these samples, you will need to add the following environment variables to your .env file:

::right::

<template #1>

Overview Page (Project)

  • AZURE_SUBSCRIPTION_ID - Check Project details on the Overview page of your project.
  • AZURE_AI_PROJECT_NAME - Look at the top of the Overview page for your project.
  • AZURE_OPENAI_SERVICE - Find this in the Included capabilities tab for Azure OpenAI Service on the Overview page.

<template #2>

Management Center

  • AZURE_OPENAI_RESOURCE_GROUP - Go to Project properties on the Overview page of the Management Center.
  • 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.

<template #3>

Models + Endpoints Page

  • AZURE_OPENAI_EMBEDDING_DEPLOYMENT_NAME - Select your embedding model (e.g., text-embedding-ada-002) and note the Deployment name from the model details.
  • AZURE_OPENAI_CHAT_DEPLOYMENT_NAME - Select your chat model (e.g., gpt-4o-mini) and note the Deployment name from the model details.

<template #4>

Azure Portal

  • 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".
  • AZURE_OPENAI_API_KEY - From the same screen, copy KEY 1 or KEY 2.
  • AZURE_SEARCH_SERVICE_ENDPOINT - Find your Azure AI Search resource, click it, and see Overview.
  • AZURE_SEARCH_API_KEY - Then go to Settings and then Keys to copy the primary or secondary admin key.

<template #5>

External Webpage

<template #6>

Setup keyless authentication

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.

from azure.identity import DefaultAzureCredential, InteractiveBrowserCredential

layout: statement

Stuck Somewhere?

If you have any issues running this setup, hop into our Azure AI Community Discord or create an issue.


layout: end

Next Lesson

You are now ready to run the code of this course, happy learning more about the world of AI Agents!

Introduction to AI Agents and Agent Use Cases