microsoft / microsoft/agent-framework
.NET Compaction - Introduce preconfigured `CompactionStrategy` pattern
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 13.6k
- Forks
- 2.3k
- Avg merge
- 2d 45m
- Merged PRs (30d)
- 358
Description
I expect many developers will ask: How do I configured my `CompactionStrategy`? ...which one do I use? ...what thresholds work best?
We can expose a factory that creates a pre-configured `CompactionStrategy` according to a set of options:
```c#
// Setup a chat client for summarization
IChatClient summarizingChatClient = ...;
// Create a compaction strategy based on a menu selection of characteristics
CompactionStrategy tunedStrategy =
CompactionStrategy.Create(
Approach.Balanced,
Size.Compact,
summarizingChatClient);
```
In this example, "size" could be:
- Compact
- Moderate
- Generous
And "approach" could be:
- Aggressive
- Balanced
- Gentle
Perhaps the "size" parameter is informed by the maximum input tokens allowed by a given model, with a default based on a conservative estimate of the most common usage.
Behind the scenes the combination of these two axes map to a certain `CompactionStrategy` configuration. As we improve our configuration, developers using this pattern will automatically realize those improvements.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.