Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Fix Inkling reasoning-effort coercion for duck-typed engine stand-ins (#7158)
Daniel Han030f12753c77
diff --git a/studio/backend/core/inference/llama_cpp.py b/studio/backend/core/inference/llama_cpp.pyindex e797cfe22a7..06b68ea8311 100644--- a/studio/backend/core/inference/llama_cpp.py+++ b/studio/backend/core/inference/llama_cpp.py@@ -1541,6 +1541,31 @@ def _is_external_link(path: Path) -> bool:return False+# Inkling's template takes a numeric thinking-effort dial (0..0.99) and its+# float() coercion turns unrecognized named levels into 0, i.e. no thinking.+# Map OpenAI-style names to the values the model was trained on. Module-level+# so duck-typed engine stand-ins in tests do not need the attribute.+_INKLING_REASONING_EFFORT = {+ "none": 0.0,+ "minimal": 0.1,+ "low": 0.2,+ "medium": 0.7,+ "high": 0.9,+ "xhigh": 0.99,+ "max": 0.99,+}+++def _coerce_reasoning_effort(architecture, kwargs: dict) -> dict:+ if architecture == "inkling":+ effort = kwargs.get("reasoning_effort")+ if isinstance(effort, str):+ mapped = _INKLING_REASONING_EFFORT.get(effort.strip().lower())+ if mapped is not None:+ kwargs["reasoning_effort"] = mapped+ return kwargs++class LlamaCppBackend:"""Manages a llama-server subprocess for GGUF model inference.@@ -1941,36 +1966,15 @@ class LlamaCppBackend:def reasoning_default(self) -> bool:return self._reasoning_default- # Inkling's template takes a numeric thinking-effort dial (0..0.99) and its- # float() coercion turns unrecognized named levels into 0, i.e. no thinking.- # Map OpenAI-style names to the values the model was trained on.- _INKLING_REASONING_EFFORT = {- "none": 0.0,- "minimal": 0.2,- "low": 0.2,- "medium": 0.7,- "high": 0.9,- "xhigh": 0.99,- "max": 0.99,- }-- def _coerce_reasoning_effort(self, kwargs: dict) -> dict:- if getattr(self, "_architecture", None) == "inkling":- effort = kwargs.get("reasoning_effort")- if isinstance(effort, str):- mapped = self._INKLING_REASONING_EFFORT.get(effort.strip().lower())- if mapped is not None:- kwargs["reasoning_effort"] = mapped- return kwargs-def _reasoning_kwargs(self, enable_thinking: bool) -> dict:if self._reasoning_style == "enable_thinking_effort":# GLM-5.2-style: enable_thinking is the on/off gate; when on, leave# the template's default effort (max) in place.return {"enable_thinking": enable_thinking}if self._reasoning_style == "reasoning_effort":- return self._coerce_reasoning_effort(- {"reasoning_effort": "high" if enable_thinking else "low"}+ return _coerce_reasoning_effort(+ getattr(self, "_architecture", None),+ {"reasoning_effort": "high" if enable_thinking else "low"},)return {"enable_thinking": enable_thinking}@@ -2019,7 +2023,7 @@ class LlamaCppBackend:kwargs["enable_thinking"] = enable_thinkingif self._supports_preserve_thinking and preserve_thinking is not None:kwargs["preserve_thinking"] = preserve_thinking- self._coerce_reasoning_effort(kwargs)+ _coerce_reasoning_effort(getattr(self, "_architecture", None), kwargs)return kwargs or None@property