Skip to content

Update models to gpt-5#52139

Open
gewarren wants to merge 4 commits intodotnet:mainfrom
gewarren:gpt-nae
Open

Update models to gpt-5#52139
gewarren wants to merge 4 commits intodotnet:mainfrom
gewarren:gpt-nae

Conversation

@gewarren gewarren requested a review from a team as a code owner March 11, 2026 00:07
Copilot AI review requested due to automatic review settings March 11, 2026 00:07
@dotnetrepoman dotnetrepoman bot added this to the March 2026 milestone Mar 11, 2026
@gewarren gewarren enabled auto-merge (squash) March 11, 2026 00:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the AI documentation and code snippets to use newer model names (primarily gpt-5) and removes the need to store model names in user-secrets.

Changes:

  • Updated multiple docs and snippets from gpt-4o to gpt-5.
  • Removed AZURE_OPENAI_GPT_NAME user-secrets instructions and switched several Azure OpenAI samples to hard-coded deployment names.
  • Updated tokenizer examples and a few OpenAI (non-Azure) defaults to gpt-5.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
docs/ai/quickstarts/text-to-image.md Removes the model-name user-secret instruction for the text-to-image quickstart.
docs/ai/quickstarts/structured-output.md Updates the structured-output quickstart to reference gpt-5 and removes the model-name user-secret instruction.
docs/ai/quickstarts/snippets/text-to-image/azure-openai/Program.cs Hard-codes the image deployment name as gpt-image-1.
docs/ai/quickstarts/snippets/structured-output/Program.cs Hard-codes the chat deployment name as gpt-5.
docs/ai/quickstarts/snippets/function-calling/openai/Program.cs Updates the default OpenAI model fallback to gpt-5.
docs/ai/how-to/snippets/use-tokenizers/csharp/TokenizersExamples/TiktokenExample.cs Updates tokenizer model selection to gpt-5.
docs/ai/how-to/snippets/handle-invalid-tool-input/csharp/StrictSchema.cs Updates OpenAI model fallback and generalizes the compatibility comment.
docs/ai/how-to/snippets/handle-invalid-tool-input/csharp/IncludeDetailedErrors.cs Updates OpenAI model fallback to gpt-5.
docs/ai/how-to/snippets/handle-invalid-tool-input/csharp/FunctionInvoker.cs Updates OpenAI model fallback to gpt-5.
docs/ai/how-to/snippets/access-data/ArgumentsExample.cs Hard-codes the Azure OpenAI deployment name as gpt-5.
docs/ai/evaluation/snippets/evaluate-with-reporting/MyTests.cs Hard-codes the Azure OpenAI deployment name as gpt-5.
docs/ai/evaluation/snippets/evaluate-safety/MyTests.cs Hard-codes the Azure OpenAI deployment name as gpt-5.
docs/ai/evaluation/snippets/evaluate-ai-responses/MyTests.cs Hard-codes the Azure OpenAI deployment name as gpt-5.
docs/ai/evaluation/evaluate-with-reporting.md Updates tutorial text to reference gpt-5 and removes the model-name user-secret instruction.
docs/ai/evaluation/evaluate-safety.md Updates tutorial text to reference gpt-5 and removes the model-name user-secret instruction.
docs/ai/evaluation/evaluate-ai-response.md Updates quickstart text to reference gpt-5 and removes the model-name user-secret instruction.
docs/ai/conceptual/data-ingestion.md Updates tokenizer model selection example to gpt-5.
Comments suppressed due to low confidence (2)

docs/ai/quickstarts/snippets/text-to-image/azure-openai/Program.cs:17

  • model is hard-coded to "gpt-image-1" but is used as the Azure OpenAI deployment name (via GetImageClient). This will break if the deployment name differs. Consider making the deployment name configurable and/or renaming the variable to deploymentName to avoid implying it’s a model ID.
string model = "gpt-image-1";

