Skip to content

Your lightweight open-source personal agent.

feat(think): adjust thinking method for dashscope and modelark

PlayDustinDBbd94454b91ba
diff --git a/nanobot/providers/openai_compat_provider.py b/nanobot/providers/openai_compat_provider.py
index 7149b95e1..b49a0b32c 100644
--- a/nanobot/providers/openai_compat_provider.py
+++ b/nanobot/providers/openai_compat_provider.py
@@ -297,6 +297,23 @@ class OpenAICompatProvider(LLMProvider):
if reasoning_effort:
kwargs["reasoning_effort"] = reasoning_effort
+ # Provider-specific thinking parameters
+ if spec:
+ # Refer: https://docs.byteplus.com/en/docs/ModelArk/1449737#adjust-reasoning-length
+ # The agent will stop thinking if reasoning_effort is minimal or None. Otherwise, it will think.
+ thinking_enabled = (
+ reasoning_effort is not None and reasoning_effort.lower() != "minimal"
+ )
+ if spec.name == "dashscope":
+ # Qwen: extra_body={"enable_thinking": True/False}
+ kwargs["extra_body"] = {"enable_thinking": thinking_enabled}
+ elif spec.name in ("volcengine", "volcengine_coding_plan"):
+ # VolcEngine/Byteplus ModelArk: extra_body={"thinking": {"type": "enabled"/"disabled"}}
+ kwargs["extra_body"] = {
+ "thinking": {"type": "enabled" if thinking_enabled else "disabled"}
+ }
+
+
if tools:
kwargs["tools"] = tools
kwargs["tool_choice"] = tool_choice or "auto"