Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 23, 2025

Remove Azure.AI.OpenAI dependency and update packages in Microsoft Extensions AI Evaluation samples

Following the pattern from dotnet/extensions PR #6873, this change removes the Azure.AI.OpenAI package dependency and uses the standard OpenAI client with Azure-compatible endpoints. Additionally, all NuGet packages have been updated to their latest stable or prerelease versions.

Completed Changes:

  • Update Evaluation.csproj to replace Azure.AI.OpenAI with Azure.Core and OpenAI packages
  • Update Reporting.csproj to replace Azure.AI.OpenAI with Azure.Core and OpenAI packages
  • Update TestSetup.cs to use OpenAIClient with Azure endpoints instead of AzureOpenAIClient
  • Add pragma warnings for OPENAI001 in code files
  • Update all NuGet packages to latest stable or prerelease versions
  • Update dotnet-tools.json to version 9.10.0
  • Build and test the changes to ensure everything works correctly
  • Code review completed
  • Address code review feedback: simplify comment and extract endpoint variable
  • Extract BearerTokenPolicy into policy variable for better readability
  • Collapse multi-line client initialization and remove project-level NoWarn
  • Update pragma warning format to separate directive from comment
  • Revert to multi-line client initialization for better readability
  • Add named arguments to BearerTokenPolicy constructor
  • Add documentation link for /openai/v1 suffix
  • Update packages to exact versions verified by maintainer
  • Update Microsoft.Extensions.AI to version 9.10.1
  • Revert Microsoft.NET.Test.Sdk to version 17.14.1
  • Remove extra whitespace from TestSetup.cs
  • Update comment formatting to use XML doc comments

Key Changes:

Project Files (Evaluation.csproj & Reporting.csproj)

  • Removed Azure.AI.OpenAI package reference (version 2.1.0)
  • Added Azure.Core package reference (version 1.49.0)
  • Updated packages to exact versions:
    • Azure.Identity: 1.17.0
    • AwesomeAssertions: 9.2.1
    • Microsoft.Data.Sqlite: 9.0.10
    • Microsoft.Extensions.AI: 9.10.1
    • Microsoft.Extensions.AI.Abstractions: 9.10.1
    • Microsoft.Extensions.AI.AzureAIInference: 9.10.0-preview.1.25513.3
    • Microsoft.Extensions.AI.Evaluation: 9.10.0
    • Microsoft.Extensions.AI.Evaluation.NLP: 9.10.0-preview.1.25513.3
    • Microsoft.Extensions.AI.Evaluation.Quality: 9.10.0
    • Microsoft.Extensions.AI.Evaluation.Reporting: 9.10.0
    • Microsoft.Extensions.AI.Evaluation.Reporting.Azure: 9.10.0
    • Microsoft.Extensions.AI.Evaluation.Safety: 9.10.0-preview.1.25513.3
    • Microsoft.Extensions.AI.OpenAI: 9.10.1-preview.1.25521.4
    • Microsoft.NET.Test.Sdk: 17.14.1
    • MSTest.TestAdapter: 3.11.0
    • MSTest.TestFramework: 3.11.0
    • OllamaSharp: 5.4.8
    • OpenAI: 2.5.0
  • Use #pragma directives in code instead of project-level NoWarn

dotnet-tools.json

  • Updated microsoft.extensions.ai.evaluation.console from 9.9.0 to 9.10.0

TestSetup.cs

  • Updated using statements to include System.ClientModel and System.ClientModel.Primitives
  • Removed using Azure.AI.OpenAI
  • Updated GetAzureOpenAIChatConfiguration() to:
    • Use OpenAIClient instead of AzureOpenAIClient
    • Extract endpoint variable for better readability
    • Extract BearerTokenPolicy into policy variable with named arguments (tokenProvider, scope)
    • Split BearerTokenPolicy initialization across two lines to avoid exceeding 120 characters
    • Append /openai/v1 suffix to Azure OpenAI endpoints with documentation link
    • Use BearerTokenPolicy with DefaultAzureCredential for managed identity authentication
    • Use OpenAIClientOptions to configure the Azure endpoint
    • Chain client initialization calls in multi-line format for clarity
  • Updated GetOpenAIChatConfiguration() to use ApiKeyCredential wrapper
  • Added pragma warnings around experimental OpenAI API usage (using XML doc comments)
  • Removed extra whitespace and trailing spaces
  • Updated all comments to use XML doc comment style (///)

Verification:

✅ Solution builds successfully with zero errors and zero warnings
✅ All package dependencies are correctly resolved
✅ Code review feedback addressed
✅ All packages updated to exact versions specified by maintainer
✅ Changes follow the established pattern from dotnet/extensions PR #6873

Original prompt

Look at the changes made in the dotnet/extensions repo in this PR: dotnet/extensions#6873

Specifically look at the changes in the following two files -

  • test/Libraries/Microsoft.Extensions.AI.Evaluation.Integration.Tests/Microsoft.Extensions.AI.Evaluation.Integration.Tests.csproj
  • test/Libraries/Microsoft.Extensions.AI.Evaluation.Integration.Tests/Setup.cs

I would like to make the same changes for the samples in the current repo (dotnet/ai-samples) present under https://github.com/dotnet/ai-samples/tree/main/src/microsoft-extensions-ai-evaluation/api. In other words, I'd like to remove dependency on Azure.AI.OpenAI package for both the Evaluation.csproj as well as Reporting.csproj projects under the above folder and fix up the code to work using references to only the Azure.Core and OpenAI packages.

In all likelihood, the required changes for the above would be confined to (a subset of) the following files: Evaluation.csproj, Reporting.csproj and TestSetup.cs.

Use tools if needed to read the PR link I posted above for the PR in the dotnet\extensions repo.

There is no need to add any additional documentation (like markdown files) as part of yourr change.

Follow existing coding styles and maintain general structure of the existing code. Make the minimal set of changes required to satisfy the above requirements.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Remove dependency on Azure.AI.OpenAI package in samples Remove Azure.AI.OpenAI dependency from Microsoft Extensions AI Evaluation samples Oct 23, 2025
Copilot finished work on behalf of shyamnamboodiripad October 23, 2025 00:30
Copilot finished work on behalf of shyamnamboodiripad October 23, 2025 00:41
…Warn from csproj files

Co-authored-by: shyamnamboodiripad <[email protected]>
Copilot finished work on behalf of shyamnamboodiripad October 23, 2025 00:53
Copilot finished work on behalf of shyamnamboodiripad October 23, 2025 00:59
Copilot finished work on behalf of shyamnamboodiripad October 23, 2025 02:21
Copilot finished work on behalf of shyamnamboodiripad October 23, 2025 02:30
Copilot finished work on behalf of shyamnamboodiripad October 23, 2025 02:38
Copy link
Contributor

@shyamnamboodiripad shyamnamboodiripad left a comment

Choose a reason for hiding this comment

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

I ran all tests in the solution and confirmed that the changes work 👍🏾 :shipit:

@shyamnamboodiripad shyamnamboodiripad marked this pull request as ready for review October 23, 2025 03:00
@shyamnamboodiripad shyamnamboodiripad enabled auto-merge (squash) October 23, 2025 03:43
@shyamnamboodiripad shyamnamboodiripad merged commit ce95539 into main Oct 23, 2025
1 check passed
@shyamnamboodiripad shyamnamboodiripad deleted the copilot/remove-azure-ai-openai-dependency branch October 23, 2025 18:25
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.

3 participants