Skip to content
This repository was archived by the owner on Aug 21, 2026. It is now read-only.

fix(research): BUG-1 fix wrong model param for token limit detection - #335

Open
Weather-Report (WeatherCore) wants to merge 2 commits into
langchain-ai:mainfrom
WeatherCore:main
Open

Weather-Report (WeatherCore) wants to merge 2 commits into
langchain-ai:mainfrom
WeatherCore:main

Conversation

@WeatherCore

Copy link
Copy Markdown

Summary

In compress_research, the token limit detection logic incorrectly uses configurable.research_model instead of configurable.compression_model.

Problem

When the compression model is different from the research model (e.g., research_model="openai:gpt-4o" and compression_model="deepseek:deepseek-chat"), the exception handler fails to recognize token limit errors because is_token_limit_exceeded checks the wrong model's provider-specific error patterns. This causes the retry loop to exit early without truncating the messages, resulting in a "Maximum retries exceeded" error even when simply truncating would resolve the issue.

Fix

  • Line 569: Replace configurable.research_model with configurable.compression_model in the is_token_limit_exceeded call.

Impact

  • Resolves silent failures when using mixed-model configurations.
  • No effect on default setups where both models are identical.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant