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.
Files changed (53) hide show
  1. {user_simulator-0.2.0 → user_simulator-0.2.1}/PKG-INFO +1 -1
  2. {user_simulator-0.2.0 → user_simulator-0.2.1}/pyproject.toml +1 -1
  3. user_simulator-0.2.1/src/user_sim/cli/cli.py +113 -0
  4. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/cli/sensei_chat.py +46 -35
  5. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_simulator.egg-info/PKG-INFO +1 -1
  6. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_simulator.egg-info/SOURCES.txt +1 -0
  7. {user_simulator-0.2.0 → user_simulator-0.2.1}/LICENSE.txt +0 -0
  8. {user_simulator-0.2.0 → user_simulator-0.2.1}/README.md +0 -0
  9. {user_simulator-0.2.0 → user_simulator-0.2.1}/setup.cfg +0 -0
  10. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/metamorphic/__init__.py +0 -0
  11. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/metamorphic/results.py +0 -0
  12. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/metamorphic/rule_utils.py +0 -0
  13. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/metamorphic/rules.py +0 -0
  14. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/metamorphic/tests.py +0 -0
  15. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/metamorphic/text_comparison_utils.py +0 -0
  16. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/technologies/__init__.py +0 -0
  17. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/technologies/chatbot_connectors.py +0 -0
  18. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/technologies/chatbots.py +0 -0
  19. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/technologies/taskyto.py +0 -0
  20. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/__init__.py +0 -0
  21. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/cli/__init__.py +0 -0
  22. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/cli/gen_user_profile.py +0 -0
  23. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/cli/init_project.py +0 -0
  24. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/cli/sensei_check.py +0 -0
  25. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/cli/validation_check.py +0 -0
  26. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/core/__init__.py +0 -0
  27. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/core/ask_about.py +0 -0
  28. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/core/data_extraction.py +0 -0
  29. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/core/data_gathering.py +0 -0
  30. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/core/interaction_styles.py +0 -0
  31. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/core/role_structure.py +0 -0
  32. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/core/user_simulator.py +0 -0
  33. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/handlers/__init__.py +0 -0
  34. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/handlers/asr_module.py +0 -0
  35. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/handlers/html_parser_module.py +0 -0
  36. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/handlers/image_recognition_module.py +0 -0
  37. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/handlers/pdf_parser_module.py +0 -0
  38. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/utils/__init__.py +0 -0
  39. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/utils/config.py +0 -0
  40. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/utils/cost_tracker.py +0 -0
  41. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/utils/cost_tracker_v2.py +0 -0
  42. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/utils/errors.py +0 -0
  43. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/utils/exceptions.py +0 -0
  44. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/utils/languages.py +0 -0
  45. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/utils/register_management.py +0 -0
  46. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/utils/show_logs.py +0 -0
  47. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/utils/token_cost_calculator.py +0 -0
  48. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/utils/url_management.py +0 -0
  49. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_sim/utils/utilities.py +0 -0
  50. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_simulator.egg-info/dependency_links.txt +0 -0
  51. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_simulator.egg-info/entry_points.txt +0 -0
  52. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_simulator.egg-info/requires.txt +0 -0
  53. {user_simulator-0.2.0 → user_simulator-0.2.1}/src/user_simulator.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: user-simulator
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: LLM-based user simulator for chatbot testing.
5
5
  Author: Alejandro Del Pozzo Escalera, Juan de Lara Jaramillo, Esther Guerra Sánchez
6
6
  License: MIT License
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "user-simulator"
3
- version = "0.2.0"
3
+ version = "0.2.1"
4
4
  description = "LLM-based user simulator for chatbot testing."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -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
- connec = args[0]
99
- with open(connec, 'r', encoding='utf-8') as f:
100
- con_yaml = yaml.safe_load(f)
101
-
102
-
103
- if len(args)<2 or not con_yaml["parameters"]:
104
- logger.warning("No parameters added for connector configuration. They may not have been set as input arguments "
105
- "or declared as dynamic parameters in the connector file.")
106
- return con_yaml
107
-
108
- parameters = args[1]
109
- if isinstance(parameters, str):
110
- parameters = json.loads(parameters)
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
- logger = create_logger(parser_args.verbose, 'Info Logger')
471
- logger.info('Logs enabled!')
482
+
472
483
 
473
484
  # check_keys(["OPENAI_API_KEY"])
474
485
  config.test_cases_folder = parser_args.extract
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: user-simulator
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: LLM-based user simulator for chatbot testing.
5
5
  Author: Alejandro Del Pozzo Escalera, Juan de Lara Jaramillo, Esther Guerra Sánchez
6
6
  License: MIT License
@@ -13,6 +13,7 @@ src/technologies/chatbots.py
13
13
  src/technologies/taskyto.py
14
14
  src/user_sim/__init__.py
15
15
  src/user_sim/cli/__init__.py
16
+ src/user_sim/cli/cli.py
16
17
  src/user_sim/cli/gen_user_profile.py
17
18
  src/user_sim/cli/init_project.py
18
19
  src/user_sim/cli/sensei_chat.py
File without changes
File without changes