itam-assistant 0.1.7__tar.gz → 0.1.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {itam_assistant-0.1.7 → itam_assistant-0.1.9}/PKG-INFO +11 -2
- {itam_assistant-0.1.7 → itam_assistant-0.1.9}/itam_assistant/do_ai.py +77 -33
- {itam_assistant-0.1.7 → itam_assistant-0.1.9}/itam_assistant.egg-info/PKG-INFO +12 -3
- {itam_assistant-0.1.7 → itam_assistant-0.1.9}/setup.py +1 -1
- {itam_assistant-0.1.7 → itam_assistant-0.1.9}/test/test.py +2 -2
- {itam_assistant-0.1.7 → itam_assistant-0.1.9}/README.md +0 -0
- {itam_assistant-0.1.7 → itam_assistant-0.1.9}/itam_assistant/__init__.py +0 -0
- {itam_assistant-0.1.7 → itam_assistant-0.1.9}/itam_assistant/ailyapp_client.py +0 -0
- {itam_assistant-0.1.7 → itam_assistant-0.1.9}/itam_assistant/config.py +0 -0
- {itam_assistant-0.1.7 → itam_assistant-0.1.9}/itam_assistant/intent_detail.py +0 -0
- {itam_assistant-0.1.7 → itam_assistant-0.1.9}/itam_assistant/lark_client.py +0 -0
- {itam_assistant-0.1.7 → itam_assistant-0.1.9}/itam_assistant/logger.py +0 -0
- {itam_assistant-0.1.7 → itam_assistant-0.1.9}/itam_assistant/openapi.py +0 -0
- {itam_assistant-0.1.7 → itam_assistant-0.1.9}/itam_assistant/test.py +0 -0
- {itam_assistant-0.1.7 → itam_assistant-0.1.9}/itam_assistant.egg-info/SOURCES.txt +0 -0
- {itam_assistant-0.1.7 → itam_assistant-0.1.9}/itam_assistant.egg-info/dependency_links.txt +0 -0
- {itam_assistant-0.1.7 → itam_assistant-0.1.9}/itam_assistant.egg-info/requires.txt +0 -0
- {itam_assistant-0.1.7 → itam_assistant-0.1.9}/itam_assistant.egg-info/top_level.txt +0 -0
- {itam_assistant-0.1.7 → itam_assistant-0.1.9}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: itam_assistant
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.9
|
|
4
4
|
Summary: 优化版本--技能分发的结果展示
|
|
5
5
|
Home-page: https://github.com/liujunmeiD/itam_assistant
|
|
6
6
|
Author: liujunmeiD
|
|
@@ -12,5 +12,14 @@ Requires-Python: >=3.6
|
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
Requires-Dist: requests>=2.25.1
|
|
14
14
|
Requires-Dist: numpy>=1.20.0
|
|
15
|
+
Dynamic: author
|
|
16
|
+
Dynamic: author-email
|
|
17
|
+
Dynamic: classifier
|
|
18
|
+
Dynamic: description
|
|
19
|
+
Dynamic: description-content-type
|
|
20
|
+
Dynamic: home-page
|
|
21
|
+
Dynamic: requires-dist
|
|
22
|
+
Dynamic: requires-python
|
|
23
|
+
Dynamic: summary
|
|
15
24
|
|
|
16
25
|
详见https://bytedance.feishu.cn/docs/doccnSOL0o2qtnElftgd2rir2Dc
|
|
@@ -68,7 +68,7 @@ def do_ai_auto(Testk_data, clientinfo):
|
|
|
68
68
|
# 可不需等待运行实例创建完成
|
|
69
69
|
# if not runs:
|
|
70
70
|
# raise ValueError("未能成功创建运行实例")
|
|
71
|
-
time.sleep(
|
|
71
|
+
time.sleep(2)
|
|
72
72
|
else:
|
|
73
73
|
return startAt, i
|
|
74
74
|
break
|
|
@@ -81,23 +81,26 @@ def do_ai_auto(Testk_data, clientinfo):
|
|
|
81
81
|
tenant_access_token = AilyLarkClient(clientinfo).get_tenant_access_token()
|
|
82
82
|
if not tenant_access_token:
|
|
83
83
|
raise ValueError("未能获取到有效的租户访问令牌")
|
|
84
|
-
|
|
84
|
+
if i['ext'].get('input'):
|
|
85
|
+
aa = i['ext']['input']
|
|
86
|
+
else:
|
|
87
|
+
aa = i['ext']['用户输入']
|
|
85
88
|
if startAt == 0:
|
|
86
89
|
startAt = int(time.time())
|
|
87
90
|
# 创建会话
|
|
88
91
|
seseion_id = AilyLarkClient(clientinfo).create_ailysession(tenant_access_token)
|
|
89
|
-
time.sleep(
|
|
92
|
+
time.sleep(2)
|
|
90
93
|
if not seseion_id:
|
|
91
94
|
raise ValueError("未能成功创建会话")
|
|
92
95
|
# 创建消息
|
|
93
96
|
message_id = AilyLarkClient(clientinfo).create_ailysessionaily_message(tenant_access_token, seseion_id,
|
|
94
97
|
aa)
|
|
95
|
-
time.sleep(
|
|
98
|
+
time.sleep(2)
|
|
96
99
|
if not message_id:
|
|
97
100
|
raise ValueError("未能成功创建消息")
|
|
98
101
|
# 创建运行实例
|
|
99
102
|
runs = AilyLarkClient(clientinfo).create_ailysession_run(tenant_access_token, seseion_id)
|
|
100
|
-
time.sleep(
|
|
103
|
+
time.sleep(2)
|
|
101
104
|
num = num + 1
|
|
102
105
|
return startAt, num
|
|
103
106
|
except KeyError as ke:
|
|
@@ -316,12 +319,13 @@ def do_waterlevellineres_sr(res, info,hardtype):
|
|
|
316
319
|
info['label'].append(copy.deepcopy(aaa))
|
|
317
320
|
# 判断label0和label1是否为空,为空则:label默认2级
|
|
318
321
|
# 判断exp和label是否一致,一致则:rt=True,不一致则:rt=False
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
322
|
+
# 判断label0和label1是否为空,为空则:label默认2级
|
|
323
|
+
for a in range(len(info['exp'])):
|
|
324
|
+
if info['exp'][a]['label'] == info['label'][a]['label']:
|
|
325
|
+
info['rt'] = True
|
|
326
|
+
else:
|
|
327
|
+
info['rt'] = False
|
|
328
|
+
break
|
|
325
329
|
else:
|
|
326
330
|
info['label'] = info['label'] = [{'label': '', 'score': 0}, {'label': '', 'score': 0}]
|
|
327
331
|
info['rt'] = False
|
|
@@ -334,10 +338,10 @@ def do_metricsevaluation_list(collections,data,score_threshold):
|
|
|
334
338
|
"""
|
|
335
339
|
info = {
|
|
336
340
|
"input": {
|
|
337
|
-
"
|
|
341
|
+
"用户输入": "测试数据"
|
|
338
342
|
},
|
|
339
343
|
"output": {
|
|
340
|
-
"
|
|
344
|
+
"output": "测试数据"
|
|
341
345
|
},
|
|
342
346
|
"rt": False,
|
|
343
347
|
"label": [{"label": "测试"}, {"label": "测试"}],
|
|
@@ -351,20 +355,20 @@ def do_metricsevaluation_list(collections,data,score_threshold):
|
|
|
351
355
|
cleaned_content = i['content'].replace('\r', '').replace('\n', '').replace('\\', '')
|
|
352
356
|
cleaned_userInput = j['用户输入/userInput'].replace('\r', '').replace('\n', '').replace('\\', '')
|
|
353
357
|
if cleaned_content == cleaned_userInput:
|
|
354
|
-
info['input']['
|
|
355
|
-
info['output']['
|
|
356
|
-
if i['ext']['
|
|
358
|
+
info['input']['用户输入'] = i['ext'].get('input') or i['ext']['用户输入']
|
|
359
|
+
info['output']['output'] = "对话id:"+j['对话日志/intentID']+" 对话内容:"+j['用户输入/userInput']
|
|
360
|
+
if i['ext']['分发技能'] != '' and i['ext']['分发技能'] in j['分发技能/skill'][0]:
|
|
357
361
|
info['rt'] = True
|
|
358
362
|
info['label'] = [{'label': j['分发技能/skill'][0]}]
|
|
359
|
-
info['exp'] = [{'label': i['ext']['
|
|
363
|
+
info['exp'] = [{'label': i['ext']['分发技能']}]
|
|
360
364
|
info['artificial'] = info['exp']
|
|
361
365
|
else:
|
|
362
366
|
info['rt'] = False
|
|
363
367
|
info['label'] = [{'label': j['分发技能/skill'][0]}]
|
|
364
|
-
info['exp'] = [{'label': i['ext']['
|
|
368
|
+
info['exp'] = [{'label': i['ext']['分发技能']}]
|
|
365
369
|
info['artificial'] = info['exp']
|
|
366
|
-
if i['ext']['
|
|
367
|
-
businessscenario.append(i['ext']['
|
|
370
|
+
if i['ext']['分发技能'] not in businessscenario:
|
|
371
|
+
businessscenario.append(i['ext']['分发技能'])
|
|
368
372
|
#将data中的j删除
|
|
369
373
|
data.remove(j)
|
|
370
374
|
info_list.append(copy.deepcopy(info))
|
|
@@ -725,7 +729,7 @@ def do_waterlevelline_autotest_SoftwareApplyRecommendList(collections, clientinf
|
|
|
725
729
|
"用户输入/userInput": "我要申请软件,名字叫:ai_xzh_all_restricted_software完全受限软件"
|
|
726
730
|
},
|
|
727
731
|
"output": {
|
|
728
|
-
"
|
|
732
|
+
"实际输出/output": "我要申请软件,名字叫:ai_xzh_all_restricted_software完全受限软件"
|
|
729
733
|
},
|
|
730
734
|
"rt": True,
|
|
731
735
|
"label": [{"label": "GUI 软件申请", "score": 0.6}, {"label": "软件申请", "score": 0.5}],
|
|
@@ -735,16 +739,24 @@ def do_waterlevelline_autotest_SoftwareApplyRecommendList(collections, clientinf
|
|
|
735
739
|
}
|
|
736
740
|
a =0
|
|
737
741
|
for i in collections:
|
|
738
|
-
info['input']['用户输入/userInput'] = i['ext'].get('
|
|
739
|
-
info['output']['
|
|
740
|
-
info['exp'] = [
|
|
741
|
-
|
|
742
|
-
|
|
742
|
+
info['input']['用户输入/userInput'] = i['ext'].get('BPO标注-AP-资产名称') or i['ext'].get('BPO标注-AP-资产名称')
|
|
743
|
+
info['output']['实际输出/output'] = i['ext']['BPO标注-AP-资产名称']
|
|
744
|
+
info['exp'] = []
|
|
745
|
+
for j in [i['ext']['BPO标注-AP-资产型号'], i['ext'].get('BPO标注-AP-资产型号1'),
|
|
746
|
+
i['ext'].get('BPO标注-AP-资产型号2'), i['ext'].get('BPO标注-AP-资产型号3'),
|
|
747
|
+
i['ext'].get('BPO标注-AP-资产型号4'), i['ext'].get('BPO标注-AP-资产型号5'),
|
|
748
|
+
i['ext'].get('BPO标注-AP-资产型号6'), i['ext'].get('BPO标注-AP-资产型号7'),
|
|
749
|
+
i['ext'].get('BPO标注-AP-资产型号8'), i['ext'].get('BPO标注-AP-资产型号9'),
|
|
750
|
+
i['ext'].get('BPO标注-AP-资产型号10')]:
|
|
751
|
+
if j:
|
|
752
|
+
info['exp'].append({'label': j, 'score': score_threshold})
|
|
753
|
+
if info['exp'] == '':
|
|
754
|
+
break
|
|
743
755
|
info['artificial'] = info['exp']
|
|
744
756
|
info['label']=[]
|
|
745
|
-
if i['ext']['
|
|
746
|
-
if "软件" in i['ext']['
|
|
747
|
-
asset_name = i['ext']['
|
|
757
|
+
if i['ext']['BPO标注-AP-资产名称']:
|
|
758
|
+
if "软件" in i['ext']['BPO标注-AP-分发技能']:
|
|
759
|
+
asset_name = i['ext']['BPO标注-AP-资产名称']
|
|
748
760
|
try:
|
|
749
761
|
# 尝试将其解析为 JSON 对象
|
|
750
762
|
if isinstance(asset_name, str):
|
|
@@ -780,6 +792,7 @@ def do_waterlevellineres_software(res, info):
|
|
|
780
792
|
return info
|
|
781
793
|
reslist=res["data"]["SoftwareApplyRecommendList"]
|
|
782
794
|
aaa ={}
|
|
795
|
+
info['output']['实际输出/output'] = 'requestId:'+res.get('requestId')
|
|
783
796
|
# 判断res["body"]["Results"]不为空,空则:label0 label1 为空,label默认2级
|
|
784
797
|
if reslist:
|
|
785
798
|
# 取["Results"]下前2个结果,若只有1个结果,label1为空
|
|
@@ -788,15 +801,46 @@ def do_waterlevellineres_software(res, info):
|
|
|
788
801
|
aaa = {'label': reslist[j]['Data']['Name']['ValueZh'],
|
|
789
802
|
'score': reslist[j]['Score']}
|
|
790
803
|
info['label'].append(copy.deepcopy(aaa))
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
else:
|
|
794
|
-
info['rt'] = False
|
|
804
|
+
|
|
805
|
+
info['rt'] = do_businessassertionrules(info['label'],info['exp'])
|
|
795
806
|
else:
|
|
796
807
|
info['label'] = info['label'] = [{'label': '', 'score': 0}, {'label': '', 'score': 0}]
|
|
797
808
|
info['rt'] = False
|
|
798
809
|
return info
|
|
799
810
|
|
|
811
|
+
def do_businessassertionrules(label, epx):
|
|
812
|
+
"""
|
|
813
|
+
业务断言
|
|
814
|
+
:param res:
|
|
815
|
+
:param info:
|
|
816
|
+
:return:
|
|
817
|
+
"""
|
|
818
|
+
# 当预期值或实际值列表为空时,直接返回 False
|
|
819
|
+
if not epx or not label:
|
|
820
|
+
return False
|
|
821
|
+
|
|
822
|
+
# 规则1:当预期值为1维时
|
|
823
|
+
if len(epx) == 1:
|
|
824
|
+
return epx[0]['label'] == label[0]['label']
|
|
825
|
+
|
|
826
|
+
# 规则2:当预期值大于等于 实际值时,判断预期值包含实际值
|
|
827
|
+
if len(epx) >= len(label):
|
|
828
|
+
for i in range(len(label)):
|
|
829
|
+
if epx[i]['label'] != label[i]['label']:
|
|
830
|
+
return False
|
|
831
|
+
return True
|
|
832
|
+
|
|
833
|
+
# 规则3:当预期值小于 实际值时,判断实际值包含预期值
|
|
834
|
+
for i in range(len(epx)):
|
|
835
|
+
if epx[i]['label'] != label[i]['label']:
|
|
836
|
+
return False
|
|
837
|
+
return True
|
|
838
|
+
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
|
|
842
|
+
|
|
843
|
+
|
|
800
844
|
def get_conversationlogs1(startAt):
|
|
801
845
|
"""
|
|
802
846
|
对话ID 技能分发 用户输入
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
2
|
-
Name:
|
|
3
|
-
Version: 0.1.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: itam_assistant
|
|
3
|
+
Version: 0.1.9
|
|
4
4
|
Summary: 优化版本--技能分发的结果展示
|
|
5
5
|
Home-page: https://github.com/liujunmeiD/itam_assistant
|
|
6
6
|
Author: liujunmeiD
|
|
@@ -12,5 +12,14 @@ Requires-Python: >=3.6
|
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
Requires-Dist: requests>=2.25.1
|
|
14
14
|
Requires-Dist: numpy>=1.20.0
|
|
15
|
+
Dynamic: author
|
|
16
|
+
Dynamic: author-email
|
|
17
|
+
Dynamic: classifier
|
|
18
|
+
Dynamic: description
|
|
19
|
+
Dynamic: description-content-type
|
|
20
|
+
Dynamic: home-page
|
|
21
|
+
Dynamic: requires-dist
|
|
22
|
+
Dynamic: requires-python
|
|
23
|
+
Dynamic: summary
|
|
15
24
|
|
|
16
25
|
详见https://bytedance.feishu.cn/docs/doccnSOL0o2qtnElftgd2rir2Dc
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import csv
|
|
3
3
|
import json
|
|
4
4
|
import copy
|
|
5
|
-
from
|
|
5
|
+
from itam_assistant1.do_ai import do_ai_auto
|
|
6
6
|
|
|
7
7
|
# 假设 Testsuitelink 是一个有效的文档链接
|
|
8
|
-
from
|
|
8
|
+
from itam_assistant1.openapi import get_query_vector
|
|
9
9
|
|
|
10
10
|
Testsuitelink = "your_testsuitelink_here"
|
|
11
11
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|