Skip to content

fix(langchain): alias Bedrock providers in summarization token check#37453

Merged
ccurme (ccurme) merged 1 commit into
masterfrom
cc/aws_fix_summarization
May 15, 2026
Merged

fix(langchain): alias Bedrock providers in summarization token check#37453
ccurme (ccurme) merged 1 commit into
masterfrom
cc/aws_fix_summarization

Conversation

@ccurme
Copy link
Copy Markdown
Collaborator

SummarizationMiddleware triggers based on approximate token counting, but includes a fallback checking if the reported token counts in the AIMessage usage_metadata already exceeds the threshold. It gates this fallback on the last AIMessage originating from the same provider as the summarization model, comparing response_metadata["model_provider"] against the model's ls_provider. These values aren't consistent for ChatBedrock and ChatBedrockConverse.

Here we special-case the comparison for those chat models.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 15, 2026

Merging this PR will not alter performance

✅ 2 untouched benchmarks
⏩ 13 skipped benchmarks1


Comparing cc/aws_fix_summarization (2c2acac) with master (f42d80c)2

Open in CodSpeed

Footnotes

  1. 13 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on master (0831e44) during the generation of this report, so f42d80c was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix For PRs that implement a fix internal langchain `langchain` package issues & PRs size: S 50-199 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant