generated from pascalvanderheiden/ais-apim-openai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.http
52 lines (44 loc) · 1.51 KB
/
tests.http
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
@tenantId = <your_tenant_id>
@scope = user_impersonation
@clientId = <app_id_consumer_app_registration>
@clientSecret = <password_consumer_app_registration>
@apimName = <api_management_name>
@apiPath = openai
@azureOpenAIDeploymentId = chat
@azureOpenAIApiVersion = 2023-03-15-preview
@prompt = "You are a helpful assistant."
@subscriptionKey = <subscription_key>
### Test Azure API Management endpoint, chat completion without OAuth2
POST https://{{apimName}}.azure-api.net/{{apiPath}}/deployments/{{azureOpenAIDeploymentId}}/chat/completions?api-version={{azureOpenAIApiVersion}}
Content-Type: application/json
Ocp-Apim-Subscription-Key: {{subscriptionKey}}
{
"messages": [
{
"role": "user",
"content": {{prompt}}
}
]
}
### Get Token for consumer for OAuth2
# @name consumerToken
POST https://login.microsoftonline.com/{{tenantId}}/oauth2/token HTTP/1.1
Content-Type: application/x-www-form-urlencoded
client_id={{clientId}}
&scope={{scope}}
&client_secret={{clientSecret}}
&grant_type=client_credentials
#### Get Token Response
@accessToken = {{consumerToken.response.body.$.access_token}}
### Test Azure API Management endpoint, chat completion with OAuth2
POST https://{{apimName}}.azure-api.net/{{apiPath}}/deployments/{{azureOpenAIDeploymentId}}/chat/completions?api-version={{azureOpenAIApiVersion}}
Content-Type: application/json
Authorization: Bearer {{accessToken}}
{
"messages": [
{
"role": "user",
"content": {{prompt}}
}
]
}