Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions src/google/adk/apps/compaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@ async def _run_compaction_for_sliding_window(
beginning.
- A `CompactedEvent` is generated, summarizing events within
`invocation_id` range [1, 2].
- The session now contains: `[E(inv=1, role=user), E(inv=1, role=model),
E(inv=2, role=user), E(inv=2, role=model), E(inv=2, role=user),
CompactedEvent(inv=[1, 2])]`.
- The session now contains: `[
E(inv=1, role=user), E(inv=1, role=model),
E(inv=2, role=user), E(inv=2, role=model),
CompactedEvent(inv=[1, 2])]`.

2. **After `invocation_id` 3 events are added:**
- No compaction happens yet, because only 1 new invocation (`inv=3`)
Expand All @@ -91,10 +92,13 @@ async def _run_compaction_for_sliding_window(
- The new compaction range is from `invocation_id` 2 to 4.
- A new `CompactedEvent` is generated, summarizing events within
`invocation_id` range [2, 4].
- The session now contains: `[E(inv=1, role=user), E(inv=1, role=model),
E(inv=2, role=user), E(inv=2, role=model), E(inv=2, role=user),
CompactedEvent(inv=[1, 2]), E(inv=3, role=user), E(inv=3, role=model),
E(inv=4, role=user), E(inv=4, role=model), CompactedEvent(inv=[2, 4])]`.
- The session now contains: `[
E(inv=1, role=user), E(inv=1, role=model),
E(inv=2, role=user), E(inv=2, role=model),
CompactedEvent(inv=[1, 2]),
E(inv=3, role=user), E(inv=3, role=model),
E(inv=4, role=user), E(inv=4, role=model),
CompactedEvent(inv=[2, 4])]`.


Args:
Expand Down