user-simulator 0.1.1__py3-none-any.whl → 0.1.2__py3-none-any.whl
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.
- metamorphic/__init__.py +9 -0
- metamorphic/results.py +62 -0
- metamorphic/rule_utils.py +482 -0
- metamorphic/rules.py +231 -0
- metamorphic/tests.py +83 -0
- metamorphic/text_comparison_utils.py +31 -0
- technologies/__init__.py +0 -0
- technologies/chatbot_connectors.py +567 -0
- technologies/chatbots.py +80 -0
- technologies/taskyto.py +110 -0
- user_sim/cli/sensei_chat.py +1 -1
- user_sim/core/role_structure.py +1 -1
- user_sim/handlers/pdf_parser_module.py +1 -1
- user_sim/utils/register_management.py +1 -1
- {user_simulator-0.1.1.dist-info → user_simulator-0.1.2.dist-info}/METADATA +1 -1
- {user_simulator-0.1.1.dist-info → user_simulator-0.1.2.dist-info}/RECORD +20 -10
- user_simulator-0.1.2.dist-info/entry_points.txt +6 -0
- user_simulator-0.1.2.dist-info/top_level.txt +3 -0
- user_simulator-0.1.1.dist-info/entry_points.txt +0 -6
- user_simulator-0.1.1.dist-info/top_level.txt +0 -1
- {user_simulator-0.1.1.dist-info → user_simulator-0.1.2.dist-info}/WHEEL +0 -0
- {user_simulator-0.1.1.dist-info → user_simulator-0.1.2.dist-info}/licenses/LICENSE.txt +0 -0
technologies/taskyto.py
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
import glob
|
2
|
+
import inflect
|
3
|
+
import os
|
4
|
+
import yaml
|
5
|
+
|
6
|
+
from .chatbots import RoleData, ChatbotSpecification
|
7
|
+
from typing import List, Dict
|
8
|
+
|
9
|
+
|
10
|
+
class ChatbotSpecificationTaskyto (ChatbotSpecification):
|
11
|
+
def build_user_profile(self, chatbot_folder) -> RoleData:
|
12
|
+
"""
|
13
|
+
:param chatbot_folder: folder containing the chatbot modules
|
14
|
+
:returns user profile built from the chatbot specification
|
15
|
+
"""
|
16
|
+
formatter = inflect.engine()
|
17
|
+
profile = RoleData()
|
18
|
+
profile.role = 'You have to act as a user of a chatbot.'
|
19
|
+
profile.context = [
|
20
|
+
"Never indicate that you are the user, like 'user: bla bla'.", #todo: these prompts should be removed since they are added internaly in the code. A.
|
21
|
+
"Sometimes, interact with what the assistant just said.",
|
22
|
+
"Never act as the assistant.",
|
23
|
+
"Don't end the conversation until you've asked everything you need."
|
24
|
+
]
|
25
|
+
# profile.conversations.interaction_style.append('long phrase')
|
26
|
+
profile.conversations.interaction_style.append('change your mind')
|
27
|
+
profile.conversations.interaction_style.append('make spelling mistakes')
|
28
|
+
profile.conversations.interaction_style.append('single question')
|
29
|
+
profile.conversations.interaction_style.append('all questions')
|
30
|
+
# profile.conversations.interaction_style.append('default')
|
31
|
+
|
32
|
+
# chatbot modules
|
33
|
+
modules = self.__class__.__load_chatbot_modules(chatbot_folder)
|
34
|
+
for module in modules:
|
35
|
+
if module.get("modules"):
|
36
|
+
modules.extend(module.get("modules"))
|
37
|
+
continue
|
38
|
+
# menu module ...........................................
|
39
|
+
kind = module.get("kind")
|
40
|
+
if kind == "menu":
|
41
|
+
if module.get("items"):
|
42
|
+
modules.extend(module.get("items"))
|
43
|
+
if not profile.fallback:
|
44
|
+
profile.fallback = module.get("fallback")
|
45
|
+
if module.get("presentation"):
|
46
|
+
profile.role += f' This chatbot is described as follows: \"{module.get("presentation").strip()}\"'
|
47
|
+
# data gathering module .................................
|
48
|
+
elif kind == "data_gathering":
|
49
|
+
for data in module.get("data"):
|
50
|
+
for item in data.keys():
|
51
|
+
item_values = data.get(item)
|
52
|
+
if item_values.get("type") == "enum":
|
53
|
+
if formatter.singular_noun(item) is True:
|
54
|
+
item = formatter.plural(item)
|
55
|
+
ask_about = 'Consider the following ' + item + ': {{' + item + '}}.'
|
56
|
+
ask_values = self.__class__.__flatten(item_values.get("values"))
|
57
|
+
profile.ask_about.append(ask_about)
|
58
|
+
profile.ask_about.append({item: ask_values})
|
59
|
+
# answer module .........................................
|
60
|
+
elif kind == "answer":
|
61
|
+
profile.ask_about.append(module.get("title"))
|
62
|
+
|
63
|
+
# chatbot configuration
|
64
|
+
config = self.__class__.__load_configuration_file(chatbot_folder)
|
65
|
+
if config.get("languages"):
|
66
|
+
languages = [language.strip() for language in config.get("languages").split(",")]
|
67
|
+
profile.conversations.change_language.extend(languages)
|
68
|
+
profile.language = languages[0]
|
69
|
+
|
70
|
+
return profile
|
71
|
+
|
72
|
+
@staticmethod
|
73
|
+
def __flatten(list_values: List[str | Dict[str, List[str]]]) -> List[str]:
|
74
|
+
"""
|
75
|
+
:param list_values: list of values, which can be strings or dictionaries
|
76
|
+
:returns list of string values (dicts are flattened -- their keys and values are added to the list)
|
77
|
+
"""
|
78
|
+
list_flattened = []
|
79
|
+
for value in list_values:
|
80
|
+
if isinstance(value, Dict):
|
81
|
+
for key in value.keys():
|
82
|
+
list_flattened.append(key)
|
83
|
+
list_flattened.extend(value.get(key))
|
84
|
+
else:
|
85
|
+
list_flattened.append(value)
|
86
|
+
return list_flattened
|
87
|
+
|
88
|
+
@staticmethod
|
89
|
+
def __load_chatbot_modules(chatbot_folder) -> List[Dict]:
|
90
|
+
"""
|
91
|
+
:param chatbot_folder: folder containing the chatbot modules
|
92
|
+
:returns yaml files in chatbot_folder
|
93
|
+
"""
|
94
|
+
modules = []
|
95
|
+
for file_path in glob.glob(os.path.join(chatbot_folder, '*.yaml')):
|
96
|
+
with open(file_path) as yaml_file:
|
97
|
+
modules.append(yaml.safe_load(yaml_file.read()))
|
98
|
+
return modules
|
99
|
+
|
100
|
+
@staticmethod
|
101
|
+
def __load_configuration_file(chatbot_folder) -> Dict:
|
102
|
+
"""
|
103
|
+
:param chatbot_folder: folder containing the chatbot modules
|
104
|
+
:returns file chatbot_folder/configuration/default.yaml
|
105
|
+
"""
|
106
|
+
configuration_file = os.path.join(chatbot_folder, "configuration", "default.yaml")
|
107
|
+
if os.path.isfile(configuration_file):
|
108
|
+
with open(configuration_file) as yaml_file:
|
109
|
+
return yaml.safe_load(yaml_file.read())
|
110
|
+
return {}
|
user_sim/cli/sensei_chat.py
CHANGED
@@ -79,7 +79,7 @@ def configure_project(project_path):
|
|
79
79
|
config.custom_personalities_folder = os.path.join(project_path, "personalities")
|
80
80
|
|
81
81
|
custom_types_path = os.path.join(project_path, "types")
|
82
|
-
default_types_path = os.path.join(config.root_path, "config", "types")
|
82
|
+
default_types_path = os.path.join(config.root_path,"src", "config", "types")
|
83
83
|
|
84
84
|
custom_types = load_yaml_files_from_folder(custom_types_path)
|
85
85
|
default_types = load_yaml_files_from_folder(default_types_path, existing_keys=custom_types.keys())
|
user_sim/core/role_structure.py
CHANGED
@@ -281,7 +281,7 @@ class RoleData:
|
|
281
281
|
custom_personalities_path = config.custom_personalities_folder
|
282
282
|
path_list.append(custom_personalities_path)
|
283
283
|
|
284
|
-
default_personalities_path = os.path.join(config.root_path, "config", "personalities")
|
284
|
+
default_personalities_path = os.path.join(config.root_path,"src", "config", "personalities")
|
285
285
|
path_list.append(default_personalities_path)
|
286
286
|
|
287
287
|
try:
|
@@ -11,7 +11,7 @@ from user_sim.handlers.image_recognition_module import image_description
|
|
11
11
|
|
12
12
|
logger = logging.getLogger('Info Logger')
|
13
13
|
current_script_dir = os.path.dirname(os.path.abspath(__file__))
|
14
|
-
project_root = os.path.abspath(os.path.join(current_script_dir, "
|
14
|
+
project_root = os.path.abspath(os.path.join(current_script_dir, "../.."))
|
15
15
|
pdf_register_name = "pdf_register.json"
|
16
16
|
|
17
17
|
|
@@ -4,7 +4,7 @@ import hashlib
|
|
4
4
|
import logging
|
5
5
|
|
6
6
|
current_script_dir = os.path.dirname(os.path.abspath(__file__))
|
7
|
-
project_root = os.path.abspath(os.path.join(current_script_dir, "
|
7
|
+
project_root = os.path.abspath(os.path.join(current_script_dir, "../..")) #change
|
8
8
|
temp_file_dir = os.path.join(project_root, "data/cache")
|
9
9
|
|
10
10
|
logger = logging.getLogger('Info Logger')
|
@@ -1,8 +1,18 @@
|
|
1
|
+
metamorphic/__init__.py,sha256=BqyThH4lzS95P_YZ27b4K3rf5P9JgwHU9I3r99jSEiQ,135
|
2
|
+
metamorphic/results.py,sha256=kKeud02cNpehVmHRAkVO-uf1rd-H7D8cAkSeiKmU8Jg,2040
|
3
|
+
metamorphic/rule_utils.py,sha256=frm2IDxHEsYlvFVTQqFDEdfDVejNKtqhxreIOb7_Jrs,17978
|
4
|
+
metamorphic/rules.py,sha256=b0W-L1JDqflpuIiPI9OQNqSGunQ3aAeWnXDf9hiAWjU,9504
|
5
|
+
metamorphic/tests.py,sha256=aS_kzOXM4T4FomdXbJvPfEwP7ACRPGBgZHaXKcQuN0w,3214
|
6
|
+
metamorphic/text_comparison_utils.py,sha256=3SKhaMX1taQKzSNkkDkslabhJChIXFNcfWK6-97yu6Y,998
|
7
|
+
technologies/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
|
+
technologies/chatbot_connectors.py,sha256=sXMyVyHXYfPjIC7H4LlHgtSnhI4oIhkTdvMR2JSn8DI,25398
|
9
|
+
technologies/chatbots.py,sha256=apTbCU2paYLgVLAXg2h0HAigazJxIo7L9vKQpcJpqyM,3047
|
10
|
+
technologies/taskyto.py,sha256=d-I45hE0xKrFsV6qDkAZ0b98NAnaARAiSM5RE781CVw,5194
|
1
11
|
user_sim/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
12
|
user_sim/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
13
|
user_sim/cli/gen_user_profile.py,sha256=2CyPOr3CDSVZuJephFc4sOnzS8PyBXz4O_r-iqW-eIU,1466
|
4
14
|
user_sim/cli/init_project.py,sha256=t4z4Omfo2_uh-mNjVOpFIxnnlWdtH9VUa3mD3q14v6A,1947
|
5
|
-
user_sim/cli/sensei_chat.py,sha256=
|
15
|
+
user_sim/cli/sensei_chat.py,sha256=g3eDgaWaT1qF_J5zS20UeHbFTU2nlv02OGwHMpNgy6k,20539
|
6
16
|
user_sim/cli/sensei_check.py,sha256=m4YLKLe1QpNsHXS6YTXE9a82InRpPZg4ztVHQQsh55s,3918
|
7
17
|
user_sim/cli/validation_check.py,sha256=XxXwo5-L3P5Q3nT7wZBv-l5rW1jt6cTrhyO7pGV_IUQ,5371
|
8
18
|
user_sim/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -10,13 +20,13 @@ user_sim/core/ask_about.py,sha256=E_3iUYBk73VSjgD0LZdN3HtTr0PmS9ek5IH2PeChRT8,28
|
|
10
20
|
user_sim/core/data_extraction.py,sha256=cDgE5VWko7neR2uP0SSPncwFf3xvro1MYtX3kgF_PVU,9811
|
11
21
|
user_sim/core/data_gathering.py,sha256=mLTnBLmBYfHfSSDhhprl60c_w1mwCLTtKJbhpnQoZW8,4943
|
12
22
|
user_sim/core/interaction_styles.py,sha256=JmtvpUvVkMis7ON91IQsO8ISkV_Qf417KCMkxeXkdLY,4374
|
13
|
-
user_sim/core/role_structure.py,sha256=
|
23
|
+
user_sim/core/role_structure.py,sha256=pl7JNSRNQ9Jl4-gsp2ZiBjjs0VPJqGD9XXiDH-_pxnU,24257
|
14
24
|
user_sim/core/user_simulator.py,sha256=zrg5jmVIthlsqgH3kxVr18GUr23T5_xKlm4Z6dFq4ms,11522
|
15
25
|
user_sim/handlers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
26
|
user_sim/handlers/asr_module.py,sha256=LrOTM21sNCvMk8HHw_4jdRs3u9lQtMNiW8fCvFCxYLk,4146
|
17
27
|
user_sim/handlers/html_parser_module.py,sha256=C8w75ZFru9l54JAbwnxXCddI_AsutE2o0l9PBy3v8yc,6828
|
18
28
|
user_sim/handlers/image_recognition_module.py,sha256=68XtRRtymr_w4MYBJW1LX3ZTBAEQPpEH1vtj5oL5rxo,4572
|
19
|
-
user_sim/handlers/pdf_parser_module.py,sha256=
|
29
|
+
user_sim/handlers/pdf_parser_module.py,sha256=2Fiu37wmpXYt--Cul9oSeoHG47feJyRpfgb6aiUdxQo,4011
|
20
30
|
user_sim/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
21
31
|
user_sim/utils/config.py,sha256=MWS1YiE9IV8qcFLArku_r5jdcEaF9-eQumYMnensNH0,1336
|
22
32
|
user_sim/utils/cost_tracker.py,sha256=0iV2uDs0O95iRAPkXsrFQheItNQmZ92txy5HI-q0hCs,5210
|
@@ -24,14 +34,14 @@ user_sim/utils/cost_tracker_v2.py,sha256=A-nfQpbrc0Bx_MsPBXUmXMG18FYWK5FtTkOJpnN
|
|
24
34
|
user_sim/utils/errors.py,sha256=hY284HuSGiZNAzL5rfgbjy7wQdaIlkYD6xFKvAr0roU,438
|
25
35
|
user_sim/utils/exceptions.py,sha256=Y-vR9j1C3EUYhzqW2L4f6S7sVEIMCNZDjsGxSprpPIM,787
|
26
36
|
user_sim/utils/languages.py,sha256=TunF7POkW9x2Y-7KOH0M15I2tArad_CnORrWh5N51XA,2110
|
27
|
-
user_sim/utils/register_management.py,sha256=
|
37
|
+
user_sim/utils/register_management.py,sha256=ZUmnPZLzNZQs17GezD5iM9hxMHNW1rZyeBzB1pQoniU,2097
|
28
38
|
user_sim/utils/show_logs.py,sha256=pqwksfYYFZEu3pb-4KJrV4OEaiAUrfc5-G1qz8akJmo,1754
|
29
39
|
user_sim/utils/token_cost_calculator.py,sha256=6jf8jqppq-Ao_pJJEdqvvUmI9aeDY-dYqqTHomqWEgc,12548
|
30
40
|
user_sim/utils/url_management.py,sha256=TnV4Qv09SVmjXrEa2sqRCFiqr3tyzMkqAhs1XpR7U4I,2010
|
31
41
|
user_sim/utils/utilities.py,sha256=IC6KlyZeRJOElOl-QfZLo1VPkWW6l_qjRHCazw4XZ-g,19774
|
32
|
-
user_simulator-0.1.
|
33
|
-
user_simulator-0.1.
|
34
|
-
user_simulator-0.1.
|
35
|
-
user_simulator-0.1.
|
36
|
-
user_simulator-0.1.
|
37
|
-
user_simulator-0.1.
|
42
|
+
user_simulator-0.1.2.dist-info/licenses/LICENSE.txt,sha256=Qv2ilebwoUtMJnRsZwRy729xS5JZQzLauJ0tQzkAkTA,1088
|
43
|
+
user_simulator-0.1.2.dist-info/METADATA,sha256=ZASmEgeyZYebBDAQ5SWmyTVLbe6CQXInbgJEPU2zFVU,31705
|
44
|
+
user_simulator-0.1.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
45
|
+
user_simulator-0.1.2.dist-info/entry_points.txt,sha256=Kib_IjI6nHiTeev6mZZvTkO1uMoFBGVVK_2DnOWzJ9c,303
|
46
|
+
user_simulator-0.1.2.dist-info/top_level.txt,sha256=IGlrGt_QHrM2G3Mlo76gMp8ArUR_F9k4RrzJd8YHpE4,34
|
47
|
+
user_simulator-0.1.2.dist-info/RECORD,,
|
@@ -0,0 +1,6 @@
|
|
1
|
+
[console_scripts]
|
2
|
+
sensei-chat = src.user_sim.cli.sensei_chat:main
|
3
|
+
sensei-check = src.user_sim.cli.sensei_check:main
|
4
|
+
sensei-gen-user-profile = src.user_sim.cli.gen_user_profile:main
|
5
|
+
sensei-init-project = src.user_sim.cli.init_project:main
|
6
|
+
sensei-validation-check = src.user_sim.cli.validation_check:main
|
@@ -1,6 +0,0 @@
|
|
1
|
-
[console_scripts]
|
2
|
-
sensei-chat = user_sim.cli.sensei_chat:main
|
3
|
-
sensei-check = user_sim.cli.sensei_check:main
|
4
|
-
sensei-gen-user-profile = user_sim.cli.gen_user_profile:main
|
5
|
-
sensei-init-project = user_sim.cli.init_project:main
|
6
|
-
sensei-validation-check = user_sim.cli.validation_check:main
|
@@ -1 +0,0 @@
|
|
1
|
-
user_sim
|
File without changes
|
File without changes
|