Skip to content

.Net: Samples showing how to manage Chat History#8954

Merged
markwallace-microsoft merged 27 commits intomicrosoft:mainfrom
markwallace-microsoft:users/markwallace/issue_8518
Nov 4, 2024
Merged

.Net: Samples showing how to manage Chat History#8954
markwallace-microsoft merged 27 commits intomicrosoft:mainfrom
markwallace-microsoft:users/markwallace/issue_8518

Conversation

@markwallace-microsoft
Copy link
Member

@markwallace-microsoft markwallace-microsoft commented Sep 23, 2024

Motivation and Context

Large Language Models (LLMs) operate with a defined limit on the number of tokens they can process at once, referred to as the context window. Exceeding this limit can have significant cost and performance implications. Therefore, it is essential to manage the size of the input sent to the LLM, particularly when using chat completion models. This involves effectively managing chat history and implementing strategies to truncate it when it becomes too large.

Related to #8518

Description

Samples demonstrating how to manage chat history, the following strategies are implemented:

  1. Sending Only the Last N Messages: Retain the last few messages, including the System Message.
  2. Limiting Based on Maximum Token Count: Ensure the total token count remains within a specified limit.
  3. Summarizing Older Messages: Create a summary of previous messages to maintain context while reducing token usage.

Contribution Checklist

@markwallace-microsoft markwallace-microsoft requested a review from a team as a code owner September 23, 2024 14:49
@markwallace-microsoft markwallace-microsoft added the .NET Issue or Pull requests regarding .NET code label Sep 23, 2024
@github-actions github-actions bot changed the title First sample showing how to manage Chat History .Net: First sample showing how to manage Chat History Sep 23, 2024
@markwallace-microsoft markwallace-microsoft marked this pull request as draft September 23, 2024 16:26
@markwallace-microsoft markwallace-microsoft changed the title .Net: First sample showing how to manage Chat History .Net: Samples showing how to manage Chat History Sep 27, 2024
@crickman
Copy link
Contributor

crickman commented Nov 1, 2024

Are the PR's included in the release notes? If so, perhaps some additional information in the description would be helpful for anyone consuming the release notes?

https://github.com/microsoft/semantic-kernel/releases/tag/dotnet-1.26.0

@markwallace-microsoft markwallace-microsoft added this pull request to the merge queue Nov 4, 2024
Merged via the queue into microsoft:main with commit aec6577 Nov 4, 2024
@markwallace-microsoft markwallace-microsoft deleted the users/markwallace/issue_8518 branch November 4, 2024 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation .NET Issue or Pull requests regarding .NET code

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants