rasa-pro 3.9.18__py3-none-any.whl → 3.10.16__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.

Potentially problematic release.


This version of rasa-pro might be problematic. Click here for more details.

Files changed (183) hide show
  1. README.md +0 -374
  2. rasa/__init__.py +1 -2
  3. rasa/__main__.py +5 -0
  4. rasa/anonymization/anonymization_rule_executor.py +2 -2
  5. rasa/api.py +27 -23
  6. rasa/cli/arguments/data.py +27 -2
  7. rasa/cli/arguments/default_arguments.py +25 -3
  8. rasa/cli/arguments/run.py +9 -9
  9. rasa/cli/arguments/train.py +11 -3
  10. rasa/cli/data.py +70 -8
  11. rasa/cli/e2e_test.py +104 -431
  12. rasa/cli/evaluate.py +1 -1
  13. rasa/cli/interactive.py +1 -0
  14. rasa/cli/llm_fine_tuning.py +398 -0
  15. rasa/cli/project_templates/calm/endpoints.yml +1 -1
  16. rasa/cli/project_templates/tutorial/endpoints.yml +1 -1
  17. rasa/cli/run.py +15 -14
  18. rasa/cli/scaffold.py +10 -8
  19. rasa/cli/studio/studio.py +35 -5
  20. rasa/cli/train.py +56 -8
  21. rasa/cli/utils.py +22 -5
  22. rasa/cli/x.py +1 -1
  23. rasa/constants.py +7 -1
  24. rasa/core/actions/action.py +98 -49
  25. rasa/core/actions/action_run_slot_rejections.py +4 -1
  26. rasa/core/actions/custom_action_executor.py +9 -6
  27. rasa/core/actions/direct_custom_actions_executor.py +80 -0
  28. rasa/core/actions/e2e_stub_custom_action_executor.py +68 -0
  29. rasa/core/actions/grpc_custom_action_executor.py +2 -2
  30. rasa/core/actions/http_custom_action_executor.py +6 -5
  31. rasa/core/agent.py +21 -17
  32. rasa/core/channels/__init__.py +2 -0
  33. rasa/core/channels/audiocodes.py +1 -16
  34. rasa/core/channels/voice_aware/__init__.py +0 -0
  35. rasa/core/channels/voice_aware/jambonz.py +103 -0
  36. rasa/core/channels/voice_aware/jambonz_protocol.py +344 -0
  37. rasa/core/channels/voice_aware/utils.py +20 -0
  38. rasa/core/channels/voice_native/__init__.py +0 -0
  39. rasa/core/constants.py +6 -1
  40. rasa/core/information_retrieval/faiss.py +7 -4
  41. rasa/core/information_retrieval/information_retrieval.py +8 -0
  42. rasa/core/information_retrieval/milvus.py +9 -2
  43. rasa/core/information_retrieval/qdrant.py +1 -1
  44. rasa/core/nlg/contextual_response_rephraser.py +32 -10
  45. rasa/core/nlg/summarize.py +4 -3
  46. rasa/core/policies/enterprise_search_policy.py +113 -45
  47. rasa/core/policies/flows/flow_executor.py +122 -76
  48. rasa/core/policies/intentless_policy.py +83 -29
  49. rasa/core/processor.py +72 -54
  50. rasa/core/run.py +5 -4
  51. rasa/core/tracker_store.py +8 -4
  52. rasa/core/training/interactive.py +1 -1
  53. rasa/core/utils.py +56 -57
  54. rasa/dialogue_understanding/coexistence/llm_based_router.py +53 -13
  55. rasa/dialogue_understanding/commands/__init__.py +6 -0
  56. rasa/dialogue_understanding/commands/restart_command.py +58 -0
  57. rasa/dialogue_understanding/commands/session_start_command.py +59 -0
  58. rasa/dialogue_understanding/commands/utils.py +40 -0
  59. rasa/dialogue_understanding/generator/constants.py +10 -3
  60. rasa/dialogue_understanding/generator/flow_retrieval.py +21 -5
  61. rasa/dialogue_understanding/generator/llm_based_command_generator.py +13 -3
  62. rasa/dialogue_understanding/generator/multi_step/multi_step_llm_command_generator.py +134 -90
  63. rasa/dialogue_understanding/generator/nlu_command_adapter.py +47 -7
  64. rasa/dialogue_understanding/generator/single_step/single_step_llm_command_generator.py +127 -41
  65. rasa/dialogue_understanding/patterns/restart.py +37 -0
  66. rasa/dialogue_understanding/patterns/session_start.py +37 -0
  67. rasa/dialogue_understanding/processor/command_processor.py +16 -3
  68. rasa/dialogue_understanding/processor/command_processor_component.py +6 -2
  69. rasa/e2e_test/aggregate_test_stats_calculator.py +134 -0
  70. rasa/e2e_test/assertions.py +1223 -0
  71. rasa/e2e_test/assertions_schema.yml +106 -0
  72. rasa/e2e_test/constants.py +20 -0
  73. rasa/e2e_test/e2e_config.py +220 -0
  74. rasa/e2e_test/e2e_config_schema.yml +26 -0
  75. rasa/e2e_test/e2e_test_case.py +131 -8
  76. rasa/e2e_test/e2e_test_converter.py +363 -0
  77. rasa/e2e_test/e2e_test_converter_prompt.jinja2 +70 -0
  78. rasa/e2e_test/e2e_test_coverage_report.py +364 -0
  79. rasa/e2e_test/e2e_test_result.py +26 -6
  80. rasa/e2e_test/e2e_test_runner.py +493 -71
  81. rasa/e2e_test/e2e_test_schema.yml +96 -0
  82. rasa/e2e_test/pykwalify_extensions.py +39 -0
  83. rasa/e2e_test/stub_custom_action.py +70 -0
  84. rasa/e2e_test/utils/__init__.py +0 -0
  85. rasa/e2e_test/utils/e2e_yaml_utils.py +55 -0
  86. rasa/e2e_test/utils/io.py +598 -0
  87. rasa/e2e_test/utils/validation.py +80 -0
  88. rasa/engine/graph.py +9 -3
  89. rasa/engine/recipes/default_components.py +0 -2
  90. rasa/engine/recipes/default_recipe.py +10 -2
  91. rasa/engine/storage/local_model_storage.py +40 -12
  92. rasa/engine/validation.py +78 -1
  93. rasa/env.py +9 -0
  94. rasa/graph_components/providers/story_graph_provider.py +59 -6
  95. rasa/llm_fine_tuning/__init__.py +0 -0
  96. rasa/llm_fine_tuning/annotation_module.py +241 -0
  97. rasa/llm_fine_tuning/conversations.py +144 -0
  98. rasa/llm_fine_tuning/llm_data_preparation_module.py +178 -0
  99. rasa/llm_fine_tuning/notebooks/unsloth_finetuning.ipynb +407 -0
  100. rasa/llm_fine_tuning/paraphrasing/__init__.py +0 -0
  101. rasa/llm_fine_tuning/paraphrasing/conversation_rephraser.py +281 -0
  102. rasa/llm_fine_tuning/paraphrasing/default_rephrase_prompt_template.jina2 +44 -0
  103. rasa/llm_fine_tuning/paraphrasing/rephrase_validator.py +121 -0
  104. rasa/llm_fine_tuning/paraphrasing/rephrased_user_message.py +10 -0
  105. rasa/llm_fine_tuning/paraphrasing_module.py +128 -0
  106. rasa/llm_fine_tuning/storage.py +174 -0
  107. rasa/llm_fine_tuning/train_test_split_module.py +441 -0
  108. rasa/model_training.py +56 -16
  109. rasa/nlu/persistor.py +157 -36
  110. rasa/server.py +45 -10
  111. rasa/shared/constants.py +76 -16
  112. rasa/shared/core/domain.py +27 -19
  113. rasa/shared/core/events.py +28 -2
  114. rasa/shared/core/flows/flow.py +208 -13
  115. rasa/shared/core/flows/flow_path.py +84 -0
  116. rasa/shared/core/flows/flows_list.py +33 -11
  117. rasa/shared/core/flows/flows_yaml_schema.json +269 -193
  118. rasa/shared/core/flows/validation.py +112 -25
  119. rasa/shared/core/flows/yaml_flows_io.py +149 -10
  120. rasa/shared/core/trackers.py +6 -0
  121. rasa/shared/core/training_data/structures.py +20 -0
  122. rasa/shared/core/training_data/visualization.html +2 -2
  123. rasa/shared/exceptions.py +4 -0
  124. rasa/shared/importers/importer.py +64 -16
  125. rasa/shared/nlu/constants.py +2 -0
  126. rasa/shared/providers/_configs/__init__.py +0 -0
  127. rasa/shared/providers/_configs/azure_openai_client_config.py +183 -0
  128. rasa/shared/providers/_configs/client_config.py +57 -0
  129. rasa/shared/providers/_configs/default_litellm_client_config.py +130 -0
  130. rasa/shared/providers/_configs/huggingface_local_embedding_client_config.py +234 -0
  131. rasa/shared/providers/_configs/openai_client_config.py +175 -0
  132. rasa/shared/providers/_configs/self_hosted_llm_client_config.py +176 -0
  133. rasa/shared/providers/_configs/utils.py +101 -0
  134. rasa/shared/providers/_ssl_verification_utils.py +124 -0
  135. rasa/shared/providers/embedding/__init__.py +0 -0
  136. rasa/shared/providers/embedding/_base_litellm_embedding_client.py +259 -0
  137. rasa/shared/providers/embedding/_langchain_embedding_client_adapter.py +74 -0
  138. rasa/shared/providers/embedding/azure_openai_embedding_client.py +277 -0
  139. rasa/shared/providers/embedding/default_litellm_embedding_client.py +102 -0
  140. rasa/shared/providers/embedding/embedding_client.py +90 -0
  141. rasa/shared/providers/embedding/embedding_response.py +41 -0
  142. rasa/shared/providers/embedding/huggingface_local_embedding_client.py +191 -0
  143. rasa/shared/providers/embedding/openai_embedding_client.py +172 -0
  144. rasa/shared/providers/llm/__init__.py +0 -0
  145. rasa/shared/providers/llm/_base_litellm_client.py +251 -0
  146. rasa/shared/providers/llm/azure_openai_llm_client.py +338 -0
  147. rasa/shared/providers/llm/default_litellm_llm_client.py +84 -0
  148. rasa/shared/providers/llm/llm_client.py +76 -0
  149. rasa/shared/providers/llm/llm_response.py +50 -0
  150. rasa/shared/providers/llm/openai_llm_client.py +155 -0
  151. rasa/shared/providers/llm/self_hosted_llm_client.py +293 -0
  152. rasa/shared/providers/mappings.py +75 -0
  153. rasa/shared/utils/cli.py +30 -0
  154. rasa/shared/utils/io.py +65 -2
  155. rasa/shared/utils/llm.py +246 -200
  156. rasa/shared/utils/yaml.py +121 -15
  157. rasa/studio/auth.py +6 -4
  158. rasa/studio/config.py +13 -4
  159. rasa/studio/constants.py +1 -0
  160. rasa/studio/data_handler.py +10 -3
  161. rasa/studio/download.py +19 -13
  162. rasa/studio/train.py +2 -3
  163. rasa/studio/upload.py +19 -11
  164. rasa/telemetry.py +113 -58
  165. rasa/tracing/instrumentation/attribute_extractors.py +32 -17
  166. rasa/utils/common.py +18 -19
  167. rasa/utils/endpoints.py +7 -4
  168. rasa/utils/json_utils.py +60 -0
  169. rasa/utils/licensing.py +9 -1
  170. rasa/utils/ml_utils.py +4 -2
  171. rasa/validator.py +213 -3
  172. rasa/version.py +1 -1
  173. rasa_pro-3.10.16.dist-info/METADATA +196 -0
  174. {rasa_pro-3.9.18.dist-info → rasa_pro-3.10.16.dist-info}/RECORD +179 -113
  175. rasa/nlu/classifiers/llm_intent_classifier.py +0 -519
  176. rasa/shared/providers/openai/clients.py +0 -43
  177. rasa/shared/providers/openai/session_handler.py +0 -110
  178. rasa_pro-3.9.18.dist-info/METADATA +0 -563
  179. /rasa/{shared/providers/openai → cli/project_templates/tutorial/actions}/__init__.py +0 -0
  180. /rasa/cli/project_templates/tutorial/{actions.py → actions/actions.py} +0 -0
  181. {rasa_pro-3.9.18.dist-info → rasa_pro-3.10.16.dist-info}/NOTICE +0 -0
  182. {rasa_pro-3.9.18.dist-info → rasa_pro-3.10.16.dist-info}/WHEEL +0 -0
  183. {rasa_pro-3.9.18.dist-info → rasa_pro-3.10.16.dist-info}/entry_points.txt +0 -0
@@ -3,11 +3,12 @@ from typing import Union
3
3
 
4
4
  from rasa.cli.arguments.default_arguments import (
5
5
  add_config_param,
6
- add_stories_param,
7
- add_nlu_data_param,
8
- add_out_param,
9
6
  add_domain_param,
10
7
  add_endpoint_param,
8
+ add_nlu_data_param,
9
+ add_out_param,
10
+ add_remote_storage_param,
11
+ add_stories_param,
11
12
  )
12
13
  from rasa.graph_components.providers.training_tracker_provider import (
13
14
  TrainingTrackerProvider,
@@ -38,6 +39,13 @@ def set_train_arguments(parser: argparse.ArgumentParser) -> None:
38
39
  add_endpoint_param(
39
40
  parser, help_text="Configuration file for the connectors as a yml file."
40
41
  )
42
+ add_remote_storage_param(parser)
43
+ parser.add_argument(
44
+ "--remote-bot-config-path",
45
+ help="Path to the bot configuration file in the remote storage.",
46
+ required=False,
47
+ type=str,
48
+ )
41
49
 
42
50
 
43
51
  def set_train_core_arguments(parser: argparse.ArgumentParser) -> None:
rasa/cli/data.py CHANGED
@@ -3,28 +3,36 @@ import logging
3
3
  import pathlib
4
4
  from typing import List
5
5
 
6
+ import rasa.cli.utils
6
7
  import rasa.shared.core.domain
8
+ import rasa.shared.data
9
+ import rasa.shared.nlu.training_data.loading
10
+ import rasa.shared.nlu.training_data.util
11
+ import rasa.shared.utils.cli
12
+ import rasa.shared.utils.io
13
+ import rasa.utils.common
7
14
  from rasa import telemetry
8
15
  from rasa.cli import SubParsersAction
9
16
  from rasa.cli.arguments import data as arguments
10
17
  from rasa.cli.arguments import default_arguments
11
- import rasa.cli.utils
18
+ from rasa.e2e_test.e2e_config import create_llm_e2e_test_converter_config
19
+ from rasa.e2e_test.e2e_test_converter import E2ETestConverter
20
+ from rasa.e2e_test.utils.e2e_yaml_utils import E2ETestYAMLWriter
12
21
  from rasa.shared.constants import (
13
22
  DEFAULT_DATA_PATH,
14
23
  DEFAULT_CONFIG_PATH,
15
24
  DEFAULT_DOMAIN_PATHS,
16
25
  )
17
- import rasa.shared.data
26
+ from rasa.shared.exceptions import RasaException
18
27
  from rasa.shared.importers.importer import TrainingDataImporter
19
- import rasa.shared.nlu.training_data.loading
20
- import rasa.shared.nlu.training_data.util
21
- import rasa.shared.utils.cli
22
- import rasa.utils.common
23
- import rasa.shared.utils.io
28
+ from rasa.shared.utils.common import minimal_kwargs
24
29
  from rasa.shared.utils.yaml import read_yaml_file, write_yaml
30
+ from rasa.utils.beta import ensure_beta_feature_is_enabled
25
31
 
26
32
  logger = logging.getLogger(__name__)
27
33
 
34
+ RASA_PRO_BETA_E2E_CONVERSION_ENV_VAR_NAME = "RASA_PRO_BETA_E2E_CONVERSION"
35
+
28
36
 
29
37
  def add_subparser(
30
38
  subparsers: SubParsersAction, parents: List[argparse.ArgumentParser]
@@ -71,7 +79,16 @@ def _add_data_convert_parsers(
71
79
  help="Converts NLU data between formats.",
72
80
  )
73
81
  convert_nlu_parser.set_defaults(func=_convert_nlu_data)
74
- arguments.set_convert_arguments(convert_nlu_parser, data_type="Rasa NLU")
82
+ arguments.set_convert_nlu_arguments(convert_nlu_parser, data_type="Rasa NLU")
83
+
84
+ convert_e2e_parser = convert_subparsers.add_parser(
85
+ "e2e",
86
+ formatter_class=argparse.ArgumentDefaultsHelpFormatter,
87
+ parents=parents,
88
+ help="Convert input sample conversations into E2E test cases.",
89
+ )
90
+ convert_e2e_parser.set_defaults(func=convert_data_to_e2e_tests)
91
+ arguments.set_convert_e2e_arguments(convert_e2e_parser)
75
92
 
76
93
 
77
94
  def _add_data_split_parsers(
@@ -290,3 +307,48 @@ def _migrate_domain(args: argparse.Namespace) -> None:
290
307
  import rasa.core.migrate
291
308
 
292
309
  rasa.core.migrate.migrate_domain_format(args.domain, args.out)
310
+
311
+
312
+ def validate_e2e_test_conversion_output_path(output_path: str) -> None:
313
+ """Validates that the provided output path is within the project directory.
314
+
315
+ Args:
316
+ output_path (str): The output path to be validated.
317
+
318
+ Raises:
319
+ RasaException: If the provided output path is an absolute path.
320
+ """
321
+ if pathlib.Path(output_path).is_absolute():
322
+ raise RasaException(
323
+ "Please provide a relative output path within the assistant "
324
+ "project directory in which the command is running."
325
+ )
326
+
327
+
328
+ def convert_data_to_e2e_tests(args: argparse.Namespace) -> None:
329
+ """Converts sample conversation data into E2E test cases
330
+ and stores them in the output YAML file.
331
+
332
+ Args:
333
+ args: The arguments passed in from the CLI.
334
+ """
335
+ try:
336
+ ensure_beta_feature_is_enabled(
337
+ "conversion of sample conversations into end-to-end tests",
338
+ RASA_PRO_BETA_E2E_CONVERSION_ENV_VAR_NAME,
339
+ )
340
+ validate_e2e_test_conversion_output_path(args.output)
341
+
342
+ config_path = pathlib.Path(args.output)
343
+ llm_config = create_llm_e2e_test_converter_config(config_path)
344
+
345
+ kwargs = minimal_kwargs(vars(args), E2ETestConverter)
346
+ converter = E2ETestConverter(llm_config=llm_config, **kwargs)
347
+ yaml_tests_string = converter.run()
348
+
349
+ writer = E2ETestYAMLWriter(output_path=args.output)
350
+ writer.write_to_file(yaml_tests_string)
351
+ except RasaException as exc:
352
+ rasa.shared.utils.cli.print_error_and_exit(
353
+ f"Failed to convert the data into E2E tests. Error: {exc}"
354
+ )