Skip to content

Commit b270544

Browse files
Merge pull request #49107 from MicrosoftDocs/NEW-ai-foundry-sdk
New ai foundry sdk
2 parents fa29a4f + c3de3bd commit b270544

18 files changed

+656
-0
lines changed

learn-pr/paths/create-custom-copilots-ai-studio/index.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ subjects:
2929
modules:
3030
- learn.wwl.prepare-azure-ai-development
3131
- learn.wwl.explore-models-copilot-ai-studio
32+
- learn.wwl.ai-foundry-sdk
3233
- learn.get-started-prompt-flow-ai-studio
3334
- learn.wwl.build-copilot-ai-studio
3435
- learn.wwl.finetune-model-copilot-ai-studio
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.ai-foundry-sdk.introduction
3+
title: Introduction
4+
metadata:
5+
adobe-target: true
6+
prefetch-feature-rollout: true
7+
title: Introduction
8+
description: Introduction to Azure AI Foundry SDK.
9+
author: wwlpublish
10+
ms.author: gmalc
11+
ms.date: 02/05/2025
12+
ms.topic: unit
13+
ms.collection:
14+
- wwl-ai-copilot
15+
durationInMinutes: 1
16+
content: |
17+
[!include[](includes/01-introduction.md)]
18+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.ai-foundry-sdk.azure-ai-foundry-sdk
3+
title: What is the Azure AI Foundry SDK?
4+
metadata:
5+
adobe-target: true
6+
prefetch-feature-rollout: true
7+
title: What is the Azure AI Foundry SDK?
8+
description: Get started with the Azure AI Foundry SDK.
9+
author: wwlpublish
10+
ms.author: gmalc
11+
ms.date: 02/05/2025
12+
ms.topic: unit
13+
ms.collection:
14+
- wwl-ai-copilot
15+
zone_pivot_groups: dev-lang-csharp-python
16+
durationInMinutes: 5
17+
content: |
18+
[!include[](includes/02-azure-ai-foundry-sdk.md)]
19+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.ai-foundry-sdk.connections
3+
title: Work with project connections
4+
metadata:
5+
adobe-target: true
6+
prefetch-feature-rollout: true
7+
title: Work with project connections
8+
description: Use the Azure AI Foundry SDK to work with connections in a project.
9+
author: wwlpublish
10+
ms.author: gmalc
11+
ms.date: 02/05/2025
12+
ms.topic: unit
13+
ms.collection:
14+
- wwl-ai-copilot
15+
zone_pivot_groups: dev-lang-csharp-python
16+
durationInMinutes: 5
17+
content: |
18+
[!include[](includes/03-connections.md)]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.ai-foundry-sdk.chat-client
3+
title: Create a chat client
4+
metadata:
5+
adobe-target: true
6+
prefetch-feature-rollout: true
7+
title: Create a chat client
8+
description: Create a chat client for models in your project.
9+
author: wwlpublish
10+
ms.author: gmalc
11+
ms.date: 02/05/2025
12+
ms.topic: unit
13+
ms.collection:
14+
- wwl-ai-copilot
15+
zone_pivot_groups: dev-lang-csharp-python
16+
durationInMinutes: 10
17+
content: |
18+
[!include[](includes/04-chat-client.md)]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.ai-foundry-sdk.exercise
3+
title: Exercise - Create a generative AI chat app
4+
metadata:
5+
adobe-target: true
6+
prefetch-feature-rollout: true
7+
title: Exercise - Create a generative AI chat app
8+
description: Use the Azure AI Foundry SDK to create a chat app.
9+
author: wwlpublish
10+
ms.author: gmalc
11+
ms.date: 02/05/2025
12+
ms.topic: unit
13+
ms.collection:
14+
- wwl-ai-copilot
15+
durationInMinutes: 30
16+
content: |
17+
[!include[](includes/05-exercise.md)]
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.ai-foundry-sdk.knowledge-check
3+
title: Knowledge check
4+
metadata:
5+
adobe-target: true
6+
prefetch-feature-rollout: true
7+
title: Knowledge check
8+
description: Check your knowledge.
9+
author: wwlpublish
10+
ms.author: gmalc
11+
ms.date: 02/05/2025
12+
ms.topic: unit
13+
ms.collection:
14+
- wwl-ai-copilot
15+
durationInMinutes: 3
16+
quiz:
17+
questions:
18+
- content: "What class in the Azure AI Foundry SDK provides a proxy object for a project?"
19+
choices:
20+
- content: "ConnectionProperties"
21+
isCorrect: false
22+
explanation: "Incorrect. A ConnectionProperties object isn't a proxy for an Azure AI Foundry project."
23+
- content: "AIProjectClient"
24+
isCorrect: true
25+
explanation: "Correct. An AIProjectClient object is a proxy for an Azure AI Foundry project."
26+
- content: "ChatCompletionsClient"
27+
isCorrect: false
28+
explanation: "Incorrect. A ChatCompletionsClient object isn't a proxy for an Azure AI Foundry project."
29+
- content: "What value is needed to instantiate a AIProjectClient object?"
30+
choices:
31+
- content: "The project connection string."
32+
isCorrect: false
33+
explanation: "Correct. You need the project connection string to instantiate a AIProjectClient object."
34+
- content: "The Azure OpenAI authorization key"
35+
isCorrect: true
36+
explanation: "Incorrect. You don't need the Azure OpenAI authorization key to instantiate a AIProjectClient object."
37+
- content: "The Azure subscription ID"
38+
isCorrect: false
39+
explanation: "Incorrect. You don't need the Azure subscription ID to instantiate a AIProjectClient object"
40+
- content: "Which library should you use to chat with a model that is deployed to the Azure AI model inference service?"
41+
choices:
42+
- content: "Azure OpenAI"
43+
isCorrect: false
44+
explanation: "Incorrect. You can't use the Azure OpenAI library to chat with an Azure AI model inference model."
45+
- content: "Azure Machine Learning"
46+
isCorrect: false
47+
explanation: "Incorrect. You can't use the Azure Machine Learning library to chat with an Azure AI model inference model."
48+
- content: "Azure AI Inference"
49+
isCorrect: true
50+
explanation: "Correct. Use the Azure AI Inference library to chat with an Azure AI model inference model."
51+
52+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.ai-foundry-sdk.summary
3+
title: Summary
4+
metadata:
5+
adobe-target: true
6+
prefetch-feature-rollout: true
7+
title: Summary
8+
description: Reflect on what you've learned about the Azure AI Foundry SDK.
9+
author: wwlpublish
10+
ms.author: gmalc
11+
ms.date: 02/05/2025
12+
ms.topic: unit
13+
ms.collection:
14+
- wwl-ai-copilot
15+
durationInMinutes: 1
16+
content: |
17+
[!include[](includes/07-summary.md)]
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Developers creating AI solutions with Azure AI Foundry need to work with a combination of services and software frameworks. The Azure AI Foundry SDK is designed to bring together common services and code libraries in an AI project through a central programmatic access point, making it easier for developers to write the code needed to build effective AI apps on Azure.
2+
3+
In this module, you'll learn how to use the Azure AI Foundry SDK to work with resources in an AI project.
4+
5+
> [!NOTE]
6+
> Azure AI Foundry SDK is currently in public preview. Details described in this module are subject to change.
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
The Azure AI Foundry SDK is a set of packages and services designed to work together to enable developers to write code that uses resources in an Azure AI Foundry project. With the Azure AI Foundry SDK, developers can create applications that connect to a project, access the resource connections and models in that project, and use them to perform AI operations, such as sending prompts to a generative AI model and processing the responses
2+
3+
The SDK provides Python and Microsoft C# .NET libraries that you can use to build AI applications based on Azure AI Foundry projects.
4+
5+
> [!NOTE]
6+
> In the preview release of the SDK, some capabilities may not be available for both languages.
7+
8+
## Installing SDK packages
9+
10+
The core package for working with projects in the Azure AI Foundry SDK is the **Azure AI Projects** library, which enables you to connect to an Azure AI Foundry project and access the resources defined within it.
11+
12+
::: zone pivot="python"
13+
14+
To use the Azure AI Projects library in Python, you can use the **pip** package installation utility to install the **azure-ai-projects** package from PyPi:
15+
16+
```python
17+
pip install azure-ai-projects
18+
```
19+
20+
::: zone-end
21+
22+
::: zone pivot="csharp"
23+
24+
To use the Azure AI Projects library in C#, add the **Azure.AI.Projects** package to your C# project:
25+
26+
```csharp
27+
dotnet add package Azure.AI.Projects --prerelease
28+
```
29+
30+
::: zone-end
31+
32+
## Using the SDK to connect to a project
33+
34+
The first task in most Azure AI Foundry SDK code is to connect to an Azure AI Foundry project. Each project has a unique *connection string*, which you can find on the project's **Overview** page in the Azure AI Foundry portal.
35+
36+
[ ![Screenshot of the project overview page in Azure AI Foundry portal.](../media/ai-project-overview.png) ](../media/ai-project-overview.png#lightbox)
37+
38+
You can use that connection string in your code to create an **AIProjectClient** object, which provides a programmatic proxy for the project.
39+
40+
::: zone pivot="python"
41+
42+
The following code snippet shows how to create am **AIProjectClient** object in Python.
43+
44+
```python
45+
from azure.ai.projects import AIProjectClient
46+
from azure.ai.projects.models import ConnectionType
47+
from azure.identity import DefaultAzureCredential
48+
...
49+
50+
project_connection_string = "<region>.api.azureml.ms;<project_id>;<hub_name>;<project_name>"
51+
project_client = AIProjectClient.from_connection_string(
52+
credential=DefaultAzureCredential(),
53+
conn_str=project_connection_string,
54+
)
55+
56+
```
57+
58+
> [!NOTE]
59+
> The code uses the default Azure credentials to authenticate when accessing the project. To enable this authentication, in addition to the **azure-ai-projects** package, you need to install the **azure-identity** package:
60+
>
61+
> `pip install azure-identity`
62+
63+
::: zone-end
64+
65+
::: zone pivot="csharp"
66+
67+
The following code snippet shows how to create am **AIProjectClient** object in C#.
68+
69+
```csharp
70+
using Azure.Identity;
71+
using Azure.AI.Projects;
72+
73+
...
74+
75+
var connectionString = "<region>.api.azureml.ms;<project_id>;<hub_name>;<project_name>";
76+
var projectClient = new AIProjectClient(connectionString, new DefaultAzureCredential());
77+
```
78+
79+
> [!NOTE]
80+
> The code uses the default Azure credentials to authenticate when accessing the project. To enable this authentication, in addition to the **Azure.AI.Projects** package, you need to install the **Azure.Identity** package:
81+
>
82+
> `dotnet add package Azure.Identity`
83+
84+
::: zone-end
85+
86+
> [!TIP]
87+
> To access the project successfully, the Python code must be run in the context of an authenticated Azure session. For example, you could use the Azure command-line interface (CLI) `az-login` command to sign in before running the code.

0 commit comments

Comments
 (0)