mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
* Initial implementation * tmp * Replace function calling with a FunctionInvokingChatClient * Cleanups * Remove custom thread * Fixing function calling server and client * Cleanup * Cleanup serialization * Run dotnet format * Pass logger factory * Populate message properties * Remove files * Cleanups * cleanup * Cleanups * More cleanup * Simplify things * Cleanup * Clean up json serialization * Additional tests * Add service collection extensions for serialization * Combine options in AGUIChatClient * Additional tests * Include tool calling in the sample, fix mixed server and client tool calls * Fix tests * More cleanups * Fix tests * Cleanups * Dojo project and fixes * Fix build * Remove dojo * Cleanup * Address feedback * address feedback * Additional feedback * Fix build * Fix build * Make packages packable
29 lines
1.0 KiB
C#
29 lines
1.0 KiB
C#
// Copyright (c) Microsoft. All rights reserved.
|
|
|
|
using System;
|
|
using Microsoft.Agents.AI;
|
|
using Microsoft.Agents.AI.Hosting.AGUI.AspNetCore;
|
|
using Microsoft.AspNetCore.Http.Json;
|
|
|
|
namespace Microsoft.Extensions.DependencyInjection;
|
|
|
|
/// <summary>
|
|
/// Extension methods for <see cref="IServiceCollection"/> to configure AG-UI support.
|
|
/// </summary>
|
|
public static class MicrosoftAgentAIHostingAGUIServiceCollectionExtensions
|
|
{
|
|
/// <summary>
|
|
/// Adds support for exposing <see cref="AIAgent"/> instances via AG-UI.
|
|
/// </summary>
|
|
/// <param name="services">The <see cref="IServiceCollection"/> to configure.</param>
|
|
/// <returns>The <see cref="IServiceCollection"/> for method chaining.</returns>
|
|
public static IServiceCollection AddAGUI(this IServiceCollection services)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(services);
|
|
|
|
services.Configure<JsonOptions>(options => options.SerializerOptions.TypeInfoResolverChain.Add(AGUIJsonSerializerOptions.Default.TypeInfoResolver!));
|
|
|
|
return services;
|
|
}
|
|
}
|