diff --git a/cli/azd/extensions/azure.ai.agents/internal/cmd/init.go b/cli/azd/extensions/azure.ai.agents/internal/cmd/init.go index 0b48d8a78fb..9baa3299f83 100644 --- a/cli/azd/extensions/azure.ai.agents/internal/cmd/init.go +++ b/cli/azd/extensions/azure.ai.agents/internal/cmd/init.go @@ -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") diff --git a/cli/azd/extensions/azure.ai.agents/internal/cmd/init_adopt.go b/cli/azd/extensions/azure.ai.agents/internal/cmd/init_adopt.go index 70aa787adab..81dcecdc829 100644 --- a/cli/azd/extensions/azure.ai.agents/internal/cmd/init_adopt.go +++ b/cli/azd/extensions/azure.ai.agents/internal/cmd/init_adopt.go @@ -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 } diff --git a/cli/azd/extensions/azure.ai.agents/internal/cmd/init_foundry_resources_helpers.go b/cli/azd/extensions/azure.ai.agents/internal/cmd/init_foundry_resources_helpers.go index aae2bd9de23..32085a6668f 100644 --- a/cli/azd/extensions/azure.ai.agents/internal/cmd/init_foundry_resources_helpers.go +++ b/cli/azd/extensions/azure.ai.agents/internal/cmd/init_foundry_resources_helpers.go @@ -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 } @@ -1266,8 +1266,12 @@ func selectNewModel( return nil, exterrors.Dependency( exterrors.CodeModelResolutionFailed, fmt.Sprintf("failed to select an AI model: %s", err), - "pass --model (e.g. --model gpt-4.1-mini) or --project-id "+ - " with --model-deployment to skip interactive model selection", + fmt.Sprintf( + "to run non-interactively, pass --no-prompt with --model "+ + "(e.g. --model %s), or --no-prompt with --project-id "+ + "and --model-deployment ", + defaultAgentModel, + ), ) } diff --git a/cli/azd/extensions/azure.ai.agents/internal/cmd/init_foundry_resources_helpers_test.go b/cli/azd/extensions/azure.ai.agents/internal/cmd/init_foundry_resources_helpers_test.go index 4ce6327c205..124cbf71442 100644 --- a/cli/azd/extensions/azure.ai.agents/internal/cmd/init_foundry_resources_helpers_test.go +++ b/cli/azd/extensions/azure.ai.agents/internal/cmd/init_foundry_resources_helpers_test.go @@ -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, + }, + { + 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() diff --git a/cli/azd/extensions/azure.ai.agents/internal/cmd/init_models.go b/cli/azd/extensions/azure.ai.agents/internal/cmd/init_models.go index 8083cecf4e9..8a6b3ad9667 100644 --- a/cli/azd/extensions/azure.ai.agents/internal/cmd/init_models.go +++ b/cli/azd/extensions/azure.ai.agents/internal/cmd/init_models.go @@ -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