docs(langchain): fix SummarizationMiddleware AND vs OR trigger logic documentation#2959
Open
Prince (PrinceThummar011) wants to merge 1 commit intolangchain-ai:mainfrom
Conversation
- Clarify Python only supports OR logic (list of tuples) - Add <Note> explaining Python has no AND logic equivalent - Add TypeScript code examples to JS ParamField for AND/OR - Add 'No AND logic' bullet to Full example accordion Fixes langchain-ai#2027
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2027
The
SummarizationMiddlewaredocumentation under Built-in middleware →Configuration options contained misleading and incorrect information about
the
triggerparameter's AND vs OR logic, causing user confusion.Problem
The Python "Full example" accordion labelled a
listof tuples as"Single condition (AND logic)", then showed a second example — also a
listof tuples — labelled "Multiple conditions (OR logic)". Bothexamples were syntactically identical, making it impossible to understand
how AND logic differed from OR logic.
Additionally, the JavaScript
triggerParamField described AND/OR behaviourin abstract text only, with no code examples to illustrate the difference.
Changes
src/oss/langchain/middleware/built-in.mdxtriggerParamField — added a<Note>block explicitlystating that Python's
ContextSizeis a single("key", value)tuple anddoes not support AND logic. A list of tuples always evaluates as OR
logic (summarization fires when any one condition is met).
triggerParamField — added inline TypeScript code examplesfor both AND logic (
trigger: { tokens: 4000, messages: 10 }) and OR logic(
trigger: [{ tokens: 3000 }, { messages: 6 }]), making the structuraldifference immediately visible.
logic" bullet clarifying there is no Python equivalent of JavaScript's
multi-property AND object.
Type of change
Checklist
src/oss/langchain/middleware/built-in.mdx)reference/(auto-generated)docs.jsonnavigation unchanged (no new pages added)