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
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class AzureAIFoundryDeploymentResource : Resource, IResourceWithParent<Az
public AzureAIFoundryDeploymentResource(string name, string modelName, string modelVersion, string format, AzureAIFoundryResource parent)
: base(name)
{
DeploymentName = modelName;
DeploymentName = name;
ModelName = modelName;
ModelVersion = modelVersion;
Format = format;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public void AddDeployment_ShouldAddDeploymentToResource()
var resource = Assert.Single(builder.Resources.OfType<AzureAIFoundryResource>());
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);
Expand Down Expand Up @@ -112,17 +113,17 @@ 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");
var deployment = foundry.AddDeployment("deployment1", "gpt-4", "1.0", "OpenAI");
foundry.RunAsFoundryLocal();
var resource = Assert.Single(builder.Resources.OfType<AzureAIFoundryResource>());
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);
}
Expand All @@ -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<DistributedApplicationModel>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
Expand All @@ -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
output name string = foundry.name
Loading