Skip to content

Commit 338aff4

Browse files
trangeviJeffreyCA
andauthored
[AI Agents Extension] Add check for missing sku capacity (#6053)
* Add check for missing sku capacity Signed-off-by: trangevi <[email protected]> * Update cli/azd/extensions/azure.ai.agents/internal/cmd/init.go Co-authored-by: JeffreyCA <[email protected]> --------- Signed-off-by: trangevi <[email protected]> Co-authored-by: JeffreyCA <[email protected]>
1 parent f457240 commit 338aff4

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

cli/azd/extensions/azure.ai.agents/internal/cmd/init.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"path/filepath"
1313
"regexp"
1414
"slices"
15+
"strconv"
1516
"strings"
1617

1718
"azureaiagent/internal/pkg/agents/agent_yaml"
@@ -1415,5 +1416,24 @@ func (a *InitAction) getModelDetails(ctx context.Context, modelName string, mode
14151416
return nil, fmt.Errorf("failed to get model deployment: %w", err)
14161417
}
14171418

1419+
if modelDeployment.Sku.Capacity == -1 {
1420+
skuCapacity, err := a.azdClient.Prompt().Prompt(ctx, &azdext.PromptRequest{
1421+
Options: &azdext.PromptOptions{
1422+
Message: "Selected model SKU has no default capacity. Please enter desired capacity",
1423+
IgnoreHintKeys: true,
1424+
Required: true,
1425+
},
1426+
})
1427+
if err != nil {
1428+
return nil, fmt.Errorf("failed to prompt for text value: %w", err)
1429+
}
1430+
1431+
capacity, err := strconv.Atoi(skuCapacity.Value)
1432+
if err != nil {
1433+
return nil, fmt.Errorf("invalid capacity value: %w", err)
1434+
}
1435+
modelDeployment.Sku.Capacity = int32(capacity)
1436+
}
1437+
14181438
return modelDeployment, nil
14191439
}

cli/azd/extensions/azure.ai.agents/internal/pkg/azure/ai/model_catalog.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,10 +347,15 @@ func (c *ModelCatalogService) GetModelDeployment(
347347
Sku: AiModelDeploymentSku{
348348
Name: *sku.Name,
349349
UsageName: *sku.UsageName,
350-
Capacity: *sku.Capacity.Default,
351350
},
352351
}
353352

353+
if sku.Capacity.Default != nil {
354+
modelDeployment.Sku.Capacity = *sku.Capacity.Default
355+
} else {
356+
modelDeployment.Sku.Capacity = -1
357+
}
358+
354359
break
355360
}
356361
}

0 commit comments

Comments
 (0)