Skip to content

Minor correction in session_memory.ipynb #2187

@YuvalSarel1

Description

@YuvalSarel1

Love these kinds of explainers - they make the implementation details much easier to reason about.

Small issue:

In the example with keep_last_n_turns=2 and context_limit=4, the text says:

“everything before the earliest of the last 4 turns is summarized into a synthetic pair, and the last 2 turns remain verbatim.”

This wording is a bit misleading - it suggests that turns 3 and 4 are neither summarized nor kept verbatim.

Based on the code (user_starts[-keep_last_n_turns]), it seems the correct description is “earliest of the last 2 turns.”

Adjusting that line would make it clearer that no messages are dropped from both the summary and the preserved context.

"# At this point, with context_limit=4, everything *before* the earliest of the last 4 turns\n",

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions