MSAgent-Bench-通用SFT数据
收藏魔搭社区2026-05-22 更新2024-05-15 收录
下载链接:
https://modelscope.cn/datasets/iic/ms_agent
下载链接
链接失效反馈官方服务:
资源简介:
### MSAgent-Bench(React版)
ModelScope-Agent是一个通用且可定制的代理框架,用于实际应用,基于开源LLMs作为种树。它提供了一个用户友好的系统库,具有可定制的引擎设计,支持在多个开源LLMs上进行模型训练,同时还以一种统一的方式实现了与模型API和常见API的无缝集成。
该数据是MSAgentBench的react版本,可以兼容react格式的tool learning使用方式
### 数据集加载方式
#### 方法1:使用sdk加载
```python
import ast
from modelscope.msdatasets import MsDataset
ds = MsDataset.load('iic/ms_agent', split='train') # or split='validation'
one_ds = next(iter(ds))
print(one_ds)
# to parse conversations value
conv = one_ds['conversations']
conv = ast.literal_eval(conv)
print(conv[0]['from'])
print(conv[0]['value'])
```
### 数据集介绍
我们在ModelScope社区上提供了插件的训练数据集,包括598k的训练集和对应的验证集,测试集。数据集主要包括了四种:AI模型API,通用API,API无关通用sft数据,API检索增强数据

数据集文件包含了train/dev两个个文件共接近600k样本。数据格式为每行一个样本,里面包含了id和converstions两个字段,其中conversations里面包含了system,user,assistant三种字段。其中:
system: 表示给模型前置的人设输入,其中有告诉模型如何调用插件以及生成请求
user: 表示用户的输入prompt,分为两种,通用生成的prompt和调用插件需求的prompt
assistant: 为模型的回复。其中会包括插件调用代码和执行代码,调用代码是要LLM生成的,而执行代码是调用服务来生成结果的。如下面例子,调用部分代码会通过<|startofthink|>和<|endofthink|>包起来,>然后执行部分代码是api执行完结果后,把执行结果通过<|startofexec|>和<|endofexec|>包起来再输入给模型生成后面的回复
```json
{
"id":"MS_Agent_Bench_126374",
"conversations":[
{
"from":"system",
"value":"Answer the following questions as best you can. You have access to the following APIs:\n1. hm_recipe_recommend: Call this tool to interact with the hmreciperecommend API. What is the hmreciperecommend API useful for? . Parameters: [{\"name\": \"keywords_dict\", \"description\": \"盒马推荐菜谱关键词字典。\", \"required\": \"True\"}]\n\n2. hm_product_marketing: Call this tool to interact with the hmproductmarketing API. What is the hmproductmarketing API useful for? . Parameters: [{\"name\": \"sku_code_list\", \"description\": \"盒马商品的编码列表\", \"required\": \"True\"}]\n\n3. hm_product_info: Call this tool to interact with the hmproductinfo API. What is the hmproductinfo API useful for? . Parameters: [{\"name\": \"sku_code_list\", \"description\": \"盒马商品的编码列表\", \"required\": \"True\"}, {\"name\": \"sku_name_list\", \"description\": \"盒马商品的名称列表\", \"required\": \"True\"}, {\"name\": \"property_list\", \"description\": \"盒马商品的属性列表\", \"required\": \"True\"}]\n\n4. hm_product_recommend: Call this tool to interact with the hmproductrecommend API. What is the hmproductrecommend API useful for? . Parameters: [{\"name\": \"keywords_dict\", \"description\": \"盒马推荐商品关键词字典。\", \"required\": \"True\"}]\n\nUse the following format:\n\nThought: you should always think about what to do\nAction: the action to take, should be one of the above tools[hm_recipe_recommend, hm_product_marketing, hm_product_info, hm_product_recommend]\nAction Input: the input to the action\nObservation: the result of the action\n... (this Thought/Action/Action Input/Observation can be repeated zero or more times)\nThought: I now know the final answer\nFinal Answer: the final answer to the original input question\nBegin!"
},
{
"from":"user",
"value":"你好,请问你们有哪些手机可以推荐?"
},
{
"from":"assistant",
"value":"Action: hm_product_recommend\nAction Input: {'keywords_dict': {'商品类目': '手机'}}\nObservation: [{'sku_code': '10518244314', 'product_name': '小米11 Ultra 5G手机 256GB', 'bussiness_type': '标品', 'product_price': '5999', 'product_description': '拥有120Hz高刷新率和骁龙888处理器,还配备了高品质相机系统'}, {'sku_code': '10222726664', 'product_name': 'vivo X60 Pro 5G手机 256GB', 'bussiness_type': '标品', 'product_price': '4498', 'product_description': '搭载Exynos 1080处理器与ZEISS联合调校的相机系统,拍照实力十足'}, {'sku_code': '18227073452', 'product_name': '华为畅享 20 Pro 5G手机 128GB', 'bussiness_type': '标品', 'product_price': '2699', 'product_description': '拥有4000mAh的电池容量和优秀的相机而价格非常亲民'}]\nThought: I now know the final answer\nFinal Answer: 您好,我们有以下几款手机供您选择:1.小米11 Ultra 5G手机 256GB:价格为5999元,拥有120Hz高刷新率和骁龙888处理器,还配备了高品质相机系统;2. vivo X60 Pro 5G手机 256GB:售价为4498元,搭载Exynos 1080处理器与ZEISS联合调校的相机系统,拍照实力十足;3. 华为畅享 20 Pro 5G手机 128GB:价格亲民,只需2699元即可拥有优秀的相机和4000mAh的电池容量。这些手机都具有不同的特点和功能,您可以根据自己的需求进行选择。如果您有其他问题或需求,请随时告诉我。"
}
]
}
```
### 方案实现
利用提供的API插件数据,在开源大模型上进行微调,因为数据里面只提供了少量的sft数据,所以最好是基于已经在sft上训练过的生成大模型,这样可以很快的泛化到训练集的API插件数据。
涉及到的几个模型API在魔搭社区都有相应的服务提供,需要测试调用链路是否顺畅,输入输出结果是否符合数据集的要求,比如信息抽取api,可以进入modelscope模型主页,从 “部署” -> “api推理”来调用。
## 数据集版权信息
数据集已经开源,license为Apache License 2.0,如有违反相关条款,随时联系modelscope删除。
### Clone with HTTP
```bash
git clone https://www.modelscope.cn/datasets/iic/ms_agent.git
```
### MSAgent-Bench(React版)
ModelScope-Agent是一款通用化、可定制的AI智能体(AI Agent)框架,面向实际应用场景打造,以开源大语言模型(LLM,Large Language Model)作为核心支撑。该框架提供了易用性极强的系统库,采用可定制化的引擎设计,支持基于多款开源大语言模型开展模型训练,同时以统一的接口实现了与模型API及通用API的无缝集成。
本数据集为MSAgentBench的React适配版,可兼容React格式的工具学习(tool learning)调用范式。
### 数据集加载方式
#### 方法1:通过SDK加载
python
import ast
from modelscope.msdatasets import MsDataset
ds = MsDataset.load('iic/ms_agent', split='train') # or split='validation'
one_ds = next(iter(ds))
print(one_ds)
# to parse conversations value
conv = one_ds['conversations']
conv = ast.literal_eval(conv)
print(conv[0]['from'])
print(conv[0]['value'])
### 数据集介绍
我们在ModelScope社区开源了该插件训练数据集,包含59.8万条训练样本、配套验证集与测试集。数据集整体分为四类:AI模型API、通用API、API无关通用监督微调(SFT,Supervised Fine-Tuning)数据、API检索增强数据。

