Skip to content

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

Merged
Mark Wallace (markwallace-microsoft) merged 27 commits into
microsoft:mainfrom
markwallace-microsoft:users/markwallace/issue_8518
Nov 4, 2024
Merged

Mark Wallace (markwallace-microsoft) merged 27 commits into
microsoft:mainfrom
markwallace-microsoft:users/markwallace/issue_8518

Conversation

@markwallace-microsoft

@markwallace-microsoft Mark Wallace (markwallace-microsoft) commented Sep 23, 2024 •

Copy link
Copy Markdown
Contributor

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 Mark Wallace (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 Mark Wallace (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
Copy Markdown
Contributor

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

Merged via the queue into microsoft:main with commit aec6577 Nov 4, 2024
@markwallace-microsoft
Mark Wallace (markwallace-microsoft) deleted the users/markwallace/issue_8518 branch November 4, 2024 09:14

This branch was previously deployed

1 inactive deployment
integration — 606698eb Deployed Nov 1, 2024 by markwallace-microsoft
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