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

@@ -43,13 +43,16 @@ from dotenv import load_dotenv
load_dotenv()
def _effective_temperature_for_model(model: str) -> Optional[float]:
def _effective_temperature_for_model(
model: str,
base_url: Optional[str] = None,
) -> Optional[float]:
"""Return a fixed temperature for models with strict sampling contracts."""
try:
from agent.auxiliary_client import _fixed_temperature_for_model
except Exception:
return None
return _fixed_temperature_for_model(model)
return _fixed_temperature_for_model(model, base_url)
@@ -457,7 +460,10 @@ Complete the user's task step by step."""
"tools": self.tools,
"timeout": 300.0,
}
fixed_temperature = _effective_temperature_for_model(self.model)
fixed_temperature = _effective_temperature_for_model(
self.model,
str(getattr(self.client, "base_url", "") or ""),
)
if fixed_temperature is not None:
api_kwargs["temperature"] = fixed_temperature