-
Notifications
You must be signed in to change notification settings - Fork 840
Preserve function content in SummarizingChatReducer
#6908
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Fixes an issue in SummarizingChatReducer where function call content was being removed even when not summarized. The PR preserves function call and result content in the returned message list and improves message boundary detection to avoid orphaning assistant responses from their user messages.
Key changes:
- Preserves
FunctionCallContentandFunctionResultContentin message lists - Implements backward search within threshold window for user message boundaries
- Updates logic to keep complete function call sequences together
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/Libraries/Microsoft.Extensions.AI/ChatReduction/SummarizingChatReducer.cs |
Core implementation changes to preserve function content and improve message boundary detection |
test/Libraries/Microsoft.Extensions.AI.Tests/ChatReduction/SummarizingChatReducerTests.cs |
Updated and added tests to verify function content preservation and threshold behavior |
Summary
Fixes an issue where
SummarizingChatReduceralways removes function call content, even if it didn't get summarized.Description
This PR makes the following changes to
SummarizingChatReducer:FunctionCallContentandFunctionResultContentnow get preserved in the returned message list.targetCount + thresholdmessages.Fixes #6890
Microsoft Reviewers: Open in CodeFlow