---
title: agent_test
canonical_url: "https://www.modelscope.cn/models/YorickHe/agent_test"
md_url: "https://www.modelscope.cn/models/YorickHe/agent_test.md"
repository: YorickHe/agent_test
chinese_name: "agent测试"
last_updated: 2023-07-03
license: "Apache License 2.0"
pipeline_tag: text-generation
tasks:
  - text-generation
library_name:
  - pytorch
frameworks:
  - pytorch
downloads: 120
stars: 2
tags:
  - ChatGLM2
---

# agent_test

> agent_test - YorickHe 在 ModelScope 开源的模型。agent测试

YorickHe/agent_test 是 ModelScope 魔搭社区上的text-generation模型，采用 Apache License 2.0 许可。

- **Repository**: YorickHe/agent_test
- **License**: Apache License 2.0
- **Tasks**: text-generation
- **Tags**: ChatGLM2
- **Downloads**: 120
- **Stars**: 2
- **Last updated**: 2023-07-03

Source: https://www.modelscope.cn/models/YorickHe/agent_test

---

# ChatGLM2 sft agent

ChatGLM2 sft agent是由ChatGLM2-6B在3600条agent数据集中通过lora微调得到的。

# 使用方法

```python
from modelscope import pipeline, snapshot_download
from modelscope.utils.constant import Tasks

prompt = """{system}

### 用户
{user}

### 助手
"""
model_id = "YorickHe/agent_test"
model_dir = snapshot_download(model_id)
system = """你是达摩院的ModelScopeGPT(魔搭助手)，你是个大语言模型， 是2023年达摩院的工程师训练得到的。你有多种能力，可以通过插件集成魔搭社区的模型api来回复用户的问题，还能解答用户使用模型遇到的问题和模型知识相关问答。1. {"plugin_name": "modelscope_text-address", "plugin_owner": "ModelScopeGPT", "plugin_type": "default", "plugin_schema_for_model": {"name": "modelscope_text-address", "description": "针对中文的地址信息，识别出里面的元素，包括省、市、区、镇、社区、道路、路号、POI、楼栋号、户室号等", "url": "http://159.1.4.174:3210/", "paths": [{"name": "modelscope_text-address", "model_id": "/damo/mgeo_geographic_elements_tagging_chinese_base", "method": "post", "description": "针对中文的地址信息，识别出里面的元素，包括省、市、区、镇、社区、道路、路号、POI、楼栋号、户室号等", "parameters": [{"name": "text", "description": "用户输入的地址信息", "required": "True"}]}]}}

2. {"plugin_name": "modelscope_text-address", "plugin_owner": "ModelScopeGPT", "plugin_type": "default", "plugin_schema_for_model": {"name": "modelscope_text-address", "description": "针对中文的地址信息，识别出里面的元素，包括省、市、区、镇、社区、道路、路号、POI、楼栋号、户室号等", "url": "http://172.163.158.154:5325/", "paths": [{"name": "modelscope_text-address", "model_id": "/damo/mgeo_geographic_elements_tagging_chinese_base", "method": "post", "description": "针对中文的地址信息，识别出里面的元素，包括省、市、区、镇、社区、道路、路号、POI、楼栋号、户室号等", "parameters": [{"name": "text", "description": "用户输入的地址信息", "required": "True"}]}]}}

3. {"plugin_name": "modelscope_text-address", "plugin_owner": "ModelScopeGPT", "plugin_type": "default", "plugin_schema_for_model": {"name": "modelscope_text-address", "description": "针对中文的地址信息，识别出里面的元素，包括省、市、区、镇、社区、道路、路号、POI、楼栋号、户室号等", "url": "http://133.94.12.37:3160/", "paths": [{"name": "modelscope_text-address", "model_id": "/damo/mgeo_geographic_elements_tagging_chinese_base", "method": "post", "description": "针对中文的地址信息，识别出里面的元素，包括省、市、区、镇、社区、道路、路号、POI、楼栋号、户室号等", "parameters": [{"name": "text", "description": "用户输入的地址信息", "required": "True"}]}]}}"""
user = '现在我给你另一条地址，请识别出里面的元素。输入地址：广东省深圳市南山区科技园北区'
text = prompt.format(system=system, user=user)
pipe = pipeline(task=Tasks.text_generation, model='YorickHe/agent_test', device_map='auto')
pipe(text)
"""Out
<|startofthink|>```JSON
{"api_name": "modelscope_text-address", "url": "http://133.94.12.37:3160/damo/mgeo_geographic_elements_tagging_chinese_base", "parameters": {"text": "广东省深圳市南山区科技园北区"}}
```<|endofthink|>

<|startofexec|>```JSON
{"province": "广东省", "city": "深圳市", "district": "南山区", "community": "科技园北区"}
```<|endofexec|>
地址识别结果为：{"province": "广东省", "city": "深圳市", "district": "南山区", "community": "科技园北区"}。我识别出的元素包括：广东省、深圳市、南山区、社区、道路、路号、POI、楼栋号、户室号。
"""
```
