fix: propagate kimi base-url temperature overrides

Follow up salvaged PR #12668 by threading base_url through the
remaining direct-call sites so kimi-k2.5 uses temperature=1.0 on
api.moonshot.ai and keeps 0.6 on api.kimi.com/coding. Add focused
regression tests for run_agent, trajectory_compressor, and
mini_swe_runner.
This commit is contained in:
kshitijk4poor
2026-04-20 01:35:42 +05:30
committed by Teknium
parent 6f79b8f01d
commit 50d6799389
7 changed files with 119 additions and 8 deletions

View File

@@ -54,14 +54,18 @@ _project_env = Path(__file__).parent / ".env"
load_hermes_dotenv(hermes_home=_hermes_home, project_env=_project_env)
def _effective_temperature_for_model(model: str, requested_temperature: float) -> float:
def _effective_temperature_for_model(
model: str,
requested_temperature: float,
base_url: Optional[str] = None,
) -> float:
"""Apply fixed model temperature contracts to direct client calls."""
try:
from agent.auxiliary_client import _fixed_temperature_for_model
except Exception:
return requested_temperature
fixed_temperature = _fixed_temperature_for_model(model)
fixed_temperature = _fixed_temperature_for_model(model, base_url)
if fixed_temperature is not None:
return fixed_temperature
return requested_temperature
@@ -583,6 +587,7 @@ Write only the summary, starting with "[CONTEXT SUMMARY]:" prefix."""
summary_temperature = _effective_temperature_for_model(
self.config.summarization_model,
self.config.temperature,
self.config.base_url,
)
if getattr(self, '_use_call_llm', False):
@@ -649,6 +654,7 @@ Write only the summary, starting with "[CONTEXT SUMMARY]:" prefix."""
summary_temperature = _effective_temperature_for_model(
self.config.summarization_model,
self.config.temperature,
self.config.base_url,
)
if getattr(self, '_use_call_llm', False):