Update to stable Microsoft.Extensions.AI release#6552
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6552 +/- ##
==========================================
- Coverage 79.52% 75.40% -4.12%
==========================================
Files 225 331 +106
Lines 16661 19779 +3118
Branches 0 406 +406
==========================================
+ Hits 13249 14914 +1665
- Misses 3412 4592 +1180
- Partials 0 273 +273
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
Moves to the stable Microsoft.Extensions.AI 9.5.0 release and updates code to match API changes
- Bumps AI package versions to stable 9.5.0 and defines a preview version variable
- Adapts chat client extensions to use new GetChatClient/AsIChatClient API
- Updates function-call middleware to accept AIFunctionArguments and return ValueTask
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| ServiceCollectionChatCompletionExtensions.cs | Use GetChatClient and AsIChatClient instead of AsChatClient |
| FunctionCallMiddleware.cs | Change AIToolInvokeWrapper signature to use AIFunctionArguments |
| Directory.Packages.props | Bump Microsoft.Extensions.AI versions and add preview variable |
| { | ||
| var arguments = JsonSerializer.Deserialize<Dictionary<string, object?>>(args); | ||
| var result = await lambda(arguments, CancellationToken.None); | ||
| var result = await lambda(new(arguments), CancellationToken.None); |
There was a problem hiding this comment.
[nitpick] The use of target-typed 'new(arguments)' may reduce readability; consider using the explicit constructor 'new AIFunctionArguments(arguments)' for clarity.
| var result = await lambda(new(arguments), CancellationToken.None); | |
| var result = await lambda(new AIFunctionArguments(arguments), CancellationToken.None); |
| <PackageVersion Include="Microsoft.Extensions.AI.AzureAIInference" Version="$(MicrosoftExtensionsAIPreviewVersion)" /> | ||
| <PackageVersion Include="Microsoft.Extensions.AI.Ollama" Version="$(MicrosoftExtensionsAIPreviewVersion)" /> | ||
| <PackageVersion Include="Microsoft.Extensions.AI.OpenAI" Version="$(MicrosoftExtensionsAIPreviewVersion)" /> |
There was a problem hiding this comment.
[nitpick] Mixing stable and preview package versions for related AI packages can lead to mismatches; if stable releases exist for AzureAIInference, Ollama, and OpenAI, consider aligning them with the stable version variable or documenting the preview usage.
| <PackageVersion Include="Microsoft.Extensions.AI.AzureAIInference" Version="$(MicrosoftExtensionsAIPreviewVersion)" /> | |
| <PackageVersion Include="Microsoft.Extensions.AI.Ollama" Version="$(MicrosoftExtensionsAIPreviewVersion)" /> | |
| <PackageVersion Include="Microsoft.Extensions.AI.OpenAI" Version="$(MicrosoftExtensionsAIPreviewVersion)" /> | |
| <PackageVersion Include="Microsoft.Extensions.AI.AzureAIInference" Version="$(MicrosoftExtensionsAIVersion)" /> | |
| <PackageVersion Include="Microsoft.Extensions.AI.Ollama" Version="$(MicrosoftExtensionsAIVersion)" /> | |
| <PackageVersion Include="Microsoft.Extensions.AI.OpenAI" Version="$(MicrosoftExtensionsAIVersion)" /> |
Why are these changes needed?
Moves to the stable 9.5.0 release instead of a preview (for the core Microsoft.Extensions.AI.Abstractions and Microsoft.Extensions.AI packages).
Related issue number
Checks