初始化项目,由ModelHub XC社区提供模型
Model: miromind-ai/MiroThinker-1.7-mini Source: Original Platform
This commit is contained in:
65
.gitattributes
vendored
Normal file
65
.gitattributes
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.model filter=lfs diff=lfs merge=lfs -text
|
||||
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
||||
*.tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||
*.db* filter=lfs diff=lfs merge=lfs -text
|
||||
*.ark* filter=lfs diff=lfs merge=lfs -text
|
||||
**/*ckpt*data* filter=lfs diff=lfs merge=lfs -text
|
||||
**/*ckpt*.meta filter=lfs diff=lfs merge=lfs -text
|
||||
**/*ckpt*.index filter=lfs diff=lfs merge=lfs -text
|
||||
|
||||
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||
*.gguf* filter=lfs diff=lfs merge=lfs -text
|
||||
*.ggml filter=lfs diff=lfs merge=lfs -text
|
||||
*.llamafile* filter=lfs diff=lfs merge=lfs -text
|
||||
*.pt2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||
|
||||
model-00002-of-00013.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
model-00001-of-00013.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
model-00003-of-00013.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
||||
model-00005-of-00013.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
model-00007-of-00013.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
model.safetensors.index.json filter=lfs diff=lfs merge=lfs -text
|
||||
merges.txt filter=lfs diff=lfs merge=lfs -text
|
||||
model-00011-of-00013.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
model-00013-of-00013.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
model-00012-of-00013.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
model-00006-of-00013.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
model-00008-of-00013.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
model-00010-of-00013.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
model-00009-of-00013.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
vocab.json filter=lfs diff=lfs merge=lfs -text
|
||||
model-00004-of-00013.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
394
README.md
Normal file
394
README.md
Normal file
@@ -0,0 +1,394 @@
|
||||
---
|
||||
library_name: transformers
|
||||
pipeline_tag: text-generation
|
||||
license: apache-2.0
|
||||
language:
|
||||
- en
|
||||
base_model:
|
||||
- Qwen/Qwen3-235B-A22B-Thinking-2507
|
||||
tags:
|
||||
- agent
|
||||
- open-source
|
||||
- miromind
|
||||
- deep-research
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<img src="https://cdn-uploads.huggingface.co/production/uploads/6466e7be1343dce20e59191b/uWvc1L779NGAT5PB1kldO.png" width="55%" alt="MiroThinker" />
|
||||
</div>
|
||||
|
||||
<div align="center">
|
||||
|
||||
[](https://huggingface.co/collections/miromind-ai/mirothinker-17)
|
||||
[](https://arxiv.org/pdf/2603.15726)
|
||||
|
||||
[](https://github.com/MiroMindAI/MiroThinker)
|
||||
[](https://discord.com/invite/GPqEnkzQZd)
|
||||
[](https://miromind.ai/)
|
||||
|
||||
</div>
|
||||
|
||||
## Introduction
|
||||
|
||||
Our new MiroThinker family represents a significant leap in building reliable agents for long-chain tasks. Engineered with enhanced post-training pipeline, our MiroThinker-1.7 family achieve SOTA performance in deep research tasks among open-source models.
|
||||
|
||||
|
||||
**Key Features**
|
||||
|
||||
- MiroThinker-1.7 supports a 256K context window, long-horizon reasoning, and deep multi-step analysis.
|
||||
- Handles up to 300 tool calls per task, now with more accurate stepwise reasoning and decision-making.
|
||||
- Released in 30B and 235B parameter scales, accompanied by a comprehensive suite of tools and workflows to flexibly support diverse research settings and compute budgets.
|
||||
- Our proprietary agent, MiroThinker-H1 provides promising evidence for long-chain verifiable reasoning — reasoning processes that are step-verifiable and globally verifiable, improving the performance of complex agentic workflows.
|
||||
|
||||
<div align="center">
|
||||
|
||||
| Model Name | Parameters | Max Context | Max Tool Calls | HF Link |
|
||||
|:---------------------:|:-----------------------------:|:-----------:|:--------------:|:------------------------------------------------------------------:|
|
||||
| MiroThinker-1.7-mini | 30B | 256K | 300 | [🤗 link](https://huggingface.co/miromind-ai/MiroThinker-1.7-mini) |
|
||||
| MiroThinker-1.7 | 235B | 256K | 300 | [🤗 link](https://huggingface.co/miromind-ai/MiroThinker-1.7) |
|
||||
|
||||
</div>
|
||||
|
||||
MiroThinker-1.7 demonstrates strong general-research performance across a broad range of benchmarks, achieving 74.0%, 75.3%, 82.7% and 42.9% accuracy on BrowseComp, BrowseComp-ZH, GAIA-Val-165 and HLE-Text, respectively. MiroThinker-1.7 achieves SOTA performance on BrowseComp-ZH.
|
||||
|
||||
|
||||

|
||||
|
||||
More details can be found in our [technical report](https://arxiv.org/pdf/2603.15726).
|
||||
|
||||
## Try MiroThinker Online
|
||||
|
||||
Welcome to try out [MiroThinker](https://dr.miromind.ai/) which offers agentic general QA experience better than OpenAI DeepResearch.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> <div>
|
||||
> Note: This online service is not intended for BrowseComp evaluation. Each query is limited to 100 tool calls for latency and stability. BrowseComp involves long-horizon tasks that typically require over 200 tool calls for our agent, which is outside the scope of this demo.
|
||||
> </div>
|
||||
|
||||
## Performance
|
||||
|
||||
> To prevent potential information leakage (e.g., retrieving benchmark answers from HuggingFace), we blocked access to certain websites during evaluation.
|
||||
|
||||
<div>
|
||||
<img src="https://cdn-uploads.huggingface.co/production/uploads/6466e7be1343dce20e59191b/QdErYcdpCfs6dgiwG6xf8.png" width="100%" alt="MiroThinker" />
|
||||
</div>
|
||||
|
||||
## Quick Start
|
||||
|
||||
For optimal usage, we recommend using MiroThinker with our tool-enabled agent framework and thinking mode enabled. Please refer to our GitHub repository for installation instructions, examples, and full documentation:
|
||||
|
||||
👉 **[https://github.com/MiroMindAI/MiroThinker](https://github.com/MiroMindAI/MiroThinker)**
|
||||
|
||||
### Local Deployment
|
||||
|
||||
It is recommended to use SGLang or vLLM for deploying the agent:
|
||||
|
||||
```shell
|
||||
# SGLang
|
||||
python -m sglang.launch_server --model-path miromind-ai/MiroThinker-1.7-mini --tp 8 --host 0.0.0.0 --port 1234
|
||||
# vLLM
|
||||
vllm serve miromind-ai/MiroThinker-1.7-mini --tensor-parallel-size 8 --max-model-len 262144 --enable-reasoning
|
||||
```
|
||||
|
||||
For optimal performance in agentic tasks, we recommend the following inference parameters:
|
||||
|
||||
```
|
||||
temperature: 1.0
|
||||
top_p: 0.95
|
||||
repetition_penalty: 1.05
|
||||
max_context_length: 262144
|
||||
max_tokens: 16384
|
||||
```
|
||||
|
||||
### Recommended System Prompt
|
||||
|
||||
We use this unified XML-wrapped JSON format to describe and organize all tools. If you have additional tools, please document them using the same structure and formatting to ensure consistent parsing, compatibility, and optimal performance across the environment.
|
||||
|
||||
<details>
|
||||
<summary>Click to expand system prompt example</summary>
|
||||
|
||||
```
|
||||
In this environment you have access to a set of tools you can use to answer the user's question.
|
||||
You only have access to the tools provided below. You can only use one tool per message, and will receive the result of that tool in the user's next response. You use tools step-by-step to accomplish a given task, with each tool-use informed by the result of the previous tool-use. Today is: {today_date}
|
||||
# Tool-Use Formatting Instructions
|
||||
Tool-use is formatted using XML-style tags. The tool-use is enclosed in <use_mcp_tool></use_mcp_tool> and each parameter is similarly enclosed within its own set of tags.
|
||||
The Model Context Protocol (MCP) connects to servers that provide additional tools and resources to extend your capabilities. You can use the server's tools via the `use_mcp_tool`.
|
||||
Description:
|
||||
Request to use a tool provided by a MCP server. Each MCP server can provide multiple tools with different capabilities. Tools have defined input schemas that specify required and optional parameters.
|
||||
Parameters:
|
||||
- server_name: (required) The name of the MCP server providing the tool
|
||||
- tool_name: (required) The name of the tool to execute
|
||||
- arguments: (required) A JSON object containing the tool's input parameters, following the tool's input schema, quotes within string must be properly escaped, ensure it's valid JSON
|
||||
Usage:
|
||||
<use_mcp_tool>
|
||||
<server_name>server name here</server_name>
|
||||
<tool_name>tool name here</tool_name>
|
||||
<arguments>
|
||||
{
|
||||
"param1": "value1",
|
||||
"param2": "value2 \"escaped string\""
|
||||
}
|
||||
</arguments>
|
||||
</use_mcp_tool>
|
||||
Important Notes:
|
||||
- Tool-use must be placed **at the end** of your response, **top-level**, and not nested within other tags.
|
||||
- Always adhere to this format for the tool use to ensure proper parsing and execution.
|
||||
String and scalar parameters should be specified as is, while lists and objects should use JSON format. Note that spaces for string values are not stripped. The output is not expected to be valid XML and is parsed with regular expressions.
|
||||
Here are the functions available in JSONSchema format:
|
||||
## Server name: tool-python
|
||||
### Tool name: create_sandbox
|
||||
Description: Create a linux sandbox.
|
||||
Args:
|
||||
timeout: Time in seconds before the sandbox is automatically shutdown. The default is 600 seconds.
|
||||
Returns:
|
||||
The id of the newly created sandbox. You should use this sandbox_id to run other tools in the sandbox.
|
||||
Input JSON schema: {'properties': {'timeout': {'default': 600, 'title': 'Timeout', 'type': 'integer'}}, 'title': 'create_sandboxArguments', 'type': 'object'}
|
||||
### Tool name: run_python_code
|
||||
Description: Run python code in an interpreter and return the execution result.
|
||||
Args:
|
||||
code_block: The python code to run.
|
||||
sandbox_id: The id of the sandbox to run the code in. Reuse existing sandboxes whenever possible. To create a new sandbox, use tool `create_sandbox`.
|
||||
Returns:
|
||||
A result of the command execution, format like (stderr=..., stdout=..., exit_code=..., error=...)
|
||||
Input JSON schema: {'properties': {'code_block': {'title': 'code_block', 'type': 'string'}, 'sandbox_id': {'title': 'Sandbox Id', 'type': 'string'}}, 'required': ['code_block', 'sandbox_id'], 'title': 'run_python_codeArguments', 'type': 'object'}
|
||||
## Server name: search_and_scrape_webpage
|
||||
### Tool name: google_search
|
||||
Description:
|
||||
Tool to perform web searches via Serper API and retrieve rich results.
|
||||
It is able to retrieve organic search results, people also ask,
|
||||
related searches, and knowledge graph.
|
||||
Args:
|
||||
q: Search query string
|
||||
gl: Optional region code for search results in ISO 3166-1 alpha-2 format (e.g., 'us')
|
||||
hl: Optional language code for search results in ISO 639-1 format (e.g., 'en')
|
||||
location: Optional location for search results (e.g., 'SoHo, New York, United States', 'California, United States')
|
||||
num: Number of results to return (default: 10)
|
||||
tbs: Time-based search filter ('qdr:h' for past hour, 'qdr:d' for past day, 'qdr:w' for past week, 'qdr:m' for past month, 'qdr:y' for past year)
|
||||
page: Page number of results to return (default: 1)
|
||||
autocorrect: Whether to autocorrect spelling in query
|
||||
Returns:
|
||||
Dictionary containing search results and metadata.
|
||||
Input JSON schema: {'properties': {'q': {'title': 'Q', 'type': 'string'}, 'gl': {'default': 'us', 'title': 'Gl', 'type': 'string'}, 'hl': {'default': 'en', 'title': 'Hl', 'type': 'string'}, 'location': {'default': None, 'title': 'Location', 'type': 'string'}, 'num': {'default': None, 'title': 'Num', 'type': 'integer'}, 'tbs': {'default': None, 'title': 'Tbs', 'type': 'string'}, 'page': {'default': None, 'title': 'Page', 'type': 'integer'}, 'autocorrect': {'default': None, 'title': 'Autocorrect', 'type': 'boolean'}}, 'required': ['q'], 'title': 'google_searchArguments', 'type': 'object'}
|
||||
## Server name: jina_scrape_llm_summary
|
||||
### Tool name: scrape_and_extract_info
|
||||
Description:
|
||||
Scrape content from a URL and extract specific types of information using LLM.
|
||||
Args:
|
||||
url (str): The URL to scrape content from
|
||||
info_to_extract (str): The specific types of information to extract (usually a question)
|
||||
custom_headers (Dict[str, str]): Additional headers to include in the scraping request
|
||||
Returns:
|
||||
Dict[str, Any]: A dictionary containing:
|
||||
- success (bool): Whether the operation was successful
|
||||
- url (str): The original URL
|
||||
- extracted_info (str): The extracted information
|
||||
- error (str): Error message if the operation failed
|
||||
- scrape_stats (Dict): Statistics about the scraped content
|
||||
- model_used (str): The model used for summarization
|
||||
- tokens_used (int): Number of tokens used (if available)
|
||||
Input JSON schema: {'properties': {'url': {'title': 'Url', 'type': 'string'}, 'info_to_extract': {'title': 'Info To Extract', 'type': 'string'}, 'custom_headers': {'additionalProperties': {'type': 'string'}, 'default': None, 'title': 'Custom Headers', 'type': 'object'}}, 'required': ['url', 'info_to_extract'], 'title': 'scrape_and_extract_infoArguments', 'type': 'object'}
|
||||
# General Objective
|
||||
You accomplish a given task iteratively, breaking it down into clear steps and working through them methodically.
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### Minimal Runnable Example
|
||||
|
||||
The following example shows how to run a MCP-style tool-calling workflow, including system prompt generation, agent invocation, tool execution, and final response generation.
|
||||
|
||||
Before running the script, make sure to set the required environment variables:
|
||||
|
||||
```bash
|
||||
export OPENAI_API_KEY="your-api-key-here"
|
||||
export BASE_URL="https://your-agent-endpoint.example.com/v1"
|
||||
```
|
||||
|
||||
<details open>
|
||||
<summary>Click to expand python code example</summary>
|
||||
|
||||
```python
|
||||
import json
|
||||
import os
|
||||
import inspect
|
||||
import re
|
||||
from openai import OpenAI
|
||||
from json_repair import repair_json
|
||||
def get_weather(location: str, unit: str = "celsius") -> str:
|
||||
"""
|
||||
Get weather information for a specified location (simulated)
|
||||
|
||||
Args:
|
||||
location: Location name
|
||||
unit: Temperature unit, either celsius or fahrenheit
|
||||
|
||||
Returns:
|
||||
JSON string with weather information
|
||||
"""
|
||||
weather_data = {
|
||||
"London": {"temperature": 15, "condition": "sunny", "humidity": 45},
|
||||
"New York": {"temperature": 20, "condition": "cloudy", "humidity": 60},
|
||||
"Tokyo": {"temperature": 25, "condition": "rainy", "humidity": 75},
|
||||
}
|
||||
weather = weather_data.get(location, {"temperature": 18, "condition": "unknown", "humidity": 50})
|
||||
if unit == "fahrenheit":
|
||||
weather["temperature"] = weather["temperature"] * 9/5 + 32
|
||||
weather["unit"] = "°F"
|
||||
else:
|
||||
weather["unit"] = "°C"
|
||||
return json.dumps(weather, ensure_ascii=False)
|
||||
def calculate(expression: str) -> str:
|
||||
"""
|
||||
Calculate a mathematical expression
|
||||
|
||||
Args:
|
||||
expression: Mathematical expression, e.g., "2 + 3 * 4"
|
||||
|
||||
Returns:
|
||||
Calculation result
|
||||
"""
|
||||
try:
|
||||
result = eval(expression)
|
||||
return json.dumps({"result": result, "expression": expression}, ensure_ascii=False)
|
||||
except Exception as e:
|
||||
return json.dumps({"error": str(e)}, ensure_ascii=False)
|
||||
tools = [
|
||||
{"type": "function", "function": {"name": "get_weather", "parameters": {"type": "object", "properties": {"location": {"type": "string", "description": "Location name"}, "unit": {"type": "string", "enum": ["celsius", "fahrenheit"], "description": "Temperature unit, default is celsius"}}, "required": ["location"]}}},
|
||||
{"type": "function", "function": {"name": "calculate", "parameters": {"type": "object", "properties": {"expression": {"type": "string", "description": "Mathematical expression to calculate, e.g., '2 + 3 * 4'"}}, "required": ["expression"]}}}
|
||||
]
|
||||
available_functions = {"get_weather": get_weather, "calculate": calculate}
|
||||
def parse_mcp_tool_call(response_text: str):
|
||||
"""Parse MCP-style tool call from model response. Returns first tool call or None."""
|
||||
match = re.search(r'<use_mcp_tool>(.*?)</use_mcp_tool>', response_text, re.DOTALL)
|
||||
if not match:
|
||||
return None
|
||||
content = match.group(1)
|
||||
server_match = re.search(r'<server_name>(.*?)</server_name>', content, re.DOTALL)
|
||||
tool_match = re.search(r'<tool_name>(.*?)</tool_name>', content, re.DOTALL)
|
||||
args_match = re.search(r'<arguments>(.*?)</arguments>', content, re.DOTALL)
|
||||
server_name = server_match.group(1).strip() if server_match else None
|
||||
tool_name = tool_match.group(1).strip() if tool_match else None
|
||||
if args_match:
|
||||
try:
|
||||
arguments = json.loads(args_match.group(1).strip())
|
||||
except json.JSONDecodeError as e:
|
||||
print(f"⚠️ Warning: Failed to parse arguments JSON: {e}, attempting to repair...")
|
||||
try:
|
||||
repaired = repair_json(args_match.group(1).strip())
|
||||
arguments = json.loads(repaired)
|
||||
print(f"✅ Successfully repaired JSON")
|
||||
except Exception as repair_error:
|
||||
print(f"❌ Failed to repair JSON: {repair_error}")
|
||||
arguments = {}
|
||||
else:
|
||||
arguments = {}
|
||||
if server_name and tool_name:
|
||||
return {"server_name": server_name, "tool_name": tool_name, "arguments": arguments}
|
||||
return None
|
||||
def generate_mcp_system_prompt(openai_tools: list, available_functions: dict = None, server_name: str = "default", date: str = "2025-11-27") -> str:
|
||||
"""Generate MCP-style system prompt from OpenAI tools format."""
|
||||
prefix = f"""
|
||||
In this environment you have access to a set of tools you can use to answer the user's question.
|
||||
You only have access to the tools provided below. You can only use one tool per message, and will receive the result of that tool in the user's next response. You use tools step-by-step to accomplish a given task, with each tool-use informed by the result of the previous tool-use. Today is: {date}
|
||||
# Tool-Use Formatting Instructions
|
||||
Tool-use is formatted using XML-style tags. The tool-use is enclosed in <use_mcp_tool></use_mcp_tool> and each parameter is similarly enclosed within its own set of tags.
|
||||
The Model Context Protocol (MCP) connects to servers that provide additional tools and resources to extend your capabilities. You can use the server's tools via the `use_mcp_tool`.
|
||||
Description:
|
||||
Request to use a tool provided by a MCP server. Each MCP server can provide multiple tools with different capabilities. Tools have defined input schemas that specify required and optional parameters.
|
||||
Parameters:
|
||||
- server_name: (required) The name of the MCP server providing the tool
|
||||
- tool_name: (required) The name of the tool to execute
|
||||
- arguments: (required) A JSON object containing the tool's input parameters, following the tool's input schema, quotes within string must be properly escaped, ensure it's valid JSON
|
||||
Usage:
|
||||
<use_mcp_tool>
|
||||
<server_name>server name here</server_name>
|
||||
<tool_name>tool name here</tool_name>
|
||||
<arguments>
|
||||
{{
|
||||
"param1": "value1",
|
||||
"param2": "value2 \\"escaped string\\""
|
||||
}}
|
||||
</arguments>
|
||||
</use_mcp_tool>
|
||||
Important Notes:
|
||||
- Tool-use must be placed **at the end** of your response, **top-level**, and not nested within other tags.
|
||||
- Always adhere to this format for the tool use to ensure proper parsing and execution.
|
||||
String and scalar parameters should be specified as is, while lists and objects should use JSON format. Note that spaces for string values are not stripped. The output is not expected to be valid XML and is parsed with regular expressions.
|
||||
Here are the functions available in JSONSchema format:
|
||||
## Server name: {server_name}
|
||||
"""
|
||||
tools_section = []
|
||||
for i, tool in enumerate(openai_tools):
|
||||
if tool.get("type") == "function":
|
||||
func = tool["function"]
|
||||
tool_name = func["name"]
|
||||
func_obj = available_functions[tool_name]
|
||||
full_description = inspect.getdoc(func_obj) or func.get("description", "")
|
||||
if i > 0:
|
||||
tools_section.append("\n")
|
||||
tools_section.append(f"### Tool name: {tool_name}\nDescription: {full_description}\n\nInput JSON schema: {json.dumps(func['parameters'], ensure_ascii=False)}\n")
|
||||
suffix = "\n# General Objective\n\nYou accomplish a given task iteratively, breaking it down into clear steps and working through them methodically."
|
||||
return prefix + ''.join(tools_section) + suffix
|
||||
def run_conversation(user_query: str, model: str = "MiroThinker"):
|
||||
"""Run a complete conversation with tool calling"""
|
||||
system_prompt = generate_mcp_system_prompt(openai_tools=tools, available_functions=available_functions, server_name="My-Tools", date="2025-12-01")
|
||||
client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY", "your-api-key-here"), base_url=os.environ.get("BASE_URL", "your-base-url-here"))
|
||||
print(f"\n{'='*60}\nUser Query: {user_query}\n{'='*60}\n")
|
||||
messages = [{'role': 'system', 'content': system_prompt}, {"role": "user", "content": user_query}]
|
||||
print("📤 Sending request to model...")
|
||||
response = client.chat.completions.create(model=model, messages=messages)
|
||||
response_message = response.choices[0].message
|
||||
response_content = response_message.content
|
||||
tool_call = parse_mcp_tool_call(response_content)
|
||||
print(f"📝 Model response:\n{response_content}\n")
|
||||
messages.append(response_message)
|
||||
if tool_call:
|
||||
server_name = tool_call["server_name"]
|
||||
tool_name = tool_call["tool_name"]
|
||||
function_args = tool_call["arguments"]
|
||||
print(f"\n🔧 Model decided to call tool:\n - Server: {server_name}\n Tool: {tool_name}\n Args: {json.dumps(function_args, ensure_ascii=False)}")
|
||||
function_response = available_functions[tool_name](**function_args)
|
||||
print(f" Result: {function_response}\n")
|
||||
messages.append({"role": "user", "content": function_response})
|
||||
print("📤 Requesting model to generate final response based on tool results...\n")
|
||||
second_response = client.chat.completions.create(model=model, messages=messages)
|
||||
final_message = second_response.choices[0].message.content
|
||||
print(f"💬 Final Response:\n{final_message}\n")
|
||||
return final_message
|
||||
else:
|
||||
print(f"💬 Model Response (no tool calls):\n{response_message.content}\n")
|
||||
return response_message.content
|
||||
def main():
|
||||
"""Run multiple examples"""
|
||||
run_conversation("What's the weather like in London?")
|
||||
# run_conversation("Calculate (25 + 15) * 3 - 10")
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## License
|
||||
|
||||
MiroThinker-1.7 is released under Apache 2.0.
|
||||
|
||||
## Citation
|
||||
|
||||
If you find this project useful in your research, please consider citing:
|
||||
|
||||
```
|
||||
@article{miromind2025mirothinker,
|
||||
title={MiroThinker: Pushing the Performance Boundaries of Open-Source Research Agents via Model, Context, and Interactive Scaling},
|
||||
author={MiroMind Team and Bai, Song and Bing, Lidong and Chen, Carson and Chen, Guanzheng and Chen, Yuntao and Chen, Zhe and Chen, Ziyi and Dong, Xuan and others},
|
||||
journal={arXiv preprint arXiv:2511.11793},
|
||||
year={2025}
|
||||
}
|
||||
```
|
||||
|
||||
## Contact Us
|
||||
|
||||
MiroThinker is developed by the MiroMind AI Team.
|
||||
If you would like to leave us a message, feel free to get in touch.
|
||||
In addition to [GitHub](https://github.com/MiroMindAI/),
|
||||
[Discord](https://discord.com/invite/GPqEnkzQZd),
|
||||
you can also reach us via email at service@miromind.ai.
|
||||
96
chat_template.jinja
Normal file
96
chat_template.jinja
Normal file
@@ -0,0 +1,96 @@
|
||||
{%- set default_system_prompt = '# Role Definition\n- Name: MiroThinker\n- Developer: MiroMind\n- Identity: An AI assistant developed by MiroMind\n- Core Principle: Always respond as MiroThinker and never pretend or claim to be any other AI model\n- Please interact with the user strictly in the identity of MiroThinker.' %}
|
||||
{%- if messages[0].role == 'system' %}
|
||||
{%- set system_prompt = messages[0].content %}
|
||||
{%- else %}
|
||||
{%- set system_prompt = default_system_prompt %}
|
||||
{%- endif %}
|
||||
{%- if tools %}
|
||||
{{- '<|im_start|>system\n' }}
|
||||
{{- system_prompt + '\n\n' }}
|
||||
{{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
|
||||
{%- for tool in tools %}
|
||||
{{- "\n" }}
|
||||
{{- tool | tojson }}
|
||||
{%- endfor %}
|
||||
{{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
|
||||
{%- else %}
|
||||
{{- '<|im_start|>system\n' + system_prompt + '<|im_end|>\n' }}
|
||||
{%- endif %}
|
||||
{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
|
||||
{%- for forward_message in messages %}
|
||||
{%- set index = (messages|length - 1) - loop.index0 %}
|
||||
{%- set message = messages[index] %}
|
||||
{%- set current_content = message.content if message.content is not none else '' %}
|
||||
{%- set tool_start = '<tool_response>' %}
|
||||
{%- set tool_start_length = tool_start|length %}
|
||||
{%- set start_of_message = current_content[:tool_start_length] %}
|
||||
{%- set tool_end = '</tool_response>' %}
|
||||
{%- set tool_end_length = tool_end|length %}
|
||||
{%- set start_pos = (current_content|length) - tool_end_length %}
|
||||
{%- if start_pos < 0 %}
|
||||
{%- set start_pos = 0 %}
|
||||
{%- endif %}
|
||||
{%- set end_of_message = current_content[start_pos:] %}
|
||||
{%- if ns.multi_step_tool and message.role == "user" and not(start_of_message == tool_start and end_of_message == tool_end) %}
|
||||
{%- set ns.multi_step_tool = false %}
|
||||
{%- set ns.last_query_index = index %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- for message in messages %}
|
||||
{%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
|
||||
{{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
|
||||
{%- elif message.role == "assistant" %}
|
||||
{%- set content = message.content %}
|
||||
{%- set reasoning_content = '' %}
|
||||
{%- if message.reasoning_content is defined and message.reasoning_content is not none %}
|
||||
{%- set reasoning_content = message.reasoning_content %}
|
||||
{%- else %}
|
||||
{%- if '</think>' in message.content %}
|
||||
{%- set content = (message.content.split('</think>')|last).lstrip('\n') %}
|
||||
{%- set reasoning_content = (message.content.split('</think>')|first).rstrip('\n') %}
|
||||
{%- set reasoning_content = (reasoning_content.split('<think>')|last).lstrip('\n') %}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- if loop.index0 > ns.last_query_index %}
|
||||
{{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
|
||||
{%- else %}
|
||||
{{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
|
||||
{%- endif %}
|
||||
{%- if message.tool_calls %}
|
||||
{%- for tool_call in message.tool_calls %}
|
||||
{%- if (loop.first and content) or (not loop.first) %}
|
||||
{{- '\n' }}
|
||||
{%- endif %}
|
||||
{%- if tool_call.function %}
|
||||
{%- set tool_call = tool_call.function %}
|
||||
{%- endif %}
|
||||
{{- '<tool_call>\n{"name": "' }}
|
||||
{{- tool_call.name }}
|
||||
{{- '", "arguments": ' }}
|
||||
{%- if tool_call.arguments is string %}
|
||||
{{- tool_call.arguments }}
|
||||
{%- else %}
|
||||
{{- tool_call.arguments | tojson }}
|
||||
{%- endif %}
|
||||
{{- '}\n</tool_call>' }}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
{{- '<|im_end|>\n' }}
|
||||
{%- elif message.role == "tool" %}
|
||||
{%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
|
||||
{{- '<|im_start|>user' }}
|
||||
{%- endif %}
|
||||
{{- '\n<tool_response>\n' }}
|
||||
{{- message.content }}
|
||||
{{- '\n</tool_response>' }}
|
||||
{%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
|
||||
{{- '<|im_end|>\n' }}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- if add_generation_prompt %}
|
||||
{{- '<|im_start|>assistant\n' }}
|
||||
{%- if enable_thinking is defined and enable_thinking is false %}
|
||||
{{- '<think>\n\n</think>\n\n' }}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
38
config.json
Normal file
38
config.json
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"architectures": [
|
||||
"Qwen3MoeForCausalLM"
|
||||
],
|
||||
"attention_bias": false,
|
||||
"attention_dropout": 0.0,
|
||||
"decoder_sparse_step": 1,
|
||||
"eos_token_id": 151645,
|
||||
"head_dim": 128,
|
||||
"hidden_act": "silu",
|
||||
"hidden_size": 2048,
|
||||
"initializer_range": 0.02,
|
||||
"intermediate_size": 6144,
|
||||
"max_position_embeddings": 262144,
|
||||
"max_window_layers": 48,
|
||||
"mlp_only_layers": [],
|
||||
"model_type": "qwen3_moe",
|
||||
"moe_intermediate_size": 768,
|
||||
"norm_topk_prob": true,
|
||||
"num_attention_heads": 32,
|
||||
"num_experts": 128,
|
||||
"num_experts_per_tok": 8,
|
||||
"num_hidden_layers": 48,
|
||||
"num_key_value_heads": 4,
|
||||
"output_router_logits": false,
|
||||
"pad_token_id": 151643,
|
||||
"rms_norm_eps": 1e-06,
|
||||
"rope_scaling": null,
|
||||
"rope_theta": 10000000,
|
||||
"router_aux_loss_coef": 0.001,
|
||||
"sliding_window": null,
|
||||
"tie_word_embeddings": false,
|
||||
"torch_dtype": "bfloat16",
|
||||
"transformers_version": "4.51.1",
|
||||
"use_cache": true,
|
||||
"use_sliding_window": false,
|
||||
"vocab_size": 151936
|
||||
}
|
||||
1
configuration.json
Normal file
1
configuration.json
Normal file
@@ -0,0 +1 @@
|
||||
{"framework": "pytorch", "task": "text-generation", "allow_remote": true}
|
||||
13
generation_config.json
Normal file
13
generation_config.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"bos_token_id": 151643,
|
||||
"do_sample": true,
|
||||
"eos_token_id": [
|
||||
151645,
|
||||
151643
|
||||
],
|
||||
"pad_token_id": 151643,
|
||||
"temperature": 0.6,
|
||||
"top_k": 20,
|
||||
"top_p": 0.95,
|
||||
"transformers_version": "4.51.1"
|
||||
}
|
||||
BIN
merges.txt
(Stored with Git LFS)
Normal file
BIN
merges.txt
(Stored with Git LFS)
Normal file
Binary file not shown.
3
model-00001-of-00013.safetensors
Normal file
3
model-00001-of-00013.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:11f3585c521d6cd78987a9d841a8a431adab458c87588be6d9c9326fd6658038
|
||||
size 4997184968
|
||||
3
model-00002-of-00013.safetensors
Normal file
3
model-00002-of-00013.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c0ad476c21f919e0208c98694eb610d0c7b719c8a97b7122e9b770b5d2ebdf22
|
||||
size 4997741608
|
||||
3
model-00003-of-00013.safetensors
Normal file
3
model-00003-of-00013.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9b19be1cafeb2428c531b85a93ecdd4b19c22b894582daa1ca3209cdb489f43e
|
||||
size 4997742208
|
||||
3
model-00004-of-00013.safetensors
Normal file
3
model-00004-of-00013.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9caac877c2f6e10fdea57b467e2123b8ffd8bb0efaac6594bbd5b3b3c84d91d8
|
||||
size 4997743184
|
||||
3
model-00005-of-00013.safetensors
Normal file
3
model-00005-of-00013.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:15045b72ff36d95fd58dd4d532dbb6143719c93b2691af3481bddebc369dc092
|
||||
size 4997743184
|
||||
3
model-00006-of-00013.safetensors
Normal file
3
model-00006-of-00013.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8743ebe00a6d81e28c7177d0f30175481748dccce5a282ff222ccaa10c324fe3
|
||||
size 4997743184
|
||||
3
model-00007-of-00013.safetensors
Normal file
3
model-00007-of-00013.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7935523a6510fff7f92d34d329158b31023a7f75091eaf487a1793dbf3cab63f
|
||||
size 4997743184
|
||||
3
model-00008-of-00013.safetensors
Normal file
3
model-00008-of-00013.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:da2b9c5609adff767b5316db026a1df8a87e492af41798d413d85a74decb1db2
|
||||
size 4997743184
|
||||
3
model-00009-of-00013.safetensors
Normal file
3
model-00009-of-00013.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7d19089ecfeab3d015aabcfb13c5e0e2beb78923bcfa8ce658c86dc2c3ef4f99
|
||||
size 4997743184
|
||||
3
model-00010-of-00013.safetensors
Normal file
3
model-00010-of-00013.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:cdd82f2e4a4254559ac05c18a75ef6eacd4e45222cb7a4698ab44d85ac3e4fa8
|
||||
size 4997743184
|
||||
3
model-00011-of-00013.safetensors
Normal file
3
model-00011-of-00013.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:129ee104f1ed1b520d9b450afaebb5d6cd49bee6fd0ca519cfeb01389c9c6107
|
||||
size 4997743184
|
||||
3
model-00012-of-00013.safetensors
Normal file
3
model-00012-of-00013.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b6a09583850ed75132096c66d0c232ce7b113e48098d42da076eeb380067649e
|
||||
size 4997743184
|
||||
3
model-00013-of-00013.safetensors
Normal file
3
model-00013-of-00013.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7fbf2c805edab472db239cd8303329f0a25ac3a46095e1bd0bae48cad5579af6
|
||||
size 1094220288
|
||||
3
model.safetensors.index.json
Normal file
3
model.safetensors.index.json
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:cbfcf11e807aeb4fa2ec44db88cd92fa9daf77b77e458c79c58987db4d36135d
|
||||
size 1699758
|
||||
31
special_tokens_map.json
Normal file
31
special_tokens_map.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"additional_special_tokens": [
|
||||
"<|im_start|>",
|
||||
"<|im_end|>",
|
||||
"<|object_ref_start|>",
|
||||
"<|object_ref_end|>",
|
||||
"<|box_start|>",
|
||||
"<|box_end|>",
|
||||
"<|quad_start|>",
|
||||
"<|quad_end|>",
|
||||
"<|vision_start|>",
|
||||
"<|vision_end|>",
|
||||
"<|vision_pad|>",
|
||||
"<|image_pad|>",
|
||||
"<|video_pad|>"
|
||||
],
|
||||
"eos_token": {
|
||||
"content": "<|im_end|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
},
|
||||
"pad_token": {
|
||||
"content": "<|endoftext|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
}
|
||||
}
|
||||
BIN
tokenizer.json
(Stored with Git LFS)
Normal file
BIN
tokenizer.json
(Stored with Git LFS)
Normal file
Binary file not shown.
240
tokenizer_config.json
Normal file
240
tokenizer_config.json
Normal file
@@ -0,0 +1,240 @@
|
||||
{
|
||||
"add_bos_token": false,
|
||||
"add_prefix_space": false,
|
||||
"added_tokens_decoder": {
|
||||
"151643": {
|
||||
"content": "<|endoftext|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151644": {
|
||||
"content": "<|im_start|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151645": {
|
||||
"content": "<|im_end|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151646": {
|
||||
"content": "<|object_ref_start|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151647": {
|
||||
"content": "<|object_ref_end|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151648": {
|
||||
"content": "<|box_start|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151649": {
|
||||
"content": "<|box_end|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151650": {
|
||||
"content": "<|quad_start|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151651": {
|
||||
"content": "<|quad_end|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151652": {
|
||||
"content": "<|vision_start|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151653": {
|
||||
"content": "<|vision_end|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151654": {
|
||||
"content": "<|vision_pad|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151655": {
|
||||
"content": "<|image_pad|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151656": {
|
||||
"content": "<|video_pad|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151657": {
|
||||
"content": "<tool_call>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": false
|
||||
},
|
||||
"151658": {
|
||||
"content": "</tool_call>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": false
|
||||
},
|
||||
"151659": {
|
||||
"content": "<|fim_prefix|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": false
|
||||
},
|
||||
"151660": {
|
||||
"content": "<|fim_middle|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": false
|
||||
},
|
||||
"151661": {
|
||||
"content": "<|fim_suffix|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": false
|
||||
},
|
||||
"151662": {
|
||||
"content": "<|fim_pad|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": false
|
||||
},
|
||||
"151663": {
|
||||
"content": "<|repo_name|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": false
|
||||
},
|
||||
"151664": {
|
||||
"content": "<|file_sep|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": false
|
||||
},
|
||||
"151665": {
|
||||
"content": "<tool_response>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": false
|
||||
},
|
||||
"151666": {
|
||||
"content": "</tool_response>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": false
|
||||
},
|
||||
"151667": {
|
||||
"content": "<think>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": false
|
||||
},
|
||||
"151668": {
|
||||
"content": "</think>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": false
|
||||
}
|
||||
},
|
||||
"additional_special_tokens": [
|
||||
"<|im_start|>",
|
||||
"<|im_end|>",
|
||||
"<|object_ref_start|>",
|
||||
"<|object_ref_end|>",
|
||||
"<|box_start|>",
|
||||
"<|box_end|>",
|
||||
"<|quad_start|>",
|
||||
"<|quad_end|>",
|
||||
"<|vision_start|>",
|
||||
"<|vision_end|>",
|
||||
"<|vision_pad|>",
|
||||
"<|image_pad|>",
|
||||
"<|video_pad|>"
|
||||
],
|
||||
"bos_token": null,
|
||||
"chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0].role == 'system' %}\n {{- messages[0].content + '\\n\\n' }}\n {%- endif %}\n {{- \"# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\\n\\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\\n<tool_call>\\n{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}\\n</tool_call><|im_end|>\\n\" }}\n{%- else %}\n {%- if messages[0].role == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0].content + '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}\n{%- for message in messages[::-1] %}\n {%- set index = (messages|length - 1) - loop.index0 %}\n {%- if ns.multi_step_tool and message.role == \"user\" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}\n {%- set ns.multi_step_tool = false %}\n {%- set ns.last_query_index = index %}\n {%- endif %}\n{%- endfor %}\n{%- for message in messages %}\n {%- if message.content is string %}\n {%- set content = message.content %}\n {%- else %}\n {%- set content = '' %}\n {%- endif %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) %}\n {{- '<|im_start|>' + message.role + '\\n' + content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {%- set reasoning_content = '' %}\n {%- if message.reasoning_content is string %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- else %}\n {%- if '</think>' in content %}\n {%- set reasoning_content = content.split('</think>')[0].rstrip('\\n').split('<think>')[-1].lstrip('\\n') %}\n {%- set content = content.split('</think>')[-1].lstrip('\\n') %}\n {%- endif %}\n {%- endif %}\n {%- if loop.index0 > ns.last_query_index %}\n {%- if loop.last or (not loop.last and reasoning_content) %}\n {{- '<|im_start|>' + message.role + '\\n<think>\\n' + reasoning_content.strip('\\n') + '\\n</think>\\n\\n' + content.lstrip('\\n') }}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- if message.tool_calls %}\n {%- for tool_call in message.tool_calls %}\n {%- if (loop.first and content) or (not loop.first) %}\n {{- '\\n' }}\n {%- endif %}\n {%- if tool_call.function %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {%- if tool_call.arguments is string %}\n {{- tool_call.arguments }}\n {%- else %}\n {{- tool_call.arguments | tojson }}\n {%- endif %}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.first or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- content }}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n<think>\\n' }}\n{%- endif %}",
|
||||
"clean_up_tokenization_spaces": false,
|
||||
"eos_token": "<|im_end|>",
|
||||
"errors": "replace",
|
||||
"extra_special_tokens": {},
|
||||
"model_max_length": 262144,
|
||||
"pad_token": "<|endoftext|>",
|
||||
"split_special_tokens": false,
|
||||
"tokenizer_class": "Qwen2Tokenizer",
|
||||
"unk_token": null
|
||||
}
|
||||
BIN
vocab.json
(Stored with Git LFS)
Normal file
BIN
vocab.json
(Stored with Git LFS)
Normal file
Binary file not shown.
Reference in New Issue
Block a user