user-simulator 0.2.0__tar.gz → 0.2.1__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.
- {user_simulator-0.2.0 → user_simulator-0.2.1}/PKG-INFO +1 -1
- {user_simulator-0.2.0 → user_simulator-0.2.1}/pyproject.toml +1 -1
- user_simulator-0.2.1/src/user_sim/cli/cli.py +113 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/cli/sensei_chat.py +46 -35
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_simulator.egg-info/PKG-INFO +1 -1
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_simulator.egg-info/SOURCES.txt +1 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/LICENSE.txt +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/README.md +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/setup.cfg +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/metamorphic/__init__.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/metamorphic/results.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/metamorphic/rule_utils.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/metamorphic/rules.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/metamorphic/tests.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/metamorphic/text_comparison_utils.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/technologies/__init__.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/technologies/chatbot_connectors.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/technologies/chatbots.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/technologies/taskyto.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/__init__.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/cli/__init__.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/cli/gen_user_profile.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/cli/init_project.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/cli/sensei_check.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/cli/validation_check.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/core/__init__.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/core/ask_about.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/core/data_extraction.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/core/data_gathering.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/core/interaction_styles.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/core/role_structure.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/core/user_simulator.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/handlers/__init__.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/handlers/asr_module.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/handlers/html_parser_module.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/handlers/image_recognition_module.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/handlers/pdf_parser_module.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/utils/__init__.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/utils/config.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/utils/cost_tracker.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/utils/cost_tracker_v2.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/utils/errors.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/utils/exceptions.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/utils/languages.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/utils/register_management.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/utils/show_logs.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/utils/token_cost_calculator.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/utils/url_management.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/utils/utilities.py +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_simulator.egg-info/dependency_links.txt +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_simulator.egg-info/entry_points.txt +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_simulator.egg-info/requires.txt +0 -0
- {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_simulator.egg-info/top_level.txt +0 -0
@@ -0,0 +1,113 @@
|
|
1
|
+
import argparse
|
2
|
+
from argparse import Namespace
|
3
|
+
from chatbot_connectors import parse_connector_params
|
4
|
+
|
5
|
+
def parse_chat_arguments() -> Namespace:
|
6
|
+
"""Parse command line arguments."""
|
7
|
+
parser = argparse.ArgumentParser(description="User Simulator - Converses with chatbots to test capabilities")
|
8
|
+
|
9
|
+
# default_sessions = 3
|
10
|
+
# default_turns = 8
|
11
|
+
# default_model = "gpt-4o-mini"
|
12
|
+
default_output_dir = "output"
|
13
|
+
default_technology = "taskyto"
|
14
|
+
|
15
|
+
|
16
|
+
parser.add_argument(
|
17
|
+
"-rfy"
|
18
|
+
"--run-from-yaml",
|
19
|
+
type=str,
|
20
|
+
default=None,
|
21
|
+
help="Path to the project folder which contains run.yaml."
|
22
|
+
"Runs Sensei with CLI arguments contained in the run.yaml file."
|
23
|
+
"Example: --run-from-yaml /path/to/project/folder",
|
24
|
+
)
|
25
|
+
|
26
|
+
parser.add_argument(
|
27
|
+
"-ic",
|
28
|
+
"--ignore-cache",
|
29
|
+
type=int,
|
30
|
+
default=0,
|
31
|
+
help=f"Cache is ignored during the testing process.",
|
32
|
+
)
|
33
|
+
|
34
|
+
parser.add_argument(
|
35
|
+
"-t",
|
36
|
+
"--technology",
|
37
|
+
type=str,
|
38
|
+
default=default_technology,
|
39
|
+
help=f"Chatbot technology to use (default: {default_technology})",
|
40
|
+
)
|
41
|
+
|
42
|
+
parser.add_argument(
|
43
|
+
"-cp",
|
44
|
+
"--connector-params",
|
45
|
+
type=parse_connector_params,
|
46
|
+
default=None,
|
47
|
+
help="Connector parameters as JSON string or key=value pairs separated by commas. "
|
48
|
+
'Examples: \'{"base_url": "http://localhost", "port": 8080}\' or '
|
49
|
+
'"base_url=http://localhost,port=8080". Use --list-connector-params <technology> to see required parameters for each connector.',
|
50
|
+
)
|
51
|
+
|
52
|
+
parser.add_argument(
|
53
|
+
"-pp",
|
54
|
+
"--project-path",
|
55
|
+
type=str,
|
56
|
+
default=None,
|
57
|
+
help="The project path where all testing content is stored for a specific project."
|
58
|
+
)
|
59
|
+
|
60
|
+
parser.add_argument(
|
61
|
+
"-up",
|
62
|
+
"--user-profile",
|
63
|
+
type=str,
|
64
|
+
default=None,
|
65
|
+
help="Name of the user profile YAML or the folder containing user profiles to use in the testing process."
|
66
|
+
)
|
67
|
+
|
68
|
+
#todo: extract
|
69
|
+
parser.add_argument(
|
70
|
+
"-o",
|
71
|
+
"--output",
|
72
|
+
type=str,
|
73
|
+
default=default_output_dir,
|
74
|
+
help=f"Output directory for results and profiles (default: {default_output_dir})",
|
75
|
+
)
|
76
|
+
|
77
|
+
parser.add_argument(
|
78
|
+
"-v",
|
79
|
+
"--verbose",
|
80
|
+
action="store_true",
|
81
|
+
help="Increase output verbosity",
|
82
|
+
)
|
83
|
+
|
84
|
+
parser.add_argument(
|
85
|
+
"-cc",
|
86
|
+
"--clean-cache",
|
87
|
+
action="store_true",
|
88
|
+
help=f"Cache is cleaned after the testing process",
|
89
|
+
)
|
90
|
+
|
91
|
+
parser.add_argument(
|
92
|
+
"-uc",
|
93
|
+
"--update-cache",
|
94
|
+
action="store_true",
|
95
|
+
help=f"Cache is updated with new content if previous cache was saved",
|
96
|
+
)
|
97
|
+
|
98
|
+
#todo: implement
|
99
|
+
parser.add_argument(
|
100
|
+
"--list-connector-params",
|
101
|
+
type=str,
|
102
|
+
metavar="TECHNOLOGY",
|
103
|
+
help="List the available parameters for a specific chatbot technology and exit",
|
104
|
+
)
|
105
|
+
|
106
|
+
#todo: implement
|
107
|
+
parser.add_argument(
|
108
|
+
"--list-connectors",
|
109
|
+
action="store_true",
|
110
|
+
help="List all available chatbot connector technologies and exit",
|
111
|
+
)
|
112
|
+
|
113
|
+
return parser.parse_args()
|
@@ -1,7 +1,9 @@
|
|
1
1
|
import timeit
|
2
2
|
import yaml
|
3
3
|
import pandas as pd
|
4
|
+
from argparse import Namespace
|
4
5
|
from collections import Counter
|
6
|
+
from cli import parse_chat_arguments
|
5
7
|
from argparse import ArgumentParser
|
6
8
|
from colorama import Fore, Style
|
7
9
|
# from technologies.chatbot_connectors import (Chatbot, ChatbotRasa, ChatbotTaskyto, ChatbotMillionBot,
|
@@ -13,13 +15,7 @@ from user_sim.utils.show_logs import *
|
|
13
15
|
from user_sim.utils.utilities import *
|
14
16
|
from user_sim.utils.token_cost_calculator import create_cost_dataset
|
15
17
|
from user_sim.utils.register_management import clean_temp_files
|
16
|
-
|
17
|
-
from chatbot_connectors.implementations.custom import CustomChatbot
|
18
|
-
from chatbot_connectors.implementations.taskyto import ChatbotTaskyto
|
19
|
-
from chatbot_connectors.implementations.rasa import RasaChatbot
|
20
|
-
from chatbot_connectors.implementations.millionbot import MillionBot
|
21
|
-
|
22
|
-
from chatbot_connectors import ChatbotFactory, parse_connector_params
|
18
|
+
from chatbot_connectors.cli import ChatbotFactory, parse_connector_params
|
23
19
|
|
24
20
|
|
25
21
|
# check_keys(["OPENAI_API_KEY"])
|
@@ -93,35 +89,51 @@ def configure_project(project_path):
|
|
93
89
|
default_types = load_yaml_files_from_folder(default_types_path, existing_keys=custom_types.keys())
|
94
90
|
config.types_dict = {**default_types, **custom_types}
|
95
91
|
|
96
|
-
def configure_connector(*args):
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
92
|
+
# def configure_connector(*args):
|
93
|
+
# connec = args[0]
|
94
|
+
# with open(connec, 'r', encoding='utf-8') as f:
|
95
|
+
# con_yaml = yaml.safe_load(f)
|
96
|
+
#
|
97
|
+
#
|
98
|
+
# if len(args)<2 or not con_yaml["parameters"]:
|
99
|
+
# logger.warning("No parameters added for connector configuration. They may not have been set as input arguments "
|
100
|
+
# "or declared as dynamic parameters in the connector file.")
|
101
|
+
# return con_yaml
|
102
|
+
#
|
103
|
+
# parameters = args[1]
|
104
|
+
# if isinstance(parameters, str):
|
105
|
+
# parameters = json.loads(parameters)
|
106
|
+
#
|
107
|
+
# param_key_list = list(parameters.keys())
|
108
|
+
# if Counter(con_yaml["parameters"]) != Counter(param_key_list):
|
109
|
+
# raise UnmachedList("Parameters in yaml don't match parameters input in execution")
|
110
|
+
#
|
111
|
+
# def replace_values(obj_dict, src_dict):
|
112
|
+
# for key in obj_dict:
|
113
|
+
# if isinstance(obj_dict[key], dict):
|
114
|
+
# replace_values(obj_dict[key], src_dict)
|
115
|
+
# elif key in src_dict:
|
116
|
+
# obj_dict[key] = src_dict[key]
|
117
|
+
#
|
118
|
+
# replace_values(con_yaml, parameters)
|
119
|
+
# return con_yaml
|
120
|
+
|
121
|
+
def _setup_configuration() -> Namespace:
|
122
|
+
"""Parse command line arguments, validate config, and create output dir.
|
123
|
+
|
124
|
+
Returns:
|
125
|
+
The parsed and validated command line arguments
|
126
|
+
|
127
|
+
Raises:
|
128
|
+
TracerError: If the specified technology is invalid
|
129
|
+
"""
|
130
|
+
args = parse_chat_arguments()
|
131
|
+
|
132
|
+
logger = create_logger(args.verbose, 'Info Logger')
|
133
|
+
logger.info('Logs enabled!')
|
111
134
|
|
112
|
-
param_key_list = list(parameters.keys())
|
113
|
-
if Counter(con_yaml["parameters"]) != Counter(param_key_list):
|
114
|
-
raise UnmachedList("Parameters in yaml don't match parameters input in execution")
|
115
135
|
|
116
|
-
def replace_values(obj_dict, src_dict):
|
117
|
-
for key in obj_dict:
|
118
|
-
if isinstance(obj_dict[key], dict):
|
119
|
-
replace_values(obj_dict[key], src_dict)
|
120
|
-
elif key in src_dict:
|
121
|
-
obj_dict[key] = src_dict[key]
|
122
136
|
|
123
|
-
replace_values(con_yaml, parameters)
|
124
|
-
return con_yaml
|
125
137
|
|
126
138
|
|
127
139
|
def get_conversation_metadata(user_profile, the_user, serial=None):
|
@@ -467,8 +479,7 @@ def main():
|
|
467
479
|
config.root_path = os.path.abspath(os.path.join(current_script_dir, "../../.."))
|
468
480
|
profile_path = os.path.join(config.profiles_path, parser_args.user_profile)
|
469
481
|
|
470
|
-
|
471
|
-
logger.info('Logs enabled!')
|
482
|
+
|
472
483
|
|
473
484
|
# check_keys(["OPENAI_API_KEY"])
|
474
485
|
config.test_cases_folder = parser_args.extract
|
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
|
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
|
File without changes
|
{user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/handlers/image_recognition_module.py
RENAMED
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
|
{user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_simulator.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|