fix(providers): omit Kimi K2.5/K2.6 temperature
This commit is contained in:
committed by
chengyongru
parent
b4adb29c2b
commit
8a48af7c74
@@ -71,6 +71,10 @@ _KIMI_ALWAYS_THINKING_MODELS: frozenset[str] = frozenset({
|
||||
"kimi-k2.7-code",
|
||||
"kimi-k2.7-code-highspeed",
|
||||
})
|
||||
_KIMI_SERVER_MANAGED_TEMPERATURE_MODELS: frozenset[str] = frozenset({
|
||||
"kimi-k2.5",
|
||||
"kimi-k2.6",
|
||||
})
|
||||
_TEXT_TOOL_CALL_RE = re.compile(r"<tool_call>\s*(.*?)\s*</tool_call>", re.DOTALL)
|
||||
# Thinking-capable MiMo models per Xiaomi docs (see
|
||||
# tests/providers/test_xiaomi_mimo_thinking.py). mimo-v2-flash is omitted
|
||||
@@ -764,6 +768,16 @@ class OpenAICompatProvider(LLMProvider):
|
||||
kwargs.update(overrides)
|
||||
break
|
||||
|
||||
# Moonshot selects the only valid temperature from the K2.5/K2.6 thinking mode:
|
||||
# 1.0 when enabled and 0.6 when disabled. Omitting the parameter lets the API
|
||||
# apply the matching value for both its default and explicit thinking controls.
|
||||
if (
|
||||
spec
|
||||
and spec.name == "moonshot"
|
||||
and _model_slug(model_name) in _KIMI_SERVER_MANAGED_TEMPERATURE_MODELS
|
||||
):
|
||||
kwargs.pop("temperature", None)
|
||||
|
||||
# Normalize reasoning_effort into a semantic form (OpenAI vocab)
|
||||
# used for internal decisions, and a wire form actually sent out.
|
||||
# "minimum" is accepted as a DashScope-native alias for "minimal".
|
||||
|
||||
@@ -471,7 +471,8 @@ PROVIDERS: tuple[ProviderSpec, ...] = (
|
||||
default_api_base="https://dashscope.aliyuncs.com/compatible-mode/v1",
|
||||
thinking_style="enable_thinking",
|
||||
),
|
||||
# Moonshot (月之暗面): Kimi K2.5+ enforce temperature >= 1.0.
|
||||
# Moonshot (月之暗面): Kimi K2.5/K2.6 choose temperature from thinking mode;
|
||||
# the OpenAI-compatible provider omits it. K2.7 models require 1.0.
|
||||
ProviderSpec(
|
||||
name="moonshot",
|
||||
keywords=("moonshot", "kimi"),
|
||||
@@ -480,8 +481,6 @@ PROVIDERS: tuple[ProviderSpec, ...] = (
|
||||
backend="openai_compat",
|
||||
default_api_base="https://api.moonshot.ai/v1",
|
||||
model_overrides=(
|
||||
("kimi-k2.5", {"temperature": 1.0}),
|
||||
("kimi-k2.6", {"temperature": 1.0}),
|
||||
("kimi-k2.7", {"temperature": 1.0}),
|
||||
("kimi-k2.7-code", {"temperature": 1.0}),
|
||||
("kimi-k2.7-code-highspeed", {"temperature": 1.0}),
|
||||
|
||||
Reference in New Issue
Block a user