数据集文件包含`train`与`dev`两个文件,总样本量近60万。数据格式为每行一条样本,包含`id`与`conversations`两个字段,其中`conversations`字段内嵌`system`、`user`、`assistant`三类子字段,各字段说明如下:
- `system`:用于向模型注入前置人设提示,包含插件调用规则与请求生成规范;
- `user`:代表用户输入的提示词(Prompt),分为通用生成类提示词与插件调用类提示词两类;
- `assistant`:对应模型生成的回复内容,包含插件调用代码与执行代码两部分:其中调用代码需由大语言模型生成,而执行代码用于调用服务以获取执行结果。如示例所示,调用代码会被`<|startofthink|>`与`<|endofthink|>`标签包裹,而服务执行完成后,会将执行结果用`<|startofexec|>`与`<|endofexec|>`标签包裹后输入模型,用于生成后续回复内容。
json
{
"id":"MS_Agent_Bench_126374",
"conversations":[
{
"from":"system",
"value":"Answer the following questions as best you can. You have access to the following APIs:
1. hm_recipe_recommend: Call this tool to interact with the hmreciperecommend API. What is the hmreciperecommend API useful for? . Parameters: [{"name": "keywords_dict", "description": "盒马推荐菜谱关键词字典。", "required": "True"}]
2. hm_product_marketing: Call this tool to interact with the hmproductmarketing API. What is the hmproductmarketing API useful for? . Parameters: [{"name": "sku_code_list", "description": "盒马商品的编码列表", "required": "True"}]
3. hm_product_info: Call this tool to interact with the hmproductinfo API. What is the hmproductinfo API useful for? . Parameters: [{"name": "sku_code_list", "description": "盒马商品的编码列表", "required": "True"}, {"name": "sku_name_list", "description": "盒马商品的名称列表", "required": "True"}, {"name": "property_list", "description": "盒马商品的属性列表", "required": "True"}]
4. hm_product_recommend: Call this tool to interact with the hmproductrecommend API. What is the hmproductrecommend API useful for? . Parameters: [{"name": "keywords_dict", "description": "盒马推荐商品关键词字典。", "required": "True"}]
Use the following format:
Thought: you should always think about what to do
Action: the action to take, should be one of the above tools[hm_recipe_recommend, hm_product_marketing, hm_product_info, hm_product_recommend]
Action Input: the input to the action
Observation: the result of the action
... (this Thought/Action/Action Input/Observation can be repeated zero or more times)
Thought: I now know the final answer
Final Answer: the final answer to the original input question
Begin!"
},
{
"from":"user",
"value":"你好,请问你们有哪些手机可以推荐?"
},
{
"from":"assistant",
"value":"Action: hm_product_recommend
Action Input: {'keywords_dict': {'商品类目': '手机'}}
Observation: [{'sku_code': '10518244314', 'product_name': '小米11 Ultra 5G手机 256GB', 'bussiness_type': '标品', 'product_price': '5999', 'product_description': '拥有120Hz高刷新率和骁龙888处理器,还配备了高品质相机系统'}, {'sku_code': '10222726664', 'product_name': 'vivo X60 Pro 5G手机 256GB', 'bussiness_type': '标品', 'product_price': '4498', 'product_description': '搭载Exynos 1080处理器与ZEISS联合调校的相机系统,拍照实力十足'}, {'sku_code': '18227073452', 'product_name': '华为畅享 20 Pro 5G手机 128GB', 'bussiness_type': '标品', 'product_price': '2699', 'product_description': '拥有4000mAh的电池容量和优秀的相机而价格非常亲民'}]
Thought: I now know the final answer
Final Answer: 您好,我们有以下几款手机供您选择:1.小米11 Ultra 5G手机 256GB:价格为5999元,拥有120Hz高刷新率和骁龙888处理器,还配备了高品质相机系统;2. vivo X60 Pro 5G手机 256GB:售价为4498元,搭载Exynos 1080处理器与ZEISS联合调校的相机系统,拍照实力十足;3. 华为畅享 20 Pro 5G手机 128GB:价格亲民,只需2699元即可拥有优秀的相机和4000mAh的电池容量。这些手机都具有不同的特点和功能,您可以根据自己的需求进行选择。如果您有其他问题或需求,请随时告诉我。"
}
]
}
### 方案实现
可基于本数据集提供的API插件数据对开源大语言模型进行微调。由于数据集仅包含少量监督微调数据,建议选用已完成基础监督微调训练的生成式大语言模型,以快速适配数据集内的API插件数据,实现良好的泛化能力。
本数据集涉及的多款模型API均已在魔搭社区(ModelScope社区)上线对应服务,需验证调用链路的连通性与输入输出格式是否符合数据集规范。以信息抽取API为例,可进入ModelScope模型主页,通过「部署」→「API推理」路径完成调用。
### 数据集版权信息
本数据集已开源,采用Apache License 2.0开源协议,若存在违反协议条款的情况,可随时联系ModelScope官方进行删除处理。
#### 通过HTTP协议克隆
bash
git clone https://www.modelscope.cn/datasets/iic/ms_agent.git
提供机构:
maas
创建时间:
2024-01-24
搜集汇总
数据集介绍

背景与挑战
背景概述
该数据集是MSAgent-Bench的React版本,专为工具学习设计,提供约598k训练样本及验证和测试集,涵盖AI模型API、通用API等四类数据,用于基于开源大模型的微调训练。
以上内容由遇见数据集搜集并总结生成



