mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-20 14:05:08 +00:00
Add split turn diagram to compaction docs
This commit is contained in:
parent
699702e366
commit
5f41a384cc
1 changed files with 23 additions and 0 deletions
|
|
@ -222,6 +222,29 @@ What gets sent to the LLM as context:
|
||||||
summary firstKeptEntryIndex onwards
|
summary firstKeptEntryIndex onwards
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Split turns:** When a single turn is too large, the cut point may land mid-turn (at an assistant message). In this case `cutPoint.isSplitTurn = true`:
|
||||||
|
|
||||||
|
```
|
||||||
|
Split turn example (one huge turn that exceeds keepRecentTokens):
|
||||||
|
|
||||||
|
index: 0 1 2 3 4 5 6 7 8 9
|
||||||
|
┌────────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┐
|
||||||
|
│ header │ user │ asst │ tool │ asst │ tool │ tool │ asst │ tool │ asst │
|
||||||
|
└────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┘
|
||||||
|
↑ ↑
|
||||||
|
turnStartIndex = 1 firstKeptEntryIndex = 7
|
||||||
|
│ │
|
||||||
|
└────── turn prefix ────────┘ (idx 1-6, summarized separately)
|
||||||
|
└── kept messages (idx 7-9)
|
||||||
|
|
||||||
|
messagesToSummarize = [] (no complete turns before this one)
|
||||||
|
messagesToKeep = [msg idx 7, msg idx 8, msg idx 9]
|
||||||
|
|
||||||
|
The default compaction generates TWO summaries that get merged:
|
||||||
|
1. History summary (previousSummary + messagesToSummarize)
|
||||||
|
2. Turn prefix summary (messages from turnStartIndex to firstKeptEntryIndex)
|
||||||
|
```
|
||||||
|
|
||||||
**Event fields:**
|
**Event fields:**
|
||||||
|
|
||||||
| Field | Description |
|
| Field | Description |
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue