Skip to content

Commit f532c15

Browse files
sajagtapCopilot
authored andcommitted
feat(model-router): add deployment scripts for routing modes and model subsets (#181)
Co-authored-by: Copilot <copilot@github.com>
1 parent 79619d0 commit f532c15

6 files changed

Lines changed: 304 additions & 0 deletions

File tree

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.sh text eol=lf

.github/CODEOWNERS

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# See for instructions on this file https://help.github.com/articles/about-codeowners/
2+
3+
#### Team-owned sample areas ############################################################################
4+
# Each contributing team owns their sample paths for review routing. See CONTRIBUTING.md for setup guide.
5+
/samples/python/hosted-agents/ @microsoft-foundry/hosted-agents
6+
/samples/csharp/hosted-agents/ @microsoft-foundry/hosted-agents
7+
8+
#### files referenced in docs (DO NOT EDIT, except for Docs team!!!) ##########################################
9+
/infrastructure/infrastructure-setup-bicep/01-connections/connection-key-vault.bicep @microsoft-foundry/AI-Platform-Docs
10+
/infrastructure/infrastructure-setup-bicep/05-custom-policy-definitions/deny-disallowed-connections.json @microsoft-foundry/AI-Platform-Docs
11+
/infrastructure/infrastructure-setup-terraform/00-basic-azurerm/code/main.tf @microsoft-foundry/AI-Platform-Docs
12+
/infrastructure/infrastructure-setup-terraform/00-basic-azurerm/code/providers.tf @microsoft-foundry/AI-Platform-Docs
13+
/infrastructure/infrastructure-setup-terraform/00-basic-azurerm/code/variables.tf @microsoft-foundry/AI-Platform-Docs
14+
/infrastructure/infrastructure-setup-terraform/00-basic/code/main.tf @microsoft-foundry/AI-Platform-Docs
15+
/infrastructure/infrastructure-setup-terraform/00-basic/code/providers.tf @microsoft-foundry/AI-Platform-Docs
16+
/infrastructure/infrastructure-setup-terraform/00-basic/code/variables.tf @microsoft-foundry/AI-Platform-Docs
17+
/samples-classic/REST/quickstart/quickstart.sh @microsoft-foundry/AI-Platform-Docs
18+
/samples-classic/csharp/quickstart/Samples/.env.example @microsoft-foundry/AI-Platform-Docs
19+
/samples-classic/csharp/quickstart/Samples/AgentFileSearch.cs @microsoft-foundry/AI-Platform-Docs
20+
/samples-classic/csharp/quickstart/Samples/AgentService.cs @microsoft-foundry/AI-Platform-Docs
21+
/samples-classic/csharp/quickstart/Samples/SimpleInference.cs @microsoft-foundry/AI-Platform-Docs
22+
/samples-classic/java/quickstart/src/main/java/com/azure/ai/foundry/samples/AgentSample.java @microsoft-foundry/AI-Platform-Docs
23+
/samples-classic/java/quickstart/src/main/java/com/azure/ai/foundry/samples/ChatCompletionSample.java @microsoft-foundry/AI-Platform-Docs
24+
/samples-classic/java/quickstart/src/main/java/com/azure/ai/foundry/samples/FileSearchAgentSample.java @microsoft-foundry/AI-Platform-Docs
25+
/samples-classic/python/quickstart/create_project.py @microsoft-foundry/AI-Platform-Docs
26+
/samples-classic/python/quickstart/quickstart.py @microsoft-foundry/AI-Platform-Docs
27+
/samples-classic/typescript/quickstart/.env.template @microsoft-foundry/AI-Platform-Docs
28+
/samples-classic/typescript/quickstart/src/quickstart.ts @microsoft-foundry/AI-Platform-Docs
29+
/samples/REST/quickstart/quickstart-chat-with-agent.sh @microsoft-foundry/AI-Platform-Docs
30+
/samples/REST/quickstart/quickstart-create-agent.sh @microsoft-foundry/AI-Platform-Docs
31+
/samples/REST/quickstart/quickstart-responses.sh @microsoft-foundry/AI-Platform-Docs
32+
/samples/csharp/enterprise-agent-tutorial/1-idea-to-prototype/Evaluate/Program.cs @microsoft-foundry/AI-Platform-Docs
33+
/samples/csharp/enterprise-agent-tutorial/1-idea-to-prototype/ModernWorkplaceAssistant/Program.cs @microsoft-foundry/AI-Platform-Docs
34+
/samples/csharp/quickstart/chat-with-agent/quickstart-chat-with-agent.cs @microsoft-foundry/AI-Platform-Docs
35+
/samples/csharp/quickstart/create-agent/quickstart-create-agent.cs @microsoft-foundry/AI-Platform-Docs
36+
/samples/csharp/quickstart/responses/quickstart-responses.cs @microsoft-foundry/AI-Platform-Docs
37+
/samples/java/quickstart/chat-with-agent/src/main/java/com/azure/ai/agents/ChatWithAgent.java @microsoft-foundry/AI-Platform-Docs
38+
/samples/java/quickstart/create-agent/src/main/java/com/azure/ai/agents/CreateAgent.java @microsoft-foundry/AI-Platform-Docs
39+
/samples/python/enterprise-agent-tutorial/1-idea-to-prototype/evaluate.py @microsoft-foundry/AI-Platform-Docs
40+
/samples/python/enterprise-agent-tutorial/1-idea-to-prototype/main.py @microsoft-foundry/AI-Platform-Docs
41+
/samples/python/foundry-models/model-router/model-router-chat-completions.py @microsoft-foundry/AI-Platform-Docs
42+
/samples/python/foundry-models/model-router/model-router-foundry-responses.py @microsoft-foundry/AI-Platform-Docs
43+
/samples/python/quickstart/chat-with-agent/quickstart-chat-with-agent.py @microsoft-foundry/AI-Platform-Docs
44+
/samples/python/quickstart/create-agent/quickstart-create-agent.py @microsoft-foundry/AI-Platform-Docs
45+
/samples/python/quickstart/responses/quickstart-responses.py @microsoft-foundry/AI-Platform-Docs
46+
/samples/typescript/quickstart/chat-with-agent/src/quickstart-chat-with-agent.ts @microsoft-foundry/AI-Platform-Docs
47+
/samples/typescript/quickstart/create-agent/src/quickstart-create-agent.ts @microsoft-foundry/AI-Platform-Docs
48+
/samples/typescript/quickstart/responses/src/quickstart-responses.ts @microsoft-foundry/AI-Platform-Docs
49+
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Deploys a model-router deployment with both a routing mode and a custom model subset.
2+
# WSL example: bash /mnt/c/Work/repos/foundry-samples-pr/samples/REST/model-router/deploy-model-router-all-configs.sh quality
3+
4+
SUBSCRIPTION_ID="<subscription-id>"
5+
RESOURCE_GROUP="<resource-group>"
6+
ACCOUNT_NAME="<azure-ai-foundry-account-name>"
7+
DEPLOYMENT_NAME="<deployment-name>"
8+
API_VERSION="2025-10-01-preview"
9+
SKU_NAME="GlobalStandard"
10+
SKU_CAPACITY="10"
11+
MODEL_ROUTER_FORMAT="OpenAI"
12+
MODEL_ROUTER_NAME="model-router"
13+
MODEL_ROUTER_VERSION="2025-11-18"
14+
# Valid values: balanced (default) | cost | quality
15+
ROUTING_MODE="balanced"
16+
SUBSET_1_FORMAT="OpenAI"
17+
SUBSET_1_NAME="gpt-4.1"
18+
SUBSET_1_VERSION="2025-04-14"
19+
SUBSET_2_FORMAT="OpenAI"
20+
SUBSET_2_NAME="gpt-5.2-chat"
21+
SUBSET_2_VERSION="2025-12-11"
22+
SUBSET_3_FORMAT="Meta"
23+
SUBSET_3_NAME="Llama-4-Maverick-17B-128E-Instruct-FP8"
24+
SUBSET_3_VERSION="1"
25+
26+
if [ $# -gt 0 ]; then
27+
ROUTING_MODE="$1"
28+
fi
29+
30+
if [ -z "${AZURE_AI_AUTH_TOKEN:-}" ]; then
31+
AZURE_AI_AUTH_TOKEN="$(az account get-access-token --resource https://management.azure.com --query accessToken -o tsv)"
32+
fi
33+
34+
case "${ROUTING_MODE}" in
35+
balanced|cost|quality)
36+
;;
37+
*)
38+
echo "Invalid ROUTING_MODE: ${ROUTING_MODE}. Valid values: balanced | cost | quality" >&2
39+
exit 1
40+
;;
41+
esac
42+
43+
# <deploy_model_router_all_configs>
44+
curl -X PUT "https://management.azure.com/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/${RESOURCE_GROUP}/providers/Microsoft.CognitiveServices/accounts/${ACCOUNT_NAME}/deployments/${DEPLOYMENT_NAME}?api-version=${API_VERSION}" \
45+
-H "Content-Type: application/json" \
46+
-H "Authorization: Bearer $AZURE_AI_AUTH_TOKEN" \
47+
-d @- <<EOF
48+
{
49+
"sku": {
50+
"name": "${SKU_NAME}",
51+
"capacity": ${SKU_CAPACITY}
52+
},
53+
"properties": {
54+
"model": {
55+
"format": "${MODEL_ROUTER_FORMAT}",
56+
"name": "${MODEL_ROUTER_NAME}",
57+
"version": "${MODEL_ROUTER_VERSION}"
58+
},
59+
"routing": {
60+
"mode": "${ROUTING_MODE}",
61+
"models": [
62+
{
63+
"format": "${SUBSET_1_FORMAT}",
64+
"name": "${SUBSET_1_NAME}",
65+
"version": "${SUBSET_1_VERSION}"
66+
},
67+
{
68+
"format": "${SUBSET_2_FORMAT}",
69+
"name": "${SUBSET_2_NAME}",
70+
"version": "${SUBSET_2_VERSION}"
71+
},
72+
{
73+
"format": "${SUBSET_3_FORMAT}",
74+
"name": "${SUBSET_3_NAME}",
75+
"version": "${SUBSET_3_VERSION}"
76+
}
77+
]
78+
}
79+
}
80+
}
81+
EOF
82+
# </deploy_model_router_all_configs>
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Deploys a model-router deployment that routes only to a custom subset of models.
2+
# WSL example: bash /mnt/c/Work/repos/foundry-samples-pr/samples/REST/model-router/deploy-model-router-model-subset.sh
3+
4+
SUBSCRIPTION_ID="<subscription-id>"
5+
RESOURCE_GROUP="<resource-group>"
6+
ACCOUNT_NAME="<azure-ai-foundry-account-name>"
7+
DEPLOYMENT_NAME="<deployment-name>"
8+
API_VERSION="2025-10-01-preview"
9+
SKU_NAME="GlobalStandard"
10+
SKU_CAPACITY="10"
11+
MODEL_ROUTER_FORMAT="OpenAI"
12+
MODEL_ROUTER_NAME="model-router"
13+
MODEL_ROUTER_VERSION="2025-11-18"
14+
SUBSET_1_FORMAT="OpenAI"
15+
SUBSET_1_NAME="gpt-4.1"
16+
SUBSET_1_VERSION="2025-04-14"
17+
SUBSET_2_FORMAT="OpenAI"
18+
SUBSET_2_NAME="gpt-5.2-chat"
19+
SUBSET_2_VERSION="2025-12-11"
20+
SUBSET_3_FORMAT="Meta"
21+
SUBSET_3_NAME="Llama-4-Maverick-17B-128E-Instruct-FP8"
22+
SUBSET_3_VERSION="1"
23+
24+
if [ -z "${AZURE_AI_AUTH_TOKEN:-}" ]; then
25+
AZURE_AI_AUTH_TOKEN="$(az account get-access-token --resource https://management.azure.com --query accessToken -o tsv)"
26+
fi
27+
28+
# <deploy_model_router_model_subset>
29+
curl -X PUT "https://management.azure.com/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/${RESOURCE_GROUP}/providers/Microsoft.CognitiveServices/accounts/${ACCOUNT_NAME}/deployments/${DEPLOYMENT_NAME}?api-version=${API_VERSION}" \
30+
-H "Content-Type: application/json" \
31+
-H "Authorization: Bearer $AZURE_AI_AUTH_TOKEN" \
32+
-d @- <<EOF
33+
{
34+
"sku": {
35+
"name": "${SKU_NAME}",
36+
"capacity": ${SKU_CAPACITY}
37+
},
38+
"properties": {
39+
"model": {
40+
"format": "${MODEL_ROUTER_FORMAT}",
41+
"name": "${MODEL_ROUTER_NAME}",
42+
"version": "${MODEL_ROUTER_VERSION}"
43+
},
44+
"routing": {
45+
"models": [
46+
{
47+
"format": "${SUBSET_1_FORMAT}",
48+
"name": "${SUBSET_1_NAME}",
49+
"version": "${SUBSET_1_VERSION}"
50+
},
51+
{
52+
"format": "${SUBSET_2_FORMAT}",
53+
"name": "${SUBSET_2_NAME}",
54+
"version": "${SUBSET_2_VERSION}"
55+
},
56+
{
57+
"format": "${SUBSET_3_FORMAT}",
58+
"name": "${SUBSET_3_NAME}",
59+
"version": "${SUBSET_3_VERSION}"
60+
}
61+
]
62+
}
63+
}
64+
}
65+
EOF
66+
# </deploy_model_router_model_subset>
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
2+
# Deploys a model-router deployment with a selected routing mode.
3+
# WSL example: bash /mnt/c/Work/repos/foundry-samples-pr/samples/REST/model-router/deploy-model-router-routing-mode.sh quality
4+
5+
SUBSCRIPTION_ID="<subscription-id>"
6+
RESOURCE_GROUP="<resource-group>"
7+
ACCOUNT_NAME="<azure-ai-foundry-account-name>"
8+
DEPLOYMENT_NAME="<deployment-name>"
9+
API_VERSION="2025-10-01-preview"
10+
# Valid values: balanced (default) | cost | quality
11+
ROUTING_MODE="balanced"
12+
SKU_NAME="GlobalStandard"
13+
SKU_CAPACITY="10"
14+
MODEL_FORMAT="OpenAI"
15+
MODEL_NAME="model-router"
16+
MODEL_VERSION="2025-11-18"
17+
18+
if [ $# -gt 0 ]; then
19+
ROUTING_MODE="$1"
20+
fi
21+
22+
if [ -z "${AZURE_AI_AUTH_TOKEN:-}" ]; then
23+
AZURE_AI_AUTH_TOKEN="$(az account get-access-token --resource https://management.azure.com --query accessToken -o tsv)"
24+
fi
25+
26+
case "${ROUTING_MODE}" in
27+
balanced|cost|quality)
28+
;;
29+
*)
30+
echo "Invalid ROUTING_MODE: ${ROUTING_MODE}. Valid values: balanced | cost | quality" >&2
31+
exit 1
32+
;;
33+
esac
34+
35+
# <deploy_model_router_routing_mode>
36+
curl -X PUT "https://management.azure.com/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/${RESOURCE_GROUP}/providers/Microsoft.CognitiveServices/accounts/${ACCOUNT_NAME}/deployments/${DEPLOYMENT_NAME}?api-version=${API_VERSION}" \
37+
-H "Content-Type: application/json" \
38+
-H "Authorization: Bearer $AZURE_AI_AUTH_TOKEN" \
39+
-d @- <<EOF
40+
{
41+
"sku": {
42+
"name": "${SKU_NAME}",
43+
"capacity": ${SKU_CAPACITY}
44+
},
45+
"properties": {
46+
"model": {
47+
"format": "${MODEL_FORMAT}",
48+
"name": "${MODEL_NAME}",
49+
"version": "${MODEL_VERSION}"
50+
},
51+
"routing": {
52+
"mode": "${ROUTING_MODE}"
53+
}
54+
}
55+
}
56+
EOF
57+
# </deploy_model_router_routing_mode>

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
2+
3+
SUBSCRIPTION_ID="<subscription-id>"
4+
RESOURCE_GROUP="<resource-group>"
5+
ACCOUNT_NAME="<azure-ai-foundry-account-name>"
6+
DEPLOYMENT_NAME="<deployment-name>"
7+
API_VERSION="2025-10-01-preview"
8+
# Valid values: balanced (default) | cost | quality
9+
ROUTING_MODE="${ROUTING_MODE:-balanced}"
10+
SKU_NAME="GlobalStandard"
11+
SKU_CAPACITY="10"
12+
MODEL_FORMAT="OpenAI"
13+
MODEL_NAME="model-router"
14+
MODEL_VERSION="2025-11-18"
15+
16+
if [ -z "${AZURE_AI_AUTH_TOKEN:-}" ]; then
17+
AZURE_AI_AUTH_TOKEN="$(az account get-access-token --resource https://management.azure.com --query accessToken -o tsv)"
18+
fi
19+
20+
case "${ROUTING_MODE}" in
21+
balanced|cost|quality)
22+
;;
23+
*)
24+
echo "Invalid ROUTING_MODE: ${ROUTING_MODE}. Valid values: balanced | cost | quality" >&2
25+
exit 1
26+
;;
27+
esac
28+
29+
curl -X PUT "https://management.azure.com/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/${RESOURCE_GROUP}/providers/Microsoft.CognitiveServices/accounts/${ACCOUNT_NAME}/deployments/${DEPLOYMENT_NAME}?api-version=${API_VERSION}" \
30+
-H "Content-Type: application/json" \
31+
-H "Authorization: Bearer $AZURE_AI_AUTH_TOKEN" \
32+
-d @- <<EOF
33+
{
34+
"sku": {
35+
"name": "${SKU_NAME}",
36+
"capacity": ${SKU_CAPACITY}
37+
},
38+
"properties": {
39+
"model": {
40+
"format": "${MODEL_FORMAT}",
41+
"name": "${MODEL_NAME}",
42+
"version": "${MODEL_VERSION}"
43+
},
44+
"routing": {
45+
"mode": "${ROUTING_MODE}"
46+
}
47+
}
48+
}
49+
EOF

0 commit comments

Comments
 (0)