Skip to content

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

Merged
rogerbarreto merged 25 commits intomicrosoft:feature-msextensions-aifrom
rogerbarreto:issues/10729-sk-meai-agent-integration
Mar 29, 2025
Merged

.Net: MEAI - Add IChatClient support for ChatCompletionAgents#11049
rogerbarreto merged 25 commits intomicrosoft:feature-msextensions-aifrom
rogerbarreto:issues/10729-sk-meai-agent-integration

Conversation

@rogerbarreto
Copy link
Member

@rogerbarreto rogerbarreto commented Mar 18, 2025

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 markwallace-microsoft added .NET Issue or Pull requests regarding .NET code kernel.core labels Mar 18, 2025
@rogerbarreto rogerbarreto self-assigned this Mar 19, 2025
@markwallace-microsoft markwallace-microsoft added the kernel Issues or pull requests impacting the core kernel label Mar 19, 2025
@rogerbarreto rogerbarreto marked this pull request as ready for review March 21, 2025 09:02
@rogerbarreto rogerbarreto requested a review from a team as a code owner March 21, 2025 09:02
@rogerbarreto rogerbarreto added the msft.ext.ai Related to Microsoft.Extensions.AI label Mar 21, 2025
@rogerbarreto rogerbarreto changed the title .Net: MEAI - Agents IChatClient Seamless Integration - WIP .Net: MEAI - Add IChatClient support for ChatCompletionAgents Mar 21, 2025
@rogerbarreto rogerbarreto requested a review from crickman March 21, 2025 09:07
@rogerbarreto rogerbarreto merged commit dfbf238 into microsoft:feature-msextensions-ai Mar 29, 2025
11 checks passed
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