Skip to content

.Net: MEAI - Add IChatClient support for ChatCompletionAgents - #11049

Merged
Roger Barreto (rogerbarreto) merged 25 commits into
microsoft:feature-msextensions-aifrom
rogerbarreto:issues/10729-sk-meai-agent-integration
Mar 29, 2025
Merged

Roger Barreto (rogerbarreto) merged 25 commits into
microsoft:feature-msextensions-aifrom
rogerbarreto:issues/10729-sk-meai-agent-integration

Conversation

@rogerbarreto

@rogerbarreto Roger Barreto (rogerbarreto) commented Mar 18, 2025 •

Copy link
Copy Markdown
Member

Add ChatClient Support to ChatCompletionAgent

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.

@markwallace-microsoft Mark Wallace (markwallace-microsoft) added the kernel Issues or pull requests impacting the core kernel label Mar 19, 2025
@rogerbarreto
Roger Barreto (rogerbarreto) marked this pull request as ready for review March 21, 2025 09:02
@rogerbarreto
Roger Barreto (rogerbarreto) requested a review from a team as a code owner March 21, 2025 09:02
@rogerbarreto Roger Barreto (rogerbarreto) added the msft.ext.ai Related to Microsoft.Extensions.AI label Mar 21, 2025
@rogerbarreto Roger Barreto (rogerbarreto) changed the title .Net: MEAI - Agents IChatClient Seamless Integration - WIP .Net: MEAI - Add IChatClient support for ChatCompletionAgents Mar 21, 2025
@rogerbarreto
Roger Barreto (rogerbarreto) merged commit dfbf238 into microsoft:feature-msextensions-ai Mar 29, 2025

This branch was previously deployed

1 inactive deployment
integration — 3ec69158 Deployed Mar 21, 2025 by rogerbarreto
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 msft.ext.ai Related to Microsoft.Extensions.AI .NET Issue or Pull requests regarding .NET code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants