Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion cli/azd/extensions/azure.ai.agents/internal/cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -1547,7 +1547,12 @@ from code-deploy ZIP packaging (uses .gitignore syntax).`,
"Name of an existing model deployment to use from the Foundry project. Only used when paired with an existing Foundry project, either via --project-id or interactive prompts")

cmd.Flags().StringVar(&flags.model, "model", "",
"Name of the AI model to use (e.g., 'gpt-4o'). If not specified, defaults to 'gpt-4.1-mini'. Mutually exclusive with --model-deployment, with --model-deployment being used if both are provided")
fmt.Sprintf(
"Name of the AI model to deploy. Defaults to '%s' during interactive model selection; "+
"required to deploy a new model with --no-prompt. If --model-deployment is also provided, "+
"--model-deployment takes precedence",
defaultAgentModel,
))

cmd.Flags().StringVarP(&flags.manifestPointer, "manifest", "m", "",
"Path or URI to an agent manifest, or to a sample's unified azure.yaml to adopt as the project manifest")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ func promptAlternativeDeployment(
if useCatalog {
// Use the full model + deployment prompt which handles version,
// SKU, and capacity selection (same as manifest path).
defaultModel := "gpt-4.1-mini"
defaultModel := defaultAgentModel
if modelFlag != "" {
defaultModel = modelFlag
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,7 @@ func selectNewModel(
azureContext *azdext.AzureContext,
modelFlag string,
) (*azdext.AiModel, error) {
defaultModel := "gpt-4.1-mini"
defaultModel := defaultAgentModel
if modelFlag != "" {
defaultModel = modelFlag
}
Expand All @@ -1266,8 +1266,12 @@ func selectNewModel(
return nil, exterrors.Dependency(
exterrors.CodeModelResolutionFailed,
fmt.Sprintf("failed to select an AI model: %s", err),
"pass --model <name> (e.g. --model gpt-4.1-mini) or --project-id "+
"<id> with --model-deployment <name> to skip interactive model selection",
fmt.Sprintf(
"to run non-interactively, pass --no-prompt with --model <name> "+
"(e.g. --model %s), or --no-prompt with --project-id <id> "+
"and --model-deployment <name>",
defaultAgentModel,
),
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,79 @@ func TestAgentModelFilter(t *testing.T) {
}
}

type recordingPromptAiModelServer struct {
azdext.UnimplementedPromptServiceServer
requests []*azdext.PromptAiModelRequest
}

func (s *recordingPromptAiModelServer) PromptAiModel(
_ context.Context,
req *azdext.PromptAiModelRequest,
) (*azdext.PromptAiModelResponse, error) {
s.requests = append(s.requests, req)
return &azdext.PromptAiModelResponse{
Model: &azdext.AiModel{Name: "selected-model"},
}, nil
}

func TestSelectNewModel(t *testing.T) {
t.Parallel()

tests := []struct {
name string
modelFlag string
wantDefault string
}{
{
name: "uses default agent model",
wantDefault: defaultAgentModel,
Comment thread
huimiu marked this conversation as resolved.
},
{
name: "explicit model wins",
modelFlag: "gpt-5",
wantDefault: "gpt-5",
},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()

promptServer := &recordingPromptAiModelServer{}
azdClient := newTestAzdClient(
t,
&testEnvironmentServiceServer{},
&testWorkflowServiceServer{},
promptServer,
)
azureContext := &azdext.AzureContext{
Scope: &azdext.AzureScope{Location: "eastus"},
}

model, err := selectNewModel(
t.Context(),
azdClient,
azureContext,
tt.modelFlag,
)

require.NoError(t, err)
require.Equal(t, "selected-model", model.Name)
require.Len(t, promptServer.requests, 1)

req := promptServer.requests[0]
require.Equal(t, tt.wantDefault, req.DefaultValue)
require.NotNil(t, req.Filter)
require.Equal(t, []string{"eastus"}, req.Filter.Locations)
require.Equal(
t,
[]string{agentsV2ModelCapability},
req.Filter.Capabilities,
)
})
}
}

func TestLocationAllowed(t *testing.T) {
t.Parallel()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ import (

var defaultSkuPriority = []string{"GlobalStandard", "DataZoneStandard", "Standard"}

// defaultAgentModel is preselected in interactive catalog prompts.
const defaultAgentModel = "gpt-5.4-mini"

// defaultDeploymentCapacity is the preferred deployment capacity for agent model deployments.
// This overrides the lower SKU default (typically 10) which is insufficient for agents.
const defaultDeploymentCapacity int32 = 50
Expand Down
Loading