Salvages the Xiaomi MiMo thinking/replay fixes from #27886/#25379/#26802/#27363 into one provider cluster, with MiMo reasoning replay enabled for native Xiaomi endpoints plus Nous/OpenRouter Xiaomi slugs. Co-authored-by: EloquentBrush0x <283442588+EloquentBrush0x@users.noreply.github.com> Co-authored-by: Peterson <pppan2003@gmail.com> Co-authored-by: Zhao Zhuoran <zhao.zr11@protonmail.com> Co-authored-by: zccyman <zccyman@users.noreply.github.com>
39 lines
1.2 KiB
Python
39 lines
1.2 KiB
Python
"""Xiaomi MiMo provider profile."""
|
|
|
|
from typing import Any
|
|
|
|
from providers import register_provider
|
|
from providers.base import ProviderProfile
|
|
|
|
|
|
class XiaomiProfile(ProviderProfile):
|
|
"""Xiaomi MiMo — explicit thinking disable support."""
|
|
|
|
def build_api_kwargs_extras(
|
|
self,
|
|
*,
|
|
reasoning_config: dict | None = None,
|
|
**context: Any,
|
|
) -> tuple[dict[str, Any], dict[str, Any]]:
|
|
if not reasoning_config or not isinstance(reasoning_config, dict):
|
|
return {}, {}
|
|
|
|
effort = str(reasoning_config.get("effort") or "").strip().lower()
|
|
enabled = reasoning_config.get("enabled", True)
|
|
if enabled is False or effort == "none":
|
|
return {"thinking": {"type": "disabled"}}, {}
|
|
return {}, {}
|
|
|
|
|
|
xiaomi = XiaomiProfile(
|
|
name="xiaomi",
|
|
aliases=("mimo", "xiaomi-mimo"),
|
|
env_vars=("XIAOMI_API_KEY",),
|
|
base_url="https://api.xiaomimimo.com/v1",
|
|
supports_health_check=False, # /v1/models returns 401 even with valid key
|
|
supports_vision=True, # mimo-v2.5 / omni variants are vision-capable
|
|
supports_vision_tool_messages=False, # rejects list-type tool content (400 "text is not set")
|
|
)
|
|
|
|
register_provider(xiaomi)
|