mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix(agent): pass config_context_length in fallback activation path
Try to activate fallback model after errors was calling get_model_context_length() without the config_context_length parameter, causing it to fall through to DEFAULT_FALLBACK_CONTEXT (128K) even when config.yaml has an explicit model.context_length value (e.g. 204800 for MiniMax-M2.7). This mirrors the fix already present in switch_model() at line 1988, which correctly passes config_context_length. The fallback path was missed. Fixes: context_length forced to 128K on fallback activation
This commit is contained in:
parent
88b6eb9ad1
commit
fa6cf74bdd
1 changed files with 4 additions and 0 deletions
|
|
@ -6430,11 +6430,15 @@ class AIAgent:
|
|||
# Without this, compression decisions use the primary model's
|
||||
# context window (e.g. 200K) instead of the fallback's (e.g. 32K),
|
||||
# causing oversized sessions to overflow the fallback.
|
||||
# Also pass _config_context_length so the explicit config override
|
||||
# (model.context_length in config.yaml) is respected — without this,
|
||||
# the fallback activation drops to 128K even when config says 204800.
|
||||
if hasattr(self, 'context_compressor') and self.context_compressor:
|
||||
from agent.model_metadata import get_model_context_length
|
||||
fb_context_length = get_model_context_length(
|
||||
self.model, base_url=self.base_url,
|
||||
api_key=self.api_key, provider=self.provider,
|
||||
config_context_length=getattr(self, "_config_context_length", None),
|
||||
)
|
||||
self.context_compressor.update_model(
|
||||
model=self.model,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue