Skip to content

Commit 158f3bc

Browse files
Update policy.xml (#85)
--------- Co-authored-by: Simon Kurtz <simonkurtz@microsoft.com>
1 parent 90ddd94 commit 158f3bc

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

labs/model-routing/policy.xml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
<policies>
22
<inbound>
33
<base />
4-
<set-backend-service backend-id="@{
5-
// Determine what backend pool we use.
6-
switch(context.Request.MatchedParameters["deployment-id"]) {
7-
case "gpt-35-turbo-1106":
8-
return "{backend-id-1}";
94

10-
case "gpt-35-turbo-0125":
11-
return "{backend-id-2}";
12-
13-
case "gpt-4o-2024-05-13":
14-
return "{backend-id-3}";
15-
16-
default:
17-
return "{backend-id-1}";
18-
}
19-
}" />
5+
<!-- Use a <choose> block to evaluate deployment-id -->
6+
<choose>
7+
<when condition="@(context.Request.MatchedParameters["deployment-id"] == "gpt-35-turbo-1106")">
8+
<set-backend-service backend-id="{backend-id-1}" />
9+
</when>
10+
<when condition="@(context.Request.MatchedParameters["deployment-id"] == "gpt-35-turbo-0125")">
11+
<set-backend-service backend-id="{backend-id-2}" />
12+
</when>
13+
<when condition="@(context.Request.MatchedParameters["deployment-id"] == "gpt-4o-2024-05-13")">
14+
<set-backend-service backend-id="{backend-id-3}" />
15+
</when>
16+
<otherwise>
17+
<set-backend-service backend-id="{backend-id-1}" />
18+
</otherwise>
19+
</choose>
2020

2121
<authentication-managed-identity resource="https://cognitiveservices.azure.com" output-token-variable-name="managed-id-access-token" ignore-error="false" />
22+
2223
<set-header name="Authorization" exists-action="override">
2324
<value>@("Bearer " + (string)context.Variables["managed-id-access-token"])</value>
2425
</set-header>

0 commit comments

Comments
 (0)