user-simulator 0.1.11__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.1.11 → user_simulator-0.2.1}/PKG-INFO +4 -1
- {user_simulator-0.1.11 → user_simulator-0.2.1}/pyproject.toml +57 -54
- user_simulator-0.2.1/src/user_sim/cli/cli.py +113 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_sim/cli/sensei_chat.py +75 -52
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_sim/utils/utilities.py +47 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_simulator.egg-info/PKG-INFO +4 -1
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_simulator.egg-info/SOURCES.txt +1 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_simulator.egg-info/requires.txt +3 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/LICENSE.txt +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/README.md +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/setup.cfg +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/metamorphic/__init__.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/metamorphic/results.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/metamorphic/rule_utils.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/metamorphic/rules.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/metamorphic/tests.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/metamorphic/text_comparison_utils.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/technologies/__init__.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/technologies/chatbot_connectors.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/technologies/chatbots.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/technologies/taskyto.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_sim/__init__.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_sim/cli/__init__.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_sim/cli/gen_user_profile.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_sim/cli/init_project.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_sim/cli/sensei_check.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_sim/cli/validation_check.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_sim/core/__init__.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_sim/core/ask_about.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_sim/core/data_extraction.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_sim/core/data_gathering.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_sim/core/interaction_styles.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_sim/core/role_structure.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_sim/core/user_simulator.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_sim/handlers/__init__.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_sim/handlers/asr_module.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_sim/handlers/html_parser_module.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_sim/handlers/image_recognition_module.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_sim/handlers/pdf_parser_module.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_sim/utils/__init__.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_sim/utils/config.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_sim/utils/cost_tracker.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_sim/utils/cost_tracker_v2.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_sim/utils/errors.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_sim/utils/exceptions.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_sim/utils/languages.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_sim/utils/register_management.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_sim/utils/show_logs.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_sim/utils/token_cost_calculator.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_sim/utils/url_management.py +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_simulator.egg-info/dependency_links.txt +0 -0
- {user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_simulator.egg-info/entry_points.txt +0 -0
- {user_simulator-0.1.11 → 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.1
|
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
|
@@ -30,6 +30,8 @@ Description-Content-Type: text/markdown
|
|
30
30
|
License-File: LICENSE.txt
|
31
31
|
Requires-Dist: allpairspy>=2.5.1
|
32
32
|
Requires-Dist: beautifulsoup4>=4.13.4
|
33
|
+
Requires-Dist: build>=1.3.0
|
34
|
+
Requires-Dist: chatbot-connectors>=0.2.2
|
33
35
|
Requires-Dist: colorama>=0.4.6
|
34
36
|
Requires-Dist: httpx>=0.28.1
|
35
37
|
Requires-Dist: inflect>=7.0.0
|
@@ -44,6 +46,7 @@ Requires-Dist: pyyaml>=6.0.2
|
|
44
46
|
Requires-Dist: requests>=2.32.4
|
45
47
|
Requires-Dist: scikit-learn>=1.7.0
|
46
48
|
Requires-Dist: selenium>=4.33.0
|
49
|
+
Requires-Dist: twine>=6.1.0
|
47
50
|
Requires-Dist: webdriver-manager>=4.0.2
|
48
51
|
Dynamic: license-file
|
49
52
|
|
@@ -1,54 +1,57 @@
|
|
1
|
-
[project]
|
2
|
-
name = "user-simulator"
|
3
|
-
version = "0.1
|
4
|
-
description = "LLM-based user simulator for chatbot testing."
|
5
|
-
readme = "README.md"
|
6
|
-
requires-python = ">=3.12"
|
7
|
-
license = {file = "LICENSE.txt"}
|
8
|
-
|
9
|
-
authors = [
|
10
|
-
{name = "Alejandro Del Pozzo Escalera"},
|
11
|
-
{name = "Juan de Lara Jaramillo"},
|
12
|
-
{name = "Esther Guerra Sánchez"}
|
13
|
-
]
|
14
|
-
|
15
|
-
dependencies = [
|
16
|
-
"allpairspy>=2.5.1",
|
17
|
-
"beautifulsoup4>=4.13.4",
|
18
|
-
"
|
19
|
-
"
|
20
|
-
"
|
21
|
-
"
|
22
|
-
"
|
23
|
-
"
|
24
|
-
"
|
25
|
-
"
|
26
|
-
"
|
27
|
-
"
|
28
|
-
"
|
29
|
-
"
|
30
|
-
"
|
31
|
-
"
|
32
|
-
"
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
[project.
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
sensei-
|
43
|
-
sensei-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
[
|
50
|
-
|
51
|
-
|
52
|
-
[tool.setuptools
|
53
|
-
|
54
|
-
|
1
|
+
[project]
|
2
|
+
name = "user-simulator"
|
3
|
+
version = "0.2.1"
|
4
|
+
description = "LLM-based user simulator for chatbot testing."
|
5
|
+
readme = "README.md"
|
6
|
+
requires-python = ">=3.12"
|
7
|
+
license = {file = "LICENSE.txt"}
|
8
|
+
|
9
|
+
authors = [
|
10
|
+
{name = "Alejandro Del Pozzo Escalera"},
|
11
|
+
{name = "Juan de Lara Jaramillo"},
|
12
|
+
{name = "Esther Guerra Sánchez"}
|
13
|
+
]
|
14
|
+
|
15
|
+
dependencies = [
|
16
|
+
"allpairspy>=2.5.1",
|
17
|
+
"beautifulsoup4>=4.13.4",
|
18
|
+
"build>=1.3.0",
|
19
|
+
"chatbot-connectors>=0.2.2",
|
20
|
+
"colorama>=0.4.6",
|
21
|
+
"httpx>=0.28.1",
|
22
|
+
"inflect>=7.0.0",
|
23
|
+
"langchain>=0.3.25",
|
24
|
+
"langchain-openai>=0.3.23",
|
25
|
+
"openai>=1.0.0",
|
26
|
+
"pandas>=2.3.0",
|
27
|
+
"pillow>=11.2.1",
|
28
|
+
"pydantic>=2.0.0",
|
29
|
+
"pymupdf>=1.26.1",
|
30
|
+
"pyyaml>=6.0.2",
|
31
|
+
"requests>=2.32.4",
|
32
|
+
"scikit-learn>=1.7.0",
|
33
|
+
"selenium>=4.33.0",
|
34
|
+
"twine>=6.1.0",
|
35
|
+
"webdriver-manager>=4.0.2",
|
36
|
+
]
|
37
|
+
|
38
|
+
[project.urls]
|
39
|
+
Homepage = "https://github.com/satori-chatbots/user-simulator"
|
40
|
+
|
41
|
+
[project.scripts]
|
42
|
+
sensei-init-project = "user_sim.cli.init_project:main"
|
43
|
+
sensei-chat = "user_sim.cli.sensei_chat:main"
|
44
|
+
sensei-check = "user_sim.cli.sensei_check:main"
|
45
|
+
sensei-validation-check = "user_sim.cli.validation_check:main"
|
46
|
+
sensei-gen-user-profile = "user_sim.cli.gen_user_profile:main"
|
47
|
+
|
48
|
+
[build-system]
|
49
|
+
requires = ["setuptools>=61.0"]
|
50
|
+
build-backend = "setuptools.build_meta"
|
51
|
+
|
52
|
+
[tool.setuptools]
|
53
|
+
package-dir = {"" = "src"}
|
54
|
+
|
55
|
+
[tool.setuptools.packages.find]
|
56
|
+
where = ["src"]
|
57
|
+
include = ["user_sim*", "technologies*", "metamorphic*"]
|
@@ -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,11 +1,13 @@
|
|
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
|
-
from technologies.chatbot_connectors import (Chatbot, ChatbotRasa, ChatbotTaskyto, ChatbotMillionBot,
|
8
|
-
|
9
|
+
# from technologies.chatbot_connectors import (Chatbot, ChatbotRasa, ChatbotTaskyto, ChatbotMillionBot,
|
10
|
+
# ChatbotServiceform)
|
9
11
|
from user_sim.core.data_extraction import DataExtraction
|
10
12
|
from user_sim.core.role_structure import *
|
11
13
|
from user_sim.core.user_simulator import UserSimulator
|
@@ -13,6 +15,8 @@ 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
|
18
|
+
from chatbot_connectors.cli import ChatbotFactory, parse_connector_params
|
19
|
+
|
16
20
|
|
17
21
|
# check_keys(["OPENAI_API_KEY"])
|
18
22
|
current_script_dir = os.path.dirname(os.path.abspath(__file__))
|
@@ -85,35 +89,51 @@ def configure_project(project_path):
|
|
85
89
|
default_types = load_yaml_files_from_folder(default_types_path, existing_keys=custom_types.keys())
|
86
90
|
config.types_dict = {**default_types, **custom_types}
|
87
91
|
|
88
|
-
def configure_connector(*args):
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
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!')
|
103
134
|
|
104
|
-
param_key_list = list(parameters.keys())
|
105
|
-
if Counter(con_yaml["parameters"]) != Counter(param_key_list):
|
106
|
-
raise UnmachedList("Parameters in yaml don't match parameters input in execution")
|
107
135
|
|
108
|
-
def replace_values(obj_dict, src_dict):
|
109
|
-
for key in obj_dict:
|
110
|
-
if isinstance(obj_dict[key], dict):
|
111
|
-
replace_values(obj_dict[key], src_dict)
|
112
|
-
elif key in src_dict:
|
113
|
-
obj_dict[key] = src_dict[key]
|
114
136
|
|
115
|
-
replace_values(con_yaml, parameters)
|
116
|
-
return con_yaml
|
117
137
|
|
118
138
|
|
119
139
|
def get_conversation_metadata(user_profile, the_user, serial=None):
|
@@ -233,17 +253,18 @@ def parse_profiles(user_path):
|
|
233
253
|
raise Exception(f'Invalid path for user profile operation: {user_path}')
|
234
254
|
|
235
255
|
|
236
|
-
def build_chatbot(technology, connector)
|
237
|
-
chatbot_builder = {
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
256
|
+
def build_chatbot(technology, connector):
|
257
|
+
# chatbot_builder = {
|
258
|
+
# 'rasa': RasaChatbot,
|
259
|
+
# 'taskyto': ChatbotTaskyto,
|
260
|
+
# # 'serviceform': ChatbotServiceform(connector),
|
261
|
+
# 'millionbot': MillionBot,
|
262
|
+
# 'custom': CustomChatbot
|
263
|
+
# }
|
264
|
+
# chatbot_class = chatbot_builder.get(technology, CustomChatbot)
|
265
|
+
parsed_connector = parse_connector_params(connector)
|
266
|
+
chatbot = ChatbotFactory.create_chatbot(chatbot_type=technology, **parsed_connector)
|
267
|
+
return chatbot
|
247
268
|
|
248
269
|
def generate_conversation(technology, connector, user,
|
249
270
|
personality, extract, project_folder):
|
@@ -412,13 +433,12 @@ def main():
|
|
412
433
|
parser.add_argument('--technology', required=False,
|
413
434
|
choices=['rasa', 'taskyto', 'ada-uam', 'millionbot', 'genion', 'lola', 'serviceform', 'kuki', 'julie', 'rivas_catalina', 'saic_malaga'],
|
414
435
|
help='Technology the chatbot is implemented in')
|
415
|
-
# parser.add_argument('--
|
416
|
-
parser.add_argument('--connector', required=False, help='
|
417
|
-
parser.add_argument('--connector_parameters', required=False, help='dynamic parameters for the selected chatbot connector')
|
436
|
+
# parser.add_argument('--connector', required=False, help='path to the connector configuration file')
|
437
|
+
parser.add_argument('--connector-params', required=False, help='dynamic parameters for the selected chatbot connector')
|
418
438
|
parser.add_argument('--project_path', required=False, help='Project folder PATH where all testing data is stored')
|
419
439
|
parser.add_argument('--user_profile', required=False, help='User profile file or user profile folder to test the chatbot')
|
420
440
|
parser.add_argument('--personality', required=False, help='Personality file')
|
421
|
-
parser.add_argument(
|
441
|
+
parser.add_argument('--extract', default=False, help='Path to store conversation user-chatbot')
|
422
442
|
parser.add_argument('--verbose', action='store_true', help='Shows debug prints')
|
423
443
|
parser.add_argument('--clean_cache', action='store_true', help='Deletes temporary files.')
|
424
444
|
parser.add_argument('--ignore_cache', action='store_true', help='Ignores cache for temporary files')
|
@@ -449,7 +469,7 @@ def main():
|
|
449
469
|
parser_args = ArgsNamespace(**yaml_args)
|
450
470
|
|
451
471
|
else:
|
452
|
-
required_args = ['technology', 'user_profile', '
|
472
|
+
required_args = ['technology', 'user_profile', 'connector_params']
|
453
473
|
missing_args = [arg for arg in required_args if getattr(parser_args, arg) is None]
|
454
474
|
|
455
475
|
if missing_args:
|
@@ -459,8 +479,7 @@ def main():
|
|
459
479
|
config.root_path = os.path.abspath(os.path.join(current_script_dir, "../../.."))
|
460
480
|
profile_path = os.path.join(config.profiles_path, parser_args.user_profile)
|
461
481
|
|
462
|
-
|
463
|
-
logger.info('Logs enabled!')
|
482
|
+
|
464
483
|
|
465
484
|
# check_keys(["OPENAI_API_KEY"])
|
466
485
|
config.test_cases_folder = parser_args.extract
|
@@ -468,14 +487,18 @@ def main():
|
|
468
487
|
config.update_cache = parser_args.update_cache
|
469
488
|
config.clean_cache = parser_args.clean_cache
|
470
489
|
|
471
|
-
if parser_args.connector_parameters:
|
472
|
-
|
473
|
-
else:
|
474
|
-
|
490
|
+
# if parser_args.connector_parameters:
|
491
|
+
# connector = configure_connector(parser_args.connector, parser_args.connector_parameters)
|
492
|
+
# else:
|
493
|
+
# connector = configure_connector(parser_args.connector)
|
475
494
|
|
476
|
-
|
477
|
-
parser_args.personality, parser_args.extract, parser_args.project_path)
|
495
|
+
connector = parser_args.connector_params
|
478
496
|
|
497
|
+
try:
|
498
|
+
generate_conversation(parser_args.technology, connector, profile_path,
|
499
|
+
parser_args.personality, parser_args.extract, parser_args.project_path)
|
500
|
+
except Exception as e:
|
501
|
+
logger.error(f"An error occurred while generating the conversation: {e}")
|
479
502
|
|
480
503
|
if __name__ == '__main__':
|
481
504
|
main()
|
@@ -9,6 +9,7 @@ import importlib.util
|
|
9
9
|
import logging
|
10
10
|
import platform
|
11
11
|
|
12
|
+
from typing import Any
|
12
13
|
from datetime import datetime, timedelta, date
|
13
14
|
from sklearn.feature_extraction.text import TfidfVectorizer
|
14
15
|
from sklearn.metrics.pairwise import cosine_similarity
|
@@ -63,6 +64,52 @@ def init_model():
|
|
63
64
|
return model, llm
|
64
65
|
|
65
66
|
|
67
|
+
# def parse_connector_params(connector_params_str: str | None) -> dict[str, Any]:
|
68
|
+
# """Parse connector parameters from string input.
|
69
|
+
#
|
70
|
+
# Args:
|
71
|
+
# connector_params_str: JSON string or key=value pairs
|
72
|
+
#
|
73
|
+
# Returns:
|
74
|
+
# Dictionary of connector parameters
|
75
|
+
#
|
76
|
+
# Raises:
|
77
|
+
# ValueError: If parameter parsing fails
|
78
|
+
# """
|
79
|
+
# params = {}
|
80
|
+
#
|
81
|
+
# if connector_params_str:
|
82
|
+
# try:
|
83
|
+
# # Try to parse as JSON first
|
84
|
+
# if connector_params_str.strip().startswith("{"):
|
85
|
+
# params = json.loads(connector_params_str)
|
86
|
+
# else:
|
87
|
+
# # Parse as key=value pairs
|
88
|
+
# for pair in connector_params_str.split(","):
|
89
|
+
# if "=" not in pair:
|
90
|
+
# continue
|
91
|
+
# key, value = pair.split("=", 1)
|
92
|
+
# key = key.strip()
|
93
|
+
# value = value.strip()
|
94
|
+
#
|
95
|
+
# # Try to convert to appropriate types
|
96
|
+
# if value.lower() in ("true", "false"):
|
97
|
+
# params[key] = value.lower() == "true"
|
98
|
+
# elif value.isdigit():
|
99
|
+
# params[key] = int(value)
|
100
|
+
# else:
|
101
|
+
# try:
|
102
|
+
# params[key] = float(value)
|
103
|
+
# except ValueError:
|
104
|
+
# params[key] = value
|
105
|
+
#
|
106
|
+
# except (json.JSONDecodeError, ValueError) as e:
|
107
|
+
# logger.exception("Failed to parse connector parameters: %s", connector_params_str)
|
108
|
+
# msg = f"Invalid connector parameters format: {e}"
|
109
|
+
# raise ValueError(msg) from e
|
110
|
+
#
|
111
|
+
# return params
|
112
|
+
|
66
113
|
|
67
114
|
def parse_content_to_text(messages):
|
68
115
|
return " ".join([message["content"] for message in messages if "content" in message])
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: user-simulator
|
3
|
-
Version: 0.1
|
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
|
@@ -30,6 +30,8 @@ Description-Content-Type: text/markdown
|
|
30
30
|
License-File: LICENSE.txt
|
31
31
|
Requires-Dist: allpairspy>=2.5.1
|
32
32
|
Requires-Dist: beautifulsoup4>=4.13.4
|
33
|
+
Requires-Dist: build>=1.3.0
|
34
|
+
Requires-Dist: chatbot-connectors>=0.2.2
|
33
35
|
Requires-Dist: colorama>=0.4.6
|
34
36
|
Requires-Dist: httpx>=0.28.1
|
35
37
|
Requires-Dist: inflect>=7.0.0
|
@@ -44,6 +46,7 @@ Requires-Dist: pyyaml>=6.0.2
|
|
44
46
|
Requires-Dist: requests>=2.32.4
|
45
47
|
Requires-Dist: scikit-learn>=1.7.0
|
46
48
|
Requires-Dist: selenium>=4.33.0
|
49
|
+
Requires-Dist: twine>=6.1.0
|
47
50
|
Requires-Dist: webdriver-manager>=4.0.2
|
48
51
|
Dynamic: license-file
|
49
52
|
|
@@ -1,5 +1,7 @@
|
|
1
1
|
allpairspy>=2.5.1
|
2
2
|
beautifulsoup4>=4.13.4
|
3
|
+
build>=1.3.0
|
4
|
+
chatbot-connectors>=0.2.2
|
3
5
|
colorama>=0.4.6
|
4
6
|
httpx>=0.28.1
|
5
7
|
inflect>=7.0.0
|
@@ -14,4 +16,5 @@ pyyaml>=6.0.2
|
|
14
16
|
requests>=2.32.4
|
15
17
|
scikit-learn>=1.7.0
|
16
18
|
selenium>=4.33.0
|
19
|
+
twine>=6.1.0
|
17
20
|
webdriver-manager>=4.0.2
|
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.1.11 → 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
|
{user_simulator-0.1.11 → user_simulator-0.2.1}/src/user_simulator.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|