MiMo-V2.6-Pro · workflow
对 mimo-v2.6-pro,官方工作流是“模型返回完整 assistant(包括 reasoning_content 和 tool_calls)→ 客户端执行工具 → 追加 role: tool 结果 → 再请求模型”,直到本轮不再产生工具调用。
用 MiMo-V2.6-Pro 处理 {{TASK}}:先固定 {{MODEL_ID}} 和 {{INPUT_FORMAT}},再按 {{TOOL_STEPS}} 执行,并用 {{ACCEPTANCE}} 核对结果。
运行前替换每个变量,并把实际取值写进验收记录。运行前仍需替换: {{TASK}}, {{MODEL_ID}}, {{INPUT_FORMAT}}, {{TOOL_STEPS}}, {{ACCEPTANCE}}
用 MiMo-V2.6-Pro 处理 {{TASK}}:先固定 {{MODEL_ID}} 和 {{INPUT_FORMAT}},再按 {{TOOL_STEPS}} 执行,并用 {{ACCEPTANCE}} 核对结果。
对 mimo-v2.6-pro,官方工作流是“模型返回完整 assistant(包括 reasoning_content 和 tool_calls)→ 客户端执行工具 → 追加 role: tool 结果 → 再请求模型”,直到本轮不再产生工具调用。
适合的任务:需要实时信息、外部函数、多个工具协同、连续追问和多步 Agent 编排的任务。
不适合的任务:未经用户确认的支付、删除、发信、改权限等副作用操作;工具执行权限不由模型自动安全兜底。
适用的模型版本:mimo-v2.6-pro。联网搜索页还列出其他 MiMo 版本,但本文代码和结论只针对 Pro。
适用的客户端、Agent 或 API:OpenAI Chat Completions 兼容 API。官方联网搜索页明确写明该插件暂不支持其他 API 协议。
推荐的推理档位和参数:多轮工具调用显式使用 extra_body={"thinking": {"type": "enabled"}},并让 max_completion_tokens 覆盖思考与最终答案总长度;深度思考下不要依赖自定义 temperature、top_p。
以下 schema 来自官方“深度思考下的多轮工具调用”示例,模型 ID 已明确为 mimo-v2.6-pro。工具函数本身需要由客户端实现,不能把 schema 当成已执行的权限。
import json
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ.get("MIMO_API_KEY"),
base_url="https://api.xiaomimimo.com/v1",
)
tools = [
{
"type": "function",
"function": {
"name": "get_current_weather",
"description": "Get the current weather for a given city",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "City name, e.g. Beijing",
},
"unit": {
"type": "string",
"enum": ["celsius", "fahrenheit"],
},
},
"required": ["location"],
},
},
},
{
"type": "function",
"function": {
"name": "get_time",
"description": "Get the current time in a given timezone",
"parameters": {
"type": "object",
"properties": {
"timezone": {
"type": "string",
"description": "Timezone, e.g. Asia/Shanghai",
}
},
"required": ["timezone"],
},
},
},
]这是官方示例的可复用核心。messages.append(assistant_message) 必须保留完整 assistant 消息;不要只保存 content 或只保存工具参数。
def get_current_weather(location: str, unit: str = "celsius") -> str:
# 用真实业务服务替换;示例数据不是天气事实。
weather_data = {
"Beijing": "Sunny 25°C",
"Shanghai": "Cloudy 22°C",
"Shenzhen": "Rainy 28°C",
}
return weather_data.get(location, f"Weather unknown for {location}")
def get_time(timezone: str) -> str:
from datetime import datetime
return datetime.now().strftime(f"%Y-%m-%d %H:%M:%S ({timezone})")
TOOL_MAP = {
"get_current_weather": get_current_weather,
"get_time": get_time,
}
def run_turn(messages, turn_num, max_requests=8):
request_num = 0
while True:
request_num += 1
if request_num > max_requests:
raise RuntimeError("tool loop exceeded the local safety limit")
response = client.chat.completions.create(
model="mimo-v2.6-pro",
messages=messages,
tools=tools,
extra_body={"thinking": {"type": "enabled"}},
)
assistant_message = response.choices[0].message
# 保留 reasoning_content、content、tool_calls 及其顺序。
messages.append(assistant_message)
if not assistant_message.tool_calls:
return assistant_message.content
for tool_call in assistant_message.tool_calls:
name = tool_call.function.name
if name not in TOOL_MAP:
raise PermissionError(f"tool is not allowlisted: {name}")
args = json.loads(tool_call.function.arguments)
result = TOOL_MAP[name](**args)
messages.append({
"role": "tool",
"tool_call_id": tool_call.id,
"content": result,
})
messages = [
{
"role": "user",
"content": "How is the weather in Beijing today? What time is it now?",
}
]
run_turn(messages, turn_num=1)
# 第二轮继续复用同一个 messages;第一轮 assistant 的
# reasoning_content、content、tool_calls 和 tool 结果都仍在历史中。
messages.append({
"role": "user",
"content": "How about Shanghai? And is it hotter or colder than Beijing?",
})
run_turn(messages, turn_num=2)联网搜索不是自定义 Function。官方页面的 mimo-v2.6-pro 示例使用 type: "web_search",并通过 max_keyword、force_search、limit 和近似位置控制一次请求:
completion = client.chat.completions.create(
model="mimo-v2.6-pro",
messages=[
{"role": "user", "content": "武汉明天天气怎么样?"},
],
max_completion_tokens=1024,
stream=False,
extra_body={"thinking": {"type": "disabled"}},
tools=[
{
"type": "web_search",
"max_keyword": 3,
"force_search": True,
"limit": 1,
"user_location": {
"type": "approximate",
"country": "China",
"region": "Hubei",
"city": "Wuhan",
},
}
],
tool_choice="auto",
)在 Xiaomi MiMo 控制台开通联网服务插件(仅联网搜索工作流需要),并从环境变量读取 API Key。
对自定义函数使用严格的 JSON Schema:列出函数名、用途、参数类型、枚举值和必填字段;客户端只注册允许执行的函数。
发送 tools 和用户消息。复杂多步任务开启 thinking.type=enabled;若使用 Python SDK,thinking 放在 extra_body,不是顶层 OpenAI 标准参数。
收到 assistant 后先把完整消息加入 messages,再解析 tool_calls。如果有多个调用,逐个校验名称和参数;彼此独立且无副作用的读取操作可以受控并行执行,然后按原调用顺序追加对应 role: tool 消息。
追加所有工具结果后再次请求 mimo-v2.6-pro。重复“请求→执行→追加”直到 assistant 没有 tool_calls,再把 content 返回给用户。
下一轮用户追问只能在同一历史中追加新的 role: user;不要丢弃此前带 reasoning_content 的 assistant 消息。
验证每轮 response.model == "mimo-v2.6-pro"、finish_reason、工具名、JSON 参数、tool_call_id 对应关系和最终 content;记录输入/输出 token、工具调用次数、错误和耗时。
本地增加最大请求轮数、超时、取消、重试和成本上限。官方示例展示了循环,但没有公开一个可依赖的最大工具调用轮数或最大并行调用数。
官方列出 mimo-v2.6-pro 支持 thinking.type 的 enabled/disabled。
官方示例的第一轮同时调用 get_current_weather 与 get_time,客户端执行工具并把结果以 role: "tool" 追加,再发起下一次请求;第二轮在保留第一轮上下文的情况下追加用户追问。
官方要求:在开启深度思考且历史中有工具调用时,后续用户交互轮次若 assistant 含工具调用,必须完整回传 reasoning_content;缺失会导致 API 返回 400,也可能造成指令遵循下降或幻觉增多。
官方说明流式响应先输出 reasoning_content 增量,再输出 content 增量;若要跨轮使用,客户端应拼接并持久化对应字段。
官方说明深度思考下不支持自定义 temperature 和 top_p,实际采用推荐默认值 1.0 和 0.95;max_completion_tokens 同时限制思考和最终回答。
官方示例明确使用 model="mimo-v2.6-pro" 和 type: "web_search"。
页面说明联网搜索支持强制搜索和意图识别;force_search=true 可避免模型判断无需搜索时直接回答。
页面说明一轮搜索可能按多个关键词多次调用联网插件,max_keyword 可限制一轮最大关键词数量并控制调用频次与成本;示例值为 3。
页面说明联网搜索可与自定义 Function、其他工具混合,模型会判断调用优先级和必要性;流式首包会返回搜索来源,流式和非流式都返回搜索与总结内容。
官方示例响应的 model 为 mimo-v2.6-pro,并返回 annotations 中的 url_citation 来源字段。
reasoning_content 是深度思考多轮工具调用的历史字段,不能因为用户只关心最终答案就删除;工具调用历史要整体持久化。
官方示例显示两个独立工具在同一 assistant 响应中返回,但没有承诺任意数量的并行调用;生产实现应设置并发上限,并对写操作默认串行和二次确认。
官方代码中的天气字典和时间函数只是演示工具执行接口,不是官方天气数据,也不代表模型联网能力的测评结果。
模型只提出工具调用,不应直接获得数据库、文件系统、网络或账户权限。生产端应做 allowlist、JSON Schema 校验、最小权限、用户确认、超时、审计和脱敏。
联网搜索插件需要单独开通;模型可能判断无需搜索,且官方说明缓存开关变化最长可能有 5 分钟延迟。要验证强制联网,应检查响应中的 annotations/url_citation,不能只看 HTTP 200。
该工作流针对托管 API 的 mimo-v2.6-pro;不能把 MiMo-V2.6-Pro-RL 本地 checkpoint、mimo-v2.6-pro-ultraspeed 或 mimo-v2.6-flash 的模板和行为直接替换进来。
官方没有公开完整业务工具服务器、并发上限、最大循环次数或安全策略;文中 max_requests=8、allowlist 和权限校验属于客户端安全护栏,不是 Xiaomi 的服务端限制。
官方原文要求多轮工具调用“必须完整回传 reasoning_content 字段”。
官方联网搜索页写明:“多工具混合调用”,可与自定义 Function 协同使用。
官方联网搜索示例的模型字段为 mimo-v2.6-pro,并展示 max_keyword: 3、force_search: True、tool_choice="auto"。
Xiaomi MiMo 官方文档 · 原文日期: 2026-09-22 · 编辑日期: 2026-09-22
阅读原始来源MiMo-V2.6-Pro
请在上方所列环境中运行本指南。下载不会自动传入模板,也不代表账户已开放该模型。