---
title: ms_agent
canonical_url: "https://www.modelscope.cn/datasets/iic/ms_agent"
md_url: "https://www.modelscope.cn/datasets/iic/ms_agent.md"
repository: iic/ms_agent
chinese_name: "MSAgent-Bench-通用SFT数据"
last_updated: 2024-09-02
license: "Apache License 2.0"
storage_size: "81 MB"
domain:
  - configs
  - source_datasets
tasks:
  - "{config_name=default, data_files=[{path=train_agent_react.jsonl, split=train}]}"
  - original
downloads: 10908
stars: 20
---

# ms_agent

> ms_agent - iic 在 ModelScope 开源的数据集。MSAgent-Bench（React版）

iic/ms_agent 是 ModelScope 魔搭社区上的{config_name=default, data_files=[{path=train_agent_react.jsonl, split=train}]}、original数据集，涉及 configs、source_datasets 领域，存储大小 81 MB，采用 Apache License 2.0 许可。

- **Repository**: iic/ms_agent
- **License**: Apache License 2.0
- **Tasks**: {config_name=default, data_files=[{path=train_agent_react.jsonl, split=train}]}, original
- **Domain**: configs, source_datasets
- **Storage size**: 81 MB
- **Downloads**: 10908
- **Stars**: 20
- **Last updated**: 2024-09-02

Source: https://www.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检索增强数据

![dataset](MSAgent-Bench.png)


数据集文件包含了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
```
