Skip to content

Conversation

@jeffhandley
Copy link
Member

@jeffhandley jeffhandley commented May 15, 2025

This brings all of the changes from main into release/9.5 to prepare for stable package releases of Microsoft.Extensions.AI, Microsoft.Extensions.AI.Abstractions, and the Microsoft.Extensions.AI.Evaluation* packages.

In addition to cherry-picking changes from main, this PR also adjusts the Microsoft.Extensions.AI.Templates infrastructure to distinguish between the MEAI stable and MEAI preview packages, so that the stable package versions can be referenced by the template-generated projects. That commit (9e014bd) will be cherry-picked from the release/9.5 branch into main after this PR is merged.

Microsoft Reviewers: Open in CodeFlow

stephentoub and others added 23 commits May 15, 2025 11:43
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.
)

* 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
* 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
We use JsonSerializer.SerializeAsync but were missing the async overrides. As with MemoryStream, these don't need to queue.
…eOptions and mark redundant properties in the latter as obsolete. (#6427)

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

* s/inferred/created
* Begin updating to latest MEVD

* Reimplement JsonVectorStore to match updated MEVD APIs

* Remove ingestion cache and track ingestion status inside the vector DB

* Track the document metadata in a separate collection so we don't have to fetch literally everything from the vector DB in order to update ingestion

* Fix equality comparison issue with Qdrant connector

* Tidying

* More tidying

* Update MEAI.Templates test snapshots

---------

Co-authored-by: Jeff Handley <jeffhandley@users.noreply.github.com>
* AI Chat Web template fixes for Azure AI Search

* Update snapshots
CreateRecordsForDocumentAsync includes `Select((pair, index) =>` but index is never used

Co-authored-by: Jeff Handley <jeffhandley@users.noreply.github.com>
* Add RawRepresentationFactory to other options types

* Undo changes in Azure.AI.Inference

* Address documentation feedback
… as stable (#6446)

* Bump ICSharpCode.Decompiler for record struct support in ApiChief tool

Needed the fix for icsharpcode/ILSpy#3159 to fix "record struct" formatting (it was "recordstruct" before the fix).

* Generate ApiChief baselines for MEAI libraries

Ran .\scripts\MakeApiBaselines.ps1 and discarded other libraries' updates.

* Hand-edit MEAI ApiChief baseline to fix params ReadOnlySpan

Params collections are not yet supported in ICSharpCode.Decompiler:
icsharpcode/ILSpy#829

The result is an emitted 'scoped' keyword instead of 'params'. This was edited by hand in the baseline MEAI file.

* Mark Microsoft.Extensions.AI and Microsoft.Extensions.AI.Abstractions as stable

* Update MEAI and MEAI.Abstractions NuGet package documentation

* Update NuGet package documentation for MEAI implementation packages

* Update MEAI.Templates package references, including SemanticKernel for a coherent build.

* Lower OllamaSharp for integration tests to use version available on feed

* Empty the ApiChief baselines for Ollama, AzureAIInference, and OpenAI adapters since they are not shipping stable

* Apply code review feedback to the MEAI package READMEs

* Update MEAI.Templates test snapshots for version bumps

* Apply documentation review feedback to the MEAI package READMEs

* Add comments to the MEAI API baseline file for the hand-editing required

* Restore documentation blurb into Microsoft.Extensions.AI.AzureAIInference per other feedback
* Mark Microsoft.Extensions.AI packages stable

All packages except Microsoft.Extensions.AI.Evaluation.Safety are being marked stable.

* Remove primary constructors from API json files.

* Remove more primary constructors from API Chief json

---------

Co-authored-by: Jeff Handley <jeffhandley@users.noreply.github.com>
@jeffhandley jeffhandley requested review from a team as code owners May 15, 2025 20:50
@jeffhandley jeffhandley merged commit 988e9ee into release/9.5 May 15, 2025
6 checks passed
@jeffhandley jeffhandley deleted the meai-stable/9.5 branch May 15, 2025 21:53
@github-actions github-actions bot locked and limited conversation to collaborators Jun 15, 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.

10 participants