rasa-pro 3.13.0.dev20250612__py3-none-any.whl → 3.13.0rc1__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 +0 -3
- rasa/api.py +1 -1
- rasa/cli/dialogue_understanding_test.py +1 -1
- rasa/cli/e2e_test.py +1 -8
- rasa/cli/evaluate.py +1 -1
- rasa/cli/export.py +3 -1
- rasa/cli/llm_fine_tuning.py +12 -11
- rasa/cli/project_templates/defaults.py +133 -0
- rasa/cli/project_templates/tutorial/config.yml +1 -1
- rasa/cli/project_templates/tutorial/endpoints.yml +1 -1
- rasa/cli/run.py +1 -1
- rasa/cli/studio/download.py +1 -23
- rasa/cli/studio/link.py +52 -0
- rasa/cli/studio/pull.py +79 -0
- rasa/cli/studio/push.py +78 -0
- rasa/cli/studio/studio.py +12 -0
- rasa/cli/studio/train.py +0 -1
- rasa/cli/studio/upload.py +8 -0
- rasa/cli/train.py +1 -1
- rasa/cli/utils.py +1 -1
- rasa/cli/x.py +1 -1
- rasa/constants.py +2 -0
- rasa/core/__init__.py +0 -16
- rasa/core/actions/action.py +5 -1
- rasa/core/actions/action_repeat_bot_messages.py +18 -22
- rasa/core/actions/action_run_slot_rejections.py +0 -1
- rasa/core/agent.py +16 -1
- rasa/core/available_endpoints.py +146 -0
- rasa/core/brokers/pika.py +1 -2
- rasa/core/channels/__init__.py +2 -0
- rasa/core/channels/botframework.py +2 -2
- rasa/core/channels/channel.py +2 -2
- rasa/core/channels/development_inspector.py +1 -1
- rasa/core/channels/facebook.py +1 -4
- rasa/core/channels/hangouts.py +8 -5
- rasa/core/channels/inspector/README.md +3 -3
- rasa/core/channels/inspector/dist/assets/{arc-c4b064fc.js → arc-371401b1.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{blockDiagram-38ab4fdb-215b5026.js → blockDiagram-38ab4fdb-3f126156.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{c4Diagram-3d4e48cf-2b54a0a3.js → c4Diagram-3d4e48cf-12f22eb7.js} +1 -1
- rasa/core/channels/inspector/dist/assets/channel-f1efda17.js +1 -0
- rasa/core/channels/inspector/dist/assets/{classDiagram-70f12bd4-daacea5f.js → classDiagram-70f12bd4-03b1d386.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{classDiagram-v2-f2320105-930d4dc2.js → classDiagram-v2-f2320105-84f69d63.js} +1 -1
- rasa/core/channels/inspector/dist/assets/clone-fdf164e2.js +1 -0
- rasa/core/channels/inspector/dist/assets/{createText-2e5e7dd3-83c206ba.js → createText-2e5e7dd3-ca47fd38.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{edges-e0da2a9e-b0eb01d0.js → edges-e0da2a9e-f837ca8a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{erDiagram-9861fffd-17586500.js → erDiagram-9861fffd-8717ac54.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDb-956e92f1-be2a1776.js → flowDb-956e92f1-94f38b83.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDiagram-66a62f08-c2120ebd.js → flowDiagram-66a62f08-b616f9fb.js} +1 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-7d7a1629.js +1 -0
- rasa/core/channels/inspector/dist/assets/{flowchart-elk-definition-4a651766-a6ab5c48.js → flowchart-elk-definition-4a651766-f5d24bb8.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{ganttDiagram-c361ad54-ef613457.js → ganttDiagram-c361ad54-b43ba8d9.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-72cf32ee-d59185b3.js → gitGraphDiagram-72cf32ee-c3aafaa5.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{graph-0f155405.js → graph-0d0a2c10.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-3862675e-d5f1d1b7.js → index-3862675e-58ea0305.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-47737d3a.js → index-cce6f8a1.js} +3 -3
- rasa/core/channels/inspector/dist/assets/{infoDiagram-f8f76790-b07d141f.js → infoDiagram-f8f76790-b8f60461.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{journeyDiagram-49397b02-1936d429.js → journeyDiagram-49397b02-95be5545.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{layout-dde8d0f3.js → layout-da885b9b.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{line-0c2c7ee0.js → line-f1c817d3.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{linear-35dd89a4.js → linear-d42801e6.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{mindmap-definition-fc14e90a-56192851.js → mindmap-definition-fc14e90a-a38923a6.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{pieDiagram-8a3498a8-fc21ed78.js → pieDiagram-8a3498a8-ca6e71e9.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{quadrantDiagram-120e2f19-25e98518.js → quadrantDiagram-120e2f19-b290dae9.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{requirementDiagram-deff3bca-546ff1f5.js → requirementDiagram-deff3bca-03f02ceb.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sankeyDiagram-04a897e0-02d8b82d.js → sankeyDiagram-04a897e0-c49eee40.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sequenceDiagram-704730f1-3ca5a92e.js → sequenceDiagram-704730f1-b2cd6a3d.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-587899a1-128ea07c.js → stateDiagram-587899a1-e53a2028.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-v2-d93cdb3a-95f290af.js → stateDiagram-v2-d93cdb3a-e1982a03.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-6aaf32cf-4984898a.js → styles-6aaf32cf-d0226ca5.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-9a916d00-1bf266ba.js → styles-9a916d00-0e21dc00.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-c10674c1-60521c63.js → styles-c10674c1-9588494e.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{svgDrawCommon-08f97a94-a25b6e12.js → svgDrawCommon-08f97a94-be478d4f.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{timeline-definition-85554ec2-0fc086bf.js → timeline-definition-85554ec2-74631749.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{xychartDiagram-e933f94c-44ee592e.js → xychartDiagram-e933f94c-a043552f.js} +1 -1
- rasa/core/channels/inspector/dist/index.html +1 -1
- rasa/core/channels/inspector/src/components/RecruitmentPanel.tsx +1 -1
- rasa/core/channels/mattermost.py +1 -1
- rasa/core/channels/rasa_chat.py +2 -4
- rasa/core/channels/rest.py +5 -4
- rasa/core/channels/socketio.py +56 -41
- rasa/core/channels/studio_chat.py +314 -10
- rasa/core/channels/vier_cvg.py +1 -2
- rasa/core/channels/voice_ready/audiocodes.py +2 -9
- rasa/core/channels/voice_stream/asr/azure.py +9 -0
- rasa/core/channels/voice_stream/audiocodes.py +8 -5
- rasa/core/channels/voice_stream/browser_audio.py +1 -1
- rasa/core/channels/voice_stream/genesys.py +2 -2
- rasa/core/channels/voice_stream/jambonz.py +166 -0
- rasa/core/channels/voice_stream/tts/__init__.py +8 -0
- rasa/core/channels/voice_stream/twilio_media_streams.py +17 -5
- rasa/core/channels/voice_stream/voice_channel.py +44 -24
- rasa/core/exporter.py +36 -0
- rasa/core/http_interpreter.py +3 -7
- rasa/core/information_retrieval/faiss.py +18 -11
- rasa/core/information_retrieval/ingestion/faq_parser.py +158 -0
- rasa/core/jobs.py +2 -1
- rasa/core/nlg/contextual_response_rephraser.py +48 -12
- rasa/core/nlg/generator.py +0 -1
- rasa/core/nlg/interpolator.py +2 -3
- rasa/core/nlg/summarize.py +39 -5
- rasa/core/policies/enterprise_search_policy.py +298 -184
- rasa/core/policies/enterprise_search_policy_config.py +241 -0
- rasa/core/policies/enterprise_search_prompt_with_relevancy_check_and_citation_template.jinja2 +64 -0
- rasa/core/policies/flow_policy.py +1 -1
- rasa/core/policies/flows/flow_executor.py +96 -17
- rasa/core/policies/intentless_policy.py +71 -26
- rasa/core/processor.py +104 -51
- rasa/core/run.py +33 -11
- rasa/core/tracker_stores/tracker_store.py +1 -1
- rasa/core/training/interactive.py +1 -1
- rasa/core/utils.py +35 -99
- rasa/dialogue_understanding/coexistence/intent_based_router.py +2 -1
- rasa/dialogue_understanding/coexistence/llm_based_router.py +13 -17
- rasa/dialogue_understanding/commands/__init__.py +4 -0
- rasa/dialogue_understanding/commands/can_not_handle_command.py +2 -0
- rasa/dialogue_understanding/commands/cancel_flow_command.py +6 -2
- rasa/dialogue_understanding/commands/chit_chat_answer_command.py +2 -0
- rasa/dialogue_understanding/commands/clarify_command.py +7 -3
- rasa/dialogue_understanding/commands/command_syntax_manager.py +1 -0
- rasa/dialogue_understanding/commands/correct_slots_command.py +5 -6
- rasa/dialogue_understanding/commands/error_command.py +1 -1
- rasa/dialogue_understanding/commands/human_handoff_command.py +3 -3
- rasa/dialogue_understanding/commands/knowledge_answer_command.py +2 -0
- rasa/dialogue_understanding/commands/repeat_bot_messages_command.py +2 -0
- rasa/dialogue_understanding/commands/set_slot_command.py +15 -5
- rasa/dialogue_understanding/commands/skip_question_command.py +3 -3
- rasa/dialogue_understanding/commands/start_flow_command.py +7 -3
- rasa/dialogue_understanding/commands/utils.py +26 -2
- rasa/dialogue_understanding/generator/__init__.py +7 -1
- rasa/dialogue_understanding/generator/command_generator.py +15 -3
- rasa/dialogue_understanding/generator/command_parser.py +2 -2
- rasa/dialogue_understanding/generator/command_parser_validator.py +63 -0
- rasa/dialogue_understanding/generator/constants.py +2 -2
- rasa/dialogue_understanding/generator/nlu_command_adapter.py +2 -2
- rasa/dialogue_understanding/generator/prompt_templates/command_prompt_template.jinja2 +0 -2
- rasa/dialogue_understanding/generator/prompt_templates/command_prompt_v2_claude_3_5_sonnet_20240620_template.jinja2 +1 -0
- rasa/dialogue_understanding/generator/prompt_templates/command_prompt_v2_gpt_4o_2024_11_20_template.jinja2 +1 -0
- rasa/dialogue_understanding/generator/prompt_templates/command_prompt_v3_claude_3_5_sonnet_20240620_template.jinja2 +79 -0
- rasa/dialogue_understanding/generator/prompt_templates/command_prompt_v3_gpt_4o_2024_11_20_template.jinja2 +79 -0
- rasa/dialogue_understanding/generator/single_step/compact_llm_command_generator.py +28 -463
- rasa/dialogue_understanding/generator/single_step/search_ready_llm_command_generator.py +147 -0
- rasa/dialogue_understanding/generator/single_step/single_step_based_llm_command_generator.py +461 -0
- rasa/dialogue_understanding/generator/single_step/single_step_llm_command_generator.py +11 -64
- rasa/dialogue_understanding/patterns/cancel.py +1 -2
- rasa/dialogue_understanding/patterns/clarify.py +1 -1
- rasa/dialogue_understanding/patterns/correction.py +2 -2
- rasa/dialogue_understanding/patterns/default_flows_for_patterns.yml +37 -25
- rasa/dialogue_understanding/patterns/domain_for_patterns.py +190 -0
- rasa/dialogue_understanding/processor/command_processor.py +11 -12
- rasa/dialogue_understanding/processor/command_processor_component.py +3 -3
- rasa/dialogue_understanding/stack/frames/flow_stack_frame.py +17 -4
- rasa/dialogue_understanding/stack/utils.py +3 -1
- rasa/dialogue_understanding/utils.py +68 -12
- rasa/dialogue_understanding_test/du_test_case.py +1 -1
- rasa/dialogue_understanding_test/du_test_runner.py +4 -22
- rasa/dialogue_understanding_test/test_case_simulation/test_case_tracker_simulator.py +2 -6
- rasa/e2e_test/e2e_test_coverage_report.py +1 -1
- rasa/e2e_test/e2e_test_runner.py +1 -1
- rasa/engine/constants.py +1 -1
- rasa/engine/graph.py +2 -2
- rasa/engine/recipes/default_recipe.py +26 -2
- rasa/engine/validation.py +3 -2
- rasa/hooks.py +0 -28
- rasa/llm_fine_tuning/annotation_module.py +39 -9
- rasa/llm_fine_tuning/conversations.py +3 -0
- rasa/llm_fine_tuning/llm_data_preparation_module.py +66 -49
- rasa/llm_fine_tuning/paraphrasing/conversation_rephraser.py +5 -7
- rasa/llm_fine_tuning/paraphrasing/rephrase_validator.py +52 -44
- rasa/llm_fine_tuning/paraphrasing_module.py +10 -12
- rasa/llm_fine_tuning/storage.py +4 -4
- rasa/llm_fine_tuning/utils.py +63 -1
- rasa/model_manager/model_api.py +88 -0
- rasa/model_manager/trainer_service.py +4 -4
- rasa/plugin.py +1 -11
- rasa/privacy/__init__.py +0 -0
- rasa/privacy/constants.py +83 -0
- rasa/privacy/event_broker_utils.py +77 -0
- rasa/privacy/privacy_config.py +281 -0
- rasa/privacy/privacy_config_schema.json +86 -0
- rasa/privacy/privacy_filter.py +340 -0
- rasa/privacy/privacy_manager.py +576 -0
- rasa/server.py +23 -2
- rasa/shared/constants.py +18 -0
- rasa/shared/core/command_payload_reader.py +1 -5
- rasa/shared/core/constants.py +4 -3
- rasa/shared/core/domain.py +7 -0
- rasa/shared/core/events.py +38 -10
- rasa/shared/core/flows/constants.py +2 -0
- rasa/shared/core/flows/flow.py +127 -14
- rasa/shared/core/flows/flows_list.py +18 -1
- rasa/shared/core/flows/flows_yaml_schema.json +3 -0
- rasa/shared/core/flows/steps/collect.py +46 -2
- rasa/shared/core/flows/steps/link.py +7 -2
- rasa/shared/core/flows/validation.py +25 -5
- rasa/shared/core/slots.py +28 -0
- rasa/shared/core/training_data/story_reader/yaml_story_reader.py +1 -4
- rasa/shared/exceptions.py +4 -0
- rasa/shared/providers/_configs/azure_openai_client_config.py +6 -2
- rasa/shared/providers/_configs/default_litellm_client_config.py +1 -1
- rasa/shared/providers/_configs/huggingface_local_embedding_client_config.py +1 -1
- rasa/shared/providers/_configs/openai_client_config.py +5 -1
- rasa/shared/providers/_configs/rasa_llm_client_config.py +1 -1
- rasa/shared/providers/_configs/self_hosted_llm_client_config.py +1 -1
- rasa/shared/providers/_configs/utils.py +0 -99
- rasa/shared/providers/embedding/_base_litellm_embedding_client.py +3 -0
- rasa/shared/providers/llm/_base_litellm_client.py +5 -2
- rasa/shared/utils/common.py +1 -1
- rasa/shared/utils/configs.py +110 -0
- rasa/shared/utils/constants.py +0 -3
- rasa/shared/utils/llm.py +195 -9
- rasa/shared/utils/pykwalify_extensions.py +0 -9
- rasa/shared/utils/yaml.py +32 -0
- rasa/studio/constants.py +1 -0
- rasa/studio/data_handler.py +11 -4
- rasa/studio/download.py +167 -0
- rasa/studio/link.py +200 -0
- rasa/studio/prompts.py +223 -0
- rasa/studio/pull/__init__.py +0 -0
- rasa/studio/{download/flows.py → pull/data.py} +23 -160
- rasa/studio/{download → pull}/domains.py +1 -1
- rasa/studio/pull/pull.py +235 -0
- rasa/studio/push.py +136 -0
- rasa/studio/train.py +1 -1
- rasa/studio/upload.py +117 -67
- rasa/telemetry.py +82 -25
- rasa/tracing/config.py +3 -4
- rasa/tracing/constants.py +19 -1
- rasa/tracing/instrumentation/attribute_extractors.py +30 -8
- rasa/tracing/instrumentation/instrumentation.py +53 -2
- rasa/tracing/instrumentation/metrics.py +98 -15
- rasa/tracing/metric_instrument_provider.py +75 -3
- rasa/utils/common.py +7 -22
- rasa/utils/log_utils.py +1 -45
- rasa/validator.py +2 -8
- rasa/version.py +1 -1
- {rasa_pro-3.13.0.dev20250612.dist-info → rasa_pro-3.13.0rc1.dist-info}/METADATA +8 -9
- {rasa_pro-3.13.0.dev20250612.dist-info → rasa_pro-3.13.0rc1.dist-info}/RECORD +241 -220
- rasa/anonymization/__init__.py +0 -2
- rasa/anonymization/anonymisation_rule_yaml_reader.py +0 -91
- rasa/anonymization/anonymization_pipeline.py +0 -286
- rasa/anonymization/anonymization_rule_executor.py +0 -266
- rasa/anonymization/anonymization_rule_orchestrator.py +0 -119
- rasa/anonymization/schemas/config.yml +0 -47
- rasa/anonymization/utils.py +0 -118
- rasa/core/channels/inspector/dist/assets/channel-3730f5fd.js +0 -1
- rasa/core/channels/inspector/dist/assets/clone-e847561e.js +0 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-efbbfe00.js +0 -1
- rasa/studio/download/download.py +0 -439
- /rasa/{studio/download → core/information_retrieval/ingestion}/__init__.py +0 -0
- {rasa_pro-3.13.0.dev20250612.dist-info → rasa_pro-3.13.0rc1.dist-info}/NOTICE +0 -0
- {rasa_pro-3.13.0.dev20250612.dist-info → rasa_pro-3.13.0rc1.dist-info}/WHEEL +0 -0
- {rasa_pro-3.13.0.dev20250612.dist-info → rasa_pro-3.13.0rc1.dist-info}/entry_points.txt +0 -0
|
@@ -5,6 +5,7 @@ from typing import TYPE_CHECKING, Any, Dict, List, Optional, Text, Tuple
|
|
|
5
5
|
|
|
6
6
|
import structlog
|
|
7
7
|
import tiktoken
|
|
8
|
+
from deprecated import deprecated # type: ignore[import]
|
|
8
9
|
from jinja2 import Template
|
|
9
10
|
from langchain.docstore.document import Document
|
|
10
11
|
from langchain.schema.embeddings import Embeddings
|
|
@@ -31,22 +32,20 @@ from rasa.graph_components.providers.responses_provider import Responses
|
|
|
31
32
|
from rasa.shared.constants import (
|
|
32
33
|
EMBEDDINGS_CONFIG_KEY,
|
|
33
34
|
LLM_CONFIG_KEY,
|
|
35
|
+
MAX_COMPLETION_TOKENS_CONFIG_KEY,
|
|
34
36
|
MODEL_CONFIG_KEY,
|
|
35
37
|
MODEL_GROUP_ID_CONFIG_KEY,
|
|
36
38
|
MODEL_NAME_CONFIG_KEY,
|
|
37
39
|
OPENAI_PROVIDER,
|
|
38
40
|
PROMPT_CONFIG_KEY,
|
|
41
|
+
PROMPT_TEMPLATE_CONFIG_KEY,
|
|
39
42
|
PROVIDER_CONFIG_KEY,
|
|
43
|
+
TEMPERATURE_CONFIG_KEY,
|
|
40
44
|
TIMEOUT_CONFIG_KEY,
|
|
41
45
|
)
|
|
42
46
|
from rasa.shared.core.constants import ACTION_LISTEN_NAME
|
|
43
47
|
from rasa.shared.core.domain import KEY_RESPONSES_TEXT, Domain
|
|
44
|
-
from rasa.shared.core.events import
|
|
45
|
-
ActionExecuted,
|
|
46
|
-
BotUttered,
|
|
47
|
-
Event,
|
|
48
|
-
UserUttered,
|
|
49
|
-
)
|
|
48
|
+
from rasa.shared.core.events import ActionExecuted, BotUttered, Event, UserUttered
|
|
50
49
|
from rasa.shared.core.flows import FlowsList
|
|
51
50
|
from rasa.shared.core.generator import TrackerWithCachedStates
|
|
52
51
|
from rasa.shared.core.policies.utils import filter_responses_for_intentless_policy
|
|
@@ -58,18 +57,22 @@ from rasa.shared.providers.embedding._langchain_embedding_client_adapter import
|
|
|
58
57
|
_LangchainEmbeddingClientAdapter,
|
|
59
58
|
)
|
|
60
59
|
from rasa.shared.providers.llm.llm_client import LLMClient
|
|
61
|
-
from rasa.shared.utils.constants import
|
|
60
|
+
from rasa.shared.utils.constants import (
|
|
61
|
+
LOG_COMPONENT_SOURCE_METHOD_FINGERPRINT_ADDON,
|
|
62
|
+
LOG_COMPONENT_SOURCE_METHOD_INIT,
|
|
63
|
+
)
|
|
62
64
|
from rasa.shared.utils.health_check.embeddings_health_check_mixin import (
|
|
63
65
|
EmbeddingsHealthCheckMixin,
|
|
64
66
|
)
|
|
65
67
|
from rasa.shared.utils.health_check.llm_health_check_mixin import LLMHealthCheckMixin
|
|
66
|
-
from rasa.shared.utils.io import deep_container_fingerprint
|
|
68
|
+
from rasa.shared.utils.io import deep_container_fingerprint, raise_deprecation_warning
|
|
67
69
|
from rasa.shared.utils.llm import (
|
|
68
70
|
AI,
|
|
69
71
|
DEFAULT_OPENAI_CHAT_MODEL_NAME,
|
|
70
72
|
DEFAULT_OPENAI_EMBEDDING_MODEL_NAME,
|
|
71
73
|
DEFAULT_OPENAI_MAX_GENERATED_TOKENS,
|
|
72
74
|
USER,
|
|
75
|
+
check_prompt_config_keys_and_warn_if_deprecated,
|
|
73
76
|
combine_custom_and_default_config,
|
|
74
77
|
embedder_factory,
|
|
75
78
|
get_prompt_template,
|
|
@@ -111,19 +114,22 @@ NLU_ABSTENTION_THRESHOLD = "nlu_abstention_threshold"
|
|
|
111
114
|
DEFAULT_LLM_CONFIG = {
|
|
112
115
|
PROVIDER_CONFIG_KEY: OPENAI_PROVIDER,
|
|
113
116
|
MODEL_CONFIG_KEY: DEFAULT_OPENAI_CHAT_MODEL_NAME,
|
|
114
|
-
|
|
115
|
-
|
|
117
|
+
TEMPERATURE_CONFIG_KEY: 0.0,
|
|
118
|
+
MAX_COMPLETION_TOKENS_CONFIG_KEY: DEFAULT_OPENAI_MAX_GENERATED_TOKENS,
|
|
116
119
|
TIMEOUT_CONFIG_KEY: 5,
|
|
117
120
|
}
|
|
118
121
|
|
|
119
122
|
DEFAULT_EMBEDDINGS_CONFIG = {
|
|
120
123
|
PROVIDER_CONFIG_KEY: OPENAI_PROVIDER,
|
|
121
|
-
|
|
124
|
+
MODEL_CONFIG_KEY: DEFAULT_OPENAI_EMBEDDING_MODEL_NAME,
|
|
122
125
|
}
|
|
123
126
|
|
|
124
|
-
|
|
127
|
+
DEFAULT_INTENTLESS_PROMPT_TEMPLATE_FILE_NAME = importlib.resources.open_text(
|
|
125
128
|
"rasa.core.policies", "intentless_prompt_template.jinja2"
|
|
126
129
|
).name
|
|
130
|
+
DEFAULT_INTENTLESS_PROMPT_TEMPLATE = importlib.resources.read_text(
|
|
131
|
+
"rasa.core.policies", "intentless_prompt_template.jinja2"
|
|
132
|
+
)
|
|
127
133
|
|
|
128
134
|
INTENTLESS_PROMPT_TEMPLATE_FILE_NAME = "intentless_policy_prompt.jinja2"
|
|
129
135
|
INTENTLESS_CONFIG_FILE_NAME = "config.json"
|
|
@@ -323,6 +329,9 @@ def conversation_as_prompt(conversation: Conversation) -> str:
|
|
|
323
329
|
@DefaultV1Recipe.register(
|
|
324
330
|
DefaultV1Recipe.ComponentType.POLICY_WITH_END_TO_END_SUPPORT, is_trainable=True
|
|
325
331
|
)
|
|
332
|
+
@deprecated(
|
|
333
|
+
reason=("The IntentlessPolicy is deprecated and will be removed in Rasa `4.0.0`.")
|
|
334
|
+
)
|
|
326
335
|
class IntentlessPolicy(LLMHealthCheckMixin, EmbeddingsHealthCheckMixin, Policy):
|
|
327
336
|
"""Policy which uses a language model to generate the next action.
|
|
328
337
|
|
|
@@ -344,9 +353,7 @@ class IntentlessPolicy(LLMHealthCheckMixin, EmbeddingsHealthCheckMixin, Policy):
|
|
|
344
353
|
# ensures that the policy will not override a deterministic policy
|
|
345
354
|
# which utilizes the nlu predictions confidence (e.g. Memoization).
|
|
346
355
|
NLU_ABSTENTION_THRESHOLD: 0.9,
|
|
347
|
-
|
|
348
|
-
EMBEDDINGS_CONFIG_KEY: DEFAULT_EMBEDDINGS_CONFIG,
|
|
349
|
-
PROMPT_CONFIG_KEY: DEFAULT_INTENTLESS_PROMPT_TEMPLATE,
|
|
356
|
+
PROMPT_TEMPLATE_CONFIG_KEY: None, # TODO: remove in Rasa 4.0.0
|
|
350
357
|
}
|
|
351
358
|
|
|
352
359
|
@staticmethod
|
|
@@ -378,27 +385,68 @@ class IntentlessPolicy(LLMHealthCheckMixin, EmbeddingsHealthCheckMixin, Policy):
|
|
|
378
385
|
prompt_template: Optional[Text] = None,
|
|
379
386
|
) -> None:
|
|
380
387
|
"""Constructs a new Policy object."""
|
|
388
|
+
raise_deprecation_warning(
|
|
389
|
+
message=("Support for `IntentlessPolicy` will be removed in Rasa `4.0.0`.")
|
|
390
|
+
)
|
|
381
391
|
super().__init__(config, model_storage, resource, execution_context, featurizer)
|
|
382
392
|
|
|
383
393
|
# Resolve LLM config
|
|
384
|
-
self.config[LLM_CONFIG_KEY] =
|
|
385
|
-
|
|
394
|
+
self.config[LLM_CONFIG_KEY] = combine_custom_and_default_config(
|
|
395
|
+
resolve_model_client_config(
|
|
396
|
+
self.config.get(LLM_CONFIG_KEY), IntentlessPolicy.__name__
|
|
397
|
+
),
|
|
398
|
+
DEFAULT_LLM_CONFIG,
|
|
386
399
|
)
|
|
387
400
|
|
|
388
401
|
# Resolve embeddings config
|
|
389
|
-
self.config[EMBEDDINGS_CONFIG_KEY] =
|
|
390
|
-
|
|
402
|
+
self.config[EMBEDDINGS_CONFIG_KEY] = combine_custom_and_default_config(
|
|
403
|
+
resolve_model_client_config(
|
|
404
|
+
self.config.get(EMBEDDINGS_CONFIG_KEY), IntentlessPolicy.__name__
|
|
405
|
+
),
|
|
406
|
+
DEFAULT_EMBEDDINGS_CONFIG,
|
|
391
407
|
)
|
|
392
408
|
|
|
393
409
|
self.nlu_abstention_threshold: float = self.config[NLU_ABSTENTION_THRESHOLD]
|
|
394
410
|
self.response_index = responses_docsearch
|
|
395
411
|
self.conversation_samples_index = samples_docsearch
|
|
396
412
|
self.embedder = self._create_plain_embedder(config)
|
|
397
|
-
|
|
398
|
-
|
|
413
|
+
|
|
414
|
+
# Warn if the prompt config key is used to set the prompt template
|
|
415
|
+
check_prompt_config_keys_and_warn_if_deprecated(config, "intentless_policy")
|
|
416
|
+
|
|
417
|
+
self.prompt_template = prompt_template or self._resolve_prompt_template(
|
|
418
|
+
config, LOG_COMPONENT_SOURCE_METHOD_INIT
|
|
399
419
|
)
|
|
400
420
|
self.trace_prompt_tokens = self.config.get("trace_prompt_tokens", False)
|
|
401
421
|
|
|
422
|
+
@classmethod
|
|
423
|
+
def _resolve_prompt_template(
|
|
424
|
+
cls: Any,
|
|
425
|
+
config: dict,
|
|
426
|
+
log_source_method: str,
|
|
427
|
+
) -> str:
|
|
428
|
+
"""Resolves the prompt template from the config.
|
|
429
|
+
|
|
430
|
+
Args:
|
|
431
|
+
config: The config to resolve the prompt template from.
|
|
432
|
+
log_source_method: The method from which the prompt template is resolved.
|
|
433
|
+
|
|
434
|
+
Returns:
|
|
435
|
+
The resolved prompt template.
|
|
436
|
+
"""
|
|
437
|
+
# Prefer prompt template over prompt config key.
|
|
438
|
+
prompt_template_file = (
|
|
439
|
+
config.get(PROMPT_TEMPLATE_CONFIG_KEY)
|
|
440
|
+
or config.get(PROMPT_CONFIG_KEY)
|
|
441
|
+
or DEFAULT_INTENTLESS_PROMPT_TEMPLATE_FILE_NAME
|
|
442
|
+
)
|
|
443
|
+
return get_prompt_template(
|
|
444
|
+
prompt_template_file,
|
|
445
|
+
DEFAULT_INTENTLESS_PROMPT_TEMPLATE,
|
|
446
|
+
log_source_component=IntentlessPolicy.__name__,
|
|
447
|
+
log_source_method=log_source_method,
|
|
448
|
+
)
|
|
449
|
+
|
|
402
450
|
@classmethod
|
|
403
451
|
def _create_plain_embedder(cls, config: Dict[Text, Any]) -> Embeddings:
|
|
404
452
|
"""Creates an embedder that uses the OpenAI API.
|
|
@@ -937,11 +985,8 @@ class IntentlessPolicy(LLMHealthCheckMixin, EmbeddingsHealthCheckMixin, Policy):
|
|
|
937
985
|
@classmethod
|
|
938
986
|
def fingerprint_addon(cls, config: Dict[str, Any]) -> Optional[str]:
|
|
939
987
|
"""Add a fingerprint of intentless policy for the graph."""
|
|
940
|
-
prompt_template =
|
|
941
|
-
config
|
|
942
|
-
DEFAULT_INTENTLESS_PROMPT_TEMPLATE,
|
|
943
|
-
log_source_component=IntentlessPolicy.__name__,
|
|
944
|
-
log_source_method=LOG_COMPONENT_SOURCE_METHOD_FINGERPRINT_ADDON,
|
|
988
|
+
prompt_template = cls._resolve_prompt_template(
|
|
989
|
+
config, LOG_COMPONENT_SOURCE_METHOD_FINGERPRINT_ADDON
|
|
945
990
|
)
|
|
946
991
|
|
|
947
992
|
llm_config = resolve_model_client_config(
|
rasa/core/processor.py
CHANGED
|
@@ -34,6 +34,9 @@ from rasa.dialogue_understanding.commands import (
|
|
|
34
34
|
CannotHandleCommand,
|
|
35
35
|
Command,
|
|
36
36
|
NoopCommand,
|
|
37
|
+
RestartCommand,
|
|
38
|
+
SessionEndCommand,
|
|
39
|
+
SessionStartCommand,
|
|
37
40
|
SetSlotCommand,
|
|
38
41
|
)
|
|
39
42
|
from rasa.dialogue_understanding.commands.utils import (
|
|
@@ -72,8 +75,8 @@ from rasa.shared.core.constants import (
|
|
|
72
75
|
ACTION_SESSION_START_NAME,
|
|
73
76
|
FOLLOWUP_ACTION,
|
|
74
77
|
SESSION_START_METADATA_SLOT,
|
|
78
|
+
SILENCE_TIMEOUT_SLOT,
|
|
75
79
|
SLOT_CONSECUTIVE_SILENCE_TIMEOUTS,
|
|
76
|
-
SLOT_SILENCE_TIMEOUT,
|
|
77
80
|
USER_INTENT_RESTART,
|
|
78
81
|
USER_INTENT_SILENCE_TIMEOUT,
|
|
79
82
|
SetSlotExtractor,
|
|
@@ -109,7 +112,8 @@ from rasa.utils.common import TempDirectoryPath, get_temp_dir_name
|
|
|
109
112
|
from rasa.utils.endpoints import EndpointConfig
|
|
110
113
|
|
|
111
114
|
if TYPE_CHECKING:
|
|
112
|
-
from rasa.core.
|
|
115
|
+
from rasa.core.available_endpoints import AvailableEndpoints
|
|
116
|
+
from rasa.privacy.privacy_manager import BackgroundPrivacyManager
|
|
113
117
|
|
|
114
118
|
logger = logging.getLogger(__name__)
|
|
115
119
|
structlogger = structlog.get_logger()
|
|
@@ -135,6 +139,7 @@ class MessageProcessor:
|
|
|
135
139
|
on_circuit_break: Optional[LambdaType] = None,
|
|
136
140
|
http_interpreter: Optional[RasaNLUHttpInterpreter] = None,
|
|
137
141
|
endpoints: Optional["AvailableEndpoints"] = None,
|
|
142
|
+
privacy_manager: Optional["BackgroundPrivacyManager"] = None,
|
|
138
143
|
) -> None:
|
|
139
144
|
"""Initializes a `MessageProcessor`."""
|
|
140
145
|
self.nlg = generator
|
|
@@ -164,6 +169,9 @@ class MessageProcessor:
|
|
|
164
169
|
self.model_path = Path(model_path)
|
|
165
170
|
self.domain = self.model_metadata.domain
|
|
166
171
|
self.http_interpreter = http_interpreter
|
|
172
|
+
self.privacy_manager = privacy_manager
|
|
173
|
+
if self.privacy_manager is not None:
|
|
174
|
+
self.privacy_manager.validate_sensitive_slots_in_domain(self.domain)
|
|
167
175
|
|
|
168
176
|
@staticmethod
|
|
169
177
|
def _load_model(
|
|
@@ -213,15 +221,30 @@ class MessageProcessor:
|
|
|
213
221
|
|
|
214
222
|
await self._run_prediction_loop(message.output_channel, tracker)
|
|
215
223
|
|
|
216
|
-
await self.run_anonymization_pipeline(tracker)
|
|
217
|
-
|
|
218
224
|
await self.save_tracker(tracker)
|
|
219
225
|
|
|
226
|
+
self.trigger_anonymization(tracker)
|
|
227
|
+
|
|
220
228
|
if isinstance(message.output_channel, CollectingOutputChannel):
|
|
221
229
|
return message.output_channel.messages
|
|
222
230
|
|
|
223
231
|
return None
|
|
224
232
|
|
|
233
|
+
def trigger_anonymization(self, tracker: DialogueStateTracker) -> None:
|
|
234
|
+
if self.privacy_manager is None:
|
|
235
|
+
structlogger.debug(
|
|
236
|
+
"processor.trigger_anonymization.skipping.pii_management_not_enabled",
|
|
237
|
+
)
|
|
238
|
+
return None
|
|
239
|
+
|
|
240
|
+
structlogger.info(
|
|
241
|
+
"rasa.core.processor.trigger_anonymization",
|
|
242
|
+
sender_id=tracker.sender_id,
|
|
243
|
+
event_info="Triggering anonymization for publishing anonymized "
|
|
244
|
+
"events to the event broker.",
|
|
245
|
+
)
|
|
246
|
+
return self.privacy_manager.run(tracker)
|
|
247
|
+
|
|
225
248
|
async def run_action_extract_slots(
|
|
226
249
|
self,
|
|
227
250
|
output_channel: OutputChannel,
|
|
@@ -262,26 +285,6 @@ class MessageProcessor:
|
|
|
262
285
|
|
|
263
286
|
return tracker
|
|
264
287
|
|
|
265
|
-
async def run_anonymization_pipeline(self, tracker: DialogueStateTracker) -> None:
|
|
266
|
-
"""Run the anonymization pipeline on the new tracker events.
|
|
267
|
-
|
|
268
|
-
Args:
|
|
269
|
-
tracker: A tracker representing a conversation state.
|
|
270
|
-
"""
|
|
271
|
-
anonymization_pipeline = plugin_manager().hook.get_anonymization_pipeline()
|
|
272
|
-
if anonymization_pipeline is None:
|
|
273
|
-
return None
|
|
274
|
-
|
|
275
|
-
old_tracker = await self.tracker_store.retrieve(tracker.sender_id)
|
|
276
|
-
new_events = rasa.shared.core.trackers.TrackerEventDiffEngine.event_difference(
|
|
277
|
-
old_tracker, tracker
|
|
278
|
-
)
|
|
279
|
-
|
|
280
|
-
for event in new_events:
|
|
281
|
-
body = {"sender_id": tracker.sender_id}
|
|
282
|
-
body.update(event.as_dict())
|
|
283
|
-
anonymization_pipeline.run(body)
|
|
284
|
-
|
|
285
288
|
async def predict_next_for_sender_id(
|
|
286
289
|
self, sender_id: Text
|
|
287
290
|
) -> Optional[Dict[Text, Any]]:
|
|
@@ -819,28 +822,8 @@ class MessageProcessor:
|
|
|
819
822
|
)
|
|
820
823
|
|
|
821
824
|
self._check_for_unseen_features(parse_data)
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
parse_data.get(INTENT, {}).get(INTENT_NAME_KEY)
|
|
825
|
-
!= USER_INTENT_SILENCE_TIMEOUT
|
|
826
|
-
and tracker
|
|
827
|
-
):
|
|
828
|
-
if (
|
|
829
|
-
SLOT_CONSECUTIVE_SILENCE_TIMEOUTS in tracker.slots
|
|
830
|
-
and tracker.slots[SLOT_CONSECUTIVE_SILENCE_TIMEOUTS].value != 0.0
|
|
831
|
-
):
|
|
832
|
-
tracker.update(SlotSet(SLOT_CONSECUTIVE_SILENCE_TIMEOUTS, 0.0))
|
|
833
|
-
if (
|
|
834
|
-
SLOT_SILENCE_TIMEOUT in tracker.slots
|
|
835
|
-
and tracker.slots[SLOT_SILENCE_TIMEOUT].value
|
|
836
|
-
!= tracker.slots[SLOT_SILENCE_TIMEOUT].initial_value
|
|
837
|
-
):
|
|
838
|
-
tracker.update(
|
|
839
|
-
SlotSet(
|
|
840
|
-
SLOT_SILENCE_TIMEOUT,
|
|
841
|
-
tracker.slots[SLOT_SILENCE_TIMEOUT].initial_value,
|
|
842
|
-
)
|
|
843
|
-
)
|
|
825
|
+
|
|
826
|
+
self._initialise_consecutive_silence_timeout_slots(parse_data, tracker)
|
|
844
827
|
|
|
845
828
|
return parse_data
|
|
846
829
|
|
|
@@ -880,19 +863,61 @@ class MessageProcessor:
|
|
|
880
863
|
tracker.has_coexistence_routing_slot
|
|
881
864
|
and tracker.get_slot(ROUTE_TO_CALM_SLOT) is None
|
|
882
865
|
):
|
|
883
|
-
#
|
|
884
|
-
#
|
|
885
|
-
#
|
|
886
|
-
#
|
|
866
|
+
# If we are currently not routing to either CALM or DM1:
|
|
867
|
+
# - Sticky route to CALM if there are any commands
|
|
868
|
+
# from the trigger intent parsing
|
|
869
|
+
# - Sticky route to DM1 if there are no commands present
|
|
870
|
+
route_to_calm_slot_value = self._determine_route_to_calm_slot_value(
|
|
871
|
+
nlu_adapted_commands
|
|
872
|
+
)
|
|
887
873
|
commands += [
|
|
888
874
|
SetSlotCommand(
|
|
889
|
-
ROUTE_TO_CALM_SLOT,
|
|
875
|
+
ROUTE_TO_CALM_SLOT, route_to_calm_slot_value
|
|
890
876
|
).as_dict()
|
|
891
877
|
]
|
|
892
878
|
|
|
893
879
|
parse_data[COMMANDS] = commands
|
|
894
880
|
return parse_data
|
|
895
881
|
|
|
882
|
+
def _determine_route_to_calm_slot_value(
|
|
883
|
+
self, nlu_adapted_commands: List[Dict[str, Any]]
|
|
884
|
+
) -> Optional[bool]:
|
|
885
|
+
"""Determines what value should be assigned to `ROUTE_TO_CALM_SLOT`.
|
|
886
|
+
|
|
887
|
+
Returns:
|
|
888
|
+
- True: If any command other than:
|
|
889
|
+
- SessionStartCommand
|
|
890
|
+
- SessionEndCommand
|
|
891
|
+
- RestartCommand
|
|
892
|
+
is present.
|
|
893
|
+
- None: If only ignored system commands are present.
|
|
894
|
+
- False If no commands at all.
|
|
895
|
+
"""
|
|
896
|
+
system_commands_to_ignore = [
|
|
897
|
+
SessionStartCommand.command(),
|
|
898
|
+
SessionEndCommand.command(),
|
|
899
|
+
RestartCommand.command(),
|
|
900
|
+
]
|
|
901
|
+
|
|
902
|
+
# Exclude the system commands, as it doesn't originate from the user's
|
|
903
|
+
# input intent and shouldn't influence the decision for setting
|
|
904
|
+
# ROUTE_TO_CALM_SLOT.
|
|
905
|
+
intent_triggered_commands = [
|
|
906
|
+
command
|
|
907
|
+
for command in nlu_adapted_commands
|
|
908
|
+
if command.get("command") not in system_commands_to_ignore
|
|
909
|
+
]
|
|
910
|
+
|
|
911
|
+
if len(intent_triggered_commands) > 0:
|
|
912
|
+
# There are commands other than system commands present - route to CALM
|
|
913
|
+
return True
|
|
914
|
+
elif len(nlu_adapted_commands) > 0:
|
|
915
|
+
# Only system command is present — defer routing decision
|
|
916
|
+
return None
|
|
917
|
+
else:
|
|
918
|
+
# No commands at all — route to DM1
|
|
919
|
+
return False
|
|
920
|
+
|
|
896
921
|
def _update_full_retrieval_intent(self, parse_data: Dict[Text, Any]) -> None:
|
|
897
922
|
"""Update the parse data with the full retrieval intent.
|
|
898
923
|
|
|
@@ -1577,3 +1602,31 @@ class MessageProcessor:
|
|
|
1577
1602
|
)
|
|
1578
1603
|
|
|
1579
1604
|
return tracker, validate_frames
|
|
1605
|
+
|
|
1606
|
+
@staticmethod
|
|
1607
|
+
def _initialise_consecutive_silence_timeout_slots(
|
|
1608
|
+
parse_data: Dict[str, Any],
|
|
1609
|
+
tracker: DialogueStateTracker,
|
|
1610
|
+
) -> None:
|
|
1611
|
+
# resetting timeouts variables whenever something that is not a timeout occurs
|
|
1612
|
+
if (
|
|
1613
|
+
parse_data.get(INTENT, {}).get(INTENT_NAME_KEY)
|
|
1614
|
+
!= USER_INTENT_SILENCE_TIMEOUT
|
|
1615
|
+
and tracker
|
|
1616
|
+
):
|
|
1617
|
+
if (
|
|
1618
|
+
SLOT_CONSECUTIVE_SILENCE_TIMEOUTS in tracker.slots
|
|
1619
|
+
and tracker.slots[SLOT_CONSECUTIVE_SILENCE_TIMEOUTS].value != 0.0
|
|
1620
|
+
):
|
|
1621
|
+
tracker.update(SlotSet(SLOT_CONSECUTIVE_SILENCE_TIMEOUTS, 0.0))
|
|
1622
|
+
if (
|
|
1623
|
+
SILENCE_TIMEOUT_SLOT in tracker.slots
|
|
1624
|
+
and tracker.slots[SILENCE_TIMEOUT_SLOT].value
|
|
1625
|
+
!= tracker.slots[SILENCE_TIMEOUT_SLOT].initial_value
|
|
1626
|
+
):
|
|
1627
|
+
tracker.update(
|
|
1628
|
+
SlotSet(
|
|
1629
|
+
SILENCE_TIMEOUT_SLOT,
|
|
1630
|
+
tracker.slots[SILENCE_TIMEOUT_SLOT].initial_value,
|
|
1631
|
+
)
|
|
1632
|
+
)
|
rasa/core/run.py
CHANGED
|
@@ -30,12 +30,11 @@ from rasa import server, telemetry
|
|
|
30
30
|
from rasa.constants import ENV_SANIC_BACKLOG
|
|
31
31
|
from rasa.core import agent, channels, constants
|
|
32
32
|
from rasa.core.agent import Agent
|
|
33
|
+
from rasa.core.available_endpoints import AvailableEndpoints
|
|
33
34
|
from rasa.core.channels import console
|
|
34
35
|
from rasa.core.channels.channel import InputChannel
|
|
35
36
|
from rasa.core.channels.development_inspector import DevelopmentInspectProxy
|
|
36
37
|
from rasa.core.persistor import StorageType
|
|
37
|
-
from rasa.core.utils import AvailableEndpoints
|
|
38
|
-
from rasa.plugin import plugin_manager
|
|
39
38
|
from rasa.shared.exceptions import RasaException
|
|
40
39
|
from rasa.shared.utils.yaml import read_config_file
|
|
41
40
|
from rasa.utils import licensing
|
|
@@ -45,7 +44,7 @@ logger = logging.getLogger() # get the root logger
|
|
|
45
44
|
|
|
46
45
|
def create_http_input_channels(
|
|
47
46
|
channel: Optional[Text], credentials_file: Optional[Text]
|
|
48
|
-
) -> List[
|
|
47
|
+
) -> List[InputChannel]:
|
|
49
48
|
"""Instantiate the chosen input channel."""
|
|
50
49
|
if credentials_file:
|
|
51
50
|
all_credentials = read_config_file(credentials_file)
|
|
@@ -59,22 +58,45 @@ def create_http_input_channels(
|
|
|
59
58
|
"To connect to all given channels, omit the '--connector' "
|
|
60
59
|
"argument.".format(channel)
|
|
61
60
|
)
|
|
62
|
-
return [
|
|
61
|
+
return [
|
|
62
|
+
_create_single_channel(
|
|
63
|
+
channel,
|
|
64
|
+
all_credentials.get(channel),
|
|
65
|
+
)
|
|
66
|
+
]
|
|
63
67
|
else:
|
|
64
68
|
return [_create_single_channel(c, k) for c, k in all_credentials.items()]
|
|
65
69
|
|
|
66
70
|
|
|
67
|
-
def _create_single_channel(
|
|
71
|
+
def _create_single_channel(
|
|
72
|
+
channel: Text,
|
|
73
|
+
credentials: Optional[Dict[Text, Any]],
|
|
74
|
+
) -> Any:
|
|
75
|
+
"""Create a single input channel based on the channel name and credentials.
|
|
76
|
+
|
|
77
|
+
Args:
|
|
78
|
+
channel: The name of the input channel to create.
|
|
79
|
+
credentials: The credentials for the input channel.
|
|
80
|
+
|
|
81
|
+
Returns:
|
|
82
|
+
An instance of the input channel class.
|
|
83
|
+
|
|
84
|
+
Raises:
|
|
85
|
+
RasaException: If the channel class cannot be found or instantiated.
|
|
86
|
+
"""
|
|
68
87
|
from rasa.core.channels import BUILTIN_CHANNELS
|
|
69
88
|
|
|
70
89
|
if channel in BUILTIN_CHANNELS:
|
|
71
|
-
|
|
90
|
+
channel_class = BUILTIN_CHANNELS[channel]
|
|
91
|
+
|
|
92
|
+
return channel_class.from_credentials(credentials)
|
|
72
93
|
else:
|
|
73
94
|
# try to load channel based on class name
|
|
74
95
|
try:
|
|
75
96
|
input_channel_class = rasa.shared.utils.common.class_from_module_path(
|
|
76
97
|
channel
|
|
77
98
|
)
|
|
99
|
+
|
|
78
100
|
return input_channel_class.from_credentials(credentials)
|
|
79
101
|
except (AttributeError, ImportError):
|
|
80
102
|
raise RasaException(
|
|
@@ -108,7 +130,7 @@ def _is_apple_silicon_system() -> bool:
|
|
|
108
130
|
|
|
109
131
|
|
|
110
132
|
def configure_app(
|
|
111
|
-
input_channels: Optional[List[
|
|
133
|
+
input_channels: Optional[List[InputChannel]] = None,
|
|
112
134
|
cors: Optional[Union[Text, List[Text], None]] = None,
|
|
113
135
|
auth_token: Optional[Text] = None,
|
|
114
136
|
enable_api: bool = True,
|
|
@@ -190,10 +212,6 @@ def configure_app(
|
|
|
190
212
|
logger.info("Killing Sanic server now.")
|
|
191
213
|
running_app.stop() # kill the sanic server
|
|
192
214
|
|
|
193
|
-
@app.after_server_stop
|
|
194
|
-
async def after_server_stop(running_app: Sanic) -> None:
|
|
195
|
-
plugin_manager().hook.after_server_stop()
|
|
196
|
-
|
|
197
215
|
if server_listeners:
|
|
198
216
|
for listener, event in server_listeners:
|
|
199
217
|
app.register_listener(listener, event)
|
|
@@ -346,3 +364,7 @@ async def close_resources(app: Sanic, _: AbstractEventLoop) -> None:
|
|
|
346
364
|
event_broker = current_agent.tracker_store.event_broker
|
|
347
365
|
if event_broker:
|
|
348
366
|
await event_broker.close()
|
|
367
|
+
|
|
368
|
+
privacy_manager = current_agent.privacy_manager
|
|
369
|
+
if privacy_manager:
|
|
370
|
+
privacy_manager.stop()
|
|
@@ -671,7 +671,7 @@ def _create_from_endpoint_config(
|
|
|
671
671
|
|
|
672
672
|
structlogger.debug(
|
|
673
673
|
"tracker_store.create_tracker_store_from_endpoint_config",
|
|
674
|
-
|
|
674
|
+
event_info=f"Connected to {tracker_store.__class__.__name__}.",
|
|
675
675
|
)
|
|
676
676
|
|
|
677
677
|
return tracker_store
|
|
@@ -47,8 +47,8 @@ import rasa.shared.utils.io
|
|
|
47
47
|
import rasa.utils.io as io_utils
|
|
48
48
|
from rasa import telemetry
|
|
49
49
|
from rasa.core import run, utils
|
|
50
|
+
from rasa.core.available_endpoints import AvailableEndpoints
|
|
50
51
|
from rasa.core.constants import DEFAULT_SERVER_FORMAT, DEFAULT_SERVER_PORT
|
|
51
|
-
from rasa.core.utils import AvailableEndpoints
|
|
52
52
|
from rasa.shared.constants import (
|
|
53
53
|
DEFAULT_SENDER_ID,
|
|
54
54
|
DOCS_URL_NLU_BASED_POLICIES,
|