Xiaomi MiMo provider profile - sends reasoning_effort to MiMo API
The bundled Xiaomi profile lacks build_api_kwargs_extras, so reasoning_effort was parsed from config but silently dropped. This user plugin overrides the profile with the missing method. Mapping: xhigh->high, high->high, medium->medium, low->low, none->omit
This commit is contained in:
commit
24f04ad6f8
23
SKILL.md
Normal file
23
SKILL.md
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Xiaomi MiMo Provider Profile
|
||||||
|
|
||||||
|
Sends `reasoning_effort` as a top-level API parameter to the Xiaomi MiMo API.
|
||||||
|
|
||||||
|
## What it fixes
|
||||||
|
|
||||||
|
The bundled Xiaomi provider profile in Hermes does not include a `build_api_kwargs_extras` method, so the `reasoning_effort` parameter from config is parsed but silently dropped. This plugin overrides that profile with the missing method.
|
||||||
|
|
||||||
|
## Mapping
|
||||||
|
|
||||||
|
- `xhigh` → `high` (MiMo API only accepts low/medium/high)
|
||||||
|
- `high` → `high`
|
||||||
|
- `medium` → `medium`
|
||||||
|
- `low` → `low`
|
||||||
|
- `none`/empty → omitted
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Deployed as a user plugin to `/opt/data/plugins/model-providers/xiaomi/`. User plugins load after bundled ones with last-writer-wins, so this persists across container restarts without modifying the image.
|
||||||
|
|
||||||
|
## Files
|
||||||
|
|
||||||
|
- `plugins/model-providers/xiaomi/__init__.py` — Provider profile override
|
||||||
43
plugins/model-providers/xiaomi/__init__.py
Normal file
43
plugins/model-providers/xiaomi/__init__.py
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
"""Xiaomi MiMo provider profile — user override.
|
||||||
|
|
||||||
|
Extends the bundled Xiaomi profile to send ``reasoning_effort`` as a
|
||||||
|
top-level API parameter. The MiMo API accepts ``low``, ``medium``,
|
||||||
|
``high`` (``xhigh`` is clamped to ``high``).
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
from providers import register_provider
|
||||||
|
from providers.base import ProviderProfile
|
||||||
|
|
||||||
|
|
||||||
|
class XiaomiProfile(ProviderProfile):
|
||||||
|
"""Xiaomi MiMo — top-level reasoning_effort."""
|
||||||
|
|
||||||
|
def build_api_kwargs_extras(
|
||||||
|
self, *, reasoning_config: dict | None = None, model: str | None = None, **context
|
||||||
|
) -> tuple[dict[str, Any], dict[str, Any]]:
|
||||||
|
extra_body: dict[str, Any] = {}
|
||||||
|
top_level: dict[str, Any] = {}
|
||||||
|
|
||||||
|
if isinstance(reasoning_config, dict):
|
||||||
|
effort = (reasoning_config.get("effort") or "").strip().lower()
|
||||||
|
if effort in ("xhigh",):
|
||||||
|
top_level["reasoning_effort"] = "high"
|
||||||
|
elif effort in ("low", "medium", "high"):
|
||||||
|
top_level["reasoning_effort"] = effort
|
||||||
|
|
||||||
|
return extra_body, top_level
|
||||||
|
|
||||||
|
|
||||||
|
xiaomi = XiaomiProfile(
|
||||||
|
name="xiaomi",
|
||||||
|
aliases=("mimo", "xiaomi-mimo"),
|
||||||
|
env_vars=("XIAOMI_API_KEY",),
|
||||||
|
base_url="https://api.xiaomimimo.com/v1",
|
||||||
|
supports_health_check=False,
|
||||||
|
)
|
||||||
|
|
||||||
|
register_provider(xiaomi)
|
||||||
Loading…
x
Reference in New Issue
Block a user