diff --git a/playground/AzureAIFoundryEndToEnd/AzureAIFoundryEndToEnd.AppHost/foundry.module.bicep b/playground/AzureAIFoundryEndToEnd/AzureAIFoundryEndToEnd.AppHost/foundry.module.bicep index 92590ac8adc..9bd27c1f183 100644 --- a/playground/AzureAIFoundryEndToEnd/AzureAIFoundryEndToEnd.AppHost/foundry.module.bicep +++ b/playground/AzureAIFoundryEndToEnd/AzureAIFoundryEndToEnd.AppHost/foundry.module.bicep @@ -22,7 +22,7 @@ resource foundry 'Microsoft.CognitiveServices/accounts@2024-10-01' = { } resource chat 'Microsoft.CognitiveServices/accounts/deployments@2024-10-01' = { - name: 'qwen2.5-0.5b' + name: 'chat' properties: { model: { format: 'Microsoft' diff --git a/src/Aspire.Hosting.Azure.AIFoundry/AzureAIFoundryDeploymentResource.cs b/src/Aspire.Hosting.Azure.AIFoundry/AzureAIFoundryDeploymentResource.cs index db468ec3a79..011ac10ecee 100644 --- a/src/Aspire.Hosting.Azure.AIFoundry/AzureAIFoundryDeploymentResource.cs +++ b/src/Aspire.Hosting.Azure.AIFoundry/AzureAIFoundryDeploymentResource.cs @@ -27,7 +27,7 @@ public class AzureAIFoundryDeploymentResource : Resource, IResourceWithParent()); var deployment = Assert.Single(resource.Deployments); Assert.Equal("deployment1", deployment.Name); + Assert.Equal("deployment1", deployment.DeploymentName); Assert.Equal("gpt-4", deployment.ModelName); Assert.Equal("1.0", deployment.ModelVersion); Assert.Equal("OpenAI", deployment.Format); @@ -112,7 +113,7 @@ public void RunAsFoundryLocal_DeploymentIsMarkedLocal() } [Fact] - public void RunAsFoundryLocal_DeploymentConnectionString_HasModelProperty() + public async Task RunAsFoundryLocal_DeploymentConnectionString_HasModelProperty() { using var builder = TestDistributedApplicationBuilder.Create(); var foundry = builder.AddAzureAIFoundry("myAIFoundry"); @@ -120,9 +121,9 @@ public void RunAsFoundryLocal_DeploymentConnectionString_HasModelProperty() foundry.RunAsFoundryLocal(); var resource = Assert.Single(builder.Resources.OfType()); Assert.Single(resource.Deployments); - var connectionString = deployment.Resource.ConnectionStringExpression.ValueExpression; - Assert.Contains("Model=gpt-4", connectionString); - Assert.Contains("DeploymentId=gpt-4", connectionString); + var connectionString = await deployment.Resource.ConnectionStringExpression.GetValueAsync(default); + Assert.Contains("Model=deployment1", connectionString); + Assert.Contains("DeploymentId=deployment1", connectionString); Assert.Contains("Endpoint=", connectionString); Assert.Contains("Key=", connectionString); } @@ -135,6 +136,7 @@ public async Task AddAzureAIFoundry_GeneratesValidBicep() var foundry = builder.AddAzureAIFoundry("foundry"); var deployment1 = foundry.AddDeployment("deployment1", "gpt-4", "1.0", "OpenAI"); var deployment2 = foundry.AddDeployment("deployment2", "Phi-4", "1.0", "Microsoft"); + var deployment3 = foundry.AddDeployment("my-model", "Phi-4", "1.0", "Microsoft"); using var app = builder.Build(); var model = app.Services.GetRequiredService(); diff --git a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureAIFoundryExtensionsTests.AddAzureAIFoundry_GeneratesValidBicep#00.verified.bicep b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureAIFoundryExtensionsTests.AddAzureAIFoundry_GeneratesValidBicep#00.verified.bicep index 88d1692c48d..a00bd7f9165 100644 --- a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureAIFoundryExtensionsTests.AddAzureAIFoundry_GeneratesValidBicep#00.verified.bicep +++ b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureAIFoundryExtensionsTests.AddAzureAIFoundry_GeneratesValidBicep#00.verified.bicep @@ -22,7 +22,7 @@ resource foundry 'Microsoft.CognitiveServices/accounts@2024-10-01' = { } resource deployment1 'Microsoft.CognitiveServices/accounts/deployments@2024-10-01' = { - name: 'gpt-4' + name: 'deployment1' properties: { model: { format: 'OpenAI' @@ -38,7 +38,7 @@ resource deployment1 'Microsoft.CognitiveServices/accounts/deployments@2024-10-0 } resource deployment2 'Microsoft.CognitiveServices/accounts/deployments@2024-10-01' = { - name: 'Phi-4' + name: 'deployment2' properties: { model: { format: 'Microsoft' @@ -56,8 +56,27 @@ resource deployment2 'Microsoft.CognitiveServices/accounts/deployments@2024-10-0 ] } +resource my_model 'Microsoft.CognitiveServices/accounts/deployments@2024-10-01' = { + name: 'my-model' + properties: { + model: { + format: 'Microsoft' + name: 'Phi-4' + version: '1.0' + } + } + sku: { + name: 'GlobalStandard' + capacity: 1 + } + parent: foundry + dependsOn: [ + deployment2 + ] +} + output aiFoundryApiEndpoint string = foundry.properties.endpoints['AI Foundry API'] output endpoint string = foundry.properties.endpoint -output name string = foundry.name \ No newline at end of file +output name string = foundry.name