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-services/agents/how-to/tools/openapi-spec-samples.md
+62-90Lines changed: 62 additions & 90 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ Use this article to find step-by-step instructions and code samples for using Op
20
20
:::zone pivot="portal"
21
21
22
22
1. Go to the [Azure AI Foundry portal](https://ai.azure.com/). in the **Create and debug** screen or **Agent playground**, select your agent.
23
-
1. Scroll down the **Setup** pane on the right to **action**. Then select **Add**.
23
+
1. Scroll down the **Setup** pane to **action**. Then select **Add**.
24
24
25
25
:::image type="content" source="../../media/tools/action-tools.png" alt-text="A screenshot showing the available tool categories in the Azure AI Foundry portal." lightbox="../../media/tools/action-tools.png":::
26
26
@@ -32,7 +32,7 @@ Use this article to find step-by-step instructions and code samples for using Op
32
32
33
33
:::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":::
34
34
35
-
1.Click Next and select your authentication method. Choose `connection` for `API key`.
35
+
1.Select **Next** and select your authentication method. Choose `connection` for `API key`.
36
36
1. If you choose `connection`, you need to select the custom keys connection you have created before.
37
37
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).
38
38
@@ -44,115 +44,88 @@ Use this article to find step-by-step instructions and code samples for using Op
44
44
45
45
:::zone pivot="csharp"
46
46
47
-
## Step 1: Create a project client
48
-
Create a client object, which will contain the connection string for connecting to your AI project and other resources.
In this example we'll demonstrate the possibility to use services with [OpenAPI Specification](https://en.wikipedia.org/wiki/OpenAPI_Specification) with the agent. We will use [wttr.in](https://wttr.in) service to get weather and its specification file [weather_openapi.json](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/ai/Azure.AI.Projects/tests/Samples/Agent/weather_openapi.json).
81
50
82
-
## Step 2: Create the OpenAPI Spec tool definition
1. First get `ProjectEndpoint` and `ModelDeploymentName` from config and create a `PersistentAgentsClient`. Also, create an `OpenApiAnonymousAuthDetails` and `OpenApiToolDefinition` from config.
5. Finally, we delete all the resources we have created in this sample.
125
+
126
+
```csharp
127
+
client.DeleteThread(thread.Id);
128
+
client.DeleteAgent(agent.Id);
156
129
```
157
130
158
131
:::zone-end
@@ -259,7 +232,7 @@ Create a run and observe that the model uses the OpenAPI Spec tool to provide a
259
232
260
233
:::zone pivot="rest-api"
261
234
262
-
## Step 1: Create the OpenAPI Spec tool definition, agent and thread
235
+
## Step 1: Create the OpenAPI Spec tool definition, agent, and thread
263
236
264
237
You might want to store the OpenAPI specification in another file and import the content to initialize the tool. This example is using `anonymous` as the authentication type.
0 commit comments