diff --git a/agent/auxiliary_client.py b/agent/auxiliary_client.py index 337ed21ea3..1e3d39c7ba 100644 --- a/agent/auxiliary_client.py +++ b/agent/auxiliary_client.py @@ -196,6 +196,12 @@ def _is_kimi_model(model: Optional[str]) -> bool: return bare.startswith("kimi-") or bare == "kimi" +def _is_arcee_trinity_thinking(model: Optional[str]) -> bool: + """True for Arcee Trinity Large Thinking (direct or via OpenRouter).""" + bare = (model or "").strip().lower().rsplit("/", 1)[-1] + return bare == "trinity-large-thinking" + + def _fixed_temperature_for_model( model: Optional[str], base_url: Optional[str] = None, @@ -213,6 +219,23 @@ def _fixed_temperature_for_model( if _is_kimi_model(model): logger.debug("Omitting temperature for Kimi model %r (server-managed)", model) return OMIT_TEMPERATURE + if _is_arcee_trinity_thinking(model): + return 0.5 + return None + + +def _compression_threshold_for_model(model: Optional[str]) -> Optional[float]: + """Return a context-compression threshold override for specific models. + + The threshold is the fraction of the model's context window that must be + consumed before Hermes triggers summarization. Higher values delay + compression and preserve more raw context. + + Returns a float in (0, 1] to override the global ``compression.threshold`` + config value, or ``None`` to leave the user's config value unchanged. + """ + if _is_arcee_trinity_thinking(model): + return 0.75 return None # Default auxiliary models for direct API-key providers (cheap/fast for side tasks) diff --git a/run_agent.py b/run_agent.py index c76d2a61b5..0b69a17175 100644 --- a/run_agent.py +++ b/run_agent.py @@ -1868,6 +1868,13 @@ class AIAgent: if not isinstance(_compression_cfg, dict): _compression_cfg = {} compression_threshold = float(_compression_cfg.get("threshold", 0.50)) + try: + from agent.auxiliary_client import _compression_threshold_for_model as _cthresh_fn + _model_cthresh = _cthresh_fn(self.model) + if _model_cthresh is not None: + compression_threshold = _model_cthresh + except Exception: + pass compression_enabled = str(_compression_cfg.get("enabled", True)).lower() in ("true", "1", "yes") compression_target_ratio = float(_compression_cfg.get("target_ratio", 0.20)) compression_protect_last = int(_compression_cfg.get("protect_last_n", 20))