rasa-pro 3.9.18__py3-none-any.whl → 3.10.3__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.
- README.md +26 -57
- rasa/__init__.py +1 -2
- rasa/__main__.py +5 -0
- rasa/anonymization/anonymization_rule_executor.py +2 -2
- rasa/api.py +26 -22
- rasa/cli/arguments/data.py +27 -2
- rasa/cli/arguments/default_arguments.py +25 -3
- rasa/cli/arguments/run.py +9 -9
- rasa/cli/arguments/train.py +2 -0
- rasa/cli/data.py +70 -8
- rasa/cli/e2e_test.py +108 -433
- rasa/cli/interactive.py +1 -0
- rasa/cli/llm_fine_tuning.py +395 -0
- rasa/cli/project_templates/calm/endpoints.yml +1 -1
- rasa/cli/project_templates/tutorial/endpoints.yml +1 -1
- rasa/cli/run.py +14 -13
- rasa/cli/scaffold.py +10 -8
- rasa/cli/train.py +8 -7
- rasa/cli/utils.py +15 -0
- rasa/constants.py +7 -1
- rasa/core/actions/action.py +98 -49
- rasa/core/actions/action_run_slot_rejections.py +4 -1
- rasa/core/actions/custom_action_executor.py +9 -6
- rasa/core/actions/direct_custom_actions_executor.py +80 -0
- rasa/core/actions/e2e_stub_custom_action_executor.py +68 -0
- rasa/core/actions/grpc_custom_action_executor.py +2 -2
- rasa/core/actions/http_custom_action_executor.py +6 -5
- rasa/core/agent.py +21 -17
- rasa/core/channels/__init__.py +2 -0
- rasa/core/channels/audiocodes.py +1 -16
- rasa/core/channels/inspector/dist/index.html +0 -2
- rasa/core/channels/inspector/index.html +0 -2
- rasa/core/channels/voice_aware/__init__.py +0 -0
- rasa/core/channels/voice_aware/jambonz.py +103 -0
- rasa/core/channels/voice_aware/jambonz_protocol.py +344 -0
- rasa/core/channels/voice_aware/utils.py +20 -0
- rasa/core/channels/voice_native/__init__.py +0 -0
- rasa/core/constants.py +6 -1
- rasa/core/featurizers/single_state_featurizer.py +1 -22
- rasa/core/featurizers/tracker_featurizers.py +18 -115
- rasa/core/information_retrieval/faiss.py +7 -4
- rasa/core/information_retrieval/information_retrieval.py +8 -0
- rasa/core/information_retrieval/milvus.py +9 -2
- rasa/core/information_retrieval/qdrant.py +1 -1
- rasa/core/nlg/contextual_response_rephraser.py +32 -10
- rasa/core/nlg/summarize.py +4 -3
- rasa/core/policies/enterprise_search_policy.py +100 -44
- rasa/core/policies/flows/flow_executor.py +130 -94
- rasa/core/policies/intentless_policy.py +52 -28
- rasa/core/policies/ted_policy.py +33 -58
- rasa/core/policies/unexpected_intent_policy.py +7 -15
- rasa/core/processor.py +20 -53
- rasa/core/run.py +5 -4
- rasa/core/tracker_store.py +8 -4
- rasa/core/utils.py +45 -56
- rasa/dialogue_understanding/coexistence/llm_based_router.py +45 -12
- rasa/dialogue_understanding/commands/__init__.py +4 -0
- rasa/dialogue_understanding/commands/change_flow_command.py +0 -6
- rasa/dialogue_understanding/commands/session_start_command.py +59 -0
- rasa/dialogue_understanding/commands/set_slot_command.py +1 -5
- rasa/dialogue_understanding/commands/utils.py +38 -0
- rasa/dialogue_understanding/generator/constants.py +10 -3
- rasa/dialogue_understanding/generator/flow_retrieval.py +14 -5
- rasa/dialogue_understanding/generator/llm_based_command_generator.py +12 -2
- rasa/dialogue_understanding/generator/multi_step/multi_step_llm_command_generator.py +106 -87
- rasa/dialogue_understanding/generator/nlu_command_adapter.py +28 -6
- rasa/dialogue_understanding/generator/single_step/single_step_llm_command_generator.py +90 -37
- rasa/dialogue_understanding/patterns/default_flows_for_patterns.yml +15 -15
- rasa/dialogue_understanding/patterns/session_start.py +37 -0
- rasa/dialogue_understanding/processor/command_processor.py +13 -14
- rasa/e2e_test/aggregate_test_stats_calculator.py +124 -0
- rasa/e2e_test/assertions.py +1181 -0
- rasa/e2e_test/assertions_schema.yml +106 -0
- rasa/e2e_test/constants.py +20 -0
- rasa/e2e_test/e2e_config.py +220 -0
- rasa/e2e_test/e2e_config_schema.yml +26 -0
- rasa/e2e_test/e2e_test_case.py +131 -8
- rasa/e2e_test/e2e_test_converter.py +363 -0
- rasa/e2e_test/e2e_test_converter_prompt.jinja2 +70 -0
- rasa/e2e_test/e2e_test_coverage_report.py +364 -0
- rasa/e2e_test/e2e_test_result.py +26 -6
- rasa/e2e_test/e2e_test_runner.py +491 -72
- rasa/e2e_test/e2e_test_schema.yml +96 -0
- rasa/e2e_test/pykwalify_extensions.py +39 -0
- rasa/e2e_test/stub_custom_action.py +70 -0
- rasa/e2e_test/utils/__init__.py +0 -0
- rasa/e2e_test/utils/e2e_yaml_utils.py +55 -0
- rasa/e2e_test/utils/io.py +596 -0
- rasa/e2e_test/utils/validation.py +80 -0
- rasa/engine/recipes/default_components.py +0 -2
- rasa/engine/storage/local_model_storage.py +0 -1
- rasa/env.py +9 -0
- rasa/llm_fine_tuning/__init__.py +0 -0
- rasa/llm_fine_tuning/annotation_module.py +241 -0
- rasa/llm_fine_tuning/conversations.py +144 -0
- rasa/llm_fine_tuning/llm_data_preparation_module.py +178 -0
- rasa/llm_fine_tuning/notebooks/unsloth_finetuning.ipynb +407 -0
- rasa/llm_fine_tuning/paraphrasing/__init__.py +0 -0
- rasa/llm_fine_tuning/paraphrasing/conversation_rephraser.py +281 -0
- rasa/llm_fine_tuning/paraphrasing/default_rephrase_prompt_template.jina2 +44 -0
- rasa/llm_fine_tuning/paraphrasing/rephrase_validator.py +121 -0
- rasa/llm_fine_tuning/paraphrasing/rephrased_user_message.py +10 -0
- rasa/llm_fine_tuning/paraphrasing_module.py +128 -0
- rasa/llm_fine_tuning/storage.py +174 -0
- rasa/llm_fine_tuning/train_test_split_module.py +441 -0
- rasa/model_training.py +48 -16
- rasa/nlu/classifiers/diet_classifier.py +25 -38
- rasa/nlu/classifiers/logistic_regression_classifier.py +9 -44
- rasa/nlu/classifiers/sklearn_intent_classifier.py +16 -37
- rasa/nlu/extractors/crf_entity_extractor.py +50 -93
- rasa/nlu/featurizers/sparse_featurizer/count_vectors_featurizer.py +45 -78
- rasa/nlu/featurizers/sparse_featurizer/lexical_syntactic_featurizer.py +17 -52
- rasa/nlu/featurizers/sparse_featurizer/regex_featurizer.py +3 -5
- rasa/nlu/persistor.py +129 -32
- rasa/server.py +45 -10
- rasa/shared/constants.py +63 -15
- rasa/shared/core/domain.py +15 -12
- rasa/shared/core/events.py +28 -2
- rasa/shared/core/flows/flow.py +208 -13
- rasa/shared/core/flows/flow_path.py +84 -0
- rasa/shared/core/flows/flows_list.py +28 -10
- rasa/shared/core/flows/flows_yaml_schema.json +269 -193
- rasa/shared/core/flows/validation.py +112 -25
- rasa/shared/core/flows/yaml_flows_io.py +149 -10
- rasa/shared/core/trackers.py +6 -0
- rasa/shared/core/training_data/visualization.html +2 -2
- rasa/shared/exceptions.py +4 -0
- rasa/shared/importers/importer.py +60 -11
- rasa/shared/importers/remote_importer.py +196 -0
- rasa/shared/nlu/constants.py +2 -0
- rasa/shared/nlu/training_data/features.py +2 -120
- rasa/shared/providers/_configs/__init__.py +0 -0
- rasa/shared/providers/_configs/azure_openai_client_config.py +181 -0
- rasa/shared/providers/_configs/client_config.py +57 -0
- rasa/shared/providers/_configs/default_litellm_client_config.py +130 -0
- rasa/shared/providers/_configs/huggingface_local_embedding_client_config.py +234 -0
- rasa/shared/providers/_configs/openai_client_config.py +175 -0
- rasa/shared/providers/_configs/self_hosted_llm_client_config.py +171 -0
- rasa/shared/providers/_configs/utils.py +101 -0
- rasa/shared/providers/_ssl_verification_utils.py +124 -0
- rasa/shared/providers/embedding/__init__.py +0 -0
- rasa/shared/providers/embedding/_base_litellm_embedding_client.py +254 -0
- rasa/shared/providers/embedding/_langchain_embedding_client_adapter.py +74 -0
- rasa/shared/providers/embedding/azure_openai_embedding_client.py +277 -0
- rasa/shared/providers/embedding/default_litellm_embedding_client.py +102 -0
- rasa/shared/providers/embedding/embedding_client.py +90 -0
- rasa/shared/providers/embedding/embedding_response.py +41 -0
- rasa/shared/providers/embedding/huggingface_local_embedding_client.py +191 -0
- rasa/shared/providers/embedding/openai_embedding_client.py +172 -0
- rasa/shared/providers/llm/__init__.py +0 -0
- rasa/shared/providers/llm/_base_litellm_client.py +227 -0
- rasa/shared/providers/llm/azure_openai_llm_client.py +338 -0
- rasa/shared/providers/llm/default_litellm_llm_client.py +84 -0
- rasa/shared/providers/llm/llm_client.py +76 -0
- rasa/shared/providers/llm/llm_response.py +50 -0
- rasa/shared/providers/llm/openai_llm_client.py +155 -0
- rasa/shared/providers/llm/self_hosted_llm_client.py +169 -0
- rasa/shared/providers/mappings.py +75 -0
- rasa/shared/utils/cli.py +30 -0
- rasa/shared/utils/io.py +65 -3
- rasa/shared/utils/llm.py +223 -200
- rasa/shared/utils/yaml.py +122 -7
- rasa/studio/download.py +19 -13
- rasa/studio/train.py +2 -3
- rasa/studio/upload.py +2 -3
- rasa/telemetry.py +113 -58
- rasa/tracing/config.py +2 -3
- rasa/tracing/instrumentation/attribute_extractors.py +29 -17
- rasa/tracing/instrumentation/instrumentation.py +4 -47
- rasa/utils/common.py +18 -19
- rasa/utils/endpoints.py +7 -4
- rasa/utils/io.py +66 -0
- rasa/utils/json_utils.py +60 -0
- rasa/utils/licensing.py +9 -1
- rasa/utils/ml_utils.py +4 -2
- rasa/utils/tensorflow/model_data.py +193 -2
- rasa/validator.py +195 -1
- rasa/version.py +1 -1
- {rasa_pro-3.9.18.dist-info → rasa_pro-3.10.3.dist-info}/METADATA +47 -72
- {rasa_pro-3.9.18.dist-info → rasa_pro-3.10.3.dist-info}/RECORD +185 -121
- rasa/nlu/classifiers/llm_intent_classifier.py +0 -519
- rasa/shared/providers/openai/clients.py +0 -43
- rasa/shared/providers/openai/session_handler.py +0 -110
- rasa/utils/tensorflow/feature_array.py +0 -366
- /rasa/{shared/providers/openai → cli/project_templates/tutorial/actions}/__init__.py +0 -0
- /rasa/cli/project_templates/tutorial/{actions.py → actions/actions.py} +0 -0
- {rasa_pro-3.9.18.dist-info → rasa_pro-3.10.3.dist-info}/NOTICE +0 -0
- {rasa_pro-3.9.18.dist-info → rasa_pro-3.10.3.dist-info}/WHEEL +0 -0
- {rasa_pro-3.9.18.dist-info → rasa_pro-3.10.3.dist-info}/entry_points.txt +0 -0
README.md
CHANGED
|
@@ -10,35 +10,39 @@
|
|
|
10
10
|
|
|
11
11
|
<hr />
|
|
12
12
|
|
|
13
|
+
<img align="right" height="255" src="https://www.rasa.com/assets/img/sara/sara-open-source-2.0.png" alt="An image of Sara, the Rasa mascot bird, holding a flag that reads Open Source with one wing, and a wrench in the other" title="Rasa Pro">
|
|
13
14
|
|
|
14
|
-
Rasa Pro is
|
|
15
|
+
Rasa Pro is an open core product that extends Rasa Open Source. With over 50 million downloads, Rasa Open Source is the most popular open source framework for building chat and voice-based AI assistants.
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
Rasa Pro introduces CALM, a generative AI-native approach to developing assistants, combined with enterprise-ready analytics, security, and observability capabilities. A paid license is required to run Rasa Pro, but all Rasa Pro code is visible to end users and can be customized as needed.
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
Rasa Pro is the pro-code component of our enterprise solution, Rasa Platform, for implementing resilient and trustworthy AI assistants at scale. Rasa Studio complements Rasa Pro with a low-code user interface, enabling anyone on your team to create and improve your assistant.
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
- **Customizable and Open:** Fully customizable code that allows developers to modify Rasa Pro to meet specific requirements, ensuring flexibility and adaptability to various conversational AI needs.
|
|
23
|
-
- **Robustness and Control:** Maintain strict adherence to business logic, preventing unwanted behaviors like prompt injection and hallucinations, leading to more reliable responses and secure interactions.
|
|
24
|
-
- **Built-in Security:** Safeguard sensitive data, control access, and ensure secure deployment, essential for production environments that demand high levels of security and compliance.
|
|
21
|
+
---
|
|
22
|
+
- 🤓 [Read The Docs](https://rasa.com/docs/rasa-pro/)
|
|
25
23
|
|
|
24
|
+
- 😁 [Install Rasa Pro](https://rasa.com/docs/rasa-pro/installation/python/installation)
|
|
26
25
|
|
|
26
|
+
---
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
## README Contents:
|
|
29
|
+
- [Development Internals](#development-internals)
|
|
30
|
+
- [Releases](#releases)
|
|
31
|
+
- [Troubleshooting](#troubleshooting)
|
|
29
32
|
|
|
30
|
-
|
|
33
|
+
## Development Internals
|
|
31
34
|
|
|
32
|
-
|
|
35
|
+
### Installing Poetry
|
|
33
36
|
|
|
34
|
-
|
|
37
|
+
Rasa uses Poetry for packaging and dependency management. If you want to build it from source,
|
|
38
|
+
you have to install Poetry first. Please follow
|
|
39
|
+
[the official guide](https://python-poetry.org/docs/#installation) to see all possible options.
|
|
35
40
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
To update an existing poetry version to the [version](.github/poetry_version.txt), currently used in rasa, run:
|
|
42
|
+
```shell
|
|
43
|
+
poetry self update <version>
|
|
44
|
+
```
|
|
40
45
|
|
|
41
|
-
<<<<<<< HEAD
|
|
42
46
|
### Managing environments
|
|
43
47
|
|
|
44
48
|
The official [Poetry guide](https://python-poetry.org/docs/managing-environments/) suggests to use
|
|
@@ -232,39 +236,6 @@ To check the types execute
|
|
|
232
236
|
make types
|
|
233
237
|
```
|
|
234
238
|
|
|
235
|
-
### Backporting
|
|
236
|
-
|
|
237
|
-
In order to port changes to `main` and across release branches, we use the `backport` workflow located at
|
|
238
|
-
the `.github/workflows/backport.yml` path.
|
|
239
|
-
This workflow is triggered by the `backport-to-<release-branch>` label applied to a PR, for example `backport-to-3.8.x`.
|
|
240
|
-
Current available target branches are `main` and maintained release branches.
|
|
241
|
-
|
|
242
|
-
When a PR gets labelled `backport-to-<release-branch>`, a PR is opened by the `backport-github-action` as soon as the
|
|
243
|
-
source PR gets closed (by merging). If you want to close the PR without merging changes, make sure to remove the `backport-to-<release-branch>` label.
|
|
244
|
-
|
|
245
|
-
The PR author which the action assigns to the backporting PR has to resolve any conflicts before approving and merging.
|
|
246
|
-
Release PRs should also be labelled with `backport-to-main` to backport the `CHANGELOG.md` updates to `main`.
|
|
247
|
-
Backporting version updates should be accepted to the `main` branch from the latest release branch only.
|
|
248
|
-
|
|
249
|
-
Here are some guidelines to follow when backporting changes and resolving conflicts:
|
|
250
|
-
|
|
251
|
-
a) for conflicts in `version.py`: accept only the version from the latest release branch. Do not merge version changes
|
|
252
|
-
from earlier release branches into `main` because this could cause issues when trying to make the next minor release.
|
|
253
|
-
|
|
254
|
-
b) for conflicts in `pyproject.toml`: if related to the `rasa-pro` version, accept only the latest release branch;
|
|
255
|
-
if related to other dependencies, accept `main` or whichever is the higher upgrade (main usually has the updated
|
|
256
|
-
dependencies because we only do housekeeping on `main`, apart from vulnerability updates). Be mindful of dependencies that
|
|
257
|
-
are removed from `main` but still exist in former release branches (for example `langchain`).
|
|
258
|
-
|
|
259
|
-
c) for conflicts in `poetry.lock`: accept changes which were already present on the target branch, then run
|
|
260
|
-
`poetry lock --no-update` so that the lock file contains your changes from `pyproject.toml` too.
|
|
261
|
-
|
|
262
|
-
d) for conflicts in `CHANGELOG.md`: Manually place the changelog in their allocated section (e.g. 3.8.10 will go under the
|
|
263
|
-
3.8 section with the other releases, rather than go at the top of the file)
|
|
264
|
-
|
|
265
|
-
If the backporting workflow fails, you are encouraged to cherry-pick the commits manually and create a PR to
|
|
266
|
-
the target branch. Alternatively, you can install the backporting CLI tool as described [here](https://github.com/sorenlouv/backport?tab=readme-ov-file#install).
|
|
267
|
-
|
|
268
239
|
## Releases
|
|
269
240
|
Rasa has implemented robust policies governing version naming, as well as release pace for major, minor, and patch releases.
|
|
270
241
|
|
|
@@ -347,12 +318,9 @@ Releasing a new version is quite simple, as the packages are build and distribut
|
|
|
347
318
|
9. If however an error occurs in the build, then we should see a failure message automatically posted in the company's Slack (`dev-tribe` channel) like this [one](https://rasa-hq.slack.com/archives/C01M5TAHDHA/p1701444735622919)
|
|
348
319
|
(In this case do the following checks):
|
|
349
320
|
- Check the workflows in [Github Actions](https://github.com/RasaHQ/rasa-private/actions) and make sure that the merged PR of the current release is completed successfully. To easily find your PR you can use the filters `event: push` and `branch: <version number>` (example on release 2.4 you can see [here](https://github.com/RasaHQ/rasa/actions/runs/643344876))
|
|
350
|
-
- If the workflow is not completed, then try to re
|
|
321
|
+
- If the workflow is not completed, then try to re run the workflow in case that solves the problem
|
|
351
322
|
- If the problem persists, check also the log files and try to find the root cause of the issue
|
|
352
323
|
- If you still cannot resolve the error, contact the infrastructure team by providing any helpful information from your investigation
|
|
353
|
-
10. If the release is successful, add the newly created release branch to the backporting configuration in the `.backportrc.json` file to
|
|
354
|
-
the `targetBranchesChoices` list. This is necessary for the backporting workflow to work correctly with new release branches.
|
|
355
|
-
|
|
356
324
|
|
|
357
325
|
### Cutting a Patch release
|
|
358
326
|
|
|
@@ -401,6 +369,10 @@ steps.
|
|
|
401
369
|
|
|
402
370
|
Please refer to the [Rasa Product Release and Maintenance Policy](https://rasa.com/rasa-product-release-and-maintenance-policy/) page.
|
|
403
371
|
|
|
372
|
+
### Active workflows on the CI
|
|
373
|
+
|
|
374
|
+
Please refer to the [WORKFLOW_README FILE](https://github.com/RasaHQ/rasa-private/blob/main/WORKFLOW_README.md)
|
|
375
|
+
|
|
404
376
|
## Troubleshooting
|
|
405
377
|
|
|
406
378
|
- When running docker commands, if you encounter this error: `OSError No space left on device`, consider running:
|
|
@@ -410,6 +382,3 @@ Please refer to the [Rasa Product Release and Maintenance Policy](https://rasa.c
|
|
|
410
382
|
```
|
|
411
383
|
|
|
412
384
|
For more information on this command, please see the [Official Docker Documentation](https://docs.docker.com/engine/reference/commandline/system_prune/).
|
|
413
|
-
=======
|
|
414
|
-
for more. Also feel free to reach out to us on the [Rasa forum](https://forum.rasa.com/).
|
|
415
|
-
>>>>>>> 2c5cd7bc639 (update readme.md from main branch on 3.10.x (#1597))
|
rasa/__init__.py
CHANGED
rasa/__main__.py
CHANGED
|
@@ -25,6 +25,7 @@ from rasa.cli import (
|
|
|
25
25
|
visualize,
|
|
26
26
|
x,
|
|
27
27
|
evaluate,
|
|
28
|
+
llm_fine_tuning,
|
|
28
29
|
)
|
|
29
30
|
from rasa.cli.arguments.default_arguments import add_logging_options
|
|
30
31
|
from rasa.cli.utils import (
|
|
@@ -76,6 +77,7 @@ def create_argument_parser() -> argparse.ArgumentParser:
|
|
|
76
77
|
export.add_subparser(subparsers, parents=parent_parsers)
|
|
77
78
|
x.add_subparser(subparsers, parents=parent_parsers)
|
|
78
79
|
evaluate.add_subparser(subparsers, parents=parent_parsers)
|
|
80
|
+
llm_fine_tuning.add_subparser(subparsers, parent_parsers)
|
|
79
81
|
plugin_manager().hook.refine_cli(
|
|
80
82
|
subparsers=subparsers, parent_parsers=parent_parsers
|
|
81
83
|
)
|
|
@@ -85,12 +87,15 @@ def create_argument_parser() -> argparse.ArgumentParser:
|
|
|
85
87
|
|
|
86
88
|
def print_version() -> None:
|
|
87
89
|
"""Prints version information of rasa tooling and python."""
|
|
90
|
+
from rasa.utils.licensing import get_license_expiration_date
|
|
91
|
+
|
|
88
92
|
print(f"Rasa Version : {version.__version__}")
|
|
89
93
|
print(f"Minimum Compatible Version: {MINIMUM_COMPATIBLE_VERSION}")
|
|
90
94
|
print(f"Rasa SDK Version : {rasa_sdk_version}")
|
|
91
95
|
print(f"Python Version : {platform.python_version()}")
|
|
92
96
|
print(f"Operating System : {platform.platform()}")
|
|
93
97
|
print(f"Python Path : {sys.executable}")
|
|
98
|
+
print(f"License Expires : {get_license_expiration_date()}")
|
|
94
99
|
|
|
95
100
|
|
|
96
101
|
def main() -> None:
|
|
@@ -123,7 +123,7 @@ class AnonymizationRuleExecutor:
|
|
|
123
123
|
else None
|
|
124
124
|
)
|
|
125
125
|
|
|
126
|
-
self.anonymizer_engine = AnonymizerEngine()
|
|
126
|
+
self.anonymizer_engine = AnonymizerEngine() # type: ignore
|
|
127
127
|
|
|
128
128
|
@staticmethod
|
|
129
129
|
def _validate_anonymization_rule_list(
|
|
@@ -146,7 +146,7 @@ class AnonymizationRuleExecutor:
|
|
|
146
146
|
|
|
147
147
|
return True
|
|
148
148
|
|
|
149
|
-
def run(self, text: Text) -> Text:
|
|
149
|
+
def run(self, text: Text) -> Optional[Text]:
|
|
150
150
|
"""Anonymizes the given text using the given anonymization rule list."""
|
|
151
151
|
if (
|
|
152
152
|
self.analyzer is None
|
rasa/api.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
from typing import Any, Text, Dict, Union, List, Optional, TYPE_CHECKING
|
|
2
1
|
import asyncio
|
|
2
|
+
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Text, Union
|
|
3
|
+
|
|
3
4
|
import rasa.shared.constants
|
|
5
|
+
from rasa.nlu.persistor import StorageType
|
|
4
6
|
|
|
5
7
|
# WARNING: Be careful about adding any top level imports at this place!
|
|
6
8
|
# These functions are imported in `rasa.__init__` and any top level import
|
|
@@ -15,11 +17,11 @@ if TYPE_CHECKING:
|
|
|
15
17
|
|
|
16
18
|
|
|
17
19
|
def run(
|
|
18
|
-
model:
|
|
19
|
-
endpoints:
|
|
20
|
-
connector:
|
|
21
|
-
credentials:
|
|
22
|
-
**kwargs:
|
|
20
|
+
model: Text,
|
|
21
|
+
endpoints: Text,
|
|
22
|
+
connector: Optional[Text] = None,
|
|
23
|
+
credentials: Optional[Text] = None,
|
|
24
|
+
**kwargs: Dict[Text, Any],
|
|
23
25
|
) -> None:
|
|
24
26
|
"""Runs a Rasa model.
|
|
25
27
|
|
|
@@ -34,10 +36,10 @@ def run(
|
|
|
34
36
|
|
|
35
37
|
"""
|
|
36
38
|
import rasa.core.run
|
|
37
|
-
from rasa.core.utils import AvailableEndpoints
|
|
38
|
-
from rasa.shared.utils.cli import print_warning
|
|
39
39
|
import rasa.shared.utils.common
|
|
40
|
+
from rasa.core.utils import AvailableEndpoints
|
|
40
41
|
from rasa.shared.constants import DOCS_BASE_URL
|
|
42
|
+
from rasa.shared.utils.cli import print_warning
|
|
41
43
|
|
|
42
44
|
_endpoints = AvailableEndpoints.read_endpoints(endpoints)
|
|
43
45
|
|
|
@@ -63,18 +65,19 @@ def run(
|
|
|
63
65
|
|
|
64
66
|
|
|
65
67
|
def train(
|
|
66
|
-
domain:
|
|
67
|
-
config:
|
|
68
|
+
domain: Text,
|
|
69
|
+
config: Text,
|
|
68
70
|
training_files: "Union[Text, List[Text]]",
|
|
69
|
-
output:
|
|
71
|
+
output: Text = rasa.shared.constants.DEFAULT_MODELS_PATH,
|
|
70
72
|
dry_run: bool = False,
|
|
71
73
|
force_training: bool = False,
|
|
72
|
-
fixed_model_name:
|
|
74
|
+
fixed_model_name: Optional[Text] = None,
|
|
73
75
|
persist_nlu_training_data: bool = False,
|
|
74
|
-
core_additional_arguments:
|
|
75
|
-
nlu_additional_arguments:
|
|
76
|
-
model_to_finetune:
|
|
76
|
+
core_additional_arguments: Optional[Dict] = None,
|
|
77
|
+
nlu_additional_arguments: Optional[Dict] = None,
|
|
78
|
+
model_to_finetune: Optional[Text] = None,
|
|
77
79
|
finetuning_epoch_fraction: float = 1.0,
|
|
80
|
+
remote_storage: Optional[StorageType] = None,
|
|
78
81
|
) -> "TrainingResult":
|
|
79
82
|
"""Runs Rasa Core and NLU training in `async` loop.
|
|
80
83
|
|
|
@@ -96,6 +99,7 @@ def train(
|
|
|
96
99
|
a directory in case the latest trained model should be used.
|
|
97
100
|
finetuning_epoch_fraction: The fraction currently specified training epochs
|
|
98
101
|
in the model configuration which should be used for finetuning.
|
|
102
|
+
remote_storage: Remote storage to use for model storage.
|
|
99
103
|
|
|
100
104
|
Returns:
|
|
101
105
|
An instance of `TrainingResult`.
|
|
@@ -116,16 +120,17 @@ def train(
|
|
|
116
120
|
nlu_additional_arguments=nlu_additional_arguments,
|
|
117
121
|
model_to_finetune=model_to_finetune,
|
|
118
122
|
finetuning_epoch_fraction=finetuning_epoch_fraction,
|
|
123
|
+
remote_storage=remote_storage,
|
|
119
124
|
)
|
|
120
125
|
)
|
|
121
126
|
|
|
122
127
|
|
|
123
128
|
def test(
|
|
124
|
-
model:
|
|
125
|
-
stories:
|
|
126
|
-
nlu_data:
|
|
127
|
-
output:
|
|
128
|
-
additional_arguments:
|
|
129
|
+
model: Text,
|
|
130
|
+
stories: Text,
|
|
131
|
+
nlu_data: Text,
|
|
132
|
+
output: Text = rasa.shared.constants.DEFAULT_RESULTS_PATH,
|
|
133
|
+
additional_arguments: Optional[Dict] = None,
|
|
129
134
|
) -> None:
|
|
130
135
|
"""Test a Rasa model against a set of test data.
|
|
131
136
|
|
|
@@ -136,8 +141,7 @@ def test(
|
|
|
136
141
|
output: path to folder where all output will be stored
|
|
137
142
|
additional_arguments: additional arguments for the test call
|
|
138
143
|
"""
|
|
139
|
-
from rasa.model_testing import test_core
|
|
140
|
-
from rasa.model_testing import test_nlu
|
|
144
|
+
from rasa.model_testing import test_core, test_nlu
|
|
141
145
|
|
|
142
146
|
if additional_arguments is None:
|
|
143
147
|
additional_arguments = {}
|
rasa/cli/arguments/data.py
CHANGED
|
@@ -10,8 +10,8 @@ from rasa.cli.arguments.default_arguments import (
|
|
|
10
10
|
from rasa.shared.constants import DEFAULT_CONVERTED_DATA_PATH
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
def
|
|
14
|
-
"""Sets convert command arguments."""
|
|
13
|
+
def set_convert_nlu_arguments(parser: argparse.ArgumentParser, data_type: Text) -> None:
|
|
14
|
+
"""Sets convert nlu command arguments."""
|
|
15
15
|
parser.add_argument(
|
|
16
16
|
"-f",
|
|
17
17
|
"--format",
|
|
@@ -32,6 +32,31 @@ def set_convert_arguments(parser: argparse.ArgumentParser, data_type: Text) -> N
|
|
|
32
32
|
parser.add_argument("-l", "--language", default="en", help="Language of data.")
|
|
33
33
|
|
|
34
34
|
|
|
35
|
+
def set_convert_e2e_arguments(parser: argparse.ArgumentParser) -> None:
|
|
36
|
+
"""Sets convert e2e command arguments.
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
parser: Parser we are going to attach arguments to.
|
|
40
|
+
"""
|
|
41
|
+
parser.add_argument(
|
|
42
|
+
"path",
|
|
43
|
+
type=str,
|
|
44
|
+
help="Path to the input CSV or XLS/XLSX file.",
|
|
45
|
+
)
|
|
46
|
+
parser.add_argument(
|
|
47
|
+
"-o",
|
|
48
|
+
"--output",
|
|
49
|
+
type=str,
|
|
50
|
+
default="e2e_tests",
|
|
51
|
+
help="Output directory to store the tests.",
|
|
52
|
+
)
|
|
53
|
+
parser.add_argument(
|
|
54
|
+
"--sheet-name",
|
|
55
|
+
type=str,
|
|
56
|
+
help="Worksheet name containing relevant data. Mandatory for Excel file input.",
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
|
|
35
60
|
def set_split_arguments(parser: argparse.ArgumentParser) -> None:
|
|
36
61
|
add_nlu_data_param(parser, help_text="File or folder containing your NLU data.")
|
|
37
62
|
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import argparse
|
|
2
2
|
import logging
|
|
3
|
-
from typing import Text, Union
|
|
3
|
+
from typing import Optional, Text, Union
|
|
4
4
|
|
|
5
|
+
from rasa.nlu.persistor import RemoteStorageType, StorageType, parse_remote_storage
|
|
5
6
|
from rasa.shared.constants import (
|
|
6
7
|
DEFAULT_CONFIG_PATH,
|
|
7
|
-
DEFAULT_DOMAIN_PATH,
|
|
8
|
-
DEFAULT_MODELS_PATH,
|
|
9
8
|
DEFAULT_DATA_PATH,
|
|
9
|
+
DEFAULT_DOMAIN_PATH,
|
|
10
10
|
DEFAULT_ENDPOINTS_PATH,
|
|
11
|
+
DEFAULT_MODELS_PATH,
|
|
11
12
|
)
|
|
12
13
|
|
|
13
14
|
|
|
@@ -163,3 +164,24 @@ def add_logging_options(parser: argparse.ArgumentParser) -> None:
|
|
|
163
164
|
help="If set, the name of the logging configuration file will be set "
|
|
164
165
|
"to the given name.",
|
|
165
166
|
)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def add_remote_storage_param(
|
|
170
|
+
parser: Union[argparse.ArgumentParser, argparse._ActionsContainer],
|
|
171
|
+
required: bool = False,
|
|
172
|
+
) -> None:
|
|
173
|
+
parser.add_argument(
|
|
174
|
+
"--remote-storage",
|
|
175
|
+
help="Remote storage which should be used to store/load the model."
|
|
176
|
+
f"Supported storages are: {RemoteStorageType.list()}. "
|
|
177
|
+
"You can also provide your own implementation of the `Persistor` interface.",
|
|
178
|
+
required=required,
|
|
179
|
+
type=parse_remote_storage_arg,
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
def parse_remote_storage_arg(value: str) -> StorageType:
|
|
184
|
+
try:
|
|
185
|
+
return parse_remote_storage(value)
|
|
186
|
+
except ValueError as e:
|
|
187
|
+
raise argparse.ArgumentTypeError(str(e))
|
rasa/cli/arguments/run.py
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import os
|
|
2
|
-
|
|
3
1
|
import argparse
|
|
2
|
+
import os
|
|
4
3
|
from typing import Union
|
|
5
4
|
|
|
6
|
-
from rasa.cli.arguments.default_arguments import
|
|
5
|
+
from rasa.cli.arguments.default_arguments import (
|
|
6
|
+
add_endpoint_param,
|
|
7
|
+
add_model_param,
|
|
8
|
+
add_remote_storage_param,
|
|
9
|
+
)
|
|
7
10
|
from rasa.core import constants
|
|
8
11
|
from rasa.env import (
|
|
12
|
+
AUTH_TOKEN_ENV,
|
|
9
13
|
DEFAULT_JWT_METHOD,
|
|
10
14
|
JWT_METHOD_ENV,
|
|
11
|
-
JWT_SECRET_ENV,
|
|
12
15
|
JWT_PRIVATE_KEY_ENV,
|
|
13
|
-
|
|
16
|
+
JWT_SECRET_ENV,
|
|
14
17
|
)
|
|
15
18
|
|
|
16
19
|
|
|
@@ -136,10 +139,7 @@ def add_server_settings_arguments(parser: argparse.ArgumentParser) -> None:
|
|
|
136
139
|
type=int,
|
|
137
140
|
help="Maximum time a request can take to process (sec).",
|
|
138
141
|
)
|
|
139
|
-
server_arguments
|
|
140
|
-
"--remote-storage",
|
|
141
|
-
help="Set the remote location where your Rasa model is stored, e.g. on AWS.",
|
|
142
|
-
)
|
|
142
|
+
add_remote_storage_param(server_arguments)
|
|
143
143
|
server_arguments.add_argument(
|
|
144
144
|
"--ssl-certificate",
|
|
145
145
|
help="Set the SSL Certificate to create a TLS secured server.",
|
rasa/cli/arguments/train.py
CHANGED
|
@@ -8,6 +8,7 @@ from rasa.cli.arguments.default_arguments import (
|
|
|
8
8
|
add_out_param,
|
|
9
9
|
add_domain_param,
|
|
10
10
|
add_endpoint_param,
|
|
11
|
+
add_remote_storage_param,
|
|
11
12
|
)
|
|
12
13
|
from rasa.graph_components.providers.training_tracker_provider import (
|
|
13
14
|
TrainingTrackerProvider,
|
|
@@ -38,6 +39,7 @@ 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)
|
|
41
43
|
|
|
42
44
|
|
|
43
45
|
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
|
-
|
|
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
|
-
|
|
26
|
+
from rasa.shared.exceptions import RasaException
|
|
18
27
|
from rasa.shared.importers.importer import TrainingDataImporter
|
|
19
|
-
|
|
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.
|
|
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
|
+
)
|