From bba3758af4d58414f0e24c9b2b3b738703285d70 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 17 Oct 2025 14:25:22 +0000 Subject: [PATCH 1/4] Initial plan From fced516795446d1cc5b1f5c5d9bce63c2b65b24e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 17 Oct 2025 14:40:12 +0000 Subject: [PATCH 2/4] Update documentation to use AIFoundryModel and GitHubModel constants Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> --- docs/azureai/azureai-foundry-integration.md | 18 ++++++---- docs/github/github-models-integration.md | 38 +++++++++++++-------- docs/snippets/azure/AppHost/AppHost.cs | 2 +- 3 files changed, 36 insertions(+), 22 deletions(-) diff --git a/docs/azureai/azureai-foundry-integration.md b/docs/azureai/azureai-foundry-integration.md index 615273f124..e9fa843a89 100644 --- a/docs/azureai/azureai-foundry-integration.md +++ b/docs/azureai/azureai-foundry-integration.md @@ -62,7 +62,8 @@ var builder = DistributedApplication.CreateBuilder(args); var foundry = builder.AddAzureAIFoundry("foundry"); -var chat = foundry.AddDeployment("chat", "Phi-4", "1", "Microsoft"); +var model = AIFoundryModel.Microsoft.Phi4; +var chat = foundry.AddDeployment("chat", model); builder.AddProject() .WithReference(chat) @@ -74,17 +75,18 @@ builder.AddProject() The preceding code: - Adds an Azure AI Foundry resource named `foundry`. -- Adds an Azure AI Foundry deployment resource named `chat` with a model name of `Phi-4`. The model name must correspond to an [available model](/azure/ai-foundry/foundry-models/concepts/models) in the Azure AI Foundry service. +- Adds an Azure AI Foundry deployment resource named `chat` using the constant for Phi-4. The model must correspond to an [available model](/azure/ai-foundry/foundry-models/concepts/models) in the Azure AI Foundry service. -> [!NOTE] -> The `format` parameter of the `AddDeployment(...)` method can be found in the Azure AI Foundry portal in the details page of the model, right after the `Quick facts` text. +> [!TIP] +> Use the strongly-typed constants to avoid typos and ensure you're using valid model identifiers. These constants are grouped by publisher (for example, `AIFoundryModel.Microsoft.Phi4`, `AIFoundryModel.OpenAI.Gpt4o`). ### Configure deployment properties You can customize deployment properties using the method: ```csharp -var chat = foundry.AddDeployment("chat", "Phi-4", "1", "Microsoft") +var model = AIFoundryModel.Microsoft.Phi4; +var chat = foundry.AddDeployment("chat", model) .WithProperties(deployment => { deployment.SkuName = "Standard"; @@ -130,7 +132,8 @@ var builder = DistributedApplication.CreateBuilder(args); var foundry = builder.AddAzureAIFoundry("foundry") .RunAsFoundryLocal(); -var chat = foundry.AddDeployment("chat", "phi-3.5-mini", "1", "Microsoft"); +var model = AIFoundryModel.Local.Phi35Mini; +var chat = foundry.AddDeployment("chat", model); builder.AddProject() .WithReference(chat) @@ -143,6 +146,9 @@ When the AppHost starts up, the local foundry service is also started. This requ The method configures the resource to run as an emulator. It downloads and loads the specified models locally. The method provides health checks for the local service and automatically manages the Foundry Local lifecycle. +> [!TIP] +> Use the strongly-typed constants for local development models. These constants are specifically optimized for Foundry Local (for example, `AIFoundryModel.Local.Phi4Mini`, `AIFoundryModel.Local.DeepseekR17b`). + ### Assign roles to resources You can assign specific roles to resources that need to access the Azure AI Foundry service. Use the method: diff --git a/docs/github/github-models-integration.md b/docs/github/github-models-integration.md index 9e63f86656..77fdcf40b7 100644 --- a/docs/github/github-models-integration.md +++ b/docs/github/github-models-integration.md @@ -39,7 +39,8 @@ To add a `GitHubModelResource` to your AppHost project, call the `AddGitHubModel ```csharp var builder = DistributedApplication.CreateBuilder(args); -var chat = builder.AddGitHubModel("chat", "openai/gpt-4o-mini"); +var model = GitHubModel.OpenAI.OpenAIGpt4oMini; +var chat = builder.AddGitHubModel("chat", model); builder.AddProject() .WithReference(chat); @@ -47,7 +48,10 @@ builder.AddProject() // After adding all resources, run the app... ``` -The preceding code adds a GitHub Model resource named `chat` using the `openai/gpt-4o-mini` model. The method passes the connection information to the `ExampleProject` project. +The preceding code adds a GitHub Model resource named `chat` using the constant for OpenAI's GPT-4o-mini model. The method passes the connection information to the `ExampleProject` project. + +> [!TIP] +> Use the strongly-typed constants to avoid typos and ensure you're using valid model identifiers. These constants are grouped by publisher (for example, `GitHubModel.OpenAI.OpenAIGpt4oMini`, `GitHubModel.Microsoft.Phi4MiniInstruct`, `GitHubModel.DeepSeek.DeepSeekV30324`). ### Specify an organization @@ -57,7 +61,8 @@ For organization-specific requests, you can specify an organization parameter: var builder = DistributedApplication.CreateBuilder(args); var organization = builder.AddParameter("github-org"); -var chat = builder.AddGitHubModel("chat", "openai/gpt-4o-mini", organization); +var model = GitHubModel.OpenAI.OpenAIGpt4oMini; +var chat = builder.AddGitHubModel("chat", model, organization); builder.AddProject() .WithReference(chat); @@ -76,7 +81,8 @@ The GitHub Models integration supports multiple ways to configure authentication By default, the integration creates a parameter named `{resource_name}-gh-apikey` that automatically falls back to the `GITHUB_TOKEN` environment variable: ```csharp -var chat = builder.AddGitHubModel("chat", "openai/gpt-4o-mini"); +var model = GitHubModel.OpenAI.OpenAIGpt4oMini; +var chat = builder.AddGitHubModel("chat", model); ``` Then in user secrets: @@ -95,7 +101,8 @@ You can also specify a custom parameter for the API key: ```csharp var apiKey = builder.AddParameter("my-api-key", secret: true); -var chat = builder.AddGitHubModel("chat", "openai/gpt-4o-mini") +var model = GitHubModel.OpenAI.OpenAIGpt4oMini; +var chat = builder.AddGitHubModel("chat", model) .WithApiKey(apiKey); ``` @@ -114,7 +121,8 @@ Then in user secrets: You can add health checks to verify the GitHub Models endpoint accessibility and API key validity: ```csharp -var chat = builder.AddGitHubModel("chat", "openai/gpt-4o-mini") +var model = GitHubModel.OpenAI.OpenAIGpt4oMini; +var chat = builder.AddGitHubModel("chat", model) .WithHealthCheck(); ``` @@ -123,14 +131,14 @@ var chat = builder.AddGitHubModel("chat", "openai/gpt-4o-mini") ### Available models -GitHub Models supports various AI models. Some popular options include: +GitHub Models supports various AI models. Use the strongly-typed constants for the most up-to-date list of available models. Some popular options include: -- `openai/gpt-4o-mini` -- `openai/gpt-4o` -- `deepseek/DeepSeek-V3-0324` -- `microsoft/Phi-4-mini-instruct` +- `GitHubModel.OpenAI.OpenAIGpt4oMini` +- `GitHubModel.OpenAI.OpenAIGpt41Mini` +- `GitHubModel.DeepSeek.DeepSeekV30324` +- `GitHubModel.Microsoft.Phi4MiniInstruct` -Check the [GitHub Models documentation](https://docs.github.com/github-models) for the most up-to-date list of available models. +Check the [GitHub Models documentation](https://docs.github.com/github-models) for more information about these models and their capabilities. ## Client integration @@ -171,7 +179,6 @@ public class ExampleService(ChatCompletionsClient client) public async Task GetResponseAsync(string prompt) { var response = await client.GetChatCompletionsAsync( - "openai/gpt-4o-mini", new[] { new ChatMessage(ChatRole.User, prompt) @@ -237,7 +244,7 @@ public class ChatService(OpenAIClient client) { public async Task GetChatResponseAsync(string prompt) { - var chatClient = client.GetChatClient("openai/gpt-4o-mini"); + var chatClient = client.GetChatClient(GitHubModel.OpenAI.OpenAIGpt4oMini); var response = await chatClient.CompleteChatAsync( new[] @@ -271,7 +278,8 @@ When running an app in GitHub Codespaces or GitHub Actions, the `GITHUB_TOKEN` e ```csharp // No additional configuration needed in Codespaces/GitHub Actions -var chat = builder.AddGitHubModel("chat", "openai/gpt-4o-mini"); +var model = GitHubModel.OpenAI.OpenAIGpt4oMini; +var chat = builder.AddGitHubModel("chat", model); ``` ##### Personal access tokens for local development diff --git a/docs/snippets/azure/AppHost/AppHost.cs b/docs/snippets/azure/AppHost/AppHost.cs index 10f1624e1a..e492135deb 100644 --- a/docs/snippets/azure/AppHost/AppHost.cs +++ b/docs/snippets/azure/AppHost/AppHost.cs @@ -6,7 +6,7 @@ var foundryDeployment = foundry.AddDeployment( name: "chat", modelName: "Phi-4", - modelVersion: "1", + modelVersion: "7", format: "Microsoft"); builder.AddAzureAppConfiguration("config"); From fee8da9e6a6614d110721b9df20d0b8b1d1c71c6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 17 Oct 2025 14:45:21 +0000 Subject: [PATCH 3/4] Update compatibility matrix to use GitHubModel constant Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com> --- docs/azureai/ai-integrations-compatibility-matrix.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/azureai/ai-integrations-compatibility-matrix.md b/docs/azureai/ai-integrations-compatibility-matrix.md index a60465e90c..ba3f8077e2 100644 --- a/docs/azureai/ai-integrations-compatibility-matrix.md +++ b/docs/azureai/ai-integrations-compatibility-matrix.md @@ -117,7 +117,8 @@ The [Aspire.Hosting.GitHub.Models](https://www.nuget.org/packages/Aspire.Hosting ```csharp var builder = DistributedApplication.CreateBuilder(args); -var chat = builder.AddGitHubModel("chat", "openai/gpt-4o-mini"); +var model = GitHubModel.OpenAI.OpenAIGpt4oMini; +var chat = builder.AddGitHubModel("chat", model); builder.AddProject() .WithReference(chat); From 429c05e8c637922ce50cecffae5fbb696a92d1f6 Mon Sep 17 00:00:00 2001 From: David Pine Date: Tue, 21 Oct 2025 14:58:50 -0500 Subject: [PATCH 4/4] Apply suggestions from code review --- docs/azureai/azureai-foundry-integration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/azureai/azureai-foundry-integration.md b/docs/azureai/azureai-foundry-integration.md index e9fa843a89..3cb1e154a6 100644 --- a/docs/azureai/azureai-foundry-integration.md +++ b/docs/azureai/azureai-foundry-integration.md @@ -147,7 +147,7 @@ When the AppHost starts up, the local foundry service is also started. This requ The method configures the resource to run as an emulator. It downloads and loads the specified models locally. The method provides health checks for the local service and automatically manages the Foundry Local lifecycle. > [!TIP] -> Use the strongly-typed constants for local development models. These constants are specifically optimized for Foundry Local (for example, `AIFoundryModel.Local.Phi4Mini`, `AIFoundryModel.Local.DeepseekR17b`). +> Use the strongly-typed `AIFoundryModel.Local` constants for local development models. These constants are specifically optimized for Foundry Local (for example, `AIFoundryModel.Local.Phi4Mini`, `AIFoundryModel.Local.DeepseekR17b`). ### Assign roles to resources