Skip to content

Commit f1b6898

Browse files
leestottCopilot
andcommitted
docs: sanitize live deployment configuration
Require live Azure identifiers at runtime, document deployed-model execution, and keep retail pricing region configurable. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 48d85d0 commit f1b6898

4 files changed

Lines changed: 111 additions & 16 deletions

File tree

‎.env.example‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ AZURE_JUDGE_ENDPOINT=https://your-resource.openai.azure.com
1616
AZURE_JUDGE_KEY=your-azure-openai-api-key
1717
AZURE_JUDGE_DEPLOYMENT=gpt-5
1818

19+
# ARM region of the Foundry resource, used to select matching Azure Retail
20+
# Prices API meters (for example: eastus, swedencentral, westeurope).
21+
AZURE_PRICING_REGION=eastus
22+
1923
# Microsoft Foundry (optional — for cloud evaluation via Foundry SDK)
2024
AZURE_AI_PROJECT_ENDPOINT=https://your-project.services.ai.azure.com
2125
AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-5

‎README.md‎

Lines changed: 61 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,61 @@ bash scripts/demo.sh
6969

7070
See [QUICKSTART.md](QUICKSTART.md) for the CLI quickstart details.
7171

72+
### Run Against Deployed Models
73+
74+
The live demo calls an existing Microsoft Foundry Model Router deployment,
75+
baseline deployment, and judge deployment. It consumes billable tokens.
76+
77+
#### Prerequisites
78+
79+
- Complete the installation steps below so `.venv` exists.
80+
- Install the [Azure CLI](https://learn.microsoft.com/cli/azure/install-azure-cli).
81+
- Sign in with `az login`.
82+
- Ensure the three deployments exist in the same Foundry resource.
83+
- Ensure your identity can list keys for that resource.
84+
85+
Run the evaluation from PowerShell:
86+
87+
```powershell
88+
az login
89+
90+
.\scripts\demo.ps1 -Live `
91+
-Subscription "<subscription-id>" `
92+
-ResourceGroup "<resource-group>" `
93+
-ResourceName "<foundry-resource-name>" `
94+
-RouterDeployment "<model-router-deployment>" `
95+
-BaselineDeployment "<baseline-model-deployment>" `
96+
-JudgeDeployment "<judge-model-deployment>"
97+
```
98+
99+
The script:
100+
101+
1. Selects the Azure subscription.
102+
2. Reads the Foundry resource endpoint, access key, and region with Azure CLI.
103+
3. Refreshes supported model prices from the Azure Retail Prices API.
104+
4. Evaluates all 25 prompts in `datasets/zava_custom.jsonl`.
105+
5. Opens the generated `dashboard.html`.
106+
107+
To resume an interrupted live evaluation, add `-Resume`.
108+
109+
> The judge should ideally be a deployment distinct from both evaluated
110+
> endpoints to reduce self-preference bias.
111+
112+
If the Router, baseline, and judge use different Azure resources, configure
113+
their endpoints and keys in `.env`, then use the standard command:
114+
115+
```powershell
116+
Copy-Item .env.example .env
117+
# Edit .env with the three deployed endpoints, keys, deployment names,
118+
# and AZURE_PRICING_REGION.
119+
120+
.\.venv\Scripts\python.exe scripts\run_eval.py `
121+
--config configs\live_demo.yaml
122+
```
123+
124+
See [Run a Live Evaluation](docs/how-to-run-live-eval.md) for dataset,
125+
configuration, security, and troubleshooting details.
126+
72127
### 1. Install
73128

74129
**Prerequisites:** Python 3.9+, a Microsoft Foundry Model Router endpoint, and an Azure OpenAI baseline endpoint.
@@ -156,11 +211,13 @@ To swap the baseline or judge model, update the deployment name in `.env` or ove
156211

157212
```yaml
158213
# configs/default.yaml
159-
baseline:
160-
deployment: gpt-5 # change to any Azure OpenAI deployment
214+
endpoints:
215+
baseline:
216+
deployment_name: gpt-5
161217
judge:
162-
deployment: gpt-5 # model used for LLM-as-a-judge scoring
163-
concurrency: 3 # parallel judge calls
218+
endpoint:
219+
deployment_name: gpt-5
220+
max_parallel: 3
164221
```
165222
166223
See [configs/](configs/) for all presets (`quick_test`, `large_scale`, `foundry`).

‎configs/live_demo.yaml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Live evaluation using the <your-foundry-resource> Foundry deployments.
1+
# Live evaluation using user-supplied Foundry deployments.
22
# Credentials are injected into the process environment by scripts/demo.ps1.
33
evaluation:
44
name: "live-model-router-demo"
@@ -27,7 +27,7 @@ pricing:
2727
model_router:
2828
input: 0.50
2929
output: 1.50
30-
<your-baseline-deployment>:
30+
baseline:
3131
input: 2.50
3232
output: 15.00
3333
gpt-5.4:
@@ -51,7 +51,7 @@ pricing_source:
5151
azure_retail:
5252
enabled: true
5353
currency: "USD"
54-
region: "eastus"
54+
region: "${AZURE_PRICING_REGION}"
5555
cache_file: ".cache/azure-retail-prices.json"
5656
cache_ttl_hours: 24
5757
timeout_seconds: 20

‎scripts/demo.ps1‎

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,19 @@
33
# .\scripts\demo.ps1
44
# .\scripts\demo.ps1 -Live
55
# .\scripts\demo.ps1 -Live -Resume
6+
# .\scripts\demo.ps1 -Live -Subscription <id> -ResourceGroup <rg> `
7+
# -ResourceName <name> -RouterDeployment <router> `
8+
# -BaselineDeployment <baseline> -JudgeDeployment <judge>
69

710
param(
811
[switch]$Live,
912
[switch]$Resume,
10-
[string]$Subscription = "<your-subscription-id>",
11-
[string]$ResourceGroup = "<your-resource-group>",
12-
[string]$ResourceName = "<your-foundry-resource>"
13+
[string]$Subscription,
14+
[string]$ResourceGroup,
15+
[string]$ResourceName,
16+
[string]$RouterDeployment,
17+
[string]$BaselineDeployment,
18+
[string]$JudgeDeployment
1319
)
1420

1521
$ErrorActionPreference = "Stop"
@@ -46,10 +52,27 @@ if ($LASTEXITCODE -ne 0) {
4652
Push-Location $projectRoot
4753
try {
4854
if ($Live) {
55+
$requiredParameters = @{
56+
Subscription = $Subscription
57+
ResourceGroup = $ResourceGroup
58+
ResourceName = $ResourceName
59+
RouterDeployment = $RouterDeployment
60+
BaselineDeployment = $BaselineDeployment
61+
JudgeDeployment = $JudgeDeployment
62+
}
63+
$missingParameters = @(
64+
$requiredParameters.GetEnumerator() |
65+
Where-Object { [string]::IsNullOrWhiteSpace([string]$_.Value) } |
66+
ForEach-Object { "-$($_.Key)" }
67+
)
68+
if ($missingParameters.Count -gt 0) {
69+
throw "Live mode requires: $($missingParameters -join ', ')."
70+
}
71+
4972
Write-Host "This calls real deployments and consumes billable tokens." -ForegroundColor Yellow
50-
Write-Host " Router: <your-router-deployment>"
51-
Write-Host " Baseline: <your-baseline-deployment> (GPT-5.4)"
52-
Write-Host " Judge: <your-baseline-deployment> (GPT-5.4)"
73+
Write-Host " Router: $RouterDeployment"
74+
Write-Host " Baseline: $BaselineDeployment"
75+
Write-Host " Judge: $JudgeDeployment"
5376
Write-Host ""
5477

5578
$az = Get-Command az -ErrorAction SilentlyContinue
@@ -73,16 +96,26 @@ try {
7396
throw "Unable to retrieve an access key for Foundry resource '$ResourceName'."
7497
}
7598

99+
$resourceLocation = az cognitiveservices account show `
100+
--resource-group $ResourceGroup `
101+
--name $ResourceName `
102+
--query location `
103+
--output tsv
104+
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($resourceLocation)) {
105+
throw "Unable to determine the Azure region for Foundry resource '$ResourceName'."
106+
}
107+
76108
$endpoint = "https://$ResourceName.cognitiveservices.azure.com/"
77109
$env:AZURE_MODEL_ROUTER_ENDPOINT = $endpoint
78110
$env:AZURE_MODEL_ROUTER_KEY = $accountKey
79-
$env:AZURE_MODEL_ROUTER_DEPLOYMENT = "<your-router-deployment>"
111+
$env:AZURE_MODEL_ROUTER_DEPLOYMENT = $RouterDeployment
80112
$env:AZURE_OPENAI_ENDPOINT = $endpoint
81113
$env:AZURE_OPENAI_KEY = $accountKey
82-
$env:AZURE_BASELINE_DEPLOYMENT = "<your-baseline-deployment>"
114+
$env:AZURE_BASELINE_DEPLOYMENT = $BaselineDeployment
83115
$env:AZURE_JUDGE_ENDPOINT = $endpoint
84116
$env:AZURE_JUDGE_KEY = $accountKey
85-
$env:AZURE_JUDGE_DEPLOYMENT = "<your-baseline-deployment>"
117+
$env:AZURE_JUDGE_DEPLOYMENT = $JudgeDeployment
118+
$env:AZURE_PRICING_REGION = $resourceLocation
86119

87120
$evalArgs = @("scripts\run_eval.py", "--config", "configs\live_demo.yaml")
88121
if ($Resume) {
@@ -128,6 +161,7 @@ try {
128161
Remove-Item Env:\AZURE_MODEL_ROUTER_KEY -ErrorAction SilentlyContinue
129162
Remove-Item Env:\AZURE_OPENAI_KEY -ErrorAction SilentlyContinue
130163
Remove-Item Env:\AZURE_JUDGE_KEY -ErrorAction SilentlyContinue
164+
Remove-Item Env:\AZURE_PRICING_REGION -ErrorAction SilentlyContinue
131165
Pop-Location
132166
}
133167

0 commit comments

Comments
 (0)