Skip to content

.Net: SK integration with MEAI Abstractions #10754

Merged
rogerbarreto merged 54 commits intomainfrom
feature-msextensions-ai
May 20, 2025
Merged

.Net: SK integration with MEAI Abstractions #10754
rogerbarreto merged 54 commits intomainfrom
feature-msextensions-ai

Conversation

…nts) Phase 1 (#10651)

### Motivation and Context

- Resolves partially #10319 

This change adds a new `IChatClientSelector` abstraction to work without
breaking current `IAIServiceSelector` implementations.

This was necessary because `Kernel` now will be able to resolve
`IChatClient`s which are not `IAIService` implementations, and
`OrderedAIServiceSelector` now can select not only `AIServices` but
`ChatClients` as well by implementing the `IChatClientSelector`
interface.

All other changes are related to test accepting `IChatClient`s added to
the `Service` DI container, ensuring they work as expected together with
current `IChatCOmpletionService` and `ITextGenerationService` in the
`Kernel`.
@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code kernel Issues or pull requests impacting the core kernel kernel.core labels Mar 3, 2025
@rogerbarreto rogerbarreto changed the title .Net: SK integration with MEAI Abstractions .Net: SK integration with MEAI Abstractions (Main Sync) - WIP Mar 3, 2025
@github-actions github-actions bot changed the title .Net: SK integration with MEAI Abstractions (Main Sync) - WIP .Net: SK integration with MEAI Abstractions Mar 3, 2025
@rogerbarreto rogerbarreto self-assigned this Mar 3, 2025
@rogerbarreto rogerbarreto added the PR: in progress Under development and/or addressing feedback label Mar 3, 2025
…1049)

# Add ChatClient Support to ChatCompletionAgent

- Resolve #10729 

## Motivation and Context

This PR enhances ChatCompletionAgent to support `IChatClient` alongside
existing IChatCompletionService, providing more flexibility in how chat
completions are handled. This enables better integration with existing
`Microsoft.Extensions.AI` types.

## Description

### Core Changes

1. Enhanced ChatCompletionAgent to:
   - Support both IChatClient and IChatCompletionService interfaces
   - Maintain backward compatibility with existing implementations

2. Updated Sample Code:
   - Added new examples in Concepts demonstrating ChatClient usage
- Updated Getting Started With Agents samples to showcase both service
types

3. Added Comprehensive Unit Tests:
   - Test coverage for Agents with ChatClient integration
   - Verification of both streaming and non-streaming scenarios

4. Added `IChatClient.AsKernelFunctionInvokingClient` extension method
to enable Kernel Function Invocation support with `IChatClient` for
solutions that target `.NET 8 LTS` only.
…ilderPattern (#12132)

- Resolves #12087 
- Add KernelChatOptions to avoid undesired leaking serializations to AI
Models.
- Added More ChatClient Extension methods to Amazon Bedrock and Azure AI
Inference
- Updated existing ChatClient using the latest changes, 
- Code improvements/clean up.
@rogerbarreto rogerbarreto marked this pull request as ready for review May 19, 2025 18:19
@rogerbarreto rogerbarreto requested a review from a team as a code owner May 19, 2025 18:19
Copy link
Member

@markwallace-microsoft markwallace-microsoft left a comment

Choose a reason for hiding this comment

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

All changes have been reviewed on their way into the feature branch

@rogerbarreto rogerbarreto added this pull request to the merge queue May 20, 2025
Merged via the queue into main with commit 57bac49 May 20, 2025
24 checks passed
@rogerbarreto rogerbarreto deleted the feature-msextensions-ai branch May 20, 2025 14:49
jcruzmot-te pushed a commit to thousandeyes/aia-semantic-kernel that referenced this pull request Sep 15, 2025
## Microsoft Extensions AI Integration

This PR brings native integration to majority of
`Microsoft.Extensions.AI` abstractions into Semantic Kernel components
and API's.

- Resolves microsoft#10081 
  Including:
  - microsoft#11628
  - microsoft#11619
  - microsoft#10727
  - microsoft#10729
  - microsoft#10730
  - microsoft#12132

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: NEWTON MALLICK <38786893+N-E-W-T-O-N@users.noreply.github.com>
Co-authored-by: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com>
Co-authored-by: Roger Barreto <rbarreto@microsoft.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Eduard van Valkenburg <eavanvalkenburg@users.noreply.github.com>
Co-authored-by: westey <164392973+westey-m@users.noreply.github.com>
Co-authored-by: Phil Jirsa <pjirsa@gmail.com>
Co-authored-by: DavidJFowler <DavidJFowler@users.noreply.github.com>
Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com>
Co-authored-by: Tao Chen <taochen@microsoft.com>
Co-authored-by: Tommaso Stocchi <tstocchi@microsoft.com>
Co-authored-by: Chris <66376200+crickman@users.noreply.github.com>
Co-authored-by: Mark Wallace <127216156+markwallace-microsoft@users.noreply.github.com>
Co-authored-by: Dade Cook <dadecook@gmail.com>
Co-authored-by: Dade Cook <dadecook@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kernel.core kernel Issues or pull requests impacting the core kernel .NET Issue or Pull requests regarding .NET code PR: in progress Under development and/or addressing feedback

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.Net: Native Integration with Microsoft.Extensions.AI - Phase 1

3 participants