From b59c84dac6f85698c86723a0fb9885f7a4fe332e Mon Sep 17 00:00:00 2001 From: "Palla. Gnana Sai Kiran" <2400031822@kluniversity.in> Date: Tue, 25 Nov 2025 22:10:27 +0530 Subject: [PATCH 1/3] Add new MEAI features to overview - Fixes #50101 Added Chat reduction and Tool reduction sections as experimental features to the Microsoft.Extensions.AI overview documentation. These additions address issue #50101 which requested adding new MEAI features including: - Chat reduction (experimental) - Tool reduction (experimental) --- docs/ai/microsoft-extensions-ai.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/ai/microsoft-extensions-ai.md b/docs/ai/microsoft-extensions-ai.md index 3a8b236ad892d..2162eccdb032b 100644 --- a/docs/ai/microsoft-extensions-ai.md +++ b/docs/ai/microsoft-extensions-ai.md @@ -40,6 +40,8 @@ The following subsections show specific [`IChatClient`](#the-ichatclient-interfa - [Custom `IChatClient` middleware](#custom-ichatclient-middleware) - [Dependency injection](#dependency-injection) - [Stateless vs. stateful clients](#stateless-vs-stateful-clients) +- [Chat reduction (experimental)](#chat-reduction-experimental) +- [Tool reduction (experimental)](#tool-reduction-experimental) The following sections show specific [`IEmbeddingGenerator`](#the-iembeddinggenerator-interface) usage examples: @@ -197,6 +199,20 @@ Some services might support automatically creating a conversation ID for a reque If you don't know ahead of time whether the service is stateless or stateful, you can check the response and act based on its value. If it's set, then that value is propagated to the options and the history is cleared so as to not resend the same history again. If the response `ConversationId` isn't set, then the response message is added to the history so that it's sent back to the service on the next turn. :::code language="csharp" source="snippets/microsoft-extensions-ai/ConsoleAI.StatelessStateful/Program.cs" id="Snippet4"::: +#### Chat reduction (experimental) + +> [!IMPORTANT] +> This feature is experimental and subject to change. + +Chat reduction helps manage conversation history by limiting the number of messages or summarizing older messages when the conversation exceeds a specified length. The `Microsoft.Extensions.AI` library provides reducers like that limits the number of non-system messages, and that automatically summarizes older messages while preserving context. + +#### Tool reduction (experimental) + +> [!IMPORTANT] +> This feature is experimental and subject to change. + +Tool reduction helps manage large tool catalogs by trimming them based on relevance to the current conversation context. The interface defines strategies for reducing the number of tools sent to the model. The library provides implementations like that ranks tools by embedding similarity to the conversation. Use the extension method to add tool reduction to your chat client pipeline. + ### The `IEmbeddingGenerator` interface From 09c9b1539fd3f354c823f8e02d985e015578a35d Mon Sep 17 00:00:00 2001 From: "Meaghan Osagie (Lewis)" Date: Wed, 26 Nov 2025 11:32:29 -0800 Subject: [PATCH 2/3] Add line to fix linting Added a section on chat reduction feature in the AI documentation. --- docs/ai/microsoft-extensions-ai.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/ai/microsoft-extensions-ai.md b/docs/ai/microsoft-extensions-ai.md index 2162eccdb032b..4cfb87723bf3b 100644 --- a/docs/ai/microsoft-extensions-ai.md +++ b/docs/ai/microsoft-extensions-ai.md @@ -199,6 +199,7 @@ Some services might support automatically creating a conversation ID for a reque If you don't know ahead of time whether the service is stateless or stateful, you can check the response and act based on its value. If it's set, then that value is propagated to the options and the history is cleared so as to not resend the same history again. If the response `ConversationId` isn't set, then the response message is added to the history so that it's sent back to the service on the next turn. :::code language="csharp" source="snippets/microsoft-extensions-ai/ConsoleAI.StatelessStateful/Program.cs" id="Snippet4"::: + #### Chat reduction (experimental) > [!IMPORTANT] From c0031c77905d71b8b40a16655ceb5c5890e8973d Mon Sep 17 00:00:00 2001 From: "Meaghan Osagie (Lewis)" Date: Wed, 26 Nov 2025 11:35:14 -0800 Subject: [PATCH 3/3] Remove extra line --- docs/ai/microsoft-extensions-ai.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/ai/microsoft-extensions-ai.md b/docs/ai/microsoft-extensions-ai.md index 4cfb87723bf3b..e0d1e9427e276 100644 --- a/docs/ai/microsoft-extensions-ai.md +++ b/docs/ai/microsoft-extensions-ai.md @@ -214,7 +214,6 @@ Chat reduction helps manage conversation history by limiting the number of messa Tool reduction helps manage large tool catalogs by trimming them based on relevance to the current conversation context. The interface defines strategies for reducing the number of tools sent to the model. The library provides implementations like that ranks tools by embedding similarity to the conversation. Use the extension method to add tool reduction to your chat client pipeline. - ### The `IEmbeddingGenerator` interface The interface represents a generic generator of embeddings. For the generic type parameters, `TInput` is the type of input values being embedded, and `TEmbedding` is the type of generated embedding, which inherits from the class.