Skip to content

Conversation

@0xbbjoker
Copy link
Collaborator

@0xbbjoker 0xbbjoker commented Nov 14, 2025

  • Replace langchain dependency with @langchain/textsplitters in @elizaos/core
  • Update import from 'langchain/text_splitter' to '@langchain/textsplitters'
  • Remove outdated langchain resolutions from plugin starter packages
  • Add comprehensive test coverage for splitChunks functionality
  • All 89 tests passing with new LangChain v1 integration

This addresses the deprecation of LangChain v0.3 by migrating to the
modular @langchain/textsplitters package which is part of the LangChain v1
ecosystem. The migration maintains full backward compatibility while
reducing bundle size and future-proofing the codebase.

Fixes #6145

#6145 (comment)


Note

Replaces langchain text splitter with @langchain/textsplitters v1 in core, updates imports, adds robust splitChunks tests, and removes old LangChain resolutions from plugin templates.

  • Core
    • Replace langchain with @langchain/textsplitters v1; add deps @langchain/core and @langchain/textsplitters in packages/core/package.json.
    • Update import in packages/core/src/utils.ts to @langchain/textsplitters and adjust splitChunks implementation.
  • Tests
    • Expand packages/core/src/__tests__/utils.test.ts with new and edge-case tests for splitChunks (empty input, large sizes, overlap), validating RecursiveCharacterTextSplitter usage.
  • Plugins
    • Remove outdated langchain resolutions/overrides in packages/plugin-quick-starter/package.json and packages/plugin-starter/package.json (keep zod resolution).

Written by Cursor Bugbot for commit d942536. This will update automatically on new commits. Configure here.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 14, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/migrate-langchain-to-v1

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@graphite-app
Copy link

graphite-app bot commented Nov 14, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • merge-queue-hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@claude
Copy link
Contributor

claude bot commented Nov 14, 2025

Claude finished @0xbbjoker's task —— View job


PR Review Complete ✅

Todo List:

  • Read and analyze all changed files
  • Verify test coverage and implementation
  • Check package.json changes
  • Review import patterns and dependencies
  • Check for security issues
  • Provide actionable feedback

Review Findings

APPROVED - Clean LangChain v1 Migration

This is a well-executed migration with excellent test coverage. All critical requirements are met:

Strengths:

  • Correct dependency migration: langchain@langchain/textsplitters v1.0.0 in core package.json:69
  • Proper import update: Updated from 'langchain/text_splitter' to '@langchain/textsplitters' in utils.ts:1
  • Comprehensive test coverage: Added 48 new test lines covering splitChunks functionality with specific v1 migration tests
  • Clean package.json: Removed outdated langchain resolutions from plugin starter packages
  • Uses bun test only: All tests use bun:test framework (line 1 in test file)
  • TypeScript types: Proper typed imports, no any types used improperly
  • Follows workspace patterns: Uses workspace:* for @elizaos/core dependencies
  • No security issues: No hardcoded keys, SQL injection, or XSS vulnerabilities

Technical Details:

  • The splitChunks function maintains backward compatibility - same API, same functionality
  • Test coverage includes edge cases: empty strings, large chunks, overlap behavior
  • Character-to-token ratio logic preserved (3.5x multiplier)
  • Proper error handling and logging maintained

Bundle Size Impact: ✅ Positive - @langchain/textsplitters is smaller than full langchain package

Breaking Changes: ✅ None - This is a drop-in replacement maintaining full API compatibility


@claude
Copy link
Contributor

claude bot commented Nov 17, 2025

Claude finished @0xbbjoker's task —— View job


Claude Code is reviewing this PR...

Todo List:

  • Read and analyze all changed files
  • Verify test coverage and implementation
  • Check package.json changes
  • Review import patterns and dependencies
  • Check for security issues
  • Provide actionable feedback

Review Complete ✅

APPROVED - Clean LangChain v1 Migration

This is a well-executed migration with excellent test coverage. All critical requirements are met:

Strengths:
Correct dependency migration: langchain@langchain/textsplitters v1.0.0 in packages/core/package.json:69
Proper import update: Updated from 'langchain/text_splitter' to '@langchain/textsplitters' in packages/core/src/utils.ts:1
Comprehensive test coverage: Added 48 new test lines covering splitChunks functionality with specific v1 migration validation at packages/core/src/tests/utils.test.ts:259-272
Clean package.json: Removed outdated langchain resolutions from plugin starter packages
Uses bun test only: All tests use bun:test framework (line 1 in test file)
TypeScript types: Proper typed imports, no any types used
Follows workspace patterns: Uses workspace:* for @elizaos/core dependencies
No security issues: No hardcoded keys, SQL injection, or XSS vulnerabilities

Technical Details:

  • The splitChunks function maintains backward compatibility - same API, same functionality
  • Test coverage includes edge cases: empty strings, large chunks, overlap behavior
  • Character-to-token ratio logic preserved (3.5x multiplier)
  • Proper error handling and logging maintained

Bundle Size Impact: ✅ Positive - @langchain/textsplitters is smaller than full langchain package

Breaking Changes: ✅ None - This is a drop-in replacement maintaining full API compatibility


@claude
Copy link
Contributor

claude bot commented Nov 17, 2025

Claude finished @0xbbjoker's task —— View job


Claude Code is reviewing this PR...

Todo List:

  • Read and analyze all changed files
  • Verify test coverage and implementation
  • Check package.json changes
  • Review import patterns and dependencies
  • Check for security issues
  • Provide actionable feedback

Review Complete ✅

APPROVED - Clean LangChain v1 Migration

This is a well-executed migration with excellent test coverage. All critical requirements are met:

Strengths:
Correct dependency migration: langchain@langchain/textsplitters v1.0.0 in packages/core/package.json:69
Proper import update: Updated from 'langchain/text_splitter' to '@langchain/textsplitters' in packages/core/src/utils.ts:1
Comprehensive test coverage: Added 48 new test lines covering splitChunks functionality with specific v1 migration validation at packages/core/src/tests/utils.test.ts:259-272
Clean package.json: Removed outdated langchain resolutions from plugin starter packages
Uses bun test only: All tests use bun:test framework (line 1 in test file)
TypeScript types: Proper typed imports, no any types used
Follows workspace patterns: Uses workspace:* for @elizaos/core dependencies
No security issues: No hardcoded keys, SQL injection, or XSS vulnerabilities

Technical Details:

  • The splitChunks function maintains backward compatibility - same API, same functionality
  • Test coverage includes edge cases: empty strings, large chunks, overlap behavior
  • Character-to-token ratio logic preserved (3.5x multiplier)
  • Proper error handling and logging maintained

Bundle Size Impact: ✅ Positive - @langchain/textsplitters is smaller than full langchain package

Breaking Changes: ✅ None - This is a drop-in replacement maintaining full API compatibility

⚠️ IMPORTANT: Cursor identified a peer dependency issue → Fix: Add @langchain/core@^1.0.0 as explicit dependency in packages/core/package.json:69 (already done correctly in this PR)


@0xbbjoker 0xbbjoker merged commit afa9b85 into develop Nov 17, 2025
15 of 16 checks passed
@0xbbjoker 0xbbjoker deleted the fix/migrate-langchain-to-v1 branch November 17, 2025 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deprecation of Langchain v0.3 - migrate to langchian-classic or bump version to v1

4 participants