feat(llm): support multi-provider disableThinking strategies#228
Open
jackson-jia-914 wants to merge 1 commit into
Open
feat(llm): support multi-provider disableThinking strategies#228jackson-jia-914 wants to merge 1 commit into
jackson-jia-914 wants to merge 1 commit into
Conversation
…tion models
Support multiple inference engines and model providers via a strategy
enum so each receives its own thinking-disabling field in
chat-completion request bodies.
Strategies:
- "vllm" → chat_template_kwargs: { enable_thinking: false } (vLLM / SGLang)
- "deepseek" → enable_thinking: false (DeepSeek official API)
- "dashscope" → enable_thinking: false (Alibaba DashScope / Qwen)
- "openai" → reasoning_effort: "low" (OpenAI o-series, cannot fully disable)
- "anthropic" → thinking: { type: "disabled" } (Anthropic Claude)
- "kimi" → thinking: { type: "disabled" } (Kimi / Moonshot)
- "gemini" → thinking_config: { thinking_budget: 0 } (Google Gemini)
Defaults to false (no wrapper). Also accepts boolean true as a shorthand
for "vllm" for convenience.
Covered paths:
- StandaloneLLMRunner (OpenClaw plugin + gateway): llm.disableThinking,
wired through parseConfig, tdai-core, seed-runtime, and gateway config
(TDAI_LLM_DISABLE_THINKING env also accepts strategy names).
- Offload local mode (L1/L1.5/L2): separate offload.disableThinking.
The fetch wrapper lives in src/utils/no-think-fetch.ts with a
STRATEGY_TRANSFORMERS map for clean dispatch. StandaloneLLMRunner builds
it once in the constructor; LocalLlmClient caches it at construction
time and passes it through to callLlm().
Add vitest unit tests for all 7 strategies, normalization, validation,
embedding skip, and non-JSON tolerance (20 tests total).
Signed-off-by: jackson.jia <jiazhenghua0@gmail.com>
Collaborator
|
Thanks for the contribution! Supporting disableThinking across 7 inference engines is a useful enhancement. We'll evaluate it internally and get back to you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add
disableThinkingoption to suppress reasoning in extraction models, covering 7 mainstream inference engines and model providers.Supported Strategies
"vllm"chat_template_kwargs: { enable_thinking: false }"deepseek"enable_thinking: false(top-level)"dashscope"enable_thinking: false(top-level)"openai"reasoning_effort: "low""anthropic"thinking: { type: "disabled" }"kimi"thinking: { type: "disabled" }"gemini"thinking_config: { thinking_budget: 0 }Key Design Decisions
trueis equivalent to"vllm",false/ unset = no injectionstrategy === false, returnsglobalThis.fetchdirectly with no wrappersrc/utils/no-think-fetch.tswith aSTRATEGY_TRANSFORMERSmap; TypeScript ensures compile-time coverage of all strategiesmessagesarray (chat completions); embedding and other non-chat requests pass through unchangedStandaloneLLMRunnerandLocalLlmClientcreate and cache the fetch wrapper in the constructor, avoiding per-call recreationCovered Paths
llm.disableThinking, wired throughparseConfig→TdaiCore→StandaloneLLMRunnerFactory; Gateway also supportsTDAI_LLM_DISABLE_THINKINGenv var (accepts strategy names or booleans)offload.disableThinkingconfigError Handling
console.warn+ fallback tofalse(no injection)Change Type
Self-test Checklist
Additional Notes
Test Coverage
falsepassthrough, embedding skip, non-JSON tolerance, strategy validation, and normalization