rasa-pro 3.10.15__py3-none-any.whl → 3.11.0__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.
- rasa/__main__.py +31 -15
- rasa/api.py +12 -2
- rasa/cli/arguments/default_arguments.py +24 -4
- rasa/cli/arguments/run.py +15 -0
- rasa/cli/arguments/shell.py +5 -1
- rasa/cli/arguments/train.py +17 -9
- rasa/cli/evaluate.py +7 -7
- rasa/cli/inspect.py +19 -7
- rasa/cli/interactive.py +1 -0
- rasa/cli/project_templates/calm/config.yml +5 -7
- rasa/cli/project_templates/calm/endpoints.yml +15 -2
- rasa/cli/project_templates/tutorial/config.yml +8 -5
- rasa/cli/project_templates/tutorial/data/flows.yml +1 -1
- rasa/cli/project_templates/tutorial/data/patterns.yml +5 -0
- rasa/cli/project_templates/tutorial/domain.yml +14 -0
- rasa/cli/project_templates/tutorial/endpoints.yml +5 -0
- rasa/cli/run.py +7 -0
- rasa/cli/scaffold.py +4 -2
- rasa/cli/studio/upload.py +0 -15
- rasa/cli/train.py +14 -53
- rasa/cli/utils.py +14 -11
- rasa/cli/x.py +7 -7
- rasa/constants.py +3 -1
- rasa/core/actions/action.py +77 -33
- rasa/core/actions/action_hangup.py +29 -0
- rasa/core/actions/action_repeat_bot_messages.py +89 -0
- rasa/core/actions/e2e_stub_custom_action_executor.py +5 -1
- rasa/core/actions/http_custom_action_executor.py +4 -0
- rasa/core/agent.py +2 -2
- rasa/core/brokers/kafka.py +3 -1
- rasa/core/brokers/pika.py +3 -1
- rasa/core/channels/__init__.py +10 -6
- rasa/core/channels/channel.py +41 -4
- rasa/core/channels/development_inspector.py +150 -46
- rasa/core/channels/inspector/README.md +1 -1
- rasa/core/channels/inspector/dist/assets/{arc-b6e548fe.js → arc-bc141fb2.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{c4Diagram-d0fbc5ce-fa03ac9e.js → c4Diagram-d0fbc5ce-be2db283.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{classDiagram-936ed81e-ee67392a.js → classDiagram-936ed81e-55366915.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{classDiagram-v2-c3cb15f1-9b283fae.js → classDiagram-v2-c3cb15f1-bb529518.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{createText-62fc7601-8b6fcc2a.js → createText-62fc7601-b0ec81d6.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{edges-f2ad444c-22e77f4f.js → edges-f2ad444c-6166330c.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{erDiagram-9d236eb7-60ffc87f.js → erDiagram-9d236eb7-5ccc6a8e.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDb-1972c806-9dd802e4.js → flowDb-1972c806-fca3bfe4.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDiagram-7ea5b25a-5fa1912f.js → flowDiagram-7ea5b25a-4739080f.js} +1 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-855bc5b3-736177bf.js +1 -0
- rasa/core/channels/inspector/dist/assets/{flowchart-elk-definition-abe16c3d-622a1fd2.js → flowchart-elk-definition-abe16c3d-7c1b0e0f.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{ganttDiagram-9b5ea136-e285a63a.js → ganttDiagram-9b5ea136-772fd050.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-99d0ae7c-f237bdca.js → gitGraphDiagram-99d0ae7c-8eae1dc9.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-2c4b9a3b-4b03d70e.js → index-2c4b9a3b-f55afcdf.js} +1 -1
- rasa/core/channels/inspector/dist/assets/index-e7cef9de.js +1317 -0
- rasa/core/channels/inspector/dist/assets/{infoDiagram-736b4530-72a0fa5f.js → infoDiagram-736b4530-124d4a14.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{journeyDiagram-df861f2b-82218c41.js → journeyDiagram-df861f2b-7c4fae44.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{layout-78cff630.js → layout-b9885fb6.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{line-5038b469.js → line-7c59abb6.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{linear-c4fc4098.js → linear-4776f780.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{mindmap-definition-beec6740-c33c8ea6.js → mindmap-definition-beec6740-2332c46c.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{pieDiagram-dbbf0591-a8d03059.js → pieDiagram-dbbf0591-8fb39303.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{quadrantDiagram-4d7f4fd6-6a0e56b2.js → quadrantDiagram-4d7f4fd6-3c7180a2.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{requirementDiagram-6fc4c22a-2dc7c7bd.js → requirementDiagram-6fc4c22a-e910bcb8.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sankeyDiagram-8f13d901-2360fe39.js → sankeyDiagram-8f13d901-ead16c89.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sequenceDiagram-b655622a-41b9f9ad.js → sequenceDiagram-b655622a-29a02a19.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-59f0c015-0aad326f.js → stateDiagram-59f0c015-042b3137.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-v2-2b26beab-9847d984.js → stateDiagram-v2-2b26beab-2178c0f3.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-080da4f6-564d890e.js → styles-080da4f6-23ffa4fc.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-3dcbcfbf-38957613.js → styles-3dcbcfbf-94f59763.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-9c745c82-f0fc6921.js → styles-9c745c82-78a6bebc.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{svgDrawCommon-4835440b-ef3c5a77.js → svgDrawCommon-4835440b-eae2a6f6.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{timeline-definition-5b62e21b-bf3e91c1.js → timeline-definition-5b62e21b-5c968d92.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{xychartDiagram-2b33534f-4d4026c0.js → xychartDiagram-2b33534f-fd3db0d5.js} +1 -1
- rasa/core/channels/inspector/dist/index.html +18 -15
- rasa/core/channels/inspector/index.html +17 -14
- rasa/core/channels/inspector/package.json +5 -1
- rasa/core/channels/inspector/src/App.tsx +118 -68
- rasa/core/channels/inspector/src/components/Chat.tsx +95 -0
- rasa/core/channels/inspector/src/components/DiagramFlow.tsx +11 -10
- rasa/core/channels/inspector/src/components/DialogueStack.tsx +10 -25
- rasa/core/channels/inspector/src/components/LoadingSpinner.tsx +6 -3
- rasa/core/channels/inspector/src/helpers/audiostream.ts +165 -0
- rasa/core/channels/inspector/src/helpers/formatters.test.ts +10 -0
- rasa/core/channels/inspector/src/helpers/formatters.ts +107 -41
- rasa/core/channels/inspector/src/helpers/utils.ts +92 -7
- rasa/core/channels/inspector/src/types.ts +21 -1
- rasa/core/channels/inspector/yarn.lock +94 -1
- rasa/core/channels/rest.py +51 -46
- rasa/core/channels/socketio.py +28 -1
- rasa/core/channels/telegram.py +1 -1
- rasa/core/channels/twilio.py +1 -1
- rasa/core/channels/{audiocodes.py → voice_ready/audiocodes.py} +122 -69
- rasa/core/channels/{voice_aware → voice_ready}/jambonz.py +26 -8
- rasa/core/channels/{voice_aware → voice_ready}/jambonz_protocol.py +57 -5
- rasa/core/channels/{twilio_voice.py → voice_ready/twilio_voice.py} +64 -28
- rasa/core/channels/voice_ready/utils.py +37 -0
- rasa/core/channels/voice_stream/asr/__init__.py +0 -0
- rasa/core/channels/voice_stream/asr/asr_engine.py +89 -0
- rasa/core/channels/voice_stream/asr/asr_event.py +18 -0
- rasa/core/channels/voice_stream/asr/azure.py +129 -0
- rasa/core/channels/voice_stream/asr/deepgram.py +90 -0
- rasa/core/channels/voice_stream/audio_bytes.py +8 -0
- rasa/core/channels/voice_stream/browser_audio.py +107 -0
- rasa/core/channels/voice_stream/call_state.py +23 -0
- rasa/core/channels/voice_stream/tts/__init__.py +0 -0
- rasa/core/channels/voice_stream/tts/azure.py +106 -0
- rasa/core/channels/voice_stream/tts/cartesia.py +118 -0
- rasa/core/channels/voice_stream/tts/tts_cache.py +27 -0
- rasa/core/channels/voice_stream/tts/tts_engine.py +58 -0
- rasa/core/channels/voice_stream/twilio_media_streams.py +173 -0
- rasa/core/channels/voice_stream/util.py +57 -0
- rasa/core/channels/voice_stream/voice_channel.py +427 -0
- rasa/core/information_retrieval/qdrant.py +1 -0
- rasa/core/nlg/contextual_response_rephraser.py +45 -17
- rasa/{nlu → core}/persistor.py +203 -68
- rasa/core/policies/enterprise_search_policy.py +119 -63
- rasa/core/policies/flows/flow_executor.py +15 -22
- rasa/core/policies/intentless_policy.py +83 -28
- rasa/core/processor.py +25 -0
- rasa/core/run.py +12 -2
- rasa/core/secrets_manager/constants.py +4 -0
- rasa/core/secrets_manager/factory.py +8 -0
- rasa/core/secrets_manager/vault.py +11 -1
- rasa/core/training/interactive.py +33 -34
- rasa/core/utils.py +47 -21
- rasa/dialogue_understanding/coexistence/llm_based_router.py +41 -14
- rasa/dialogue_understanding/commands/__init__.py +6 -0
- rasa/dialogue_understanding/commands/repeat_bot_messages_command.py +60 -0
- rasa/dialogue_understanding/commands/session_end_command.py +61 -0
- rasa/dialogue_understanding/commands/user_silence_command.py +59 -0
- rasa/dialogue_understanding/commands/utils.py +5 -0
- rasa/dialogue_understanding/generator/constants.py +2 -0
- rasa/dialogue_understanding/generator/flow_retrieval.py +47 -9
- rasa/dialogue_understanding/generator/llm_based_command_generator.py +38 -15
- rasa/dialogue_understanding/generator/llm_command_generator.py +1 -1
- rasa/dialogue_understanding/generator/multi_step/multi_step_llm_command_generator.py +35 -13
- rasa/dialogue_understanding/generator/single_step/command_prompt_template.jinja2 +3 -0
- rasa/dialogue_understanding/generator/single_step/single_step_llm_command_generator.py +60 -13
- rasa/dialogue_understanding/patterns/default_flows_for_patterns.yml +53 -0
- rasa/dialogue_understanding/patterns/repeat.py +37 -0
- rasa/dialogue_understanding/patterns/user_silence.py +37 -0
- rasa/dialogue_understanding/processor/command_processor.py +21 -1
- rasa/e2e_test/aggregate_test_stats_calculator.py +1 -11
- rasa/e2e_test/assertions.py +136 -61
- rasa/e2e_test/assertions_schema.yml +23 -0
- rasa/e2e_test/e2e_test_case.py +85 -6
- rasa/e2e_test/e2e_test_runner.py +2 -3
- rasa/engine/graph.py +0 -1
- rasa/engine/loader.py +12 -0
- rasa/engine/recipes/config_files/default_config.yml +0 -3
- rasa/engine/recipes/default_recipe.py +0 -1
- rasa/engine/recipes/graph_recipe.py +0 -1
- rasa/engine/runner/dask.py +2 -2
- rasa/engine/storage/local_model_storage.py +12 -42
- rasa/engine/storage/storage.py +1 -5
- rasa/engine/validation.py +527 -74
- rasa/model_manager/__init__.py +0 -0
- rasa/model_manager/config.py +40 -0
- rasa/model_manager/model_api.py +559 -0
- rasa/model_manager/runner_service.py +286 -0
- rasa/model_manager/socket_bridge.py +146 -0
- rasa/model_manager/studio_jwt_auth.py +86 -0
- rasa/model_manager/trainer_service.py +325 -0
- rasa/model_manager/utils.py +87 -0
- rasa/model_manager/warm_rasa_process.py +187 -0
- rasa/model_service.py +112 -0
- rasa/model_training.py +42 -23
- rasa/nlu/tokenizers/whitespace_tokenizer.py +3 -14
- rasa/server.py +4 -2
- rasa/shared/constants.py +60 -8
- rasa/shared/core/constants.py +13 -0
- rasa/shared/core/domain.py +107 -50
- rasa/shared/core/events.py +29 -0
- rasa/shared/core/flows/flow.py +5 -0
- rasa/shared/core/flows/flows_list.py +19 -6
- rasa/shared/core/flows/flows_yaml_schema.json +10 -0
- rasa/shared/core/flows/utils.py +39 -0
- rasa/shared/core/flows/validation.py +121 -0
- rasa/shared/core/flows/yaml_flows_io.py +15 -27
- rasa/shared/core/slots.py +5 -0
- rasa/shared/importers/importer.py +59 -41
- rasa/shared/importers/multi_project.py +23 -11
- rasa/shared/importers/rasa.py +12 -3
- rasa/shared/importers/remote_importer.py +196 -0
- rasa/shared/importers/utils.py +3 -1
- rasa/shared/nlu/training_data/formats/rasa_yaml.py +18 -3
- rasa/shared/nlu/training_data/training_data.py +18 -19
- rasa/shared/providers/_configs/litellm_router_client_config.py +220 -0
- rasa/shared/providers/_configs/model_group_config.py +167 -0
- rasa/shared/providers/_configs/openai_client_config.py +1 -1
- rasa/shared/providers/_configs/rasa_llm_client_config.py +73 -0
- rasa/shared/providers/_configs/self_hosted_llm_client_config.py +1 -0
- rasa/shared/providers/_configs/utils.py +16 -0
- rasa/shared/providers/_utils.py +79 -0
- rasa/shared/providers/embedding/_base_litellm_embedding_client.py +13 -29
- rasa/shared/providers/embedding/azure_openai_embedding_client.py +54 -21
- rasa/shared/providers/embedding/default_litellm_embedding_client.py +24 -0
- rasa/shared/providers/embedding/litellm_router_embedding_client.py +135 -0
- rasa/shared/providers/llm/_base_litellm_client.py +34 -22
- rasa/shared/providers/llm/azure_openai_llm_client.py +50 -29
- rasa/shared/providers/llm/default_litellm_llm_client.py +24 -0
- rasa/shared/providers/llm/litellm_router_llm_client.py +182 -0
- rasa/shared/providers/llm/rasa_llm_client.py +112 -0
- rasa/shared/providers/llm/self_hosted_llm_client.py +5 -29
- rasa/shared/providers/mappings.py +19 -0
- rasa/shared/providers/router/__init__.py +0 -0
- rasa/shared/providers/router/_base_litellm_router_client.py +183 -0
- rasa/shared/providers/router/router_client.py +73 -0
- rasa/shared/utils/common.py +40 -24
- rasa/shared/utils/health_check/__init__.py +0 -0
- rasa/shared/utils/health_check/embeddings_health_check_mixin.py +31 -0
- rasa/shared/utils/health_check/health_check.py +258 -0
- rasa/shared/utils/health_check/llm_health_check_mixin.py +31 -0
- rasa/shared/utils/io.py +27 -6
- rasa/shared/utils/llm.py +353 -43
- rasa/shared/utils/schemas/events.py +2 -0
- rasa/shared/utils/schemas/model_config.yml +0 -10
- rasa/shared/utils/yaml.py +181 -38
- rasa/studio/data_handler.py +3 -1
- rasa/studio/upload.py +160 -74
- rasa/telemetry.py +94 -17
- rasa/tracing/config.py +3 -1
- rasa/tracing/instrumentation/attribute_extractors.py +95 -18
- rasa/tracing/instrumentation/instrumentation.py +121 -0
- rasa/utils/common.py +5 -0
- rasa/utils/endpoints.py +27 -1
- rasa/utils/io.py +8 -16
- rasa/utils/log_utils.py +9 -2
- rasa/utils/sanic_error_handler.py +32 -0
- rasa/validator.py +110 -4
- rasa/version.py +1 -1
- {rasa_pro-3.10.15.dist-info → rasa_pro-3.11.0.dist-info}/METADATA +14 -12
- {rasa_pro-3.10.15.dist-info → rasa_pro-3.11.0.dist-info}/RECORD +234 -183
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-855bc5b3-1844e5a5.js +0 -1
- rasa/core/channels/inspector/dist/assets/index-a5d3e69d.js +0 -1040
- rasa/core/channels/voice_aware/utils.py +0 -20
- rasa/llm_fine_tuning/notebooks/unsloth_finetuning.ipynb +0 -407
- /rasa/core/channels/{voice_aware → voice_ready}/__init__.py +0 -0
- /rasa/core/channels/{voice_native → voice_stream}/__init__.py +0 -0
- {rasa_pro-3.10.15.dist-info → rasa_pro-3.11.0.dist-info}/NOTICE +0 -0
- {rasa_pro-3.10.15.dist-info → rasa_pro-3.11.0.dist-info}/WHEEL +0 -0
- {rasa_pro-3.10.15.dist-info → rasa_pro-3.11.0.dist-info}/entry_points.txt +0 -0
rasa/model_service.py
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
3
|
+
from sanic import Sanic
|
|
4
|
+
import structlog
|
|
5
|
+
|
|
6
|
+
from rasa.cli.scaffold import print_error_and_exit
|
|
7
|
+
from rasa.core.persistor import RemoteStorageType, get_persistor
|
|
8
|
+
from rasa.core.utils import list_routes
|
|
9
|
+
from rasa.model_manager import model_api
|
|
10
|
+
from rasa.model_manager import config
|
|
11
|
+
from rasa.model_manager.config import SERVER_BASE_URL, SERVER_PORT
|
|
12
|
+
from rasa.utils.common import configure_logging_and_warnings
|
|
13
|
+
import rasa.utils.licensing
|
|
14
|
+
from urllib.parse import urlparse
|
|
15
|
+
|
|
16
|
+
from rasa.utils.log_utils import configure_structlog
|
|
17
|
+
from rasa.utils.sanic_error_handler import register_custom_sanic_error_handler
|
|
18
|
+
|
|
19
|
+
structlogger = structlog.get_logger()
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def url_prefix_from_base_url() -> str:
|
|
23
|
+
"""Return the path prefix from the base URL."""
|
|
24
|
+
# return path without any trailing slashes
|
|
25
|
+
prefix = urlparse(SERVER_BASE_URL).path.rstrip("/") if SERVER_BASE_URL else ""
|
|
26
|
+
|
|
27
|
+
# can't be empty
|
|
28
|
+
return prefix or config.DEFAULT_SERVER_PATH_PREFIX
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def validate_model_storage_type() -> None:
|
|
32
|
+
"""Validate the storage type if remote storage is used for models."""
|
|
33
|
+
if config.SERVER_MODEL_REMOTE_STORAGE:
|
|
34
|
+
if config.SERVER_MODEL_REMOTE_STORAGE not in RemoteStorageType.list():
|
|
35
|
+
print_error_and_exit(
|
|
36
|
+
f"Invalid storage type '{config.SERVER_MODEL_REMOTE_STORAGE}'. "
|
|
37
|
+
f"Supported storage types: {', '.join(RemoteStorageType.list())}."
|
|
38
|
+
f"Alternatively, unset the remote storage type to store models locally."
|
|
39
|
+
)
|
|
40
|
+
else:
|
|
41
|
+
structlogger.info(
|
|
42
|
+
"model_api.storage.remote_storage_enabled",
|
|
43
|
+
remote_storage=config.SERVER_MODEL_REMOTE_STORAGE,
|
|
44
|
+
)
|
|
45
|
+
# try to create a client to validate the configuration
|
|
46
|
+
get_persistor(config.SERVER_MODEL_REMOTE_STORAGE)
|
|
47
|
+
else:
|
|
48
|
+
structlogger.info(
|
|
49
|
+
"model_api.storage.local_storage_enabled",
|
|
50
|
+
base_path=config.SERVER_BASE_WORKING_DIRECTORY,
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _register_update_task(app: Sanic) -> None:
|
|
55
|
+
app.add_task(
|
|
56
|
+
model_api.continuously_update_process_status,
|
|
57
|
+
name="continuously_update_process_status",
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def main() -> None:
|
|
62
|
+
"""Start the Rasa Model Manager server.
|
|
63
|
+
|
|
64
|
+
The API server can receive requests to train models, run bots, and manage
|
|
65
|
+
the lifecycle of models and bots.
|
|
66
|
+
"""
|
|
67
|
+
log_level = logging.DEBUG
|
|
68
|
+
configure_logging_and_warnings(
|
|
69
|
+
log_level=log_level,
|
|
70
|
+
logging_config_file=None,
|
|
71
|
+
warn_only_once=True,
|
|
72
|
+
filter_repeated_logs=True,
|
|
73
|
+
)
|
|
74
|
+
configure_structlog(log_level, include_time=True)
|
|
75
|
+
|
|
76
|
+
rasa.utils.licensing.validate_license_from_env()
|
|
77
|
+
|
|
78
|
+
try:
|
|
79
|
+
model_api.prepare_working_directories()
|
|
80
|
+
except Exception as e:
|
|
81
|
+
structlogger.error(
|
|
82
|
+
"model_api.prepare_directories.failed",
|
|
83
|
+
error=str(e),
|
|
84
|
+
base_directory=config.SERVER_BASE_WORKING_DIRECTORY,
|
|
85
|
+
)
|
|
86
|
+
print_error_and_exit(
|
|
87
|
+
f"Failed to create working directories. Please make sure the "
|
|
88
|
+
f"server base directory at '{config.SERVER_BASE_WORKING_DIRECTORY}' "
|
|
89
|
+
f"is writable by the current user."
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
validate_model_storage_type()
|
|
93
|
+
|
|
94
|
+
structlogger.debug("model_api.starting_server", port=SERVER_PORT)
|
|
95
|
+
|
|
96
|
+
url_prefix = url_prefix_from_base_url()
|
|
97
|
+
# configure the sanic application
|
|
98
|
+
app = Sanic("RasaModelService")
|
|
99
|
+
app.after_server_start(_register_update_task)
|
|
100
|
+
app.blueprint(model_api.external_blueprint(), url_prefix=url_prefix)
|
|
101
|
+
app.blueprint(model_api.internal_blueprint())
|
|
102
|
+
|
|
103
|
+
# list all routes
|
|
104
|
+
list_routes(app)
|
|
105
|
+
|
|
106
|
+
register_custom_sanic_error_handler(app)
|
|
107
|
+
|
|
108
|
+
app.run(host="0.0.0.0", port=SERVER_PORT, legacy=True, motd=False)
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
if __name__ == "__main__":
|
|
112
|
+
main()
|
rasa/model_training.py
CHANGED
|
@@ -15,6 +15,7 @@ import rasa.shared.utils.common
|
|
|
15
15
|
import rasa.shared.utils.io
|
|
16
16
|
import rasa.utils.common
|
|
17
17
|
from rasa import telemetry
|
|
18
|
+
from rasa.core.persistor import StorageType
|
|
18
19
|
from rasa.engine.caching import LocalTrainingCache
|
|
19
20
|
from rasa.engine.recipes.recipe import Recipe
|
|
20
21
|
from rasa.engine.runner.dask import DaskGraphRunner
|
|
@@ -22,7 +23,6 @@ from rasa.engine.storage.local_model_storage import LocalModelStorage
|
|
|
22
23
|
from rasa.engine.storage.storage import ModelStorage
|
|
23
24
|
from rasa.engine.training.components import FingerprintStatus
|
|
24
25
|
from rasa.engine.training.graph_trainer import GraphTrainer
|
|
25
|
-
from rasa.nlu.persistor import RemoteStorageType, StorageType
|
|
26
26
|
from rasa.shared.core.domain import Domain
|
|
27
27
|
from rasa.shared.core.events import SlotSet
|
|
28
28
|
from rasa.shared.core.training_data.structures import StoryGraph
|
|
@@ -156,6 +156,8 @@ async def train(
|
|
|
156
156
|
model_to_finetune: Optional[Text] = None,
|
|
157
157
|
finetuning_epoch_fraction: float = 1.0,
|
|
158
158
|
remote_storage: Optional[StorageType] = None,
|
|
159
|
+
file_importer: Optional[TrainingDataImporter] = None,
|
|
160
|
+
keep_local_model_copy: bool = False,
|
|
159
161
|
) -> TrainingResult:
|
|
160
162
|
"""Trains a Rasa model (Core and NLU).
|
|
161
163
|
|
|
@@ -177,14 +179,20 @@ async def train(
|
|
|
177
179
|
a directory in case the latest trained model should be used.
|
|
178
180
|
finetuning_epoch_fraction: The fraction currently specified training epochs
|
|
179
181
|
in the model configuration which should be used for finetuning.
|
|
180
|
-
remote_storage:
|
|
182
|
+
remote_storage: Optional name of the remote storage to
|
|
183
|
+
use for storing the model.
|
|
184
|
+
file_importer: Instance of `TrainingDataImporter` to use for training.
|
|
185
|
+
If it is not provided, a new instance will be created.
|
|
186
|
+
keep_local_model_copy: If `True` the model will be stored locally even if
|
|
187
|
+
remote storage is configured.
|
|
181
188
|
|
|
182
189
|
Returns:
|
|
183
190
|
An instance of `TrainingResult`.
|
|
184
191
|
"""
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
192
|
+
if not file_importer:
|
|
193
|
+
file_importer = TrainingDataImporter.load_from_config(
|
|
194
|
+
config, domain, training_files, core_additional_arguments
|
|
195
|
+
)
|
|
188
196
|
|
|
189
197
|
stories = file_importer.get_stories()
|
|
190
198
|
flows = file_importer.get_flows()
|
|
@@ -258,6 +266,7 @@ async def train(
|
|
|
258
266
|
finetuning_epoch_fraction=finetuning_epoch_fraction,
|
|
259
267
|
dry_run=dry_run,
|
|
260
268
|
remote_storage=remote_storage,
|
|
269
|
+
keep_local_model_copy=keep_local_model_copy,
|
|
261
270
|
**(core_additional_arguments or {}),
|
|
262
271
|
**(nlu_additional_arguments or {}),
|
|
263
272
|
)
|
|
@@ -272,6 +281,7 @@ async def _train_graph(
|
|
|
272
281
|
force_full_training: bool = False,
|
|
273
282
|
dry_run: bool = False,
|
|
274
283
|
remote_storage: Optional[StorageType] = None,
|
|
284
|
+
keep_local_model_copy: bool = False,
|
|
275
285
|
**kwargs: Any,
|
|
276
286
|
) -> TrainingResult:
|
|
277
287
|
if model_to_finetune:
|
|
@@ -312,7 +322,10 @@ async def _train_graph(
|
|
|
312
322
|
rasa.engine.validation.validate_coexistance_routing_setup(
|
|
313
323
|
domain, model_configuration, flows
|
|
314
324
|
)
|
|
315
|
-
rasa.engine.validation.
|
|
325
|
+
rasa.engine.validation.validate_model_group_configuration_setup()
|
|
326
|
+
rasa.engine.validation.validate_model_client_configuration_setup_during_training_time(
|
|
327
|
+
config
|
|
328
|
+
)
|
|
316
329
|
rasa.engine.validation.validate_flow_component_dependencies(
|
|
317
330
|
flows, model_configuration
|
|
318
331
|
)
|
|
@@ -335,7 +348,7 @@ async def _train_graph(
|
|
|
335
348
|
)
|
|
336
349
|
return _dry_run_result(fingerprint_status, force_full_training)
|
|
337
350
|
|
|
338
|
-
model_name =
|
|
351
|
+
model_name = determine_model_name(fixed_model_name, training_type)
|
|
339
352
|
full_model_path = Path(output_path, model_name)
|
|
340
353
|
|
|
341
354
|
with telemetry.track_model_training(
|
|
@@ -350,26 +363,20 @@ async def _train_graph(
|
|
|
350
363
|
)
|
|
351
364
|
if remote_storage:
|
|
352
365
|
push_model_to_remote_storage(full_model_path, remote_storage)
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
remote_storage.value
|
|
356
|
-
if isinstance(remote_storage, RemoteStorageType)
|
|
357
|
-
else remote_storage
|
|
358
|
-
)
|
|
366
|
+
if not keep_local_model_copy:
|
|
367
|
+
full_model_path.unlink()
|
|
359
368
|
structlogger.info(
|
|
360
369
|
"model_training.train.finished_training",
|
|
361
370
|
event_info=(
|
|
362
371
|
f"Your Rasa model {model_name} is trained "
|
|
363
|
-
f"and saved at remote storage provider "
|
|
364
|
-
f"'{remote_storage_string}'."
|
|
372
|
+
f"and saved at remote storage provider '{remote_storage}'."
|
|
365
373
|
),
|
|
366
374
|
)
|
|
367
375
|
else:
|
|
368
376
|
structlogger.info(
|
|
369
377
|
"model_training.train.finished_training",
|
|
370
378
|
event_info=(
|
|
371
|
-
f"Your Rasa model is trained and saved at "
|
|
372
|
-
f"'{full_model_path}'."
|
|
379
|
+
f"Your Rasa model is trained and saved at '{full_model_path}'."
|
|
373
380
|
),
|
|
374
381
|
)
|
|
375
382
|
|
|
@@ -389,9 +396,14 @@ def _create_model_storage(
|
|
|
389
396
|
return model_storage
|
|
390
397
|
|
|
391
398
|
|
|
392
|
-
def
|
|
399
|
+
def generate_random_model_name() -> str:
|
|
400
|
+
time_format = "%Y%m%d-%H%M%S"
|
|
401
|
+
return f"{time.strftime(time_format)}-{randomname.get_name()}"
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
def determine_model_name(
|
|
393
405
|
fixed_model_name: Optional[Text], training_type: TrainingType
|
|
394
|
-
) ->
|
|
406
|
+
) -> str:
|
|
395
407
|
if fixed_model_name:
|
|
396
408
|
if not fixed_model_name.endswith(".tar.gz"):
|
|
397
409
|
return f"{fixed_model_name}.tar.gz"
|
|
@@ -401,8 +413,7 @@ def _determine_model_name(
|
|
|
401
413
|
if training_type in [TrainingType.CORE, TrainingType.NLU]:
|
|
402
414
|
prefix = f"{training_type.model_type}-"
|
|
403
415
|
|
|
404
|
-
|
|
405
|
-
return f"{prefix}{time.strftime(time_format)}-{randomname.get_name()}.tar.gz"
|
|
416
|
+
return f"{prefix}{generate_random_model_name()}.tar.gz"
|
|
406
417
|
|
|
407
418
|
|
|
408
419
|
async def train_core(
|
|
@@ -414,6 +425,7 @@ async def train_core(
|
|
|
414
425
|
additional_arguments: Optional[Dict] = None,
|
|
415
426
|
model_to_finetune: Optional[Text] = None,
|
|
416
427
|
finetuning_epoch_fraction: float = 1.0,
|
|
428
|
+
keep_local_model_copy: bool = False,
|
|
417
429
|
) -> Optional[Text]:
|
|
418
430
|
"""Trains a Core model.
|
|
419
431
|
|
|
@@ -428,6 +440,8 @@ async def train_core(
|
|
|
428
440
|
a directory in case the latest trained model should be used.
|
|
429
441
|
finetuning_epoch_fraction: The fraction currently specified training epochs
|
|
430
442
|
in the model configuration which should be used for finetuning.
|
|
443
|
+
keep_local_model_copy: If `True` the model will be stored locally even if
|
|
444
|
+
remote storage is configured.
|
|
431
445
|
|
|
432
446
|
Returns:
|
|
433
447
|
Path to the model archive.
|
|
@@ -483,6 +497,7 @@ async def train_core(
|
|
|
483
497
|
model_to_finetune=model_to_finetune,
|
|
484
498
|
fixed_model_name=fixed_model_name,
|
|
485
499
|
finetuning_epoch_fraction=finetuning_epoch_fraction,
|
|
500
|
+
keep_local_model_copy=keep_local_model_copy,
|
|
486
501
|
**(additional_arguments or {}),
|
|
487
502
|
)
|
|
488
503
|
).model
|
|
@@ -498,6 +513,7 @@ async def train_nlu(
|
|
|
498
513
|
domain: Optional[Union[Domain, Text]] = None,
|
|
499
514
|
model_to_finetune: Optional[Text] = None,
|
|
500
515
|
finetuning_epoch_fraction: float = 1.0,
|
|
516
|
+
keep_local_model_copy: bool = False,
|
|
501
517
|
) -> Optional[Text]:
|
|
502
518
|
"""Trains an NLU model.
|
|
503
519
|
|
|
@@ -515,6 +531,8 @@ async def train_nlu(
|
|
|
515
531
|
a directory in case the latest trained model should be used.
|
|
516
532
|
finetuning_epoch_fraction: The fraction currently specified training epochs
|
|
517
533
|
in the model configuration which should be used for finetuning.
|
|
534
|
+
keep_local_model_copy: If `True` the model will be stored locally even if
|
|
535
|
+
remote storage is configured.
|
|
518
536
|
|
|
519
537
|
Returns:
|
|
520
538
|
Path to the model archive.
|
|
@@ -556,14 +574,15 @@ async def train_nlu(
|
|
|
556
574
|
fixed_model_name=fixed_model_name,
|
|
557
575
|
finetuning_epoch_fraction=finetuning_epoch_fraction,
|
|
558
576
|
persist_nlu_training_data=persist_nlu_training_data,
|
|
577
|
+
keep_local_model_copy=keep_local_model_copy,
|
|
559
578
|
**(additional_arguments or {}),
|
|
560
579
|
)
|
|
561
580
|
).model
|
|
562
581
|
|
|
563
582
|
|
|
564
583
|
def push_model_to_remote_storage(model_path: Path, remote_storage: StorageType) -> None:
|
|
565
|
-
"""
|
|
566
|
-
from rasa.
|
|
584
|
+
"""Push model to remote storage."""
|
|
585
|
+
from rasa.core.persistor import get_persistor
|
|
567
586
|
|
|
568
587
|
persistor = get_persistor(remote_storage)
|
|
569
588
|
|
|
@@ -43,8 +43,6 @@ class WhitespaceTokenizer(Tokenizer):
|
|
|
43
43
|
def __init__(self, config: Dict[Text, Any]) -> None:
|
|
44
44
|
"""Initialize the tokenizer."""
|
|
45
45
|
super().__init__(config)
|
|
46
|
-
self.emoji_pattern = rasa.utils.io.get_emoji_regex()
|
|
47
|
-
|
|
48
46
|
if "case_sensitive" in self._config:
|
|
49
47
|
rasa.shared.utils.io.raise_warning(
|
|
50
48
|
"The option 'case_sensitive' was moved from the tokenizers to the "
|
|
@@ -64,18 +62,9 @@ class WhitespaceTokenizer(Tokenizer):
|
|
|
64
62
|
# Path to the dictionaries on the local filesystem.
|
|
65
63
|
return cls(config)
|
|
66
64
|
|
|
67
|
-
def remove_emoji(self, text: Text) -> Text:
|
|
68
|
-
"""Remove emoji if the full text, aka token, matches the emoji regex."""
|
|
69
|
-
match = self.emoji_pattern.fullmatch(text)
|
|
70
|
-
|
|
71
|
-
if match is not None:
|
|
72
|
-
return ""
|
|
73
|
-
|
|
74
|
-
return text
|
|
75
|
-
|
|
76
65
|
def tokenize(self, message: Message, attribute: Text) -> List[Token]:
|
|
77
|
-
|
|
78
|
-
|
|
66
|
+
original_text = message.get(attribute)
|
|
67
|
+
text = rasa.utils.io.remove_emojis(original_text)
|
|
79
68
|
# we need to use regex instead of re, because of
|
|
80
69
|
# https://stackoverflow.com/questions/12746458/python-unicode-regular-expression-matching-failing-with-some-unicode-characters
|
|
81
70
|
|
|
@@ -94,11 +83,11 @@ class WhitespaceTokenizer(Tokenizer):
|
|
|
94
83
|
text,
|
|
95
84
|
).split()
|
|
96
85
|
|
|
97
|
-
words = [self.remove_emoji(w) for w in words]
|
|
98
86
|
words = [w for w in words if w]
|
|
99
87
|
|
|
100
88
|
# if we removed everything like smiles `:)`, use the whole text as 1 token
|
|
101
89
|
if not words:
|
|
90
|
+
text = original_text
|
|
102
91
|
words = [text]
|
|
103
92
|
|
|
104
93
|
tokens = self._convert_words_to_tokens(words, text)
|
rasa/server.py
CHANGED
|
@@ -50,11 +50,11 @@ from rasa.core.channels.channel import (
|
|
|
50
50
|
UserMessage,
|
|
51
51
|
)
|
|
52
52
|
from rasa.core.constants import DEFAULT_RESPONSE_TIMEOUT
|
|
53
|
+
from rasa.core.persistor import parse_remote_storage
|
|
53
54
|
from rasa.core.test import test
|
|
54
55
|
from rasa.core.utils import AvailableEndpoints
|
|
55
56
|
from rasa.nlu.emulators.emulator import Emulator
|
|
56
57
|
from rasa.nlu.emulators.no_emulator import NoEmulator
|
|
57
|
-
from rasa.nlu.persistor import parse_remote_storage
|
|
58
58
|
from rasa.nlu.test import CVEvaluationResult
|
|
59
59
|
from rasa.shared.constants import (
|
|
60
60
|
DEFAULT_MODELS_PATH,
|
|
@@ -78,6 +78,7 @@ from rasa.shared.utils.schemas.events import EVENTS_SCHEMA
|
|
|
78
78
|
from rasa.shared.utils.yaml import validate_training_data
|
|
79
79
|
from rasa.utils.common import TempDirectoryPath, get_temp_dir_name
|
|
80
80
|
from rasa.utils.endpoints import EndpointConfig
|
|
81
|
+
from rasa.utils.sanic_error_handler import register_custom_sanic_error_handler
|
|
81
82
|
|
|
82
83
|
if TYPE_CHECKING:
|
|
83
84
|
from ssl import SSLContext
|
|
@@ -528,7 +529,7 @@ def add_root_route(app: Sanic) -> None:
|
|
|
528
529
|
<p>Hello from Rasa: {rasa.__version__}</p>
|
|
529
530
|
<a href="./webhooks/inspector/inspect.html">Go to the inspector</a>
|
|
530
531
|
<script>
|
|
531
|
-
window.location.replace("./webhooks/
|
|
532
|
+
window.location.replace("./webhooks/socketio/inspect.html");
|
|
532
533
|
</script>
|
|
533
534
|
</body>
|
|
534
535
|
</html>
|
|
@@ -687,6 +688,7 @@ def create_app(
|
|
|
687
688
|
app = Sanic("rasa_server")
|
|
688
689
|
app.config.RESPONSE_TIMEOUT = response_timeout
|
|
689
690
|
configure_cors(app, cors_origins)
|
|
691
|
+
register_custom_sanic_error_handler(app)
|
|
690
692
|
|
|
691
693
|
# Reset Sanic warnings filter that allows the triggering of Sanic warnings
|
|
692
694
|
warnings.filterwarnings("ignore", category=DeprecationWarning, module=r"sanic.*")
|
rasa/shared/constants.py
CHANGED
|
@@ -111,10 +111,7 @@ CONFIG_KEYS_NLU = ["language", "pipeline"] + CONFIG_MANDATORY_COMMON_KEYS
|
|
|
111
111
|
CONFIG_KEYS = CONFIG_KEYS_CORE + CONFIG_KEYS_NLU
|
|
112
112
|
CONFIG_MANDATORY_KEYS_CORE: List[Text] = [] + CONFIG_MANDATORY_COMMON_KEYS
|
|
113
113
|
CONFIG_MANDATORY_KEYS_NLU = ["language"] + CONFIG_MANDATORY_COMMON_KEYS
|
|
114
|
-
|
|
115
|
-
CONFIG_MANDATORY_KEYS = list(
|
|
116
|
-
set(CONFIG_MANDATORY_KEYS_CORE + CONFIG_MANDATORY_KEYS_NLU)
|
|
117
|
-
)
|
|
114
|
+
CONFIG_MANDATORY_KEYS = CONFIG_MANDATORY_KEYS_CORE + CONFIG_MANDATORY_KEYS_NLU
|
|
118
115
|
|
|
119
116
|
# Keys related to Forms (in the Domain)
|
|
120
117
|
REQUIRED_SLOTS_KEY = "required_slots"
|
|
@@ -152,6 +149,10 @@ AZURE_AD_TOKEN_ENV_VAR = "AZURE_AD_TOKEN"
|
|
|
152
149
|
AZURE_API_BASE_ENV_VAR = "AZURE_API_BASE"
|
|
153
150
|
AZURE_API_VERSION_ENV_VAR = "AZURE_API_VERSION"
|
|
154
151
|
AZURE_API_TYPE_ENV_VAR = "AZURE_API_TYPE"
|
|
152
|
+
AZURE_SPEECH_API_KEY_ENV_VAR = "AZURE_SPEECH_API_KEY"
|
|
153
|
+
|
|
154
|
+
DEEPGRAM_API_KEY_ENV_VAR = "DEEPGRAM_API_KEY"
|
|
155
|
+
CARTESIA_API_KEY_ENV_VAR = "CARTESIA_API_KEY"
|
|
155
156
|
|
|
156
157
|
OPENAI_API_KEY_ENV_VAR = "OPENAI_API_KEY"
|
|
157
158
|
OPENAI_API_TYPE_ENV_VAR = "OPENAI_API_TYPE"
|
|
@@ -162,6 +163,9 @@ OPENAI_API_BASE_CONFIG_KEY = "openai_api_base"
|
|
|
162
163
|
OPENAI_API_TYPE_CONFIG_KEY = "openai_api_type"
|
|
163
164
|
OPENAI_API_VERSION_CONFIG_KEY = "openai_api_version"
|
|
164
165
|
|
|
166
|
+
AWS_BEDROCK_PROVIDER = "bedrock"
|
|
167
|
+
AWS_SAGEMAKER_PROVIDER = "sagemaker"
|
|
168
|
+
|
|
165
169
|
API_BASE_CONFIG_KEY = "api_base"
|
|
166
170
|
API_TYPE_CONFIG_KEY = "api_type"
|
|
167
171
|
API_VERSION_CONFIG_KEY = "api_version"
|
|
@@ -186,12 +190,51 @@ STREAM_CONFIG_KEY = "stream"
|
|
|
186
190
|
N_REPHRASES_CONFIG_KEY = "n"
|
|
187
191
|
USE_CHAT_COMPLETIONS_ENDPOINT_CONFIG_KEY = "use_chat_completions_endpoint"
|
|
188
192
|
|
|
193
|
+
ROUTER_CONFIG_KEY = "router"
|
|
194
|
+
ROUTING_STRATEGY_CONFIG_KEY = "routing_strategy"
|
|
195
|
+
REDIS_HOST_CONFIG_KEY = "redis_host"
|
|
196
|
+
ROUTING_STRATEGIES_REQUIRING_REDIS_CACHE = [
|
|
197
|
+
"cost-based-routing",
|
|
198
|
+
"usage-based-routing",
|
|
199
|
+
]
|
|
200
|
+
ROUTING_STRATEGIES_NOT_REQUIRING_CACHE = [
|
|
201
|
+
"latency-based-routing",
|
|
202
|
+
"least-busy",
|
|
203
|
+
"simple-shuffle",
|
|
204
|
+
]
|
|
205
|
+
VALID_ROUTING_STRATEGIES = (
|
|
206
|
+
ROUTING_STRATEGIES_REQUIRING_REDIS_CACHE + ROUTING_STRATEGIES_NOT_REQUIRING_CACHE
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
MODELS_CONFIG_KEY = "models"
|
|
210
|
+
MODEL_GROUPS_CONFIG_KEY = "model_groups"
|
|
211
|
+
MODEL_GROUP_CONFIG_KEY = "model_group"
|
|
212
|
+
MODEL_GROUP_ID_CONFIG_KEY = "id"
|
|
213
|
+
|
|
214
|
+
EXTRA_PARAMETERS_KEY = "extra_parameters"
|
|
215
|
+
MODEL_GROUP_ID_KEY = "model_group_id"
|
|
216
|
+
MODEL_LIST_KEY = "model_list"
|
|
217
|
+
LITELLM_PARAMS_KEY = "litellm_params"
|
|
218
|
+
|
|
219
|
+
LLM_API_HEALTH_CHECK_ENV_VAR = "LLM_API_HEALTH_CHECK"
|
|
220
|
+
LLM_API_HEALTH_CHECK_DEFAULT_VALUE = "false"
|
|
221
|
+
|
|
189
222
|
AZURE_API_KEY_ENV_VAR = "AZURE_API_KEY"
|
|
190
223
|
AZURE_AD_TOKEN_ENV_VAR = "AZURE_AD_TOKEN"
|
|
191
224
|
AZURE_API_BASE_ENV_VAR = "AZURE_API_BASE"
|
|
192
225
|
AZURE_API_VERSION_ENV_VAR = "AZURE_API_VERSION"
|
|
193
226
|
AZURE_API_TYPE_ENV_VAR = "AZURE_API_TYPE"
|
|
194
227
|
|
|
228
|
+
AWS_REGION_NAME_CONFIG_KEY = "aws_region_name"
|
|
229
|
+
AWS_ACCESS_KEY_ID_CONFIG_KEY = "aws_access_key_id"
|
|
230
|
+
AWS_SECRET_ACCESS_KEY_CONFIG_KEY = "aws_secret_access_key"
|
|
231
|
+
AWS_SESSION_TOKEN_CONFIG_KEY = "aws_session_token"
|
|
232
|
+
|
|
233
|
+
AWS_ACCESS_KEY_ID_ENV_VAR = "AWS_ACCESS_KEY_ID"
|
|
234
|
+
AWS_SECRET_ACCESS_KEY_ENV_VAR = "AWS_SECRET_ACCESS_KEY"
|
|
235
|
+
AWS_REGION_NAME_ENV_VAR = "AWS_REGION_NAME"
|
|
236
|
+
AWS_SESSION_TOKEN_ENV_VAR = "AWS_SESSION_TOKEN"
|
|
237
|
+
|
|
195
238
|
HUGGINGFACE_MULTIPROCESS_CONFIG_KEY = "multi_process"
|
|
196
239
|
HUGGINGFACE_CACHE_FOLDER_CONFIG_KEY = "cache_folder"
|
|
197
240
|
HUGGINGFACE_SHOW_PROGRESS_CONFIG_KEY = "show_progress"
|
|
@@ -212,11 +255,13 @@ OPENAI_PROVIDER = "openai"
|
|
|
212
255
|
AZURE_OPENAI_PROVIDER = "azure"
|
|
213
256
|
SELF_HOSTED_PROVIDER = "self-hosted"
|
|
214
257
|
HUGGINGFACE_LOCAL_EMBEDDING_PROVIDER = "huggingface_local"
|
|
258
|
+
RASA_PROVIDER = "rasa"
|
|
215
259
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
260
|
+
SELF_HOSTED_VLLM_PREFIX = "hosted_vllm"
|
|
261
|
+
SELF_HOSTED_VLLM_API_KEY_ENV_VAR = "HOSTED_VLLM_API_KEY"
|
|
262
|
+
|
|
263
|
+
SELF_HOSTED_VLLM_PREFIX = "hosted_vllm"
|
|
264
|
+
SELF_HOSTED_VLLM_API_KEY_ENV_VAR = "HOSTED_VLLM_API_KEY"
|
|
220
265
|
|
|
221
266
|
SELF_HOSTED_VLLM_PREFIX = "hosted_vllm"
|
|
222
267
|
SELF_HOSTED_VLLM_API_KEY_ENV_VAR = "HOSTED_VLLM_API_KEY"
|
|
@@ -250,3 +295,10 @@ RASA_PATTERN_CANNOT_HANDLE_INVALID_INTENT = (
|
|
|
250
295
|
)
|
|
251
296
|
|
|
252
297
|
ROUTE_TO_CALM_SLOT = "route_session_to_calm"
|
|
298
|
+
|
|
299
|
+
SENSITIVE_DATA = [
|
|
300
|
+
API_KEY,
|
|
301
|
+
AWS_ACCESS_KEY_ID_CONFIG_KEY,
|
|
302
|
+
AWS_SECRET_ACCESS_KEY_CONFIG_KEY,
|
|
303
|
+
AWS_SESSION_TOKEN_CONFIG_KEY,
|
|
304
|
+
]
|
rasa/shared/core/constants.py
CHANGED
|
@@ -10,6 +10,8 @@ USER_INTENT_RESTART = "restart"
|
|
|
10
10
|
USER_INTENT_BACK = "back"
|
|
11
11
|
USER_INTENT_OUT_OF_SCOPE = "out_of_scope"
|
|
12
12
|
USER_INTENT_SESSION_START = "session_start"
|
|
13
|
+
USER_INTENT_SESSION_END = "session_end"
|
|
14
|
+
USER_INTENT_SILENCE_TIMEOUT = "silence_timeout"
|
|
13
15
|
SESSION_START_METADATA_SLOT = "session_started_metadata"
|
|
14
16
|
|
|
15
17
|
DEFAULT_INTENTS = [
|
|
@@ -17,6 +19,8 @@ DEFAULT_INTENTS = [
|
|
|
17
19
|
USER_INTENT_BACK,
|
|
18
20
|
USER_INTENT_OUT_OF_SCOPE,
|
|
19
21
|
USER_INTENT_SESSION_START,
|
|
22
|
+
USER_INTENT_SESSION_END,
|
|
23
|
+
USER_INTENT_SILENCE_TIMEOUT,
|
|
20
24
|
constants.DEFAULT_NLU_FALLBACK_INTENT_NAME,
|
|
21
25
|
]
|
|
22
26
|
|
|
@@ -45,6 +49,8 @@ ACTION_CLEAN_STACK = "action_clean_stack"
|
|
|
45
49
|
ACTION_TRIGGER_SEARCH = "action_trigger_search"
|
|
46
50
|
ACTION_TRIGGER_CHITCHAT = "action_trigger_chitchat"
|
|
47
51
|
ACTION_RESET_ROUTING = "action_reset_routing"
|
|
52
|
+
ACTION_HANGUP = "action_hangup"
|
|
53
|
+
ACTION_REPEAT_BOT_MESSAGES = "action_repeat_bot_messages"
|
|
48
54
|
|
|
49
55
|
|
|
50
56
|
DEFAULT_ACTION_NAMES = [
|
|
@@ -70,6 +76,8 @@ DEFAULT_ACTION_NAMES = [
|
|
|
70
76
|
ACTION_TRIGGER_SEARCH,
|
|
71
77
|
ACTION_TRIGGER_CHITCHAT,
|
|
72
78
|
ACTION_RESET_ROUTING,
|
|
79
|
+
ACTION_HANGUP,
|
|
80
|
+
ACTION_REPEAT_BOT_MESSAGES,
|
|
73
81
|
]
|
|
74
82
|
|
|
75
83
|
ACTION_SHOULD_SEND_DOMAIN = "send_domain"
|
|
@@ -100,6 +108,11 @@ FLOW_HASHES_SLOT = "flow_hashes"
|
|
|
100
108
|
|
|
101
109
|
FLOW_SLOT_NAMES = [FLOW_HASHES_SLOT]
|
|
102
110
|
|
|
111
|
+
# slots for audio timeout
|
|
112
|
+
SLOT_SILENCE_TIMEOUT = "silence_timeout"
|
|
113
|
+
SLOT_CONSECUTIVE_SILENCE_TIMEOUTS = "consecutive_silence_timeouts"
|
|
114
|
+
SILENCE_TIMEOUT_DEFAULT_VALUE = 6.0
|
|
115
|
+
SILENCE_SLOTS = [SLOT_SILENCE_TIMEOUT, SLOT_CONSECUTIVE_SILENCE_TIMEOUTS]
|
|
103
116
|
# slots for knowledge base
|
|
104
117
|
SLOT_LISTED_ITEMS = "knowledge_base_listed_objects"
|
|
105
118
|
SLOT_LAST_OBJECT = "knowledge_base_last_object"
|