CompactionMessageGroup Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents a logical group of ChatMessage instances that must be kept or removed together during compaction.
public sealed class CompactionMessageGroup
type CompactionMessageGroup = class
Public NotInheritable Class CompactionMessageGroup
- Inheritance
-
CompactionMessageGroup
Remarks
Message groups ensure atomic preservation of related messages. For example, an assistant message containing tool calls and its corresponding tool result messages form a ToolCall group — removing one without the other would cause LLM API errors.
Groups also support exclusion semantics: a group can be marked as excluded (with an optional reason) to indicate it should not be included in the messages sent to the model, while still being preserved for diagnostics, storage, or later re-inclusion.
Each group tracks its MessageCount, ByteCount, and TokenCount so that CompactionMessageIndex can efficiently aggregate totals across all or only included groups.
Fields
| Name | Description |
|---|---|
| SummaryPropertyKey |
The AdditionalProperties key used to identify a message as a compaction summary. |
Properties
| Name | Description |
|---|---|
| ByteCount |
Gets the total UTF-8 byte count of the text content in this group's messages. |
| ExcludeReason |
Gets or sets an optional reason explaining why this group was excluded. |
| IsExcluded |
Gets or sets a value indicating whether this group is excluded from the projected message list. |
| Kind |
Gets the kind of this message group. |
| MessageCount |
Gets the number of messages in this group. |
| Messages |
Gets the messages in this group. |
| TokenCount |
Gets the estimated or actual token count for this group's messages. |
| TurnIndex |
Gets user turn index this group belongs to, or |