feat: implemented langchain adapter and added TrimConfig#6
Merged
Conversation
Member
IBJunior
commented
Aug 27, 2025
- Implemented compressLangChainHistory
- Moved messagesToKeep in TrimConfig interface
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements a LangChain adapter for the slimcontext library, adding convenient integration with LangChain's message format and chat models. The main purpose is to provide a seamless way to compress LangChain message histories using slimcontext's compression strategies without requiring manual conversion between message formats.
Key changes include:
- Added a comprehensive LangChain adapter with message conversion utilities and a high-level compression function
- Introduced a
TrimConfiginterface to formalize the configuration structure for trim compression - Added optional peer dependency support for
@langchain/corewith proper package exports
Reviewed Changes
Copilot reviewed 10 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/adapters/langchain.ts |
New adapter module with message conversion utilities and compressLangChainHistory function |
tests/langchain.test.ts |
Comprehensive test suite for the LangChain adapter functionality |
src/strategies/trim.ts |
Extracted TrimConfig interface and updated constructor to use it |
src/index.ts |
Added export for the langchain adapter module |
package.json |
Added LangChain peer dependency, package exports, and version bump |
examples/LANGCHAIN_COMPRESS_HISTORY.md |
New example demonstrating one-call history compression |
README.md |
Updated documentation with LangChain adapter section |
CHANGELOG.md |
Added release notes for version 2.1.0 |
.github/copilot-instructions.md |
Added comprehensive repository documentation |
.eslintignore |
Added locales directory to ignore list |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
99da906 to
c054409
Compare
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.