[PR #2959] docs(langchain): fix SummarizationMiddleware AND vs OR trigger logic documentation #3041

Open
opened 2026-06-05 18:20:55 -04:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/docs/pull/2959
Author: @PrinceThummar011
Created: 3/6/2026
Status: 🔄 Open

Base: mainHead: fix/summarization-middleware-and-or-docs


📝 Commits (1)

  • 1a61752 docs(langchain): fix AND vs OR trigger logic for SummarizationMiddleware

📊 Changes

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

View changed files

📝 src/oss/langchain/middleware/built-in.mdx (+50 -12)

📄 Description

Summary

Fixes #2027

The SummarizationMiddleware documentation under Built-in middleware →
Configuration options
contained misleading and incorrect information about
the trigger parameter's AND vs OR logic, causing user confusion.

Problem

The Python "Full example" accordion labelled a list of tuples as
"Single condition (AND logic)", then showed a second example — also a
list of tuples — labelled "Multiple conditions (OR logic)". Both
examples were syntactically identical, making it impossible to understand
how AND logic differed from OR logic.

Additionally, the JavaScript trigger ParamField described AND/OR behaviour
in abstract text only, with no code examples to illustrate the difference.

Changes

src/oss/langchain/middleware/built-in.mdx

  • Python trigger ParamField — added a <Note> block explicitly
    stating that Python's ContextSize is a single ("key", value) tuple and
    does not support AND logic. A list of tuples always evaluates as OR
    logic (summarization fires when any one condition is met).
  • JavaScript trigger ParamField — added inline TypeScript code examples
    for both AND logic (trigger: { tokens: 4000, messages: 10 }) and OR logic
    (trigger: [{ tokens: 3000 }, { messages: 6 }]), making the structural
    difference immediately visible.
  • "Full example" accordion (Python bullet list) — added a "No AND
    logic"
    bullet clarifying there is no Python equivalent of JavaScript's
    multi-property AND object.

Type of change

  • Documentation fix (incorrect / misleading content)

Checklist

  • Targets the correct file (src/oss/langchain/middleware/built-in.mdx)
  • No changes to reference/ (auto-generated)
  • docs.json navigation unchanged (no new pages added)
  • Frontmatter intact on all edited files
  • Follows Google Developer Documentation Style Guide

🔄 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/2959 **Author:** [@PrinceThummar011](https://github.com/PrinceThummar011) **Created:** 3/6/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/summarization-middleware-and-or-docs` --- ### 📝 Commits (1) - [`1a61752`](https://github.com/langchain-ai/docs/commit/1a61752d6c414a965c6708d9ba9c94dfabdc4928) docs(langchain): fix AND vs OR trigger logic for SummarizationMiddleware ### 📊 Changes **1 file changed** (+50 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `src/oss/langchain/middleware/built-in.mdx` (+50 -12) </details> ### 📄 Description ## Summary Fixes #2027 The `SummarizationMiddleware` documentation under **Built-in middleware → Configuration options** contained misleading and incorrect information about the `trigger` parameter's AND vs OR logic, causing user confusion. ## Problem The Python "Full example" accordion labelled a `list` of tuples as **"Single condition (AND logic)"**, then showed a second example — also a `list` of tuples — labelled **"Multiple conditions (OR logic)"**. Both examples were syntactically identical, making it impossible to understand how AND logic differed from OR logic. Additionally, the JavaScript `trigger` ParamField described AND/OR behaviour in abstract text only, with no code examples to illustrate the difference. ## Changes ### `src/oss/langchain/middleware/built-in.mdx` - **Python `trigger` ParamField** — added a `<Note>` block explicitly stating that Python's `ContextSize` is a single `("key", value)` tuple and does **not** support AND logic. A list of tuples always evaluates as OR logic (summarization fires when any one condition is met). - **JavaScript `trigger` ParamField** — added inline TypeScript code examples for both AND logic (`trigger: { tokens: 4000, messages: 10 }`) and OR logic (`trigger: [{ tokens: 3000 }, { messages: 6 }]`), making the structural difference immediately visible. - **"Full example" accordion (Python bullet list)** — added a **"No AND logic"** bullet clarifying there is no Python equivalent of JavaScript's multi-property AND object. ## Type of change - [x] Documentation fix (incorrect / misleading content) ## Checklist - [x] Targets the correct file (`src/oss/langchain/middleware/built-in.mdx`) - [x] No changes to `reference/` (auto-generated) - [x] `docs.json` navigation unchanged (no new pages added) - [x] Frontmatter intact on all edited files - [x] Follows Google Developer Documentation Style Guide --- <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:20:55 -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#3041