applyCompaction
function applyCompaction( messages, cut, summary): ChatMessage[];Defined in: core/src/context.ts:143
Fold messages into […system, summary, …tail].
The summary arrives as a user turn rather than a system one: a system message added mid-conversation reads to the model as a new instruction, and several providers require the system block to be first and singular anyway.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
messages |
readonly ChatMessage[] |
cut |
number |
summary |
string |