[Bugfix] Add Kimi-K2.5 reasoning/tool parser aliases and tool_call_id support (#37438)

Signed-off-by: DorBernsohn <dor.bernsohn@gmail.com>
This commit is contained in:
DorBernsohn
2026-03-19 21:08:00 +08:00
committed by GitHub
parent a32eaf5bb2
commit c63ca2b2e6
4 changed files with 173 additions and 18 deletions
+14
View File
@@ -1660,6 +1660,20 @@ def get_history_tool_calls_cnt(conversation: list[ConversationMessage]):
return idx
_KIMI_MODEL_TYPES = ("kimi_k2", "kimi_k25")
def get_tool_call_id_type(model_config: ModelConfig) -> str:
"""Return the tool-call ID type for a given model configuration."""
hf_overrides = getattr(model_config, "hf_overrides", None)
if model_config.hf_text_config.model_type in _KIMI_MODEL_TYPES or (
isinstance(hf_overrides, dict)
and hf_overrides.get("model_type") in _KIMI_MODEL_TYPES
):
return "kimi_k2"
return "random"
def make_tool_call_id(id_type: str = "random", func_name=None, idx=None):
if id_type == "kimi_k2":
return f"functions.{func_name}:{idx}"