Skip to content

Conversation

joperezr
Copy link
Member

@joperezr joperezr commented May 13, 2025

joperezr and others added 29 commits May 9, 2025 18:21
Changes in preparation of 9.5 stable release

----
#### AI description  (iteration 1)
#### PR Classification
This PR prepares the upcoming 9.5 stable release by updating dependency versions and adjusting build and pipeline configurations.

#### PR Summary
The changes update version numbers and release settings while refining the CI pipeline and NuGet feed setup for a stable release build.
- **`eng/Version.Details.xml` & `eng/Versions.props`**: Updated dependency versions from 9.0.4 to 9.0.5 (and LTS versions from 8.0.15 to 8.0.16) and enabled release-specific properties.
- **`NuGet.config`**: Revised package source mappings by adding and disabling internal feed sources.
- **`azure-pipelines.yml`**: Removed the code coverage stage and updated stage dependencies.
- **`eng/pipelines/templates/BuildAndTest.yml`**: Added tasks for setting up private NuGet feed credentials on both Windows (PowerShell) and non-Windows (Bash) agents.
- **`Directory.Build.props`**: Disabled the NU1507 warning to accommodate the internal feed configuration changes.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
Refusals in OpenAI are errors reported when the service can't generate an output that matches the requested schema. Translate refusals to ErrorContent now that we have it.
* Rename useJsonSchema parameter

The `GetResponseAsync<T>` methods accept a `bool?` parameter currently called `useJsonSchema`. This is confusing, because the whole point of the method is to create and use a JSON schema from the `T`. The parameter actually controls _how_ that schema is used, whether it's included as part of the messages (false), as part of a ChatResponseFormat in the ChatOptions (true), or up to the system to decide.

I've clarified it by renaming it from `useJsonSchema` to `useJsonSchemaResponseFormat`. It's wordier, but it disambiguates the intent.

* Update src/Libraries/Microsoft.Extensions.AI/ChatCompletion/ChatClientStructuredOutputExtensions.cs

Co-authored-by: Eirik Tsarpalis <[email protected]>

---------

Co-authored-by: Eirik Tsarpalis <[email protected]>
…tnet#6383)

* Add initial schema transformation functionality and incorporate into the OpenAI leaf client.

* Update all leaf client implementions, improve naming, add testing.

* Remove redundant suppressions

* Address feedback.
* Look for OpenAI.ChatCompletionOptions in top-level additional properties and stop looking for individually specific additional properties

* Add RawRepresentation to ChatOptions and use it in OpenAI and AzureAIInference

* Remove now unused locals

* Add [JsonIgnore] and update roundtrip tests

* Overwirte properties only if the underlying model don't specify it already

* Clone RawRepresentation

* Reflection workaround for ToolChoice not being cloned

* Style changes

* AI.Inference: Bring back propagation of additional properties

* Don't use 0.1f, it doesn't roundtrip properly in .NET Framework

* Add RawRepresentationFactory instead of object? property

* Augment remarks to discourage returning shared instances

* Documentation feedback

* AI.Inference: keep passing TopK as AdditionalProperty if not already there
Also fixed the name of the LoggingSpeechToTextClientBuilderExtensions type to conform to patterns used elsewhere in the library.
In dotnet#6148, we disabled net9.0 TFM for the aieval tool to work around the race described in dotnet/sdk#47696. The underlying issue was subsequently fixed in the SDK (via dotnet/sdk#47788). However, this fix has not been backported to the dotnet 9 SDK yet.

The SDK team is working on backporting the fix (see discussion in dotnet/sdk#47788 (comment)). But in the meanwhile, we can add back the net9.0 TFM and continue to work around the race by disabling parallel build.

This would help users of the aieval tool sidestep errors such as the ones described in dotnet#6388 when they dont have dotnet8 installed on the machine.

We can remove this workaround, once the backported fix is available in the dotnet 9 SDK.

Fixes dotnet#6388
* Add BinaryEmbedding

Also:
- Renames the polymorphic discriminators to conform with typical lingo for these types.
- Adds an Embedding.Dimensions virtual property.
…erties on report (dotnet#6377)

* Add documentation around proper usage of IDistributedCache

* Add Content-Security-Policy to prevent page from calling into other sites.

* Remove remark about IDistributedCache usage

* Fix package-lock.json

* Remove <remarks> start tag.
…AI.Evaluation.Reporting/TypeScript (dotnet#6354)

* Bump vite

Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 6.2.6 to 6.3.4.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v6.3.4/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-version: 6.3.4
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <[email protected]>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Shyam Namboodiripad <[email protected]>
* Rename IResultStore and IResponseCacheProvider

IResultStore -> IEvaluationResultStore and
IResponseCacheProvider -> IEvaluationResponseCacheProvider

* Include missing EvaluationContextConverter in AzureStorageJsonUtilities

Also use linked files to avoid the need to duplicate code.

* Reorder enum members

The new order goes from least desirable rating to most desirable.

* Refactor extension method overloads

Implement overloads that take ChatMessage by calling corresponding overloads that take ChatResponse.

* Refactor AddTurnDetails to support adding details for multiple turns

Adding single turns continues to be supported via a params array overload.

* Add missing parameter for timeToLiveForCacheEntries to DiskBasedReportingConfiguration

This was missed in an earlier PR that introduced the timeToLiveForCacheEntries on the constructor of DiskBasedResponseCacheProvider.

Also reorder constructor parameters for AzureStorageReportingConfiguration so that the parameters for caching apear next to each other and so that the parameter ordering is aligned with DiskBasedReportingConfiguration.

* Minor formatting changes
…ons.AI.Abstractions from main

This updates the release/9.5 branch with the latest from main for the MEAI/MEAI.Abstractions libraries along with compensating changes on the adapter libraries.

----
#### AI description  (iteration 1)
#### PR Classification
This pull request implements a comprehensive API update and extensive internal refactoring for chat client, schema transformation, and embedding functionalities.

#### PR Summary
The changes standardize and improve internal handling of chat options, JSON schema transformation, and embedding representations while updating related tests and logging, resulting in clearer APIs and more robust behavior.
- **`src/Libraries/Microsoft.Extensions.AI.OpenAI/` & `src/Libraries/Microsoft.Extensions.AI.AzureAIInference/`**: Clients now use a shared `AIJsonSchemaTransformCache` for transforming and validating JSON schemas, and additional properties (e.g., refusals) are handled more cleanly.
- **`src/Libraries/Microsoft.Extensions.AI.Abstractions/Utilities/`**: New utilities and types (e.g., `AIJsonSchemaTransformOptions`, `AIJsonSchemaTransformContext`, and `AIJsonSchemaTransformCache`) have been introduced to support schema conversion and enforcement.
- **`src/Libraries/Microsoft.Extensions.AI.Abstractions/Embeddings/`**: Embedding types are updated with standardized discriminator names (e.g., `"float16"`, `"float32"`, `"float64"`) and a new `BinaryEmbedding` class is added for bit-based embeddings.
- **`ChatOptions` & Structured Output Extensions**: The API now supports a `RawRepresentationFactory` and renames the JSON schema parameter to `useJsonSchemaResponseFormat` for clarity and consistency.
- **Test and Logging Updates**: Multiple test files and logging extension builders have been updated to reflect the new behaviors and internal changes.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
…release

#### AI description  (iteration 1)
#### PR Classification
This PR cherry picks commits for the 9.5 preview release and introduces API improvements, interface renaming, and caching logic updates.

#### PR Summary
The PR streamlines caching in AI Evaluation by removing legacy CacheOptions and updating related interfaces while also enhancing JSON converters and chat extension methods. Key changes include:
- **`src/Libraries/Microsoft.Extensions.AI.Evaluation.Reporting/CSharp/Storage/DiskBasedResponseCache.cs`**: Removed CacheOptions logic, added a configurable TTL parameter, and refactored cache methods.
- **Interface Renaming**: Renamed `IResponseCacheProvider` to `IEvaluationResponseCacheProvider` and `IResultStore` to `IEvaluationResultStore` across core code and associated tests.
- **`src/Libraries/Microsoft.Extensions.AI.Evaluation.Reporting/CSharp/ChatDetailsExtensions.cs`**: Modified the `AddTurnDetails` extension to accept multiple chat turns.
- **JSON Serialization**: Updated converters in `AzureStorageJsonUtilities.cs` and `JsonUtilities.cs` to use newer types (e.g., `CamelCaseEnumConverter`, `TimeSpanConverter`, and added `EvaluationContextConverter`).
- **`src/Libraries/Microsoft.Extensions.AI.Evaluation/EvaluationRating.cs`**: Reordered and renamed enum values to better reflect the intended rating semantics.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
* Remove AIFunctionFactory dependency on M.E.DI

This means reverting the recent changes to it that:
- Special-cased KeyedServices
- Special-cased IServiceProviderIsService
- Used ActivatorUtilities.CreateInstance

* Move AIFunctionFactory down to M.E.AI.Abstractions

* Add CreateInstance delegate to AIFunctionFactoryOptions

To enable use of ActivatorUtilities.CreateInstance or alternative.

* Add some comments
* Fix handling of tool calls with some endpoints

Most assistant messages containing tool calls don't contain text as well (though some can). In such a case, we were still creating the assistant with empty text. While OpenAI's service permits that, some other endpoints are more finicky about it. This avoids doing so.

* Reduce to single iteration through assistant content
…t#6419)

We use JsonSerializer.SerializeAsync but were missing the async overrides. As with MemoryStream, these don't need to queue.
* Update CHANGELOGs for M.E.AI
…eOptions and mark redundant properties in the latter as obsolete. (dotnet#6427)

* Add an AIJsonSchemaTransformOptions property inside AIJsonSchemaCreateOptions and mark redundant properties in the latter as obsolete.

* s/inferred/created
- Add missing [DebuggerDisplay] on AIFunctionArguments
- Add WriteAsync overrides to stream helper in AIFunctionFactory
- Update CHANGELOGs for M.E.AI
- Replace Type targetType AIFunctionFactory.Create parameter with a func
- Remove debug-level logging of updates in LoggingChatClient
- Add an AIJsonSchemaTransformOptions property inside AIJsonSchemaCreateOptions and mark redundant properties in the latter as obsolete.
@joperezr joperezr requested a review from a team as a code owner May 13, 2025 22:36
@joperezr joperezr requested review from a team as code owners May 13, 2025 22:36
@jeffhandley
Copy link
Member

@joperezr The MEAI Templates tests are failing. I'm working to resolve that.

@jeffhandley
Copy link
Member

@joperezr @RussKie -- I will have to finish reviewing the MEAI changes and resolving the template errors either late tonight or Wednesday. This cannot be merged until I've resolved those and approved.

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.

LGTM from eval standpoint 👍🏾

Copy link
Member

@jeffhandley jeffhandley left a comment

Choose a reason for hiding this comment

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

@joperezr I think I got the MEAI Template tests passing (they pass locally for me on this branch). CI is running now. If it's green, I'm signed off. If the tests still fail, I'll continue investigating Wednesday.

@joperezr joperezr merged commit a742d02 into dotnet:release/9.5 May 14, 2025
6 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jun 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants