CompactionMessageIndex.InsertGroup Method

Definition

Creates a new CompactionMessageGroup with byte and token counts computed using this collection's Tokenizer, and adds it to the Groups list at the specified index.

public Microsoft.Agents.AI.Compaction.CompactionMessageGroup InsertGroup(int index, Microsoft.Agents.AI.Compaction.CompactionGroupKind kind, System.Collections.Generic.IReadOnlyList<Microsoft.Extensions.AI.ChatMessage> messages, int? turnIndex = default);
member this.InsertGroup : int * Microsoft.Agents.AI.Compaction.CompactionGroupKind * System.Collections.Generic.IReadOnlyList<Microsoft.Extensions.AI.ChatMessage> * Nullable<int> -> Microsoft.Agents.AI.Compaction.CompactionMessageGroup
Public Function InsertGroup (index As Integer, kind As CompactionGroupKind, messages As IReadOnlyList(Of ChatMessage), Optional turnIndex As Nullable(Of Integer) = Nothing) As CompactionMessageGroup

Parameters

index
Int32

The zero-based index at which the group should be inserted.

kind
CompactionGroupKind

The kind of message group.

messages
IReadOnlyList<ChatMessage>

The messages in the group.

turnIndex
Nullable<Int32>

The optional turn index to assign to the new group.

Returns

The newly created CompactionMessageGroup.

Applies to