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: articles/ai-foundry/agents/how-to/tools/openapi-spec-samples.md
+11-17Lines changed: 11 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ description: Find code samples to use OpenAPI tools with agents.
5
5
author: aahill
6
6
ms.author: aahi
7
7
manager: nitinme
8
-
ms.date: 04/09/2025
8
+
ms.date: 06/18/2025
9
9
ms.service: azure-ai-agent-service
10
10
ms.topic: how-to
11
11
ms.custom:
@@ -33,8 +33,8 @@ Use this article to find step-by-step instructions and code samples for using Op
33
33
34
34
:::image type="content" source="../../media\tools\open-api-details.png" alt-text="A screenshot showing the openAPI tool details in the Azure AI Foundry portal." lightbox="../../media\tools\open-api-details.png":::
35
35
36
-
1. Select **Next** and select your authentication method. Choose `connection` for `API key`.
37
-
1. If you choose `connection`, you need to select the custom keys connection you have created before.
36
+
1. Select **Next** and select your authentication method.
37
+
1. If you choose `connection`, you need to select the custom connection you have created before.
38
38
1. If you choose `managed identity`, you need to input the audience to get your token. An example of an audience would be `https://cognitiveservices.azure.com/` to connect to Azure AI Services. Make sure you have already set up authentication and role assignment (as described in the [section](./openapi-spec.md#authenticating-with-managed-identity-microsoft-entra-id) above).
39
39
40
40
1. Copy and paste your OpenAPI specification in the text box.
@@ -70,18 +70,14 @@ with AIProjectClient(
70
70
) as project_client:
71
71
```
72
72
73
-
## Countries Tool Setup
74
-
Similarly, the OpenAPI specification for the countries service is loaded from `countries.json`. An anonymous authentication object (`OpenApiAnonymousAuthDetails`) is created, as this specific API doesn't require authentication in this example.
73
+
## Tool setup
74
+
Similarly, the OpenAPI specification is loaded from `weather.json`. An anonymous authentication object (`OpenApiAnonymousAuthDetails`) is created, as this specific API doesn't require authentication in this example. You can find an example OpenAPI spec on [GitHub](https://github.com/azure-ai-foundry/foundry-samples/blob/main/samples/microsoft/python/getting-started-agents/openapi/weather_openapi.json).
75
75
76
76
```python
77
-
# Load the OpenAPI specification for the countries service from a local JSON file
77
+
# Load the OpenAPI specification for the weather service from a local JSON file
78
78
withopen(os.path.join(os.path.dirname(__file__), "weather.json"), "r") as f:
79
79
openapi_weather = jsonref.loads(f.read())
80
80
81
-
# Load the OpenAPI specification for the countries service from a local JSON file
82
-
withopen(os.path.join(os.path.dirname(__file__), "countries.json"), "r") as f:
83
-
openapi_countries = jsonref.loads(f.read())
84
-
85
81
# Create Auth object for the OpenApiTool (note: using anonymous auth here; connection or managed identity requires additional setup)
86
82
auth = OpenApiAnonymousAuthDetails()
87
83
# for connection setup
@@ -93,10 +89,6 @@ Similarly, the OpenAPI specification for the countries service is loaded from `c
93
89
openapi_tool = OpenApiTool(
94
90
name="get_weather", spec=openapi_weather, description="Retrieve weather information for a location", auth=auth
95
91
)
96
-
# Add the countries API definition to the same tool object
97
-
openapi_tool.add_definition(
98
-
name="get_countries", spec=openapi_countries, description="Retrieve a list of countries", auth=auth
99
-
)
100
92
```
101
93
102
94
## Agent Creation
@@ -125,7 +117,7 @@ Create the thread and add the initial user message.
125
117
message = project_client.agents.messages.create(
126
118
thread_id=thread.id,
127
119
role="user",
128
-
content="What's the weather in Seattle and What is the name and population of the country that uses currency with abbreviation THB?",
120
+
content="What's the weather in Seattle?",
129
121
)
130
122
print(f"Created message, ID: {message.id}")
131
123
```
@@ -201,6 +193,8 @@ const client = new AgentsClient(projectEndpoint, new DefaultAzureCredential());
201
193
202
194
## Read in the OpenAPI spec
203
195
196
+
You can find an example OpenAPI spec on [GitHub](https://github.com/azure-ai-foundry/foundry-samples/blob/main/samples/microsoft/python/getting-started-agents/openapi/weather_openapi.json).
First, retrieve configuration details and create a `PersistentAgentsClient`, then define the `OpenApiToolDefinition` using the OpenAPI specification.
280
+
First, retrieve configuration details and create a `PersistentAgentsClient`, then define the `OpenApiToolDefinition` using the OpenAPI specification. You can find an example OpenAPI spec on [GitHub](https://github.com/azure-ai-foundry/foundry-samples/blob/main/samples/microsoft/python/getting-started-agents/openapi/weather_openapi.json).
287
281
288
282
```csharp
289
283
usingAzure;
@@ -392,7 +386,7 @@ Follow the [REST API Quickstart](../../quickstart.md?pivots=rest-api#api-call-in
392
386
393
387
## Create the OpenAPI Spec tool definition, agent, and thread
[Azure AI Foundry](https://ai.azure.com/?cid=learnDocs) supports developing in VS Code - Desktop and Web. In each scenario, your VS Code instance is remotely connected to a prebuilt custom container running on a virtual machine, also known as a compute instance.
23
+
[Azure AI Foundry](https://ai.azure.com/?cid=learnDocs) supports developing in VS Code - Desktop and Web for [!INCLUDE [hub-project-name](../../includes/hub-project-name.md)]s. In each scenario, your VS Code instance is remotely connected to a prebuilt custom container running on a virtual machine, also known as a compute instance.
24
24
25
25
## Prerequisites
26
26
@@ -35,15 +35,16 @@ author: sdgilley
35
35
1. On the left menu, select **Templates**.
36
36
1. Select **VS Code container**.
37
37
1. For **Compute**, select an existing compute instance or create a new one.
38
-
* Select a compute instance to use. If it's stopped, select **Start compute** and wait for it to switch to **Running**. You'll see a **Ready** status when the compute is ready for use.
39
-
* If you don't have a compute instance, select **Create compute**. Then enter a name, compute details, and select **Create compute**. Wait until the compute instance is ready.
38
+
* Select a compute instance to use. If it's stopped, select **Start compute** and wait for it to switch to **Running**. You see a **Ready** status when the compute is ready for use.
39
+
* If you don't have a compute instance, select **Create compute**. Then enter a name, compute details, and select **Create compute**. Wait until the compute instance is ready.
40
40
1. If prompted, select **Authenticate** to authenticate your compute instance.
41
-
1. For **VS Code container**, select **Set up container** once the button enables. This configures the container on the compute for you. The container setup might take a few minutes to complete. Once you set up the container for the first time, you can directly launch subsequent times. When setup is complete, you'll see **Ready**.
41
+
1. For **VS Code container**, select **Set up container** once the button enables. This setting configures the container on the compute for you. The container setup might take a few minutes to complete. Once you set up the container for the first time, you can directly launch subsequent times. When setup is complete, you see **Ready**.
42
42
43
43
> [!WARNING]
44
-
> Even if you [enable idle shutdown on your compute instance](../create-manage-compute.md#configure-idle-shutdown), idle shutdown will not occur for any compute that is set up with this custom VS Code container. This is to ensure the compute doesn't shut down unexpectedly while you're working within a container.
44
+
> Even if you [enable idle shutdown on your compute instance](../create-manage-compute.md#configure-idle-shutdown), idle shutdown won't occur for any compute that is set up with this custom VS Code container. This is to ensure the compute doesn't shut down unexpectedly while you're working within a container.
45
45
46
46
1. Once your container is ready, launch VS Code:
47
+
47
48
* If you want to work in your local VS Code instance, choose **Launch in VS Code (Desktop)**. A new local instance of VS Code opens on your local machine.
48
49
* If you want to work in the browser instead, select the dropdown arrow and choose **Launch in VS Code (Web)**. A new browser tab connected to *vscode.dev* opens.
49
50
@@ -108,4 +109,3 @@ For app templates and SDK samples in your preferred programming language, see [D
108
109
## Related content
109
110
110
111
-[Get started building a chat app using the prompt flow SDK](../../quickstarts/get-started-code.md)
111
-
-[Get started with Azure AI Foundry SDKs](sdk-overview.md)
Copy file name to clipboardExpand all lines: articles/ai-foundry/tutorials/deploy-chat-web-app.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ ms.custom:
9
9
- build-2024
10
10
- ignite-2024
11
11
ms.topic: tutorial
12
-
ms.date: 02/13/2025
12
+
ms.date: 06/18/2025
13
13
ms.reviewer: tgokal
14
14
ms.author: sgilley
15
15
author: sdgilley
@@ -73,7 +73,7 @@ To start, identify the resources you need to configure from the Azure AI Foundry
73
73
74
74
1. For each resource, select the link to open the resource details. From the details page, select the resource name to open the resource in the Azure portal. (For the workspaceblobstore, select **View in Azure Portal**).
75
75
1. After the browser tab opens, go back to the Azure AI Foundry portal and repeat the process for the next resource.
76
-
1. When you're done, you should have three new browser tabs open, for **Search service**, **Azure AI services**, and **blobstore Container**. Keep all three new tabs open as you'll go back and forth between them to configure the resources.
76
+
1. When you're done, you should have three new browser tabs open, for **Search service**, **Azure AI Foundry**, and **blobstore Container**. Keep all three new tabs open as you'll go back and forth between them to configure the resources.
77
77
78
78
### Enable managed identity
79
79
@@ -83,7 +83,7 @@ On the browser tab for the **Search service** resource in the Azure portal, enab
83
83
1. Switch **Status** to **On**.
84
84
1. Select **Save**.
85
85
86
-
On the browser tab for the **Azure AI services** resource in the Azure portal, enable the managed identity:
86
+
On the browser tab for the **Azure AI Foundry** resource in the Azure portal, enable the managed identity:
87
87
88
88
1. From the left pane, under **Resource Management**, select **Identity**.
89
89
1. Switch **Status** to **On**.
@@ -106,18 +106,18 @@ You'll repeat this pattern multiple times in the bulleted items below.
106
106
Use these steps to assign roles for the resources you're configuring in this tutorial:
107
107
108
108
* Assign the following roles on the browser tab for **Search service** in the Azure portal:
109
-
***Search Index Data Reader** to the **Azure AI services** managed identity
110
-
***Search Service Contributor** to the **Azure AI services** managed identity
109
+
***Search Index Data Reader** to the **Azure AI Foundry** managed identity
110
+
***Search Service Contributor** to the **Azure AI Foundry** managed identity
111
111
***Contributor** to yourself (to find **Contributor**, switch to the **Privileged administrator roles** tab at the top. All other roles are in the **Job function roles** tab.)
112
112
113
-
* Assign the following roles on the browser tab for **Azure AI services** in the Azure portal:
113
+
* Assign the following roles on the browser tab for **Azure AI Foundry** in the Azure portal:
114
114
115
115
***Cognitive Services OpenAI Contributor** to the **Search service** managed identity
116
116
***Contributor** to yourself.
117
117
118
118
* Assign the following roles on the browser tab for **Azure Blob storage** in the Azure portal:
119
119
120
-
***Storage Blob Data Contributor** to the **Azure AI services** managed identity
120
+
***Storage Blob Data Contributor** to the **Azure AI Foundry** managed identity
121
121
***Storage Blob Data Reader** to the **Search service** managed identity
| Eligibility |All customers |Customers approved for modified content filtering|
41
-
| How to enable | Enabled by default, no action needed |Customers approved for modified content filtering can configure it directly in [Azure AI Foundry portal](https://ai.azure.com/?cid=learnDocs) (as part of a content filtering configuration, applied at the deployment level) |
40
+
| Eligibility |All customers |All customers|
41
+
| How to enable | Enabled by default, no action needed |Customers can configure it directly in [Azure AI Foundry portal](https://ai.azure.com/?cid=learnDocs) (as part of a content filtering configuration, applied at the deployment level) |
42
42
|Modality and availability |Text; all GPT models |Text; all GPT models |
43
43
|Streaming experience |Content is buffered and returned in chunks |Zero latency (no buffering, filters run asynchronously) |
44
44
|Content filtering signal |Immediate filtering signal |Delayed filtering signal (in up to ~1,000-character increments) |
0 commit comments