[PR #4009] [MERGED] docs: fix delete_old_messages example to properly demonstrate deletion effect #4016

Closed
opened 2026-06-05 18:53:54 -04:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/docs/pull/4009
Author: @uditstocks
Created: 5/14/2026
Status: Merged
Merged: 5/29/2026
Merged by: @npentrel

Base: mainHead: fix/delete-old-messages-demo


📝 Commits (2)

  • 69ad5d2 docs: fix delete_old_messages example to properly demonstrate deletion effect
  • 56a106c fix(docs): mirror delete_old_messages JS example to match Python fix

📊 Changes

1 file changed (+34 additions, -12 deletions)

View changed files

📝 src/oss/langchain/short-term-memory.mdx (+34 -12)

📄 Description

Overview

The existing delete_old_messages example in the short-term memory documentation failed to properly demonstrate
the deletion effect. After deleting the earliest two messages, the agent could still recall the user's name "Bob" because
the AI's own first response had echoed the name - and that response survived the deletion window.

This PR fixes the example by inserting an unrelated conversation turn (a cat poem)
between the name introduction and the name recall query. This naturally pushes the
name-containing messages out of the window, so when the agent is asked "what's my name?"
it correctly responds that it doesn't know.

Type of change

[Update existing documentation]

Checklist

  • I have read the contributing guidelines
  • I have tested my changes locally using docs dev
  • All code examples have been tested and work correctly

Related issues/PRs

closes #3894

Additional notes

The fix is minimal and surgical - only the example code and output block are changed.
No API behavior, no logic, no navigation changes. The updated output block is taken
from an actual local run to ensure accuracy.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/docs/pull/4009 **Author:** [@uditstocks](https://github.com/uditstocks) **Created:** 5/14/2026 **Status:** ✅ Merged **Merged:** 5/29/2026 **Merged by:** [@npentrel](https://github.com/npentrel) **Base:** `main` ← **Head:** `fix/delete-old-messages-demo` --- ### 📝 Commits (2) - [`69ad5d2`](https://github.com/langchain-ai/docs/commit/69ad5d2832051127c2305c9f95c66fa2633d8c76) docs: fix delete_old_messages example to properly demonstrate deletion effect - [`56a106c`](https://github.com/langchain-ai/docs/commit/56a106ccd27ddbc4e01815a213d5322f9e0468de) fix(docs): mirror delete_old_messages JS example to match Python fix ### 📊 Changes **1 file changed** (+34 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `src/oss/langchain/short-term-memory.mdx` (+34 -12) </details> ### 📄 Description ## Overview The existing `delete_old_messages` example in the short-term memory documentation failed to properly demonstrate the deletion effect. After deleting the earliest two messages, the agent could still recall the user's name "Bob" because the AI's own first response had echoed the name - and that response survived the deletion window. This PR fixes the example by inserting an unrelated conversation turn (a cat poem) between the name introduction and the name recall query. This naturally pushes the name-containing messages out of the window, so when the agent is asked "what's my name?" it correctly responds that it doesn't know. ## Type of change [Update existing documentation] ## Checklist - [x] I have read the contributing guidelines - [x] I have tested my changes locally using `docs dev` - [x] All code examples have been tested and work correctly ## Related issues/PRs closes #3894 ## Additional notes The fix is minimal and surgical - only the example code and output block are changed. No API behavior, no logic, no navigation changes. The updated output block is taken from an actual local run to ensure accuracy. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-06-05 18:53:54 -04:00
yindo closed this issue 2026-06-05 18:53:54 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/docs#4016