fix(langchain): enable PreRouter by default to match Python behavior#91
Merged
saschabuehrle merged 1 commit intomainfrom Nov 24, 2025
Merged
Conversation
**Problem**: TypeScript LangChain integration had `enablePreRouter: false` by default, causing ALL queries to go through drafter first, relying only on quality-based cascading. **Solution**: Changed default to `enablePreRouter: true` to match Python's behavior. **What this fixes**: - Complex queries (HARD/EXPERT) are now analyzed BEFORE sending to drafter - Very complex queries skip drafter entirely and go straight to verifier - Saves latency by avoiding unnecessary drafter attempts on complex queries - Matches Python LangChain integration behavior (enable_pre_router=True) **Changes**: 1. `wrapper.ts:60` - Changed `enablePreRouter ?? false` to `enablePreRouter ?? true` 2. `types.ts:47` - Updated documentation from `@default false` to `@default true` **Verification**: - ✅ All 62 TypeScript tests passing - ✅ n8n integration already has correct default (useComplexityRouting: true) - ✅ Behavior now consistent across Python and TypeScript
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.
Problem
TypeScript LangChain integration had
enablePreRouter: falseby default, which meant:This was inconsistent with Python's
enable_pre_router=Truedefault.Solution
Changed TypeScript default to
enablePreRouter: trueto match Python behavior.What This Fixes
✅ Complex queries analyzed BEFORE sending to drafter
✅ Matches Python behavior exactly
enable_pre_router=True(default)enablePreRouter: true(now default)useComplexityRouting: true(already correct)Changes
packages/langchain-cascadeflow/src/wrapper.ts:60enablePreRouter ?? false→enablePreRouter ?? truepackages/langchain-cascadeflow/src/types.ts:47@default false→@default trueTesting
Related