Skip to content

Commit 0ed1cde

Browse files
authored
update openapi spec instructions
1 parent afc4d69 commit 0ed1cde

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

articles/ai-services/agents/how-to/tools/openapi-spec.md

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,28 @@ automated, and scalable API integrations that enhance the capabilities and effic
2727
describing HTTP APIs. This allows people to understand how an API works, how a sequence of APIs
2828
work together, generate client code, create tests, apply design standards, and more. Currently, we support 3 authentication types with the OpenAPI 3.0 specified tools: `anonymous`, `API key`, `managed identity`.
2929

30-
## Set up
30+
## Prerequisite
3131
1. Ensure you've completed the prerequisites and setup steps in the [quickstart](../../quickstart.md).
3232

33-
1. [optional]If your OpenAPI spec requires API key, you can store your API key in a `custom keys` connection and use `connection` authentication
33+
1. Check the OpenAPI spec for the following requirements:
34+
1. `operationId` should only contain letters, `-` and `_`. You can modify it to meet the requirement. We recommend to give a descriptive name to help models efficiently decide which function to use.
35+
36+
## Authenticating with API Key
37+
1. Verify if the OpenAPI spec supports API key: it has `securitySchemes` section and has one scheme of type `apiKey". An example would be:
38+
```json
39+
"securitySchemes": {
40+
"apiKeyHeader": {
41+
"type": "apiKey",
42+
"name": "x-api-key",
43+
"in": "header"
44+
}
45+
}
46+
```
47+
If the security schemes include multiple schemes, we recommend keeping only one of them.
48+
49+
1. Remove any parameter in the OpenAPI spec that needs API key, because API key will be stored and passed through connections set up later in this doc
50+
51+
1. Create a `custom keys` connection to store your API key
3452

3553
1. Go to the [Azure AI Foundry portal](https://ai.azure.com/) and select the AI Project. Click **connected resources**.
3654
:::image type="content" source="../../media/tools/bing/project-settings-button.png" alt-text="A screenshot of the settings button for an AI project." lightbox="../../media/tools/bing/project-settings-button.png":::
@@ -46,9 +64,18 @@ work together, generate client code, create tests, apply design standards, and m
4664
:::image type="content" source="../../media/tools/bing/api-key-connection.png" alt-text="A screenshot of the custom keys selection for the AI project." lightbox="../../media/tools/bing/api-key-connection.png":::
4765

4866
1. Enter the following information
49-
- `key`: "key"
67+
- key: `name` of your security scheme. In this example, it should be `x-api-key`
68+
```json
69+
"securitySchemes": {
70+
"apiKeyHeader": {
71+
"type": "apiKey",
72+
"name": "x-api-key",
73+
"in": "header"
74+
}
75+
}
76+
```
5077
- value: YOUR_API_KEY
51-
- Connection name: `YOUR_CONNECTION_NAME` (You will use this connection name in the sample code below.)
78+
- Connection name: YOUR_CONNECTION_NAME (You will use this connection name in the sample code below.)
5279
- Access: you can choose either *this project only* or *shared to all projects*. Just make sure in the sample code below, the project you entered connection string for has access to this connection.
5380

5481
::: zone-end

0 commit comments

Comments
 (0)