// Create the Azure OpenAI client and convert to IImageGenerator.
AzureOpenAIClient azureClient = new(
    new Uri(endpoint),

docs/ai/how-to/snippets/access-data/ArgumentsExample.cs:45

  • model is hard-coded to "gpt-5" but is passed to AzureOpenAIClient.GetChatClient(...), which expects an Azure OpenAI deployment name. This will fail if the deployment name differs. Consider making the deployment name configurable (even if it isn’t secret) and/or renaming the variable to deploymentName.
        string model = "gpt-5";

        // <SnippetUseAdditionalProperties>
        FunctionInvokingChatClient client = new FunctionInvokingChatClient(
            new AzureOpenAIClient(new Uri(endpoint), new AzureKeyCredential(apiKey))

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +20 to +24
To provision an Azure OpenAI service and model using the Azure portal, complete the steps in the [Create and deploy an Azure OpenAI Service resource](/azure/ai-services/openai/how-to/create-resource?pivots=web-portal) article. In the "Deploy a model" step, select the `gpt-5` model.

## Create the chat app

Complete the following steps to create a console app that connects to the `gpt-4o` AI model.
Complete the following steps to create a console app that connects to the `gpt-5` AI model.
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section tells readers to deploy/select the gpt-5 model, but the code snippet calls GetChatClient(deploymentName: ...) with a hard-coded value. Azure OpenAI uses a deployment name that can differ from the model name, so either instruct readers to set the deployment name to gpt-5 or keep the deployment name configurable in the sample.

Copilot uses AI. Check for mistakes.
Comment on lines 11 to 14
string endpoint = config["AZURE_OPENAI_ENDPOINT"];
string model = config["AZURE_OPENAI_GPT_NAME"];
string tenantId = config["AZURE_TENANT_ID"];
string model = "gpt-5";

Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

model is hard-coded to "gpt-5" but is passed as deploymentName. This will fail if the user’s Azure OpenAI deployment name isn’t exactly "gpt-5". Consider reading the deployment name from configuration (even if it isn’t secret) and/or renaming the variable to deploymentName to match how it’s used.

Copilot uses AI. Check for mistakes.
Comment on lines +19 to +23
To provision an Azure OpenAI service and model using the Azure portal, complete the steps in the [Create and deploy an Azure OpenAI Service resource](/azure/ai-services/openai/how-to/create-resource?pivots=web-portal) article. In the "Deploy a model" step, select the `gpt-5` model.

## Create the test app

Complete the following steps to create an MSTest project that connects to the `gpt-4o` AI model.
Complete the following steps to create an MSTest project that connects to the `gpt-5` AI model.
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section says to select the gpt-5 model, but the accompanying snippet hard-codes the Azure OpenAI deployment name to "gpt-5". Azure deployments can be named differently, so either document that the deployment name must be "gpt-5" or keep it configurable in the sample/tests.

Copilot uses AI. Check for mistakes.
Comment on lines 45 to 49
1. Run the following commands to add [app secrets](/aspnet/core/security/app-secrets) for your Azure OpenAI endpoint, model name, and tenant ID:

```bash
dotnet user-secrets init
dotnet user-secrets set AZURE_OPENAI_ENDPOINT <your-Azure-OpenAI-endpoint>
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The instructions say to add app secrets for the endpoint, model name, and tenant ID, but the commands no longer set any model/deployment name. Add a deployment-name setting (even if it isn’t secret) or update the wording so readers aren’t missing required configuration.

Copilot uses AI. Check for mistakes.
Comment on lines 54 to 58
1. Run the following commands to add [app secrets](/aspnet/core/security/app-secrets) for your Azure OpenAI endpoint, model name, and tenant ID:

```bash
dotnet user-secrets init
dotnet user-secrets set AZURE_OPENAI_ENDPOINT <your-Azure-OpenAI-endpoint>
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The instructions say to add app secrets for the endpoint, model name, and tenant ID, but the commands no longer set any model/deployment name. Add a deployment-name setting (even if it isn’t secret) or update the wording to match the code.

Copilot uses AI. Check for mistakes.
Comment on lines 27 to 31
string endpoint = config["AZURE_OPENAI_ENDPOINT"];
string model = config["AZURE_OPENAI_GPT_NAME"];
string tenantId = config["AZURE_TENANT_ID"];
string model = "gpt-5";

// Get an instance of Microsoft.Extensions.AI's <see cref="IChatClient"/>
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

model is hard-coded to "gpt-5" but is passed as the Azure OpenAI deploymentName later in the method. This makes the sample fail unless the deployment is named exactly "gpt-5". Consider reading the deployment name from configuration and/or renaming the variable to deploymentName to reflect how it’s used.

Copilot uses AI. Check for mistakes.
Comment on lines 52 to 56
1. Run the following commands to add [app secrets](/aspnet/core/security/app-secrets) for your Azure OpenAI endpoint, model name, and API key:

```bash
dotnet user-secrets init
dotnet user-secrets set AZURE_OPENAI_ENDPOINT <your-Azure-OpenAI-endpoint>
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The instructions say to add app secrets for the endpoint, model name, and API key, but the commands no longer set any model/deployment name. Update the text and/or add a config value for the image deployment name so the setup steps match the Program.cs snippet.

Copilot uses AI. Check for mistakes.
Comment on lines +22 to +26
To provision an Azure OpenAI service and model using the Azure portal, complete the steps in the [Create and deploy an Azure OpenAI Service resource](/azure/ai-services/openai/how-to/create-resource?pivots=web-portal) article. In the "Deploy a model" step, select the `gpt-5` model.

## Create the test app

Complete the following steps to create an MSTest project that connects to the `gpt-4o` AI model.
Complete the following steps to create an MSTest project that connects to the `gpt-5` AI model.
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section tells readers to select the gpt-5 model, but the snippets use a fixed Azure OpenAI deployment name. Azure deployments can be named differently, so either specify that the deployment name must be "gpt-5" or keep the deployment name configurable in the sample.

Copilot uses AI. Check for mistakes.
Comment on lines 76 to 80
string endpoint = config["AZURE_OPENAI_ENDPOINT"];
string model = config["AZURE_OPENAI_GPT_NAME"];
string tenantId = config["AZURE_TENANT_ID"];
string model = "gpt-5";

// Get an instance of Microsoft.Extensions.AI's <see cref="IChatClient"/>
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

model is hard-coded to "gpt-5" but is used as the Azure OpenAI deploymentName later in the method. This will break if the deployment name differs. Make the deployment name configurable and/or rename the variable to deploymentName so it’s clear what value is required.

Copilot uses AI. Check for mistakes.
Comment on lines 43 to 47
1. Run the following commands to add [app secrets](/aspnet/core/security/app-secrets) for your Azure OpenAI endpoint, model name, and tenant ID:

```bash
dotnet user-secrets init
dotnet user-secrets set AZURE_OPENAI_ENDPOINT <your-Azure-OpenAI-endpoint>
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The instructions say to add app secrets for the endpoint, model name, and tenant ID, but the commands no longer set any model/deployment name. Either add a configuration value for the deployment name (even if it isn’t secret) or update the text to remove the model-name requirement so the setup steps match the snippet.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants