-
Notifications
You must be signed in to change notification settings - Fork 118
fix: disable thinking chain for Xiaomi MiMo models #143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -79,6 +79,10 @@ export class AIService { | |
| return this.getApiType() === 'openai' && this.config.model.trim() === 'deepseek-reasoner'; | ||
| } | ||
|
|
||
| private isMiMoModel(): boolean { | ||
| return this.config.model.trim().toLowerCase().includes('mimo'); | ||
| } | ||
|
|
||
| private async requestText(options: { | ||
| system: string; | ||
| user: string; | ||
|
|
@@ -97,6 +101,7 @@ export class AIService { | |
| { role: 'user', content: options.user }, | ||
| ]; | ||
| const isDeepSeekReasoner = this.isDeepSeekReasonerModel(); | ||
| const isMiMoModel = this.isMiMoModel(); | ||
|
|
||
| const requestBody = apiType === 'openai-responses' | ||
| ? { | ||
|
|
@@ -105,13 +110,15 @@ export class AIService { | |
| temperature: options.temperature, | ||
| max_output_tokens: options.maxTokens, | ||
| ...(reasoning ? { reasoning } : {}), | ||
| ...(isMiMoModel ? { thinking: { type: 'disabled' } } : {}), | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 感谢审计,但这个结论是错误的。 官方文档明确支持
|
||
| } | ||
| : { | ||
| model: this.config.model, | ||
| messages, | ||
| max_tokens: options.maxTokens, | ||
| ...(!isDeepSeekReasoner ? { temperature: options.temperature } : {}), | ||
| ...(!isDeepSeekReasoner && reasoning && apiType !== 'openai-compatible' ? { reasoning } : {}), | ||
| ...(isMiMoModel ? { thinking: { type: 'disabled' } } : {}), | ||
| }; | ||
|
|
||
| let data: Record<string, unknown>; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
Xiaomi MiMo API thinking parameter format and valid values💡 Result:
The Xiaomi MiMo API (OpenAI-compatible /v1/chat/completions endpoint) supports a "thinking" parameter to enable the model's reasoning mode, which outputs reasoning_content in responses alongside content or tool_calls [1][2]. Parameter formats and valid values from sources: 1. Object format (Xiaomi API docs): thinking: { type: "enabled" } [1] 2. Boolean flag in chat_template_kwargs (local/self-hosted MiMo-V2-Flash): "chat_template_kwargs": { "enable_thinking": true } [2] 3. Boolean in extra_body (API wrappers): extra_body={"enable_thinking": True} [3] When enabled, responses include reasoning_content (persist it in messages for multi-turn consistency, especially with tools) [2]. Different providers (e.g., api.xiaomimimo.com, self-hosted, OpenRouter) vary slightly in param location but use true/enabled to activate [1][2][4][3]. No explicit "disabled" values documented beyond omitting the param.
Citations:
🏁 Script executed:
Repository: AmintaCCCP/GithubStarsManager
Length of output: 15219
Remove the undocumented
thinking: { type: 'disabled' }parameter — it's not supported by Xiaomi MiMo API.The official Xiaomi MiMo API documentation only documents
thinking: { type: "enabled" }to activate reasoning mode. The"disabled"value is not part of the API specification. The correct approach to disable thinking is to omit the parameter entirely, which the code already does whenisMiMoModelis false.Either remove lines 113 and 121 or conditionally add
thinking: { type: "enabled" }only when thinking should be enabled.🤖 Prompt for AI Agents