mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-12 03:42:08 +00:00
arcee temperature + compression
This commit is contained in:
parent
735349c679
commit
2d4eaed111
2 changed files with 30 additions and 0 deletions
|
|
@ -196,6 +196,12 @@ def _is_kimi_model(model: Optional[str]) -> bool:
|
||||||
return bare.startswith("kimi-") or bare == "kimi"
|
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(
|
def _fixed_temperature_for_model(
|
||||||
model: Optional[str],
|
model: Optional[str],
|
||||||
base_url: Optional[str] = None,
|
base_url: Optional[str] = None,
|
||||||
|
|
@ -213,6 +219,23 @@ def _fixed_temperature_for_model(
|
||||||
if _is_kimi_model(model):
|
if _is_kimi_model(model):
|
||||||
logger.debug("Omitting temperature for Kimi model %r (server-managed)", model)
|
logger.debug("Omitting temperature for Kimi model %r (server-managed)", model)
|
||||||
return OMIT_TEMPERATURE
|
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
|
return None
|
||||||
|
|
||||||
# Default auxiliary models for direct API-key providers (cheap/fast for side tasks)
|
# Default auxiliary models for direct API-key providers (cheap/fast for side tasks)
|
||||||
|
|
|
||||||
|
|
@ -1868,6 +1868,13 @@ class AIAgent:
|
||||||
if not isinstance(_compression_cfg, dict):
|
if not isinstance(_compression_cfg, dict):
|
||||||
_compression_cfg = {}
|
_compression_cfg = {}
|
||||||
compression_threshold = float(_compression_cfg.get("threshold", 0.50))
|
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_enabled = str(_compression_cfg.get("enabled", True)).lower() in ("true", "1", "yes")
|
||||||
compression_target_ratio = float(_compression_cfg.get("target_ratio", 0.20))
|
compression_target_ratio = float(_compression_cfg.get("target_ratio", 0.20))
|
||||||
compression_protect_last = int(_compression_cfg.get("protect_last_n", 20))
|
compression_protect_last = int(_compression_cfg.get("protect_last_n", 20))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue