SIGN IN SIGN UP

fix(chat): enable native tool calling for reasoning models via OpenAI-compatible endpoints (#528)

* fix(chat): disable thinking mode for native tool calling and strip TOOL label when unavailable

* fix(chat): only disable thinking for reasoning models when native tool calling is active

Previous fix unconditionally set enable_thinking=False for all models
when use_native_tools=True. Now gate on has_thinking_tags() so only
reasoning models (e.g. Qwen3.6-Plus matched via "qwen" prefix) get
thinking disabled. Non-reasoning models are unaffected.

* fix: enable native tool_calls for reasoning models via custom OpenAI binding

Reasoning models (e.g. Qwen3.6-Plus) accessed through a generic OpenAI-compatible binding lacked the enable_thinking parameter that DashScope sets automatically. Without it the Bailian API defaults to thinking mode but the label protocol confuses the model into writing tool-call JSON inside content instead of using native tool_calls, causing tool_without_calls violations and infinite retries. Changes: Inject enable_thinking True for reasoning models whose binding lacks a thinking_style; Append a system-prompt note telling reasoning models to ignore the label protocol; Use implicit_think_label LABEL_FINISH for reasoning models with native tool calling.

* fix: escape quotes in reasoner protocol note strings

* fix(chat): fix Qwen 3.6 Plus tool call failures

- Move _is_reasoner assignment before first use to fix UnboundLocalError
- Add custom binding capabilities for OpenAI-compatible endpoints
- Enable supports_tools and has_thinking_tags for custom providers

Fixes tool call failures with reasoning models via OpenAI-compatible APIs

* fix(capabilities): change custom binding has_thinking_tags to False

Rely on MODEL_OVERRIDES for per-model detection (qwen/deepseek/qwq
prefixes) instead of hardcoding True for all custom endpoints.
Prevents enable_thinking injection and reasoner protocol notes from
being incorrectly applied to non-reasoning models like GPT-4o.
W
wedone committed
b2f2002a0a620d3f5c31de0e8de948bb8aaee2dd
Parent: c1932dc
Committed by GitHub <noreply@github.com> on 5/27/2026, 12:22:22 PM