Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
LAE
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
文靖昊
LAE
Commits
d7261e1c
Commit
d7261e1c
authored
Nov 26, 2024
by
tinywell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
在线率工具兼容新接口;增加月度统计数据
parent
5f4098e7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
32 deletions
+38
-32
tool_rate.py
src/agent/tool_rate.py
+0
-0
run_tool_picker_monitor.py
test/run_tool_picker_monitor.py
+8
-0
run_tool_picker_rate.py
test/run_tool_picker_rate.py
+30
-32
No files found.
src/agent/tool_rate.py
View file @
d7261e1c
This diff is collapsed.
Click to expand it.
test/run_tool_picker_monitor.py
View file @
d7261e1c
...
@@ -75,7 +75,15 @@ def run_examples():
...
@@ -75,7 +75,15 @@ def run_examples():
"disaster_type"
:
"滑坡"
,
"disaster_type"
:
"滑坡"
,
}
}
}
}
},{
"query"
:
"甘肃省监控点的状态如何?"
,
"expected"
:
{
"tool"
:
"monitor_points_query"
,
"params"
:
{
"key"
:
"甘肃省陇南市"
}
}
}
},
]
]
# 为每个测试案例创建一个表格
# 为每个测试案例创建一个表格
...
...
test/run_tool_picker_rate.py
View file @
d7261e1c
...
@@ -21,14 +21,15 @@ def run_examples():
...
@@ -21,14 +21,15 @@ def run_examples():
model_name
=
"Qwen2-7B"
,
model_name
=
"Qwen2-7B"
,
verbose
=
True
verbose
=
True
)
)
base_url
=
"http://172.30.0.37:30007"
# 初始化工具
# 初始化工具
tools
=
[
tools
=
[
RegionRateTool
(),
RegionRateTool
(
base_url
=
base_url
),
RankingRateTool
(),
RankingRateTool
(
base_url
=
base_url
),
MonitorPointTool
(),
MonitorPointTool
(
base_url
=
base_url
),
]
]
tool_dict
=
{
tool
.
name
:
tool
for
tool
in
tools
}
# 初始化 ToolPicker
# 初始化 ToolPicker
picker
=
ToolPicker
(
llm
,
tools
)
picker
=
ToolPicker
(
llm
,
tools
)
...
@@ -42,7 +43,7 @@ def run_examples():
...
@@ -42,7 +43,7 @@ def run_examples():
"start_time"
:
"2024-11-19"
,
"start_time"
:
"2024-11-19"
,
"end_time"
:
"2024-11-19"
,
"end_time"
:
"2024-11-19"
,
"region_name"
:
""
,
"region_name"
:
""
,
"month_
required
"
:
False
"month_
statistics
"
:
False
}
}
}
}
},
},
...
@@ -54,7 +55,7 @@ def run_examples():
...
@@ -54,7 +55,7 @@ def run_examples():
"start_time"
:
"2024-11-19"
,
"start_time"
:
"2024-11-19"
,
"end_time"
:
"2024-11-19"
,
"end_time"
:
"2024-11-19"
,
"region_name"
:
"甘肃省"
,
"region_name"
:
"甘肃省"
,
"month_
required
"
:
False
"month_
statistics
"
:
False
}
}
}
}
},
},
...
@@ -77,15 +78,6 @@ def run_examples():
...
@@ -77,15 +78,6 @@ def run_examples():
}
}
},
},
{
{
"query"
:
"甘肃省监控点的状态如何?"
,
"expected"
:
{
"tool"
:
"monitor_points_query"
,
"params"
:
{
"key"
:
"甘肃省"
}
}
},
{
"query"
:
"2023年甘肃省每月的设备在线率分别是多少?"
,
"query"
:
"2023年甘肃省每月的设备在线率分别是多少?"
,
"expected"
:
{
"expected"
:
{
"tool"
:
"region_online_rate"
,
"tool"
:
"region_online_rate"
,
...
@@ -93,7 +85,7 @@ def run_examples():
...
@@ -93,7 +85,7 @@ def run_examples():
"start_time"
:
"2023-01-01"
,
"start_time"
:
"2023-01-01"
,
"end_time"
:
"2023-12-31"
,
"end_time"
:
"2023-12-31"
,
"region_name"
:
"甘肃省"
,
"region_name"
:
"甘肃省"
,
"month_
required
"
:
True
"month_
statistics
"
:
True
}
}
}
}
},
},
...
@@ -105,28 +97,28 @@ def run_examples():
...
@@ -105,28 +97,28 @@ def run_examples():
"start_time"
:
"2024-01-01"
,
"start_time"
:
"2024-01-01"
,
"end_time"
:
"2024-12-31"
,
"end_time"
:
"2024-12-31"
,
"region_name"
:
"甘肃省"
,
"region_name"
:
"甘肃省"
,
"month_
required
"
:
True
"month_
statistics
"
:
True
}
}
}
}
},
},
{
{
"query"
:
"2024年10月15日,
成都市武侯区
的设备在线率是多少?"
,
"query"
:
"2024年10月15日,
兰州市
的设备在线率是多少?"
,
"expected"
:
{
"expected"
:
{
"tool"
:
"region_online_rate"
,
"tool"
:
"region_online_rate"
,
"params"
:
{
"params"
:
{
"start_time"
:
"2024-10-15"
,
"start_time"
:
"2024-10-15"
,
"end_time"
:
"2024-10-15"
,
"end_time"
:
"2024-10-15"
,
"region_name"
:
"
成都市武侯区
"
,
"region_name"
:
"
兰州市
"
,
"month_
required
"
:
False
"month_
statistics
"
:
False
}
}
}
}
},
},
{
{
"query"
:
"2024年,
成都市武侯区
的设备在线率是多少?"
,
"query"
:
"2024年,
兰州市榆中县
的设备在线率是多少?"
,
"expected"
:
{
"expected"
:
{
"tool"
:
"region_online_rate"
,
"tool"
:
"region_online_rate"
,
"params"
:
{
"params"
:
{
"start_time"
:
"2024-
01-01"
,
"region_name"
:
"成都市武侯区"
,
"month_required
"
:
False
"start_time"
:
"2024-
11-26"
,
"region_name"
:
"兰州市榆中县"
,
"month_statistics
"
:
False
}
}
}
}
},
},
...
@@ -135,7 +127,7 @@ def run_examples():
...
@@ -135,7 +127,7 @@ def run_examples():
"expected"
:
{
"expected"
:
{
"tool"
:
"region_online_rate"
,
"tool"
:
"region_online_rate"
,
"params"
:
{
"params"
:
{
"start_time"
:
"2023-01-01"
,
"end_time"
:
"2023-12-31"
,
"region_name"
:
"甘肃省"
,
"month_
required
"
:
True
"start_time"
:
"2023-01-01"
,
"end_time"
:
"2023-12-31"
,
"region_name"
:
"甘肃省"
,
"month_
statistics
"
:
True
}
}
}
}
},
},
...
@@ -144,7 +136,7 @@ def run_examples():
...
@@ -144,7 +136,7 @@ def run_examples():
"expected"
:
{
"expected"
:
{
"tool"
:
"region_online_rate"
,
"tool"
:
"region_online_rate"
,
"params"
:
{
"params"
:
{
"start_time"
:
"2023-01-01"
,
"region_name"
:
"甘肃省"
,
"month_
required
"
:
True
"start_time"
:
"2023-01-01"
,
"region_name"
:
"甘肃省"
,
"month_
statistics
"
:
True
}
}
}
}
},
},
...
@@ -153,25 +145,25 @@ def run_examples():
...
@@ -153,25 +145,25 @@ def run_examples():
"expected"
:
{
"expected"
:
{
"tool"
:
"region_online_rate"
,
"tool"
:
"region_online_rate"
,
"params"
:
{
"params"
:
{
"start_time"
:
"2023-01-01"
,
"region_name"
:
""
,
"month_
required
"
:
True
"start_time"
:
"2023-01-01"
,
"region_name"
:
""
,
"month_
statistics
"
:
True
}
}
}
}
},
},
{
{
"query"
:
"2023年1月-2023年12月期间
西藏
实验点在线率是多少?"
,
"query"
:
"2023年1月-2023年12月期间
青海
实验点在线率是多少?"
,
"expected"
:
{
"expected"
:
{
"tool"
:
"region_online_rate"
,
"tool"
:
"region_online_rate"
,
"params"
:
{
"params"
:
{
"start_time"
:
"2023-01-01"
,
"end_time"
:
"2023-12-31"
,
"region_name"
:
"
西藏"
,
"month_required
"
:
False
"start_time"
:
"2023-01-01"
,
"end_time"
:
"2023-12-31"
,
"region_name"
:
"
青海"
,
"month_statistics
"
:
False
}
}
}
}
},
},
{
{
"query"
:
"2023年1月-2023年12月期间
西藏
实验点各月在线率是多少?"
,
"query"
:
"2023年1月-2023年12月期间
青海
实验点各月在线率是多少?"
,
"expected"
:
{
"expected"
:
{
"tool"
:
"region_online_rate"
,
"tool"
:
"region_online_rate"
,
"params"
:
{
"params"
:
{
"start_time"
:
"2023-01-01"
,
"end_time"
:
"2023-12-31"
,
"region_name"
:
"
西藏"
,
"month_required
"
:
True
"start_time"
:
"2023-01-01"
,
"end_time"
:
"2023-12-31"
,
"region_name"
:
"
青海"
,
"month_statistics
"
:
True
}
}
}
}
},
},
...
@@ -180,7 +172,7 @@ def run_examples():
...
@@ -180,7 +172,7 @@ def run_examples():
"expected"
:
{
"expected"
:
{
"tool"
:
"region_online_rate"
,
"tool"
:
"region_online_rate"
,
"params"
:
{
"params"
:
{
"start_time"
:
"2022-01-01"
,
"end_time"
:
"2022-12-31"
,
"region_name"
:
""
,
"month_
required
"
:
True
"start_time"
:
"2022-01-01"
,
"end_time"
:
"2022-12-31"
,
"region_name"
:
""
,
"month_
statistics
"
:
True
}
}
}
}
},
},
...
@@ -189,7 +181,7 @@ def run_examples():
...
@@ -189,7 +181,7 @@ def run_examples():
"expected"
:
{
"expected"
:
{
"tool"
:
"region_online_rate"
,
"tool"
:
"region_online_rate"
,
"params"
:
{
"params"
:
{
"start_time"
:
"2023-01-01"
,
"end_time"
:
"2023-12-31"
,
"region_name"
:
"西藏"
,
"month_
required
"
:
True
"start_time"
:
"2023-01-01"
,
"end_time"
:
"2023-12-31"
,
"region_name"
:
"西藏"
,
"month_
statistics
"
:
True
}
}
}
}
},
},
...
@@ -198,7 +190,7 @@ def run_examples():
...
@@ -198,7 +190,7 @@ def run_examples():
"expected"
:
{
"expected"
:
{
"tool"
:
"region_online_rate"
,
"tool"
:
"region_online_rate"
,
"params"
:
{
"params"
:
{
"start_time"
:
"2023-01-01"
,
"end_time"
:
"2023-12-31"
,
"region_name"
:
"西藏"
,
"month_
required
"
:
True
"start_time"
:
"2023-01-01"
,
"end_time"
:
"2023-12-31"
,
"region_name"
:
"西藏"
,
"month_
statistics
"
:
True
}
}
}
}
}
}
...
@@ -238,6 +230,12 @@ def run_examples():
...
@@ -238,6 +230,12 @@ def run_examples():
"✓"
if
expected_value
==
actual_value
else
"✗"
"✓"
if
expected_value
==
actual_value
else
"✗"
)
)
tool
=
tool_dict
[
result
[
"tool"
]]
params
=
result
[
"params"
]
result
=
tool
.
invoke
(
params
)
print
(
result
)
except
Exception
as
e
:
except
Exception
as
e
:
table
.
add_row
(
"错误"
,
""
,
str
(
e
),
"✗"
)
table
.
add_row
(
"错误"
,
""
,
str
(
e
),
"✗"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment