rasa-pro 3.11.0__py3-none-any.whl → 3.11.0a1__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 +396 -17
- rasa/__main__.py +15 -31
- rasa/api.py +1 -5
- rasa/cli/arguments/default_arguments.py +2 -1
- rasa/cli/arguments/shell.py +1 -5
- rasa/cli/arguments/train.py +0 -14
- rasa/cli/e2e_test.py +1 -1
- rasa/cli/evaluate.py +8 -8
- rasa/cli/inspect.py +7 -15
- rasa/cli/interactive.py +0 -1
- rasa/cli/llm_fine_tuning.py +1 -1
- rasa/cli/project_templates/calm/config.yml +7 -5
- rasa/cli/project_templates/calm/endpoints.yml +2 -15
- rasa/cli/project_templates/tutorial/config.yml +5 -8
- rasa/cli/project_templates/tutorial/data/flows.yml +1 -1
- rasa/cli/project_templates/tutorial/data/patterns.yml +0 -5
- rasa/cli/project_templates/tutorial/domain.yml +0 -14
- rasa/cli/project_templates/tutorial/endpoints.yml +0 -5
- rasa/cli/run.py +1 -1
- rasa/cli/scaffold.py +2 -4
- rasa/cli/studio/studio.py +8 -18
- rasa/cli/studio/upload.py +15 -0
- rasa/cli/train.py +0 -3
- rasa/cli/utils.py +1 -6
- rasa/cli/x.py +8 -8
- rasa/constants.py +1 -3
- rasa/core/actions/action.py +33 -75
- rasa/core/actions/e2e_stub_custom_action_executor.py +1 -5
- rasa/core/actions/http_custom_action_executor.py +0 -4
- rasa/core/channels/__init__.py +0 -2
- rasa/core/channels/channel.py +0 -20
- rasa/core/channels/development_inspector.py +3 -10
- rasa/core/channels/inspector/dist/assets/{arc-bc141fb2.js → arc-86942a71.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{c4Diagram-d0fbc5ce-be2db283.js → c4Diagram-d0fbc5ce-b0290676.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{classDiagram-936ed81e-55366915.js → classDiagram-936ed81e-f6405f6e.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{classDiagram-v2-c3cb15f1-bb529518.js → classDiagram-v2-c3cb15f1-ef61ac77.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{createText-62fc7601-b0ec81d6.js → createText-62fc7601-f0411e58.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{edges-f2ad444c-6166330c.js → edges-f2ad444c-7dcc4f3b.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{erDiagram-9d236eb7-5ccc6a8e.js → erDiagram-9d236eb7-e0c092d7.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDb-1972c806-fca3bfe4.js → flowDb-1972c806-fba2e3ce.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDiagram-7ea5b25a-4739080f.js → flowDiagram-7ea5b25a-7a70b71a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-855bc5b3-24a5f41a.js +1 -0
- rasa/core/channels/inspector/dist/assets/{flowchart-elk-definition-abe16c3d-7c1b0e0f.js → flowchart-elk-definition-abe16c3d-00a59b68.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{ganttDiagram-9b5ea136-772fd050.js → ganttDiagram-9b5ea136-293c91fa.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-99d0ae7c-8eae1dc9.js → gitGraphDiagram-99d0ae7c-07b2d68c.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-2c4b9a3b-f55afcdf.js → index-2c4b9a3b-bc959fbd.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-e7cef9de.js → index-3a8a5a28.js} +143 -143
- rasa/core/channels/inspector/dist/assets/{infoDiagram-736b4530-124d4a14.js → infoDiagram-736b4530-4a350f72.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{journeyDiagram-df861f2b-7c4fae44.js → journeyDiagram-df861f2b-af464fb7.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{layout-b9885fb6.js → layout-0071f036.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{line-7c59abb6.js → line-2f73cc83.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{linear-4776f780.js → linear-f014b4cc.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{mindmap-definition-beec6740-2332c46c.js → mindmap-definition-beec6740-d2426fb6.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{pieDiagram-dbbf0591-8fb39303.js → pieDiagram-dbbf0591-776f01a2.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{quadrantDiagram-4d7f4fd6-3c7180a2.js → quadrantDiagram-4d7f4fd6-82e00b57.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{requirementDiagram-6fc4c22a-e910bcb8.js → requirementDiagram-6fc4c22a-ea13c6bb.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sankeyDiagram-8f13d901-ead16c89.js → sankeyDiagram-8f13d901-1feca7e9.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sequenceDiagram-b655622a-29a02a19.js → sequenceDiagram-b655622a-070c61d2.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-59f0c015-042b3137.js → stateDiagram-59f0c015-24f46263.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-v2-2b26beab-2178c0f3.js → stateDiagram-v2-2b26beab-c9056051.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-080da4f6-23ffa4fc.js → styles-080da4f6-08abc34a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-3dcbcfbf-94f59763.js → styles-3dcbcfbf-bc74c25a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-9c745c82-78a6bebc.js → styles-9c745c82-4e5d66de.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{svgDrawCommon-4835440b-eae2a6f6.js → svgDrawCommon-4835440b-849c4517.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{timeline-definition-5b62e21b-5c968d92.js → timeline-definition-5b62e21b-d0fb1598.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{xychartDiagram-2b33534f-fd3db0d5.js → xychartDiagram-2b33534f-04d115e2.js} +1 -1
- rasa/core/channels/inspector/dist/index.html +1 -1
- rasa/core/channels/inspector/src/App.tsx +1 -1
- rasa/core/channels/inspector/src/components/LoadingSpinner.tsx +3 -6
- rasa/core/channels/socketio.py +2 -7
- rasa/core/channels/telegram.py +1 -1
- rasa/core/channels/twilio.py +1 -1
- rasa/core/channels/voice_ready/audiocodes.py +4 -15
- rasa/core/channels/voice_ready/jambonz.py +4 -15
- rasa/core/channels/voice_ready/twilio_voice.py +21 -6
- rasa/core/channels/voice_ready/utils.py +5 -6
- rasa/core/channels/voice_stream/asr/asr_engine.py +1 -19
- rasa/core/channels/voice_stream/asr/asr_event.py +0 -5
- rasa/core/channels/voice_stream/asr/deepgram.py +15 -28
- rasa/core/channels/voice_stream/audio_bytes.py +0 -1
- rasa/core/channels/voice_stream/tts/azure.py +3 -9
- rasa/core/channels/voice_stream/tts/cartesia.py +8 -12
- rasa/core/channels/voice_stream/tts/tts_engine.py +1 -11
- rasa/core/channels/voice_stream/twilio_media_streams.py +19 -28
- rasa/core/channels/voice_stream/util.py +4 -4
- rasa/core/channels/voice_stream/voice_channel.py +42 -222
- rasa/core/featurizers/single_state_featurizer.py +1 -22
- rasa/core/featurizers/tracker_featurizers.py +18 -115
- rasa/core/information_retrieval/qdrant.py +0 -1
- rasa/core/nlg/contextual_response_rephraser.py +25 -44
- rasa/core/persistor.py +34 -191
- rasa/core/policies/enterprise_search_policy.py +60 -119
- rasa/core/policies/flows/flow_executor.py +4 -7
- rasa/core/policies/intentless_policy.py +22 -82
- rasa/core/policies/ted_policy.py +33 -58
- rasa/core/policies/unexpected_intent_policy.py +7 -15
- rasa/core/processor.py +13 -89
- rasa/core/run.py +2 -2
- rasa/core/training/interactive.py +35 -34
- rasa/core/utils.py +22 -58
- rasa/dialogue_understanding/coexistence/llm_based_router.py +12 -39
- rasa/dialogue_understanding/commands/__init__.py +0 -4
- rasa/dialogue_understanding/commands/change_flow_command.py +0 -6
- rasa/dialogue_understanding/commands/utils.py +0 -5
- rasa/dialogue_understanding/generator/constants.py +0 -2
- rasa/dialogue_understanding/generator/flow_retrieval.py +4 -49
- rasa/dialogue_understanding/generator/llm_based_command_generator.py +23 -37
- rasa/dialogue_understanding/generator/multi_step/multi_step_llm_command_generator.py +10 -57
- rasa/dialogue_understanding/generator/nlu_command_adapter.py +1 -19
- rasa/dialogue_understanding/generator/single_step/command_prompt_template.jinja2 +0 -3
- rasa/dialogue_understanding/generator/single_step/single_step_llm_command_generator.py +10 -90
- rasa/dialogue_understanding/patterns/default_flows_for_patterns.yml +0 -53
- rasa/dialogue_understanding/processor/command_processor.py +1 -21
- rasa/e2e_test/assertions.py +16 -133
- rasa/e2e_test/assertions_schema.yml +0 -23
- rasa/e2e_test/e2e_test_case.py +6 -85
- rasa/e2e_test/e2e_test_runner.py +4 -6
- rasa/e2e_test/utils/io.py +1 -3
- rasa/engine/loader.py +0 -12
- rasa/engine/validation.py +11 -541
- rasa/keys +1 -0
- rasa/llm_fine_tuning/notebooks/unsloth_finetuning.ipynb +407 -0
- rasa/model_training.py +7 -29
- rasa/nlu/classifiers/diet_classifier.py +25 -38
- rasa/nlu/classifiers/logistic_regression_classifier.py +9 -22
- 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 +16 -45
- rasa/nlu/featurizers/sparse_featurizer/lexical_syntactic_featurizer.py +17 -52
- rasa/nlu/featurizers/sparse_featurizer/regex_featurizer.py +3 -5
- rasa/nlu/tokenizers/whitespace_tokenizer.py +14 -3
- rasa/server.py +1 -3
- rasa/shared/constants.py +0 -61
- rasa/shared/core/constants.py +0 -9
- rasa/shared/core/domain.py +5 -8
- rasa/shared/core/flows/flow.py +0 -5
- rasa/shared/core/flows/flows_list.py +1 -5
- rasa/shared/core/flows/flows_yaml_schema.json +0 -10
- rasa/shared/core/flows/validation.py +0 -96
- rasa/shared/core/flows/yaml_flows_io.py +4 -13
- rasa/shared/core/slots.py +0 -5
- rasa/shared/importers/importer.py +2 -19
- rasa/shared/importers/rasa.py +1 -5
- rasa/shared/nlu/training_data/features.py +2 -120
- rasa/shared/nlu/training_data/formats/rasa_yaml.py +3 -18
- rasa/shared/providers/_configs/azure_openai_client_config.py +3 -5
- rasa/shared/providers/_configs/openai_client_config.py +1 -1
- rasa/shared/providers/_configs/self_hosted_llm_client_config.py +0 -1
- rasa/shared/providers/_configs/utils.py +0 -16
- rasa/shared/providers/embedding/_base_litellm_embedding_client.py +29 -18
- rasa/shared/providers/embedding/azure_openai_embedding_client.py +21 -54
- rasa/shared/providers/embedding/default_litellm_embedding_client.py +0 -24
- rasa/shared/providers/llm/_base_litellm_client.py +31 -63
- rasa/shared/providers/llm/azure_openai_llm_client.py +29 -50
- rasa/shared/providers/llm/default_litellm_llm_client.py +0 -24
- rasa/shared/providers/llm/self_hosted_llm_client.py +29 -17
- rasa/shared/providers/mappings.py +0 -19
- rasa/shared/utils/common.py +2 -37
- rasa/shared/utils/io.py +6 -28
- rasa/shared/utils/llm.py +46 -353
- rasa/shared/utils/yaml.py +82 -181
- rasa/studio/auth.py +5 -3
- rasa/studio/config.py +4 -13
- rasa/studio/constants.py +0 -1
- rasa/studio/data_handler.py +4 -13
- rasa/studio/upload.py +80 -175
- rasa/telemetry.py +17 -94
- rasa/tracing/config.py +1 -3
- rasa/tracing/instrumentation/attribute_extractors.py +17 -94
- rasa/tracing/instrumentation/instrumentation.py +0 -121
- rasa/utils/common.py +0 -5
- rasa/utils/endpoints.py +1 -27
- rasa/utils/io.py +81 -7
- rasa/utils/log_utils.py +2 -9
- rasa/utils/tensorflow/model_data.py +193 -2
- rasa/validator.py +4 -110
- rasa/version.py +1 -1
- rasa_pro-3.11.0a1.dist-info/METADATA +576 -0
- {rasa_pro-3.11.0.dist-info → rasa_pro-3.11.0a1.dist-info}/RECORD +182 -216
- rasa/core/actions/action_repeat_bot_messages.py +0 -89
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-855bc5b3-736177bf.js +0 -1
- rasa/core/channels/inspector/src/helpers/audiostream.ts +0 -165
- rasa/core/channels/voice_stream/asr/azure.py +0 -129
- rasa/core/channels/voice_stream/browser_audio.py +0 -107
- rasa/core/channels/voice_stream/call_state.py +0 -23
- rasa/dialogue_understanding/commands/repeat_bot_messages_command.py +0 -60
- rasa/dialogue_understanding/commands/user_silence_command.py +0 -59
- rasa/dialogue_understanding/patterns/repeat.py +0 -37
- rasa/dialogue_understanding/patterns/user_silence.py +0 -37
- rasa/model_manager/__init__.py +0 -0
- rasa/model_manager/config.py +0 -40
- rasa/model_manager/model_api.py +0 -559
- rasa/model_manager/runner_service.py +0 -286
- rasa/model_manager/socket_bridge.py +0 -146
- rasa/model_manager/studio_jwt_auth.py +0 -86
- rasa/model_manager/trainer_service.py +0 -325
- rasa/model_manager/utils.py +0 -87
- rasa/model_manager/warm_rasa_process.py +0 -187
- rasa/model_service.py +0 -112
- rasa/shared/core/flows/utils.py +0 -39
- rasa/shared/providers/_configs/litellm_router_client_config.py +0 -220
- rasa/shared/providers/_configs/model_group_config.py +0 -167
- rasa/shared/providers/_configs/rasa_llm_client_config.py +0 -73
- rasa/shared/providers/_utils.py +0 -79
- rasa/shared/providers/embedding/litellm_router_embedding_client.py +0 -135
- rasa/shared/providers/llm/litellm_router_llm_client.py +0 -182
- rasa/shared/providers/llm/rasa_llm_client.py +0 -112
- rasa/shared/providers/router/__init__.py +0 -0
- rasa/shared/providers/router/_base_litellm_router_client.py +0 -183
- rasa/shared/providers/router/router_client.py +0 -73
- rasa/shared/utils/health_check/__init__.py +0 -0
- rasa/shared/utils/health_check/embeddings_health_check_mixin.py +0 -31
- rasa/shared/utils/health_check/health_check.py +0 -258
- rasa/shared/utils/health_check/llm_health_check_mixin.py +0 -31
- rasa/utils/sanic_error_handler.py +0 -32
- rasa/utils/tensorflow/feature_array.py +0 -366
- rasa_pro-3.11.0.dist-info/METADATA +0 -198
- {rasa_pro-3.11.0.dist-info → rasa_pro-3.11.0a1.dist-info}/NOTICE +0 -0
- {rasa_pro-3.11.0.dist-info → rasa_pro-3.11.0a1.dist-info}/WHEEL +0 -0
- {rasa_pro-3.11.0.dist-info → rasa_pro-3.11.0a1.dist-info}/entry_points.txt +0 -0
rasa/cli/evaluate.py
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import argparse
|
|
2
|
-
from pathlib import Path
|
|
3
2
|
from typing import List, Text, Optional
|
|
3
|
+
from pathlib import Path
|
|
4
4
|
|
|
5
|
-
import rasa.cli.arguments.evaluate as arguments
|
|
6
|
-
import rasa.shared.utils.cli
|
|
7
5
|
from rasa import telemetry
|
|
8
|
-
from rasa.cli import SubParsersAction
|
|
9
|
-
from rasa.core.evaluation.marker_base import Marker, OperatorMarker
|
|
10
|
-
from rasa.core.evaluation.marker_tracker_loader import MarkerTrackerLoader
|
|
11
|
-
from rasa.core.tracker_store import TrackerStore
|
|
12
6
|
from rasa.core.utils import AvailableEndpoints
|
|
7
|
+
from rasa.core.tracker_store import TrackerStore
|
|
8
|
+
from rasa.core.evaluation.marker_tracker_loader import MarkerTrackerLoader
|
|
9
|
+
from rasa.core.evaluation.marker_base import Marker, OperatorMarker
|
|
13
10
|
from rasa.shared.core.domain import Domain
|
|
11
|
+
from rasa.cli import SubParsersAction
|
|
12
|
+
import rasa.cli.arguments.evaluate as arguments
|
|
13
|
+
import rasa.shared.utils.cli
|
|
14
14
|
|
|
15
15
|
STATS_OVERALL_SUFFIX = "-overall.csv"
|
|
16
16
|
STATS_SESSION_SUFFIX = "-per-session.csv"
|
|
@@ -217,6 +217,6 @@ def _create_tracker_loader(
|
|
|
217
217
|
A MarkerTrackerLoader object configured with the specified strategy against
|
|
218
218
|
the configured tracker store.
|
|
219
219
|
"""
|
|
220
|
-
endpoints = AvailableEndpoints.
|
|
220
|
+
endpoints = AvailableEndpoints.read_endpoints(endpoint_config)
|
|
221
221
|
tracker_store = TrackerStore.create(endpoints.tracker_store, domain=domain)
|
|
222
222
|
return MarkerTrackerLoader(tracker_store, strategy, count, seed)
|
rasa/cli/inspect.py
CHANGED
|
@@ -5,9 +5,9 @@ from typing import List, Text
|
|
|
5
5
|
|
|
6
6
|
from sanic import Sanic
|
|
7
7
|
|
|
8
|
-
from rasa import telemetry
|
|
9
8
|
from rasa.cli import SubParsersAction
|
|
10
9
|
from rasa.cli.arguments import shell as arguments
|
|
10
|
+
from rasa.cli.arguments.default_arguments import add_skip_validation_flag
|
|
11
11
|
from rasa.core import constants
|
|
12
12
|
from rasa.utils.cli import remove_argument_from_parser
|
|
13
13
|
|
|
@@ -32,12 +32,9 @@ def add_subparser(
|
|
|
32
32
|
),
|
|
33
33
|
)
|
|
34
34
|
inspect_parser.set_defaults(func=inspect)
|
|
35
|
-
arguments.set_shell_arguments(inspect_parser)
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
inspect_parser
|
|
39
|
-
"--voice", help="Enable voice", action="store_true", default=False
|
|
40
|
-
)
|
|
36
|
+
arguments.set_shell_arguments(inspect_parser)
|
|
37
|
+
add_skip_validation_flag(inspect_parser)
|
|
41
38
|
|
|
42
39
|
# it'd be confusing to expose those arguments to the user,
|
|
43
40
|
# so we remove them
|
|
@@ -46,10 +43,9 @@ def add_subparser(
|
|
|
46
43
|
remove_argument_from_parser(inspect_parser, "--enable-api")
|
|
47
44
|
|
|
48
45
|
|
|
49
|
-
async def open_inspector_in_browser(server_url: Text
|
|
46
|
+
async def open_inspector_in_browser(server_url: Text) -> None:
|
|
50
47
|
"""Opens the rasa inspector in the default browser."""
|
|
51
|
-
|
|
52
|
-
webbrowser.open(f"{server_url}/webhooks/{channel}/inspect.html")
|
|
48
|
+
webbrowser.open(f"{server_url}/webhooks/socketio/inspect.html")
|
|
53
49
|
|
|
54
50
|
|
|
55
51
|
def inspect(args: argparse.Namespace) -> None:
|
|
@@ -59,17 +55,13 @@ def inspect(args: argparse.Namespace) -> None:
|
|
|
59
55
|
async def after_start_hook_open_inspector(_: Sanic, __: AbstractEventLoop) -> None:
|
|
60
56
|
"""Hook to open the browser on server start."""
|
|
61
57
|
server_url = constants.DEFAULT_SERVER_FORMAT.format("http", args.port)
|
|
62
|
-
await open_inspector_in_browser(server_url
|
|
58
|
+
await open_inspector_in_browser(server_url)
|
|
63
59
|
|
|
64
60
|
# the following arguments are not exposed to the user
|
|
65
|
-
|
|
66
|
-
args.connector = "browser_audio"
|
|
67
|
-
else:
|
|
68
|
-
args.connector = "rasa.core.channels.socketio.SocketIOInput"
|
|
61
|
+
args.connector = "rasa.core.channels.socketio.SocketIOInput"
|
|
69
62
|
args.enable_api = True
|
|
70
63
|
args.inspect = True
|
|
71
64
|
args.credentials = None
|
|
72
65
|
args.server_listeners = [(after_start_hook_open_inspector, "after_server_start")]
|
|
73
66
|
|
|
74
|
-
telemetry.track_inspect_started(args.connector)
|
|
75
67
|
rasa.cli.run.run(args)
|
rasa/cli/interactive.py
CHANGED
|
@@ -109,7 +109,6 @@ def _set_not_required_args(args: argparse.Namespace) -> None:
|
|
|
109
109
|
args.fail_on_validation_warnings = False
|
|
110
110
|
args.validation_max_history = None
|
|
111
111
|
args.remote_storage = None
|
|
112
|
-
args.keep_local_model_copy = False
|
|
113
112
|
|
|
114
113
|
|
|
115
114
|
def perform_interactive_learning(
|
rasa/cli/llm_fine_tuning.py
CHANGED
|
@@ -352,7 +352,7 @@ def get_valid_endpoints(endpoints_file: str) -> AvailableEndpoints:
|
|
|
352
352
|
validated_endpoints_file = rasa.cli.utils.get_validated_path(
|
|
353
353
|
endpoints_file, "endpoints", DEFAULT_ENDPOINTS_PATH, True
|
|
354
354
|
)
|
|
355
|
-
endpoints = AvailableEndpoints.
|
|
355
|
+
endpoints = AvailableEndpoints.read_endpoints(validated_endpoints_file)
|
|
356
356
|
|
|
357
357
|
# Ignore all endpoints apart from action server, model, nlu and nlg
|
|
358
358
|
# to ensure InMemoryTrackerStore is being used instead of production
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
recipe: default.v1
|
|
2
2
|
language: en
|
|
3
3
|
pipeline:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
- name: SingleStepLLMCommandGenerator
|
|
5
|
+
llm:
|
|
6
|
+
model_name: gpt-4
|
|
7
|
+
request_timeout: 7
|
|
8
|
+
max_tokens: 256
|
|
7
9
|
|
|
8
10
|
policies:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
- name: FlowPolicy
|
|
12
|
+
- name: IntentlessPolicy
|
|
@@ -41,18 +41,5 @@ action_endpoint:
|
|
|
41
41
|
# password: password
|
|
42
42
|
# queue: queue
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
# For more details, refer to the documentation:
|
|
47
|
-
# https://rasa.com/docs/rasa-pro/concepts/contextual-response-rephraser
|
|
48
|
-
# To enable the rephraser, remove the comment symbols in the lines below.
|
|
49
|
-
#nlg:
|
|
50
|
-
# type: rephrase
|
|
51
|
-
|
|
52
|
-
model_groups:
|
|
53
|
-
- id: openai-gpt-4
|
|
54
|
-
models:
|
|
55
|
-
- provider: openai
|
|
56
|
-
model: openai/gpt-4
|
|
57
|
-
request_timeout: 7
|
|
58
|
-
max_tokens: 256
|
|
44
|
+
nlg:
|
|
45
|
+
type: rephrase
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
recipe: default.v1
|
|
2
2
|
language: en
|
|
3
3
|
pipeline:
|
|
4
|
-
- name: SingleStepLLMCommandGenerator
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
model: rasa/cmd_gen_codellama_13b_calm_demo
|
|
8
|
-
api_base: "https://tutorial-llm.rasa.ai"
|
|
9
|
-
flow_retrieval:
|
|
10
|
-
active: false
|
|
4
|
+
- name: SingleStepLLMCommandGenerator
|
|
5
|
+
llm:
|
|
6
|
+
model_name: gpt-4
|
|
11
7
|
|
|
12
8
|
policies:
|
|
13
9
|
- name: FlowPolicy
|
|
14
|
-
# - name: EnterpriseSearchPolicy
|
|
10
|
+
# - name: EnterpriseSearchPolicy
|
|
11
|
+
# - name: RulePolicy
|
|
@@ -19,17 +19,3 @@ responses:
|
|
|
19
19
|
|
|
20
20
|
utter_transfer_complete:
|
|
21
21
|
- text: "All done. {amount} has been sent to {recipient}."
|
|
22
|
-
|
|
23
|
-
utter_free_chitchat_response:
|
|
24
|
-
- text: "placeholder"
|
|
25
|
-
metadata:
|
|
26
|
-
rephrase: True
|
|
27
|
-
rephrase_prompt: |
|
|
28
|
-
The following is a conversation with an AI assistant built with Rasa.
|
|
29
|
-
The assistant can help the user transfer money.
|
|
30
|
-
The assistant is helpful, creative, clever, and very friendly.
|
|
31
|
-
The user is making small talk, and the assistant should respond, keeping things light.
|
|
32
|
-
Context / previous conversation with the user:
|
|
33
|
-
{{history}}
|
|
34
|
-
{{current_input}}
|
|
35
|
-
Suggested AI Response:
|
|
@@ -41,10 +41,5 @@ action_endpoint:
|
|
|
41
41
|
# password: password
|
|
42
42
|
# queue: queue
|
|
43
43
|
|
|
44
|
-
# Allow rephrasing of responses using a Rasa-hosted model
|
|
45
44
|
nlg:
|
|
46
45
|
type: rephrase
|
|
47
|
-
llm:
|
|
48
|
-
provider: rasa
|
|
49
|
-
model: rasa/cmd_gen_codellama_13b_calm_demo
|
|
50
|
-
api_base: "https://tutorial-llm.rasa.ai"
|
rasa/cli/run.py
CHANGED
|
@@ -113,7 +113,7 @@ def run(args: argparse.Namespace) -> None:
|
|
|
113
113
|
return
|
|
114
114
|
|
|
115
115
|
# start server if model server is configured
|
|
116
|
-
endpoints = AvailableEndpoints.
|
|
116
|
+
endpoints = AvailableEndpoints.read_endpoints(args.endpoints)
|
|
117
117
|
model_server = endpoints.model if endpoints and endpoints.model else None
|
|
118
118
|
if model_server is not None:
|
|
119
119
|
rasa_run(**vars(args))
|
rasa/cli/scaffold.py
CHANGED
|
@@ -128,22 +128,20 @@ def print_run_or_instructions(args: argparse.Namespace) -> None:
|
|
|
128
128
|
setattr(args, a, None)
|
|
129
129
|
|
|
130
130
|
args.port = constants.DEFAULT_SERVER_PORT
|
|
131
|
-
args.voice = False
|
|
132
|
-
args.skip_yaml_validation = ["domain"]
|
|
133
131
|
|
|
134
132
|
inspect(args)
|
|
135
133
|
else:
|
|
136
134
|
if args.no_prompt:
|
|
137
135
|
print(
|
|
138
136
|
"If you want to speak to the assistant, "
|
|
139
|
-
"run 'rasa
|
|
137
|
+
"run 'rasa shell' at any time inside "
|
|
140
138
|
"the project directory."
|
|
141
139
|
)
|
|
142
140
|
else:
|
|
143
141
|
print_success(
|
|
144
142
|
"Ok 👍🏼. "
|
|
145
143
|
"If you want to speak to the assistant, "
|
|
146
|
-
"run 'rasa
|
|
144
|
+
"run 'rasa shell' at any time inside "
|
|
147
145
|
"the project directory."
|
|
148
146
|
)
|
|
149
147
|
|
rasa/cli/studio/studio.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import argparse
|
|
2
|
-
from typing import List, Optional
|
|
2
|
+
from typing import List, Optional
|
|
3
3
|
from urllib.parse import ParseResult, urlparse
|
|
4
4
|
|
|
5
5
|
import questionary
|
|
@@ -149,7 +149,7 @@ def _configure_studio_url() -> Optional[str]:
|
|
|
149
149
|
return studio_url
|
|
150
150
|
|
|
151
151
|
|
|
152
|
-
def _get_advanced_config(studio_url: str) ->
|
|
152
|
+
def _get_advanced_config(studio_url: str) -> tuple:
|
|
153
153
|
"""Get the advanced configuration values for Rasa Studio."""
|
|
154
154
|
keycloak_url = questionary.text(
|
|
155
155
|
"Please provide your Rasa Studio Keycloak URL",
|
|
@@ -167,7 +167,7 @@ def _get_advanced_config(studio_url: str) -> Tuple:
|
|
|
167
167
|
return keycloak_url, realm_name, client_id
|
|
168
168
|
|
|
169
169
|
|
|
170
|
-
def _get_default_config(studio_url: str) ->
|
|
170
|
+
def _get_default_config(studio_url: str) -> tuple:
|
|
171
171
|
"""Get the default configuration values for Rasa Studio."""
|
|
172
172
|
keycloak_url = studio_url + "auth/"
|
|
173
173
|
realm_name = DEFAULT_REALM_NAME
|
|
@@ -178,7 +178,6 @@ def _get_default_config(studio_url: str) -> Tuple:
|
|
|
178
178
|
f"Keycloak URL: {keycloak_url}, "
|
|
179
179
|
f"Realm Name: '{realm_name}', "
|
|
180
180
|
f"Client ID: '{client_id}'. "
|
|
181
|
-
f"SSL verification is enabled."
|
|
182
181
|
f"You can use '--advanced' to configure these settings."
|
|
183
182
|
)
|
|
184
183
|
|
|
@@ -186,11 +185,7 @@ def _get_default_config(studio_url: str) -> Tuple:
|
|
|
186
185
|
|
|
187
186
|
|
|
188
187
|
def _create_studio_config(
|
|
189
|
-
studio_url: str,
|
|
190
|
-
keycloak_url: str,
|
|
191
|
-
realm_name: str,
|
|
192
|
-
client_id: str,
|
|
193
|
-
disable_verify: bool = False,
|
|
188
|
+
studio_url: str, keycloak_url: str, realm_name: str, client_id: str
|
|
194
189
|
) -> StudioConfig:
|
|
195
190
|
"""Create a StudioConfig object with the provided parameters."""
|
|
196
191
|
return StudioConfig(
|
|
@@ -198,7 +193,6 @@ def _create_studio_config(
|
|
|
198
193
|
studio_url=studio_url + "api/graphql/",
|
|
199
194
|
client_id=client_id,
|
|
200
195
|
realm_name=realm_name,
|
|
201
|
-
disable_verify=disable_verify,
|
|
202
196
|
)
|
|
203
197
|
|
|
204
198
|
|
|
@@ -233,23 +227,19 @@ def _configure_studio_config(args: argparse.Namespace) -> StudioConfig:
|
|
|
233
227
|
|
|
234
228
|
# create a configuration and auth object to try to reach the studio
|
|
235
229
|
studio_config = _create_studio_config(
|
|
236
|
-
studio_url,
|
|
237
|
-
keycloak_url,
|
|
238
|
-
realm_name,
|
|
239
|
-
client_id,
|
|
240
|
-
disable_verify=args.disable_verify,
|
|
230
|
+
studio_url, keycloak_url, realm_name, client_id
|
|
241
231
|
)
|
|
242
232
|
|
|
243
|
-
if
|
|
233
|
+
if args.disable_verify:
|
|
244
234
|
rasa.shared.utils.cli.print_info(
|
|
245
235
|
"Disabling SSL verification for the Rasa Studio authentication server."
|
|
246
236
|
)
|
|
237
|
+
studio_auth = StudioAuth(studio_config, verify=False)
|
|
247
238
|
else:
|
|
248
239
|
rasa.shared.utils.cli.print_info(
|
|
249
240
|
"Enabling SSL verification for the Rasa Studio authentication server."
|
|
250
241
|
)
|
|
251
|
-
|
|
252
|
-
studio_auth = StudioAuth(studio_config)
|
|
242
|
+
studio_auth = StudioAuth(studio_config, verify=True)
|
|
253
243
|
|
|
254
244
|
if _check_studio_auth(studio_auth):
|
|
255
245
|
return studio_config
|
rasa/cli/studio/upload.py
CHANGED
|
@@ -32,10 +32,25 @@ def add_subparser(
|
|
|
32
32
|
set_upload_arguments(upload_parser)
|
|
33
33
|
|
|
34
34
|
|
|
35
|
+
def add_flows_param(
|
|
36
|
+
parser: argparse.ArgumentParser,
|
|
37
|
+
help_text: str = "Name of flows file to upload to Rasa Studio. Works with --calm",
|
|
38
|
+
default_path: str = "flows.yml",
|
|
39
|
+
) -> None:
|
|
40
|
+
parser.add_argument(
|
|
41
|
+
"--flows",
|
|
42
|
+
default=default_path,
|
|
43
|
+
nargs="+",
|
|
44
|
+
type=str,
|
|
45
|
+
help=help_text,
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
|
|
35
49
|
def set_upload_arguments(parser: argparse.ArgumentParser) -> None:
|
|
36
50
|
"""Add arguments for running `rasa upload`."""
|
|
37
51
|
add_data_param(parser, data_type="training")
|
|
38
52
|
add_domain_param(parser)
|
|
53
|
+
add_flows_param(parser)
|
|
39
54
|
add_config_param(parser)
|
|
40
55
|
add_endpoint_param(parser, help_text="Path to the endpoints file.")
|
|
41
56
|
|
rasa/cli/train.py
CHANGED
|
@@ -143,7 +143,6 @@ def run_training(args: argparse.Namespace, can_exit: bool = False) -> Optional[T
|
|
|
143
143
|
finetuning_epoch_fraction=args.epoch_fraction,
|
|
144
144
|
remote_storage=args.remote_storage,
|
|
145
145
|
file_importer=training_data_importer,
|
|
146
|
-
keep_local_model_copy=args.keep_local_model_copy,
|
|
147
146
|
)
|
|
148
147
|
if training_result.code != 0 and can_exit:
|
|
149
148
|
sys.exit(training_result.code)
|
|
@@ -202,7 +201,6 @@ def run_core_training(args: argparse.Namespace) -> Optional[Text]:
|
|
|
202
201
|
additional_arguments=additional_arguments,
|
|
203
202
|
model_to_finetune=_model_for_finetuning(args),
|
|
204
203
|
finetuning_epoch_fraction=args.epoch_fraction,
|
|
205
|
-
keep_local_model_copy=args.keep_local_model_copy,
|
|
206
204
|
)
|
|
207
205
|
)
|
|
208
206
|
else:
|
|
@@ -244,7 +242,6 @@ def run_nlu_training(args: argparse.Namespace) -> Optional[Text]:
|
|
|
244
242
|
domain=args.domain,
|
|
245
243
|
model_to_finetune=_model_for_finetuning(args),
|
|
246
244
|
finetuning_epoch_fraction=args.epoch_fraction,
|
|
247
|
-
keep_local_model_copy=args.keep_local_model_copy,
|
|
248
245
|
)
|
|
249
246
|
)
|
|
250
247
|
|
rasa/cli/utils.py
CHANGED
|
@@ -305,7 +305,7 @@ def _validate_domain(validator: "Validator") -> bool:
|
|
|
305
305
|
valid_forms_in_stories_rules = validator.verify_forms_in_stories_rules()
|
|
306
306
|
valid_form_slots = validator.verify_form_slots()
|
|
307
307
|
valid_slot_mappings = validator.verify_slot_mappings()
|
|
308
|
-
valid_responses = validator.
|
|
308
|
+
valid_responses = validator.check_for_no_empty_paranthesis_in_responses()
|
|
309
309
|
valid_buttons = validator.validate_button_payloads()
|
|
310
310
|
return (
|
|
311
311
|
valid_domain_validity
|
|
@@ -477,8 +477,3 @@ def get_e2e_results_file_name(
|
|
|
477
477
|
file_name = parent / f"{stem}_{result_type}.yml"
|
|
478
478
|
|
|
479
479
|
return str(file_name)
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
def is_skip_validation_flag_set() -> bool:
|
|
483
|
-
"""Checks if the skip validation flag is set."""
|
|
484
|
-
return "--skip-validation" in sys.argv
|
rasa/cli/x.py
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import argparse
|
|
2
2
|
import asyncio
|
|
3
3
|
import logging
|
|
4
|
-
import signal
|
|
5
4
|
from pathlib import Path
|
|
5
|
+
import signal
|
|
6
6
|
from typing import Iterable, List, Optional, Text, Tuple, Union
|
|
7
7
|
|
|
8
8
|
import aiohttp
|
|
9
9
|
import ruamel.yaml as yaml
|
|
10
10
|
|
|
11
|
-
import rasa.cli.utils
|
|
12
|
-
import rasa.shared.utils.cli
|
|
13
|
-
import rasa.shared.utils.io
|
|
14
|
-
import rasa.utils.common
|
|
15
|
-
import rasa.utils.io
|
|
16
11
|
from rasa.cli import SubParsersAction
|
|
17
12
|
from rasa.cli.arguments import x as arguments
|
|
18
|
-
|
|
13
|
+
import rasa.cli.utils
|
|
19
14
|
from rasa.shared.constants import (
|
|
20
15
|
DEFAULT_CREDENTIALS_PATH,
|
|
21
16
|
DEFAULT_ENDPOINTS_PATH,
|
|
22
17
|
)
|
|
18
|
+
from rasa.core.utils import AvailableEndpoints
|
|
19
|
+
import rasa.shared.utils.cli
|
|
20
|
+
import rasa.shared.utils.io
|
|
21
|
+
import rasa.utils.common
|
|
22
|
+
import rasa.utils.io
|
|
23
23
|
from rasa.shared.utils.yaml import read_config_file
|
|
24
24
|
|
|
25
25
|
logger = logging.getLogger(__name__)
|
|
@@ -179,7 +179,7 @@ def run_in_enterprise_connection_mode(args: argparse.Namespace) -> None:
|
|
|
179
179
|
print_success("Starting a Rasa server in Rasa Enterprise connection mode... 🚀")
|
|
180
180
|
|
|
181
181
|
credentials_path, endpoints_path = _get_credentials_and_endpoints_paths(args)
|
|
182
|
-
endpoints = AvailableEndpoints.
|
|
182
|
+
endpoints = AvailableEndpoints.read_endpoints(endpoints_path)
|
|
183
183
|
|
|
184
184
|
_rasa_service(args, endpoints, None, credentials_path)
|
|
185
185
|
|
rasa/constants.py
CHANGED
|
@@ -18,7 +18,7 @@ CONFIG_TELEMETRY_ID = "rasa_user_id"
|
|
|
18
18
|
CONFIG_TELEMETRY_ENABLED = "enabled"
|
|
19
19
|
CONFIG_TELEMETRY_DATE = "date"
|
|
20
20
|
|
|
21
|
-
MINIMUM_COMPATIBLE_VERSION = "3.
|
|
21
|
+
MINIMUM_COMPATIBLE_VERSION = "3.10.0rc1"
|
|
22
22
|
|
|
23
23
|
GLOBAL_USER_CONFIG_PATH = os.path.expanduser("~/.config/rasa/global.yml")
|
|
24
24
|
|
|
@@ -39,7 +39,5 @@ ENV_CPU_INTRA_OP_CONFIG = "TF_INTRA_OP_PARALLELISM_THREADS"
|
|
|
39
39
|
|
|
40
40
|
MODEL_ARCHIVE_EXTENSION = "tar.gz"
|
|
41
41
|
|
|
42
|
-
DEFAULT_BUCKET_NAME = "rasa-models"
|
|
43
|
-
|
|
44
42
|
HTTP_STATUS_FORBIDDEN = 403
|
|
45
43
|
HTTP_STATUS_NOT_FOUND = 404
|
rasa/core/actions/action.py
CHANGED
|
@@ -13,8 +13,6 @@ from typing import (
|
|
|
13
13
|
cast,
|
|
14
14
|
)
|
|
15
15
|
|
|
16
|
-
from jsonschema import Draft202012Validator
|
|
17
|
-
|
|
18
16
|
import rasa.core
|
|
19
17
|
import rasa.shared.utils.io
|
|
20
18
|
from rasa.core.actions.custom_action_executor import (
|
|
@@ -103,6 +101,7 @@ if TYPE_CHECKING:
|
|
|
103
101
|
from rasa.core.nlg import NaturalLanguageGenerator
|
|
104
102
|
from rasa.shared.core.events import IntentPrediction
|
|
105
103
|
|
|
104
|
+
|
|
106
105
|
logger = logging.getLogger(__name__)
|
|
107
106
|
|
|
108
107
|
|
|
@@ -114,7 +113,6 @@ def default_actions(action_endpoint: Optional[EndpointConfig] = None) -> List["A
|
|
|
114
113
|
from rasa.core.actions.action_trigger_search import ActionTriggerSearch
|
|
115
114
|
from rasa.core.actions.two_stage_fallback import TwoStageFallbackAction
|
|
116
115
|
from rasa.core.actions.action_hangup import ActionHangup
|
|
117
|
-
from rasa.core.actions.action_repeat_bot_messages import ActionRepeatBotMessages
|
|
118
116
|
from rasa.dialogue_understanding.patterns.cancel import ActionCancelFlow
|
|
119
117
|
from rasa.dialogue_understanding.patterns.clarify import ActionClarifyFlows
|
|
120
118
|
from rasa.dialogue_understanding.patterns.correction import ActionCorrectFlowSlot
|
|
@@ -142,7 +140,6 @@ def default_actions(action_endpoint: Optional[EndpointConfig] = None) -> List["A
|
|
|
142
140
|
ActionTriggerChitchat(),
|
|
143
141
|
ActionResetRouting(),
|
|
144
142
|
ActionHangup(),
|
|
145
|
-
ActionRepeatBotMessages(),
|
|
146
143
|
]
|
|
147
144
|
|
|
148
145
|
|
|
@@ -726,77 +723,6 @@ class ActionDeactivateLoop(Action):
|
|
|
726
723
|
return [ActiveLoop(None), SlotSet(REQUESTED_SLOT, None)]
|
|
727
724
|
|
|
728
725
|
|
|
729
|
-
class RemoteActionJSONValidator:
|
|
730
|
-
"""
|
|
731
|
-
A validator class for ensuring that the JSON response from a custom action executor
|
|
732
|
-
adheres to the expected schema.
|
|
733
|
-
"""
|
|
734
|
-
|
|
735
|
-
@staticmethod
|
|
736
|
-
def action_response_format_spec() -> Dict[Text, Any]:
|
|
737
|
-
"""Expected response schema for an Action endpoint.
|
|
738
|
-
|
|
739
|
-
Used for validation of the response returned from the
|
|
740
|
-
Action endpoint.
|
|
741
|
-
|
|
742
|
-
Returns:
|
|
743
|
-
Dict[Text, Any]: A dictionary representing the JSON schema for validation.
|
|
744
|
-
"""
|
|
745
|
-
schema = {
|
|
746
|
-
"type": "object",
|
|
747
|
-
"properties": {
|
|
748
|
-
"events": EVENTS_SCHEMA,
|
|
749
|
-
"responses": {"type": "array", "items": {"type": "object"}},
|
|
750
|
-
},
|
|
751
|
-
}
|
|
752
|
-
return schema
|
|
753
|
-
|
|
754
|
-
@classmethod
|
|
755
|
-
def validate(cls, result: Dict[Text, Any]) -> bool:
|
|
756
|
-
"""
|
|
757
|
-
Validate the given JSON result against the expected Action response schema.
|
|
758
|
-
|
|
759
|
-
This method uses a cached JSON schema validator to check if the provided result
|
|
760
|
-
conforms to the predefined schema.
|
|
761
|
-
|
|
762
|
-
Args:
|
|
763
|
-
result (Dict[Text, Any]): The JSON response to validate.
|
|
764
|
-
|
|
765
|
-
Returns:
|
|
766
|
-
bool: True if validation is successful.
|
|
767
|
-
|
|
768
|
-
Raises:
|
|
769
|
-
ValidationError: If the JSON response does not conform to the schema.
|
|
770
|
-
"""
|
|
771
|
-
from jsonschema import ValidationError
|
|
772
|
-
|
|
773
|
-
try:
|
|
774
|
-
validator = cls.get_action_response_validator()
|
|
775
|
-
validator.validate(
|
|
776
|
-
result, RemoteActionJSONValidator.action_response_format_spec()
|
|
777
|
-
)
|
|
778
|
-
return True
|
|
779
|
-
except ValidationError as e:
|
|
780
|
-
e.message += (
|
|
781
|
-
f". Failed to validate Action server response from API, "
|
|
782
|
-
f"make sure your response from the Action endpoint is valid. "
|
|
783
|
-
f"For more information about the format visit "
|
|
784
|
-
f"{DOCS_BASE_URL}/custom-actions"
|
|
785
|
-
)
|
|
786
|
-
raise e
|
|
787
|
-
|
|
788
|
-
@classmethod
|
|
789
|
-
@lru_cache(maxsize=1)
|
|
790
|
-
def get_action_response_validator(cls) -> Draft202012Validator:
|
|
791
|
-
"""
|
|
792
|
-
Retrieve a cached JSON schema validator for the Action response schema.
|
|
793
|
-
|
|
794
|
-
Returns:
|
|
795
|
-
Draft202012Validator: An instance of the JSON schema validator.
|
|
796
|
-
"""
|
|
797
|
-
return Draft202012Validator(cls.action_response_format_spec())
|
|
798
|
-
|
|
799
|
-
|
|
800
726
|
class RemoteAction(Action):
|
|
801
727
|
def __init__(
|
|
802
728
|
self,
|
|
@@ -855,6 +781,37 @@ class RemoteAction(Action):
|
|
|
855
781
|
f"Found url '{self.action_endpoint.url}'."
|
|
856
782
|
)
|
|
857
783
|
|
|
784
|
+
@staticmethod
|
|
785
|
+
def action_response_format_spec() -> Dict[Text, Any]:
|
|
786
|
+
"""Expected response schema for an Action endpoint.
|
|
787
|
+
|
|
788
|
+
Used for validation of the response returned from the
|
|
789
|
+
Action endpoint.
|
|
790
|
+
"""
|
|
791
|
+
schema = {
|
|
792
|
+
"type": "object",
|
|
793
|
+
"properties": {
|
|
794
|
+
"events": EVENTS_SCHEMA,
|
|
795
|
+
"responses": {"type": "array", "items": {"type": "object"}},
|
|
796
|
+
},
|
|
797
|
+
}
|
|
798
|
+
return schema
|
|
799
|
+
|
|
800
|
+
def _validate_action_result(self, result: Dict[Text, Any]) -> bool:
|
|
801
|
+
from jsonschema import ValidationError, validate
|
|
802
|
+
|
|
803
|
+
try:
|
|
804
|
+
validate(result, self.action_response_format_spec())
|
|
805
|
+
return True
|
|
806
|
+
except ValidationError as e:
|
|
807
|
+
e.message += (
|
|
808
|
+
f". Failed to validate Action server response from API, "
|
|
809
|
+
f"make sure your response from the Action endpoint is valid. "
|
|
810
|
+
f"For more information about the format visit "
|
|
811
|
+
f"{DOCS_BASE_URL}/custom-actions"
|
|
812
|
+
)
|
|
813
|
+
raise e
|
|
814
|
+
|
|
858
815
|
@staticmethod
|
|
859
816
|
async def _utter_responses(
|
|
860
817
|
responses: List[Dict[Text, Any]],
|
|
@@ -906,6 +863,7 @@ class RemoteAction(Action):
|
|
|
906
863
|
domain=domain,
|
|
907
864
|
tracker=tracker,
|
|
908
865
|
)
|
|
866
|
+
self._validate_action_result(response)
|
|
909
867
|
|
|
910
868
|
events_json = response.get("events", [])
|
|
911
869
|
responses = response.get("responses", [])
|
|
@@ -61,12 +61,8 @@ class E2EStubCustomActionExecutor(CustomActionExecutor):
|
|
|
61
61
|
domain: "Domain",
|
|
62
62
|
include_domain: bool = False,
|
|
63
63
|
) -> Dict[Text, Any]:
|
|
64
|
-
from rasa.core.actions.action import RemoteActionJSONValidator
|
|
65
|
-
|
|
66
64
|
structlogger.debug(
|
|
67
65
|
"action.e2e_stub_custom_action_executor.run",
|
|
68
66
|
action_name=self.action_name,
|
|
69
67
|
)
|
|
70
|
-
|
|
71
|
-
RemoteActionJSONValidator.validate(response)
|
|
72
|
-
return response
|
|
68
|
+
return self.stub_custom_action.as_dict()
|
|
@@ -66,8 +66,6 @@ class HTTPCustomActionExecutor(CustomActionExecutor):
|
|
|
66
66
|
Raises:
|
|
67
67
|
RasaException: If an error occurs while making the HTTP request.
|
|
68
68
|
"""
|
|
69
|
-
from rasa.core.actions.action import RemoteActionJSONValidator
|
|
70
|
-
|
|
71
69
|
try:
|
|
72
70
|
logger.debug(
|
|
73
71
|
"Calling action endpoint to run action '{}'.".format(self.action_name)
|
|
@@ -82,8 +80,6 @@ class HTTPCustomActionExecutor(CustomActionExecutor):
|
|
|
82
80
|
if response is None:
|
|
83
81
|
response = {}
|
|
84
82
|
|
|
85
|
-
RemoteActionJSONValidator.validate(response)
|
|
86
|
-
|
|
87
83
|
return response
|
|
88
84
|
|
|
89
85
|
except ClientResponseError as e:
|
rasa/core/channels/__init__.py
CHANGED
|
@@ -24,7 +24,6 @@ from rasa.core.channels.twilio import TwilioInput
|
|
|
24
24
|
from rasa.core.channels.voice_ready.twilio_voice import TwilioVoiceInput
|
|
25
25
|
from rasa.core.channels.voice_ready.jambonz import JambonzVoiceReadyInput
|
|
26
26
|
from rasa.core.channels.voice_ready.audiocodes import AudiocodesInput
|
|
27
|
-
from rasa.core.channels.voice_stream.browser_audio import BrowserAudioInputChannel
|
|
28
27
|
from rasa.core.channels.webexteams import WebexTeamsInput
|
|
29
28
|
from rasa.core.channels.hangouts import HangoutsInput
|
|
30
29
|
from rasa.core.channels.vier_cvg import CVGInput
|
|
@@ -52,7 +51,6 @@ input_channel_classes: List[Type[InputChannel]] = [
|
|
|
52
51
|
CVGInput,
|
|
53
52
|
JambonzVoiceReadyInput,
|
|
54
53
|
TwilioMediaStreamsInputChannel,
|
|
55
|
-
BrowserAudioInputChannel,
|
|
56
54
|
]
|
|
57
55
|
|
|
58
56
|
# Mapping from an input channel name to its class to allow name based lookup.
|