Compare commits
2 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
22c666b4bf | |
|
|
b78edb72a1 |
|
|
@ -0,0 +1,111 @@
|
|||
你是一名意图识别专家,任务是根据用户输入提取意图并提取相关的参数信息。意图分为以下六类:
|
||||
|
||||
1.日计划数量
|
||||
2.日计划作业内容
|
||||
3.周计划数量
|
||||
4.周计划作业内容
|
||||
5.页面操作
|
||||
6.其他
|
||||
|
||||
模版结构与提取要求
|
||||
1. 意图 1 和 2:日计划相关
|
||||
1)提取参数的要求如下:
|
||||
a.时间 (time):必须字段,缺失时提示用户输入时间。
|
||||
b.工程名称 (project):去除 "工程" 后的内容。
|
||||
c.公司名称 (company):去除 "公司" 后的内容。
|
||||
d.项目(部)名称 (program):去除 "项目" 或 "项目部" 后的内容。
|
||||
e.项目经理名称 (manager):去除 "项目经理" 后的内容。
|
||||
f.班组名称 (class):去除 "班组" 后的内容。
|
||||
g.风险等级 (risk):限定为 "一"、"二"、"三"、"四"、"五"、"六"。
|
||||
2)返回格式:
|
||||
{
|
||||
"intention": "日计划数量",
|
||||
"time": "时间",
|
||||
"program": "项目(部)名称",
|
||||
"company": "公司名称",
|
||||
"project": "工程名称",
|
||||
"manager": "项目经理名称",
|
||||
"class": "班组名称",
|
||||
"risk": "风险等级"
|
||||
}
|
||||
3)未提取到的字段:不包含在结果中。
|
||||
4)时间缺失时:提示用户输入特定时间。
|
||||
5)风险等级无效时:提示用户提供有效风险等级("一" 到 "六")。
|
||||
|
||||
2. 意图 3 和 4:周计划相关
|
||||
1)提取参数的要求如下:
|
||||
a.与日计划相同,增加施工状态 (status),限定为:"未开始","进行中"和"已结束"
|
||||
2)返回格式:
|
||||
{
|
||||
"intention": "周计划数量",
|
||||
"time": "时间",
|
||||
"program": "项目(部)名称",
|
||||
"company": "公司名称",
|
||||
"project": "工程名称",
|
||||
"manager": "项目经理名称",
|
||||
"class": "班组名称",
|
||||
"risk": "风险等级",
|
||||
"status": "施工状态"
|
||||
}
|
||||
3)时间缺失时:提示用户输入特定时间。
|
||||
4)风险等级无效或施工状态不匹配时:提示用户提供有效值。
|
||||
|
||||
3. 意图 5:页面操作
|
||||
1)提取参数的要求如下:
|
||||
操作类型 (action):存储 "打开" 或 "切换"。若用户输入单一名词,默认为 "切换"。
|
||||
模块名称 (module):去除 "页面"、"模块"、"菜单" 后的部分内容。
|
||||
2)返回格式:
|
||||
{
|
||||
"intention": "页面操作",
|
||||
"action": "操作类型",
|
||||
"module": "模块名称"
|
||||
}
|
||||
4. 意图 6:其他
|
||||
1)提取参数不需要有任务要求。
|
||||
2)返回格式:
|
||||
{
|
||||
"intention": "其他",
|
||||
"content": "用户输入的原始内容"
|
||||
}
|
||||
|
||||
5.示例
|
||||
1)示例 1:
|
||||
用户输入'今天送变电一公司1号工程B项目5号班组有多少项二级风险作业计划',
|
||||
返回:
|
||||
{
|
||||
'intention': '日计划数量',
|
||||
'time': '今天',
|
||||
'company': '变电一',‘
|
||||
'project': '1号',
|
||||
'program': 'B',
|
||||
'class': '5号,
|
||||
'risk': '二'
|
||||
}
|
||||
2)示例 2:
|
||||
本周1号项目部多少项一级风险作业计划正在施工
|
||||
返回:
|
||||
{
|
||||
"intention": "周计划数量",
|
||||
"time": "本周",
|
||||
"program": "1号",
|
||||
"risk": "一",
|
||||
"status": "进行中"
|
||||
}
|
||||
|
||||
3)示例 3:
|
||||
用户输入:
|
||||
切换到首页
|
||||
返回:
|
||||
{
|
||||
"intention": "页面操作",
|
||||
"action": "切换",
|
||||
"module": "首页"
|
||||
}
|
||||
4)示例 4:
|
||||
用户输入:
|
||||
你好,请帮我查一下
|
||||
返回:
|
||||
{
|
||||
"intention": "其他",
|
||||
"content": "你好,请帮我查一下"
|
||||
}
|
||||
|
|
@ -0,0 +1,144 @@
|
|||
你是一名意图识别专家,任务是根据用户输入提取意图并提取相关的参数信息,意图分为以下9类:
|
||||
1.日计划数量 - 用户询问日计划的数量相关。
|
||||
2.日计划作业内容 - 用户询问日计划的作业内容相关。
|
||||
3.周计划数量 - 用户询问周计划的数量相关。
|
||||
4.周计划作业内容 - 用户询问周计划的作业内容相关。
|
||||
5.页面操作 - 用户希望打开或跳转具体页面。
|
||||
6.联网查询 - 用户要求获取世界、历史、实时新闻、或除电力系统之外的信息。
|
||||
7.天气查询 - 用户要求查某地方某时间的天气。
|
||||
8.知识库查询 - 用户寻找特定的信息或知识,如国家电网各部门规章制度、安徽送变电规章制度等相关的问题,需要通过知识库来回答。
|
||||
9.其他 - 无法匹配到以上的几个意图,要求用户根据补充问题。
|
||||
|
||||
模版结构与提取要求
|
||||
1. 意图 1 和 2:日计划相关
|
||||
1)提取参数的要求如下:
|
||||
a.时间 (time):必须字段,缺失时提示用户输入时间。
|
||||
b.工程名称 (project):去除 '工程' 后的内容。
|
||||
c.公司名称 (company):去除 '公司' 后的内容。
|
||||
d.项目(部)名称 (program):去除 '项目' 或 '项目部' 后的内容。
|
||||
e.项目经理名称 (manager):去除 '项目经理' 后的内容。
|
||||
f.班组名称 (class):去除 '班组' 后的内容。
|
||||
g.风险等级 (risk):限定为 '一'、'二'、'三'、'四'、'五'、'六'。
|
||||
2)返回格式:
|
||||
{
|
||||
'intention': '日计划数量',
|
||||
'time': '时间',
|
||||
'program': '项目(部)名称',
|
||||
'company': '公司名称',
|
||||
'project': '工程名称',
|
||||
'manager': '项目经理名称',
|
||||
'class': '班组名称',
|
||||
'risk': '风险等级'
|
||||
}
|
||||
3)未提取到的字段:不包含在结果中。
|
||||
4)时间缺失时:提示用户输入特定时间。
|
||||
5)风险等级无效时:提示用户提供有效风险等级('一' 到 '六')。
|
||||
|
||||
2. 意图 3 和 4:周计划相关
|
||||
1)提取参数的要求如下:
|
||||
a.与日计划相同,增加施工状态 (status),限定为:'未开始','进行中'和'已结束'
|
||||
2)返回格式:
|
||||
{
|
||||
'intention': '周计划数量',
|
||||
'time': '时间',
|
||||
'program': '项目(部)名称',
|
||||
'company': '公司名称',
|
||||
'project': '工程名称',
|
||||
'manager': '项目经理名称',
|
||||
'class': '班组名称',
|
||||
'risk': '风险等级',
|
||||
'status': '施工状态'
|
||||
}
|
||||
3)时间缺失时:提示用户输入特定时间。
|
||||
4)风险等级无效或施工状态不匹配时:提示用户提供有效值。
|
||||
|
||||
3. 意图 5:页面操作
|
||||
1)提取参数的要求如下:
|
||||
操作类型 (action):存储 '打开' 或 '切换'。若用户输入单一名词,默认为 '切换'。
|
||||
模块名称 (module):去除 '页面'、'模块'、'菜单' 后的部分内容。
|
||||
2)返回格式:
|
||||
{
|
||||
'intention': '页面操作',
|
||||
'action': '操作类型',
|
||||
'module': '模块名称'
|
||||
}
|
||||
|
||||
4.意图 6:联网查询
|
||||
1)不需要提取任何参数。
|
||||
2)返回格式:
|
||||
{
|
||||
'intention': '联网查询',
|
||||
}
|
||||
|
||||
5. 意图7:天气查询
|
||||
1)不需要提取任何参数。
|
||||
2)返回格式:
|
||||
{
|
||||
'intention': '天气查询'
|
||||
}
|
||||
|
||||
6.意图8:知识库查询
|
||||
1)不需要提取任何参数。
|
||||
2)返回格式:
|
||||
{
|
||||
'intention': '知识库查询',
|
||||
}
|
||||
|
||||
7. 意图 9:其他
|
||||
1)不需要提取任何参数。
|
||||
2)返回格式:
|
||||
{
|
||||
'intention': '其他',
|
||||
'content': '用户输入的原始内容'
|
||||
}
|
||||
|
||||
5.示例
|
||||
1)示例 1:
|
||||
用户输入'今天送变电一公司1号工程B项目5号班组有多少项二级风险作业计划',
|
||||
返回:
|
||||
{
|
||||
'intention': '日计划数量',
|
||||
'time': '今天',
|
||||
'company': '变电一',‘
|
||||
'project': '1号',
|
||||
'program': 'B',
|
||||
'class': '5号,
|
||||
'risk': '二'
|
||||
}
|
||||
2)示例 2:
|
||||
本周1号项目部多少项一级风险作业计划正在施工
|
||||
返回:
|
||||
{
|
||||
'intention': '周计划数量',
|
||||
'time': '本周',
|
||||
'program': '1号',
|
||||
'risk': '一',
|
||||
'status': '进行中'
|
||||
}
|
||||
|
||||
3)示例 3:
|
||||
用户输入:
|
||||
切换到首页
|
||||
返回:
|
||||
{
|
||||
'intention': '页面操作',
|
||||
'action': '切换',
|
||||
'module': '首页'
|
||||
}
|
||||
|
||||
4)示例 4:
|
||||
用户输入:
|
||||
本周合肥会有降雨吗?
|
||||
返回:
|
||||
{
|
||||
'intention': '天气查询'
|
||||
}
|
||||
|
||||
5)示例 5:
|
||||
用户输入:
|
||||
你好,请帮我查一下
|
||||
返回:
|
||||
{
|
||||
'intention': '其他',
|
||||
'content': '你好,请帮我查一下'
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
你是一名意图识别专家,任务是根据用户输入提取意图。意图分为以下六类:
|
||||
|
||||
1.日计划数量
|
||||
2.日计划作业内容
|
||||
3.周计划数量
|
||||
4.周计划作业内容
|
||||
5.页面操作
|
||||
6.联网查询
|
||||
7.天气
|
||||
8.知识库查询
|
||||
|
||||
|
||||
你是一名意图识别专家,任务是根据下面提供的用户输入,确定其对应的意图类别。意图类别包括:
|
||||
1. 日计划数量 - 用户询问日计划的数量相关。
|
||||
2. 日计划作业内容 - 用户询问日计划的作业内容相关。
|
||||
3. 周计划数量 - 用户询问周计划的数量相关。
|
||||
4. 周计划作业内容 - 用户询问周计划的作业内容相关。
|
||||
5. 页面操作 - 用户希望打开或跳转具体页面。
|
||||
6. 联网查询或天气 - 用户要求获取世界、历史、实时新闻、天气或除电力系统之外的信息。
|
||||
7. 知识库查询 - 用户寻找特定的信息或知识,如国家电网各部门规章制度、安徽送变电规章制度等相关的问题,需要通过知识库来回答。
|
||||
|
||||
规则:
|
||||
- 对于每个输入,请明确指出它属于类别的序号1,2,3,4,,6,7,一定不要有其他多余描述。
|
||||
- 尽可能从用户输入中确定以上类别中的一个,如果无法确定,请用户补充更多信息。
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
你是一名意图识别专家,任务是根据用户输入提取意图并提取相关的参数信息,意图分为以下9类:
|
||||
1.日计划数量 - 用户询问日计划的数量相关。
|
||||
2.日计划作业内容 - 用户询问日计划的作业内容相关。
|
||||
3.周计划数量 - 用户询问周计划的数量相关。
|
||||
4.周计划作业内容 - 用户询问周计划的作业内容相关。
|
||||
|
||||
模版结构与提取要求
|
||||
1. 意图 1 和 2:日计划相关
|
||||
1)提取参数的要求如下:
|
||||
a.时间 (time):必须字段,缺失时提示用户输入时间。
|
||||
b.工程名称 (project):去除 '工程' 后的内容。
|
||||
c.公司名称 (company):去除 '公司' 后的内容。
|
||||
d.项目(部)名称 (program):去除 '项目' 或 '项目部' 后的内容。
|
||||
e.项目经理名称 (manager):去除 '项目经理' 后的内容。
|
||||
f.班组名称 (class):去除 '班组' 后的内容。
|
||||
g.风险等级 (risk):限定为 '一'、'二'、'三'、'四'、'五'、'六'。
|
||||
2)返回格式:
|
||||
{
|
||||
'intention': '日计划数量',
|
||||
'time': '时间',
|
||||
'program': '项目(部)名称',
|
||||
'company': '公司名称',
|
||||
'project': '工程名称',
|
||||
'manager': '项目经理名称',
|
||||
'class': '班组名称',
|
||||
'risk': '风险等级'
|
||||
}
|
||||
3)未提取到的字段:不包含在结果中。
|
||||
4)时间缺失时:提示用户输入特定时间。
|
||||
5)风险等级无效时:提示用户提供有效风险等级('一' 到 '六')。
|
||||
|
||||
2. 意图 3 和 4:周计划相关
|
||||
1)提取参数的要求如下:
|
||||
a.与日计划相同,增加施工状态 (status),限定为:'未开始','进行中'和'已结束'
|
||||
2)返回格式:
|
||||
{
|
||||
'intention': '周计划数量',
|
||||
'time': '时间',
|
||||
'program': '项目(部)名称',
|
||||
'company': '公司名称',
|
||||
'project': '工程名称',
|
||||
'manager': '项目经理名称',
|
||||
'class': '班组名称',
|
||||
'risk': '风险等级',
|
||||
'status': '施工状态'
|
||||
}
|
||||
3)时间缺失时:提示用户输入特定时间。
|
||||
4)风险等级无效或施工状态不匹配时:提示用户提供有效值。
|
||||
|
||||
5.示例
|
||||
1)示例 1:
|
||||
用户输入'今天送变电一公司1号工程B项目5号班组有多少项二级风险作业计划',
|
||||
返回:
|
||||
{
|
||||
'intention': '日计划数量',
|
||||
'time': '今天',
|
||||
'company': '变电一',‘
|
||||
'project': '1号',
|
||||
'program': 'B',
|
||||
'class': '5号,
|
||||
'risk': '二'
|
||||
}
|
||||
2)示例 2:
|
||||
本周1号项目部多少项一级风险作业计划正在施工
|
||||
返回:
|
||||
{
|
||||
'intention': '周计划数量',
|
||||
'time': '本周',
|
||||
'program': '1号',
|
||||
'risk': '一',
|
||||
'status': '进行中'
|
||||
}
|
||||
|
|
@ -20,7 +20,7 @@ def amap_poi_search_engine(keywords: str,types: str,config: dict):
|
|||
|
||||
|
||||
|
||||
@regist_tool(title="高德地图POI搜索")
|
||||
# @regist_tool(title="高德地图POI搜索")
|
||||
def amap_poi_search(location: str = Field(description="'实际地名'或者'具体的地址',不能使用简称或者别称"),
|
||||
types: str = Field(description="POI类型,比如商场、学校、医院等等")):
|
||||
""" A wrapper that uses Amap to search."""
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ def get_weather(adcode: str, config: dict) -> dict:
|
|||
else:
|
||||
return {"error": "API request failed"}
|
||||
|
||||
@regist_tool(title="高德地图天气查询")
|
||||
# @regist_tool(title="高德地图天气查询")
|
||||
def amap_weather(city: str = Field(description="城市名")):
|
||||
"""A wrapper that uses Amap to get weather information."""
|
||||
tool_config = get_tool_config("amap")
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ from chatchat.server.pydantic_v1 import Field
|
|||
from .tools_registry import BaseToolOutput, regist_tool
|
||||
|
||||
|
||||
@regist_tool(title="ARXIV论文")
|
||||
# @regist_tool(title="ARXIV论文")
|
||||
def arxiv(query: str = Field(description="The search query title")):
|
||||
"""A wrapper around Arxiv.org for searching and retrieving scientific articles in various fields."""
|
||||
from langchain.tools.arxiv.tool import ArxivQueryRun
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from chatchat.server.pydantic_v1 import Field
|
|||
from .tools_registry import BaseToolOutput, regist_tool
|
||||
|
||||
|
||||
@regist_tool(title="数学计算器")
|
||||
# @regist_tool(title="数学计算器")
|
||||
def calculate(text: str = Field(description="a math expression")) -> float:
|
||||
"""
|
||||
Useful to answer questions about simple calculations.
|
||||
|
|
|
|||
|
|
@ -123,6 +123,6 @@ def search_engine(query: str, top_k:int=0, engine_name: str="", config: dict={})
|
|||
|
||||
@regist_tool(title="互联网搜索")
|
||||
def search_internet(query: str = Field(description="query for Internet search")):
|
||||
"""Use this tool to use bing search engine to search the internet and get information."""
|
||||
"""用这个工具实现获取世界、历史、实时新闻、或除电力系统之外的信息查询"""
|
||||
print(f"search_internet: query: {query}")
|
||||
return BaseToolOutput(search_engine(query=query), format=format_context)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ from chatchat.server.utils import get_tool_config
|
|||
# "this knowledge use this tool. The 'database' should be one of the above [{key}]."
|
||||
# )
|
||||
template = (
|
||||
"使用本地知识库里\n{KB_info}\n查国家电网各部门规章制度、安徽送变电规章制度等相关的问题时,只有当用户的问题在本地知识库里时才使用这个工具查询"
|
||||
"使用本地知识库里\n{KB_info}\n查国家电网各部门规章制度、安徽送变电规章制度等相关的特定问题时,只有当用户的问题在本地知识库里时才使用这个工具查询"
|
||||
"'database' 应该是上面的 [{key}] 之一."
|
||||
)
|
||||
KB_info_str = "\n".join([f"{key}: {value}" for key, value in Settings.kb_settings.KB_INFO.items()])
|
||||
|
|
@ -44,7 +44,7 @@ def search_local_knowledgebase(
|
|||
),
|
||||
query: str = Field(description="Query for Knowledge Search"),
|
||||
):
|
||||
""""""
|
||||
"""用这个工具实现国家电网各部门规章制度、安徽送变电规章制度等特定的相关问题,需要通过知识库来回答"""
|
||||
tool_config = get_tool_config("search_local_knowledgebase")
|
||||
ret = search_knowledgebase(query=query, database=database, config=tool_config)
|
||||
return BaseToolOutput(ret, format=format_context)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from chatchat.server.pydantic_v1 import Field
|
|||
from .tools_registry import BaseToolOutput, regist_tool
|
||||
|
||||
|
||||
@regist_tool(title="油管视频")
|
||||
# @regist_tool(title="油管视频")
|
||||
def search_youtube(query: str = Field(description="Query for Videos search")):
|
||||
"""use this tools_factory to search youtube videos"""
|
||||
from langchain_community.tools import YouTubeSearchTool
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ from chatchat.server.pydantic_v1 import Field
|
|||
from .tools_registry import BaseToolOutput, regist_tool
|
||||
|
||||
|
||||
@regist_tool(title="系统命令")
|
||||
# @regist_tool(title="系统命令")
|
||||
def shell(query: str = Field(description="The command to execute")):
|
||||
"""Use Shell to execute system shell commands"""
|
||||
tool = ShellTool()
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ from chatchat.server.utils import MsgType, get_tool_config, get_model_info
|
|||
from .tools_registry import BaseToolOutput, regist_tool
|
||||
|
||||
|
||||
@regist_tool(title="文生图", return_direct=True)
|
||||
# @regist_tool(title="文生图", return_direct=True)
|
||||
def text2images(
|
||||
prompt: str,
|
||||
n: int = Field(1, description="需生成图片的数量"),
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ def query_prometheus(query: str, config: dict) -> str:
|
|||
return content
|
||||
|
||||
|
||||
@regist_tool(title="Prometheus对话")
|
||||
# @regist_tool(title="Prometheus对话")
|
||||
def text2promql(
|
||||
query: str = Field(
|
||||
description="Tool for querying a Prometheus server, No need for PromQL statements, "
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ def query_database(query: str, config: dict):
|
|||
return context
|
||||
|
||||
|
||||
@regist_tool(title="数据库对话")
|
||||
# @regist_tool(title="数据库对话")
|
||||
def text2sql(
|
||||
query: str = Field(
|
||||
description="No need for SQL statements,just input the natural language that you want to chat with database"
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ from chatchat.server.agent.tools_factory.tools_registry import format_context
|
|||
from .tools_registry import BaseToolOutput, regist_tool
|
||||
|
||||
|
||||
@regist_tool(title="URL内容阅读")
|
||||
# @regist_tool(title="URL内容阅读")
|
||||
def url_reader(
|
||||
url: str = Field(
|
||||
description="The URL to be processed, so that its web content can be made more clear to read. Then provide a detailed description of the content in about 500 words. As structured as possible. ONLY THE LINK SHOULD BE PASSED IN."),
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@ from .tools_registry import BaseToolOutput, regist_tool
|
|||
def weather_check(
|
||||
city: str = Field(description="City name,include city and county,like '厦门'"),
|
||||
):
|
||||
"""Use this tool to check the weather at a specific city"""
|
||||
"""用这个工具获取指定地点和指定时间的天气"""
|
||||
# """Use this tool to check the weather at a specific city"""
|
||||
|
||||
print(f"weather_check tool内部调用,city{city}")
|
||||
tool_config = get_tool_config("weather_check")
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ from chatchat.server.pydantic_v1 import Field
|
|||
from .tools_registry import BaseToolOutput, regist_tool
|
||||
|
||||
|
||||
@regist_tool(title="维基百科搜索")
|
||||
# @regist_tool(title="维基百科搜索")
|
||||
def wikipedia_search(query: str = Field(description="The search query")):
|
||||
""" A wrapper that uses Wikipedia to search."""
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ from chatchat.server.utils import get_tool_config
|
|||
from .tools_registry import BaseToolOutput, regist_tool
|
||||
|
||||
|
||||
@regist_tool
|
||||
# @regist_tool
|
||||
def wolfram(query: str = Field(description="The formula to be calculated")):
|
||||
"""Useful for when you need to calculate difficult formulas"""
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue