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
|
@@ -4,32 +4,21 @@ from typing import Any, Dict, Literal, Optional, Text
|
|
|
4
4
|
import structlog
|
|
5
5
|
|
|
6
6
|
from rasa.dialogue_understanding.commands.command_syntax_manager import (
|
|
7
|
-
CommandSyntaxManager,
|
|
8
7
|
CommandSyntaxVersion,
|
|
9
8
|
)
|
|
10
|
-
from rasa.dialogue_understanding.generator.
|
|
11
|
-
|
|
12
|
-
FLOW_RETRIEVAL_KEY,
|
|
13
|
-
LLM_CONFIG_KEY,
|
|
14
|
-
USER_INPUT_CONFIG_KEY,
|
|
15
|
-
)
|
|
16
|
-
from rasa.dialogue_understanding.generator.flow_retrieval import FlowRetrieval
|
|
17
|
-
from rasa.dialogue_understanding.generator.single_step.compact_llm_command_generator import ( # noqa: E501
|
|
18
|
-
CompactLLMCommandGenerator,
|
|
9
|
+
from rasa.dialogue_understanding.generator.single_step.single_step_based_llm_command_generator import ( # noqa: E501
|
|
10
|
+
SingleStepBasedLLMCommandGenerator,
|
|
19
11
|
)
|
|
20
12
|
from rasa.engine.recipes.default_recipe import DefaultV1Recipe
|
|
21
13
|
from rasa.engine.storage.resource import Resource
|
|
22
14
|
from rasa.engine.storage.storage import ModelStorage
|
|
23
15
|
from rasa.shared.constants import (
|
|
24
|
-
EMBEDDINGS_CONFIG_KEY,
|
|
25
16
|
PROMPT_CONFIG_KEY,
|
|
26
17
|
PROMPT_TEMPLATE_CONFIG_KEY,
|
|
27
18
|
)
|
|
28
|
-
from rasa.shared.utils.constants import LOG_COMPONENT_SOURCE_METHOD_FINGERPRINT_ADDON
|
|
29
|
-
from rasa.shared.utils.io import deep_container_fingerprint
|
|
30
19
|
from rasa.shared.utils.llm import (
|
|
20
|
+
check_prompt_config_keys_and_warn_if_deprecated,
|
|
31
21
|
get_prompt_template,
|
|
32
|
-
resolve_model_client_config,
|
|
33
22
|
)
|
|
34
23
|
|
|
35
24
|
DEFAULT_COMMAND_PROMPT_TEMPLATE = importlib.resources.read_text(
|
|
@@ -47,7 +36,7 @@ structlogger = structlog.get_logger()
|
|
|
47
36
|
],
|
|
48
37
|
is_trainable=True,
|
|
49
38
|
)
|
|
50
|
-
class SingleStepLLMCommandGenerator(
|
|
39
|
+
class SingleStepLLMCommandGenerator(SingleStepBasedLLMCommandGenerator):
|
|
51
40
|
"""A single step LLM-based command generator."""
|
|
52
41
|
|
|
53
42
|
def __init__(
|
|
@@ -66,64 +55,22 @@ class SingleStepLLMCommandGenerator(CompactLLMCommandGenerator):
|
|
|
66
55
|
**kwargs,
|
|
67
56
|
)
|
|
68
57
|
|
|
69
|
-
#
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
"single_step_llm_command_generator.init",
|
|
73
|
-
event_info=(
|
|
74
|
-
"The config parameter 'prompt' is deprecated "
|
|
75
|
-
"and will be removed in Rasa 4.0.0. "
|
|
76
|
-
"Please use the config parameter 'prompt_template' instead. "
|
|
77
|
-
),
|
|
78
|
-
)
|
|
79
|
-
|
|
80
|
-
# Set the command syntax version to v1
|
|
81
|
-
CommandSyntaxManager.set_syntax_version(
|
|
82
|
-
self.get_component_command_syntax_version()
|
|
83
|
-
)
|
|
84
|
-
|
|
85
|
-
@staticmethod
|
|
86
|
-
def get_default_config() -> Dict[str, Any]:
|
|
87
|
-
"""The component's default config (see parent class for full docstring)."""
|
|
88
|
-
return {
|
|
89
|
-
PROMPT_CONFIG_KEY: None, # Legacy
|
|
90
|
-
PROMPT_TEMPLATE_CONFIG_KEY: None,
|
|
91
|
-
USER_INPUT_CONFIG_KEY: None,
|
|
92
|
-
LLM_CONFIG_KEY: None,
|
|
93
|
-
FLOW_RETRIEVAL_KEY: FlowRetrieval.get_default_config(),
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
@classmethod
|
|
97
|
-
def fingerprint_addon(cls: Any, config: Dict[str, Any]) -> Optional[str]:
|
|
98
|
-
"""Add a fingerprint for the graph."""
|
|
99
|
-
prompt_template = cls._resolve_component_prompt_template(
|
|
100
|
-
config, log_context=LOG_COMPONENT_SOURCE_METHOD_FINGERPRINT_ADDON
|
|
101
|
-
)
|
|
102
|
-
llm_config = resolve_model_client_config(
|
|
103
|
-
config.get(LLM_CONFIG_KEY), SingleStepLLMCommandGenerator.__name__
|
|
104
|
-
)
|
|
105
|
-
embedding_config = resolve_model_client_config(
|
|
106
|
-
config.get(FLOW_RETRIEVAL_KEY, {}).get(EMBEDDINGS_CONFIG_KEY),
|
|
107
|
-
FlowRetrieval.__name__,
|
|
108
|
-
)
|
|
109
|
-
return deep_container_fingerprint(
|
|
110
|
-
[prompt_template, llm_config, embedding_config]
|
|
58
|
+
# Warn if the prompt config key is used to set the prompt template
|
|
59
|
+
check_prompt_config_keys_and_warn_if_deprecated(
|
|
60
|
+
config, "single_step_llm_command_generator"
|
|
111
61
|
)
|
|
112
62
|
|
|
113
|
-
@staticmethod
|
|
114
|
-
def get_default_llm_config() -> Dict[str, Any]:
|
|
115
|
-
"""Get the default LLM config for the command generator."""
|
|
116
|
-
return DEFAULT_LLM_CONFIG
|
|
117
|
-
|
|
118
63
|
@staticmethod
|
|
119
64
|
def get_component_command_syntax_version() -> CommandSyntaxVersion:
|
|
120
65
|
return CommandSyntaxVersion.v1
|
|
121
66
|
|
|
122
|
-
@
|
|
67
|
+
@classmethod
|
|
123
68
|
def _resolve_component_prompt_template(
|
|
69
|
+
cls: Any,
|
|
124
70
|
config: Dict[str, Any],
|
|
125
71
|
prompt_template: Optional[str] = None,
|
|
126
72
|
log_context: Optional[Literal["init", "fingerprint_addon"]] = None,
|
|
73
|
+
log_source_component: Optional[str] = "SingleStepLLMCommandGenerator",
|
|
127
74
|
) -> Optional[str]:
|
|
128
75
|
"""Get the prompt template from the config or the default prompt template."""
|
|
129
76
|
# Case when model is being loaded
|
|
@@ -143,6 +90,6 @@ class SingleStepLLMCommandGenerator(CompactLLMCommandGenerator):
|
|
|
143
90
|
return get_prompt_template(
|
|
144
91
|
prompt_template_path,
|
|
145
92
|
DEFAULT_COMMAND_PROMPT_TEMPLATE,
|
|
146
|
-
log_source_component=
|
|
93
|
+
log_source_component=log_source_component,
|
|
147
94
|
log_source_method=log_context,
|
|
148
95
|
)
|
|
@@ -90,7 +90,7 @@ class ActionCancelFlow(action.Action):
|
|
|
90
90
|
return []
|
|
91
91
|
|
|
92
92
|
if not isinstance(top, CancelPatternFlowStackFrame):
|
|
93
|
-
structlogger.warning("action.cancel_flow.no_cancel_frame"
|
|
93
|
+
structlogger.warning("action.cancel_flow.no_cancel_frame")
|
|
94
94
|
return []
|
|
95
95
|
|
|
96
96
|
for canceled_frame_id in top.canceled_frames:
|
|
@@ -105,7 +105,6 @@ class ActionCancelFlow(action.Action):
|
|
|
105
105
|
else:
|
|
106
106
|
structlogger.warning(
|
|
107
107
|
"action.cancel_flow.frame_not_found",
|
|
108
|
-
dialogue_stack=stack,
|
|
109
108
|
frame_id=canceled_frame_id,
|
|
110
109
|
)
|
|
111
110
|
|
|
@@ -89,7 +89,7 @@ class ActionClarifyFlows(action.Action):
|
|
|
89
89
|
return []
|
|
90
90
|
|
|
91
91
|
if not isinstance(top, ClarifyPatternFlowStackFrame):
|
|
92
|
-
structlogger.warning("action.clarify_flows.no_clarification_frame"
|
|
92
|
+
structlogger.warning("action.clarify_flows.no_clarification_frame")
|
|
93
93
|
return []
|
|
94
94
|
|
|
95
95
|
options_string = self.assemble_options_string(top.names)
|
|
@@ -114,7 +114,8 @@ class ActionCorrectFlowSlot(action.Action):
|
|
|
114
114
|
|
|
115
115
|
if not isinstance(top, CorrectionPatternFlowStackFrame):
|
|
116
116
|
structlogger.warning(
|
|
117
|
-
"action.correct_flow_slot.no_correction_frame",
|
|
117
|
+
"action.correct_flow_slot.no_correction_frame",
|
|
118
|
+
top=top, # no PII
|
|
118
119
|
)
|
|
119
120
|
return []
|
|
120
121
|
|
|
@@ -246,7 +247,6 @@ def reset_stack_on_tracker_to_prior_state(
|
|
|
246
247
|
"action.correct_flow_slot.no_target_frame_found",
|
|
247
248
|
reset_step_id=reset_step_id,
|
|
248
249
|
reset_flow_id=reset_flow_id,
|
|
249
|
-
stack_to_reset_to=stack_to_reset_to,
|
|
250
250
|
)
|
|
251
251
|
return tracker.stack
|
|
252
252
|
|
|
@@ -93,6 +93,11 @@ responses:
|
|
|
93
93
|
metadata:
|
|
94
94
|
rephrase: True
|
|
95
95
|
|
|
96
|
+
utter_no_relevant_answer_found:
|
|
97
|
+
- text: I’m sorry, I can’t help with that.
|
|
98
|
+
metadata:
|
|
99
|
+
rephrase: True
|
|
100
|
+
|
|
96
101
|
utter_skip_question_answer:
|
|
97
102
|
- text: I'm here to provide you with the best assistance, and in order to do so, I kindly request that we complete this step together. Your input is essential for a seamless experience!
|
|
98
103
|
metadata:
|
|
@@ -129,23 +134,28 @@ flows:
|
|
|
129
134
|
- action: utter_flow_cancelled_rasa
|
|
130
135
|
|
|
131
136
|
pattern_cannot_handle:
|
|
132
|
-
description:
|
|
133
|
-
|
|
134
|
-
name: pattern cannot handle
|
|
137
|
+
description: Conversation repair flow for addressing failed command generation scenarios
|
|
138
|
+
name: pattern_cannot_handle
|
|
135
139
|
steps:
|
|
136
140
|
- noop: true
|
|
137
141
|
next:
|
|
138
|
-
#
|
|
139
|
-
- if:
|
|
142
|
+
# Chitchat fallback
|
|
143
|
+
- if: context.reason is "cannot_handle_chitchat"
|
|
140
144
|
then:
|
|
141
145
|
- action: utter_cannot_handle
|
|
142
146
|
next: "END"
|
|
143
|
-
#
|
|
144
|
-
- if:
|
|
147
|
+
# Fallback for things that are not supported
|
|
148
|
+
- if: context.reason is "cannot_handle_not_supported"
|
|
145
149
|
then:
|
|
146
150
|
- action: utter_cannot_handle
|
|
147
151
|
next: END
|
|
148
|
-
#
|
|
152
|
+
# Fallback when no relevant answer to the user query has been found.
|
|
153
|
+
# This is used by the EnterpriseSearchPolicy.
|
|
154
|
+
- if: context.reason is "cannot_handle_no_relevant_answer"
|
|
155
|
+
then:
|
|
156
|
+
- action: utter_no_relevant_answer_found
|
|
157
|
+
next: END
|
|
158
|
+
# Default
|
|
149
159
|
- else:
|
|
150
160
|
- action: utter_ask_rephrase
|
|
151
161
|
next: END
|
|
@@ -219,15 +229,15 @@ flows:
|
|
|
219
229
|
|
|
220
230
|
pattern_internal_error:
|
|
221
231
|
description: Conversation repair flow for informing users about internal errors
|
|
222
|
-
name:
|
|
232
|
+
name: pattern_internal_error
|
|
223
233
|
steps:
|
|
224
234
|
- noop: true
|
|
225
235
|
next:
|
|
226
|
-
- if:
|
|
236
|
+
- if: context.error_type is "rasa_internal_error_user_input_too_long"
|
|
227
237
|
then:
|
|
228
238
|
- action: utter_user_input_too_long_error_rasa
|
|
229
239
|
next: END
|
|
230
|
-
- if:
|
|
240
|
+
- if: context.error_type is "rasa_internal_error_user_input_empty"
|
|
231
241
|
then:
|
|
232
242
|
- action: utter_user_input_empty_error_rasa
|
|
233
243
|
next: END
|
|
@@ -281,23 +291,25 @@ flows:
|
|
|
281
291
|
- noop: true
|
|
282
292
|
next:
|
|
283
293
|
- if: "slots.consecutive_silence_timeouts = 0.0"
|
|
284
|
-
then:
|
|
285
|
-
- set_slots:
|
|
286
|
-
- consecutive_silence_timeouts: 1.0
|
|
287
|
-
- action: action_repeat_bot_messages
|
|
288
|
-
next: END
|
|
294
|
+
then: set_slots_consecutive_silence_timeouts
|
|
289
295
|
- if: "slots.consecutive_silence_timeouts = 1.0"
|
|
290
|
-
then:
|
|
291
|
-
- set_slots:
|
|
292
|
-
- consecutive_silence_timeouts: 2.0
|
|
293
|
-
- action: utter_ask_still_there
|
|
294
|
-
next: END
|
|
296
|
+
then: set_slots_consecutive_silence_timeouts_2
|
|
295
297
|
- if: "slots.consecutive_silence_timeouts > 1.0"
|
|
296
|
-
then:
|
|
297
|
-
- action: utter_inform_hangup
|
|
298
|
-
- action: action_hangup
|
|
299
|
-
next: END
|
|
298
|
+
then: message_utter_inform_hangup
|
|
300
299
|
- else: END
|
|
300
|
+
- id: set_slots_consecutive_silence_timeouts
|
|
301
|
+
set_slots:
|
|
302
|
+
- consecutive_silence_timeouts: 1.0
|
|
303
|
+
- action: action_repeat_bot_messages
|
|
304
|
+
next: END
|
|
305
|
+
- id: set_slots_consecutive_silence_timeouts_2
|
|
306
|
+
set_slots:
|
|
307
|
+
- consecutive_silence_timeouts: 2.0
|
|
308
|
+
- action: utter_ask_still_there
|
|
309
|
+
next: END
|
|
310
|
+
- id: message_utter_inform_hangup
|
|
311
|
+
action: utter_inform_hangup
|
|
312
|
+
- action: action_hangup
|
|
301
313
|
|
|
302
314
|
pattern_validate_slot:
|
|
303
315
|
description: Flow for running validations on slots
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import importlib
|
|
4
|
+
import inspect
|
|
5
|
+
import os
|
|
6
|
+
from dataclasses import fields, is_dataclass
|
|
7
|
+
from typing import Any, Dict, List, Optional, Set, Text
|
|
8
|
+
|
|
9
|
+
import importlib_resources
|
|
10
|
+
from pydantic import BaseModel, Field, ValidationInfo, field_validator
|
|
11
|
+
|
|
12
|
+
from rasa.dialogue_understanding.stack.frames.pattern_frame import PatternFlowStackFrame
|
|
13
|
+
from rasa.shared.core.constants import (
|
|
14
|
+
DEFAULT_ACTION_NAMES,
|
|
15
|
+
DEFAULT_INTENTS,
|
|
16
|
+
RULE_SNIPPET_ACTION_NAME,
|
|
17
|
+
)
|
|
18
|
+
from rasa.shared.core.slots import AnySlot, BooleanSlot, CategoricalSlot, TextSlot
|
|
19
|
+
|
|
20
|
+
ACTIONS: List[Text] = [
|
|
21
|
+
*DEFAULT_ACTION_NAMES,
|
|
22
|
+
"validate_{{context.collect}}",
|
|
23
|
+
]
|
|
24
|
+
EXCLUDED_ACTIONS: Set[Text] = {RULE_SNIPPET_ACTION_NAME}
|
|
25
|
+
|
|
26
|
+
INTENTS: List[Text] = [*DEFAULT_INTENTS]
|
|
27
|
+
|
|
28
|
+
CONTEXT_FIELD_TYPES: Dict[Text, Text] = {
|
|
29
|
+
"canceled_name": CategoricalSlot.type_name,
|
|
30
|
+
"names": CategoricalSlot.type_name,
|
|
31
|
+
"collect": CategoricalSlot.type_name,
|
|
32
|
+
"utter": CategoricalSlot.type_name,
|
|
33
|
+
"collect_action": CategoricalSlot.type_name,
|
|
34
|
+
"previous_flow_name": CategoricalSlot.type_name,
|
|
35
|
+
"reset_flow_id": CategoricalSlot.type_name,
|
|
36
|
+
"is_reset_only": BooleanSlot.type_name,
|
|
37
|
+
"canceled_frames": AnySlot.type_name,
|
|
38
|
+
"corrected_slots": AnySlot.type_name,
|
|
39
|
+
"rejections": AnySlot.type_name,
|
|
40
|
+
"info": AnySlot.type_name,
|
|
41
|
+
"reason": TextSlot.type_name,
|
|
42
|
+
"error_type": TextSlot.type_name,
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
FLOW_NAME_VALUES = "FLOW_NAME"
|
|
46
|
+
FLOW_ID_VALUES = "FLOW_ID"
|
|
47
|
+
SLOT_NAME_VALUES = "SLOT_NAME"
|
|
48
|
+
RESPONSE_NAME_VALUES = "RESPONSE_NAME"
|
|
49
|
+
ACTION_NAME_VALUES = "ACTION_NAME"
|
|
50
|
+
|
|
51
|
+
CONTEXT_FIELD_VALUES: Dict[Text, Text] = {
|
|
52
|
+
"canceled_name": FLOW_NAME_VALUES,
|
|
53
|
+
"names": FLOW_NAME_VALUES,
|
|
54
|
+
"previous_flow_name": FLOW_NAME_VALUES,
|
|
55
|
+
"reset_flow_id": FLOW_ID_VALUES,
|
|
56
|
+
"collect": SLOT_NAME_VALUES,
|
|
57
|
+
"utter": RESPONSE_NAME_VALUES,
|
|
58
|
+
"collect_action": ACTION_NAME_VALUES,
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
PATTERNS_MODULE_BASE = "rasa.dialogue_understanding.patterns"
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class ContextField(BaseModel):
|
|
65
|
+
"""Element in the `contexts` mapping of the domain."""
|
|
66
|
+
|
|
67
|
+
patterns: List[Text] = Field(
|
|
68
|
+
..., description="Patterns that reference this context field."
|
|
69
|
+
)
|
|
70
|
+
type: Text = Field(
|
|
71
|
+
..., description="Slot type (categorical, text, boolean, any …)."
|
|
72
|
+
)
|
|
73
|
+
values: Optional[List[Text]] = Field(
|
|
74
|
+
None,
|
|
75
|
+
description="Optional placeholder that restricts which values a slot can take "
|
|
76
|
+
"(FLOW_NAME, SLOT_NAME, …).",
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
@field_validator("type")
|
|
80
|
+
def _validate_slot_type(cls, v: str) -> str:
|
|
81
|
+
allowed_types = list(set(CONTEXT_FIELD_TYPES.values()))
|
|
82
|
+
if v not in allowed_types:
|
|
83
|
+
raise ValueError(
|
|
84
|
+
f"Unsupported type '{v}'. "
|
|
85
|
+
f"Must be one of: {', '.join(allowed_types)}."
|
|
86
|
+
)
|
|
87
|
+
return v
|
|
88
|
+
|
|
89
|
+
@field_validator("values")
|
|
90
|
+
def _validate_values_placeholder(
|
|
91
|
+
cls, v: Optional[str], values: ValidationInfo
|
|
92
|
+
) -> Optional[str]:
|
|
93
|
+
if v is None:
|
|
94
|
+
return v
|
|
95
|
+
|
|
96
|
+
allowed_values = set(CONTEXT_FIELD_VALUES.values())
|
|
97
|
+
if not set(v).issubset(allowed_values):
|
|
98
|
+
raise ValueError(
|
|
99
|
+
f"Unsupported values placeholder '{v}'. "
|
|
100
|
+
f"Must be one of {', '.join(allowed_values)}."
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
slot_type = values.data.get("type")
|
|
104
|
+
if slot_type != CategoricalSlot.type_name:
|
|
105
|
+
raise ValueError(
|
|
106
|
+
"`values` can only be specified for categorical slots "
|
|
107
|
+
f"(got slot type '{slot_type}')."
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
return v
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
class PatternDomain(BaseModel):
|
|
114
|
+
"""Complete domain that is generated for the default patterns."""
|
|
115
|
+
|
|
116
|
+
actions: List[Text]
|
|
117
|
+
intents: List[Text]
|
|
118
|
+
contexts: Dict[Text, ContextField]
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def build_contexts_from_patterns() -> Dict[str, Dict[str, Any]]:
|
|
122
|
+
"""Builds a dictionary of contexts from the pattern classes.
|
|
123
|
+
|
|
124
|
+
Returns:
|
|
125
|
+
A dictionary where each key is a field name and the value is a dictionary
|
|
126
|
+
"""
|
|
127
|
+
patterns_folder = str(importlib_resources.files(PATTERNS_MODULE_BASE))
|
|
128
|
+
contexts_map: Dict[str, Dict[str, Any]] = {}
|
|
129
|
+
|
|
130
|
+
# Dynamically gather all .py files
|
|
131
|
+
for root, _, files in os.walk(patterns_folder):
|
|
132
|
+
for file in files:
|
|
133
|
+
if not file.endswith(".py"):
|
|
134
|
+
continue
|
|
135
|
+
|
|
136
|
+
try:
|
|
137
|
+
module_name = f"{PATTERNS_MODULE_BASE}.{file[:-3]}"
|
|
138
|
+
module = importlib.import_module(module_name)
|
|
139
|
+
except ImportError:
|
|
140
|
+
continue
|
|
141
|
+
|
|
142
|
+
# Inspect classes in that module
|
|
143
|
+
for _, cls in inspect.getmembers(module, inspect.isclass):
|
|
144
|
+
if not is_dataclass(cls):
|
|
145
|
+
continue
|
|
146
|
+
|
|
147
|
+
# The cls has to be a subclass of PatternFlowStackFrame
|
|
148
|
+
if cls == PatternFlowStackFrame or not issubclass(
|
|
149
|
+
cls, PatternFlowStackFrame
|
|
150
|
+
):
|
|
151
|
+
continue
|
|
152
|
+
|
|
153
|
+
for f in fields(cls):
|
|
154
|
+
field_name = f.name
|
|
155
|
+
if field_name not in contexts_map:
|
|
156
|
+
field_type = CONTEXT_FIELD_TYPES.get(
|
|
157
|
+
field_name, TextSlot.type_name
|
|
158
|
+
)
|
|
159
|
+
contexts_map[field_name] = {
|
|
160
|
+
"patterns": set(),
|
|
161
|
+
"type": field_type,
|
|
162
|
+
}
|
|
163
|
+
values: Optional[Text] = CONTEXT_FIELD_VALUES.get(field_name)
|
|
164
|
+
if values:
|
|
165
|
+
contexts_map[field_name]["values"] = [values]
|
|
166
|
+
|
|
167
|
+
# Add the pattern name to the set
|
|
168
|
+
pattern_name = cls.type()
|
|
169
|
+
contexts_map[field_name]["patterns"].add(pattern_name)
|
|
170
|
+
|
|
171
|
+
# Convert "patterns" from set to list, for a clean final structure
|
|
172
|
+
for field_name, details in contexts_map.items():
|
|
173
|
+
details["patterns"] = sorted(list(details["patterns"]))
|
|
174
|
+
|
|
175
|
+
return contexts_map
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def generate_domain_for_default_patterns() -> PatternDomain:
|
|
179
|
+
"""
|
|
180
|
+
Generate the domain for pattern-based flows as a strongly-typed object.
|
|
181
|
+
|
|
182
|
+
Returns: PatternDomain Pydantic model containing actions, intents and contexts.
|
|
183
|
+
"""
|
|
184
|
+
actions = [action for action in ACTIONS if action not in EXCLUDED_ACTIONS]
|
|
185
|
+
raw_contexts = build_contexts_from_patterns()
|
|
186
|
+
contexts = {
|
|
187
|
+
field_name: ContextField(**details)
|
|
188
|
+
for field_name, details in raw_contexts.items()
|
|
189
|
+
}
|
|
190
|
+
return PatternDomain(actions=actions, intents=INTENTS, contexts=contexts)
|
|
@@ -132,7 +132,7 @@ def validate_state_of_commands(commands: List[Command]) -> None:
|
|
|
132
132
|
if sum(isinstance(c, CancelFlowCommand) for c in commands) > 1:
|
|
133
133
|
structlogger.error(
|
|
134
134
|
"command_processor.validate_state_of_commands.multiple_cancel_flow_commands",
|
|
135
|
-
commands=commands,
|
|
135
|
+
commands=[command.__class__.__name__ for command in commands],
|
|
136
136
|
)
|
|
137
137
|
raise ValueError("There can only be one cancel flow command.")
|
|
138
138
|
|
|
@@ -143,7 +143,7 @@ def validate_state_of_commands(commands: List[Command]) -> None:
|
|
|
143
143
|
if free_form_answer_commands != commands[: len(free_form_answer_commands)]:
|
|
144
144
|
structlogger.error(
|
|
145
145
|
"command_processor.validate_state_of_commands.free_form_answer_commands_not_at_beginning",
|
|
146
|
-
commands=commands,
|
|
146
|
+
commands=[command.__class__.__name__ for command in commands],
|
|
147
147
|
)
|
|
148
148
|
raise ValueError(
|
|
149
149
|
"Free form answer commands must be at start of the predicted command list."
|
|
@@ -153,7 +153,7 @@ def validate_state_of_commands(commands: List[Command]) -> None:
|
|
|
153
153
|
if sum(isinstance(c, CorrectSlotsCommand) for c in commands) > 1:
|
|
154
154
|
structlogger.error(
|
|
155
155
|
"command_processor.validate_state_of_commands.multiple_correct_slots_commands",
|
|
156
|
-
commands=commands,
|
|
156
|
+
commands=[command.__class__.__name__ for command in commands],
|
|
157
157
|
)
|
|
158
158
|
raise ValueError("There can only be one correct slots command.")
|
|
159
159
|
|
|
@@ -214,18 +214,18 @@ def execute_commands(
|
|
|
214
214
|
commands: List[Command] = get_commands_from_tracker(tracker)
|
|
215
215
|
original_tracker = tracker.copy()
|
|
216
216
|
|
|
217
|
-
commands = clean_up_commands(
|
|
218
|
-
commands, tracker, all_flows, execution_context, story_graph, domain
|
|
219
|
-
)
|
|
220
|
-
|
|
221
217
|
updated_flows = find_updated_flows(tracker, all_flows)
|
|
222
218
|
if updated_flows:
|
|
223
|
-
#
|
|
219
|
+
# if there are updated flows, we need to handle the code change
|
|
224
220
|
structlogger.debug(
|
|
225
221
|
"command_processor.execute_commands.running_flows_were_updated",
|
|
226
222
|
updated_flow_ids=updated_flows,
|
|
227
223
|
)
|
|
228
224
|
commands = [HandleCodeChangeCommand()]
|
|
225
|
+
else:
|
|
226
|
+
commands = clean_up_commands(
|
|
227
|
+
commands, tracker, all_flows, execution_context, story_graph, domain
|
|
228
|
+
)
|
|
229
229
|
|
|
230
230
|
# store current flow hashes if they changed
|
|
231
231
|
new_hashes = calculate_flow_fingerprints(all_flows)
|
|
@@ -348,7 +348,6 @@ def get_current_collect_step(
|
|
|
348
348
|
# but no flow that triggered it. this should never happen.
|
|
349
349
|
structlogger.warning(
|
|
350
350
|
"command_processor.get_current_collect_step.no_flow_on_stack",
|
|
351
|
-
stack=dialogue_stack,
|
|
352
351
|
)
|
|
353
352
|
return None
|
|
354
353
|
|
|
@@ -358,7 +357,7 @@ def get_current_collect_step(
|
|
|
358
357
|
# step from it
|
|
359
358
|
structlogger.warning(
|
|
360
359
|
"command_processor.get_current_collect_step.no_step_for_frame",
|
|
361
|
-
frame=frame_that_triggered_collect_infos,
|
|
360
|
+
frame=frame_that_triggered_collect_infos.frame_id,
|
|
362
361
|
)
|
|
363
362
|
return None
|
|
364
363
|
|
|
@@ -724,7 +723,7 @@ def clean_up_chitchat_command(
|
|
|
724
723
|
)
|
|
725
724
|
structlogger.warn(
|
|
726
725
|
"command_processor.clean_up_chitchat_command.pattern_chitchat_not_found",
|
|
727
|
-
command=resulting_commands[0],
|
|
726
|
+
command=resulting_commands[0], # no PII
|
|
728
727
|
)
|
|
729
728
|
return resulting_commands
|
|
730
729
|
|
|
@@ -742,7 +741,7 @@ def clean_up_chitchat_command(
|
|
|
742
741
|
)
|
|
743
742
|
structlogger.warn(
|
|
744
743
|
"command_processor.clean_up_chitchat_command.replace_chitchat_answer_with_cannot_handle",
|
|
745
|
-
command=resulting_commands[0],
|
|
744
|
+
command=resulting_commands[0], # no PII
|
|
746
745
|
pattern_chitchat_uses_action_trigger_chitchat=has_action_trigger_chitchat,
|
|
747
746
|
defined_intentless_policy_in_config=defines_intentless_policy,
|
|
748
747
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
from typing import Any, Dict, List, Text
|
|
3
|
+
from typing import Any, Dict, List, Optional, Text
|
|
4
4
|
|
|
5
5
|
import rasa.dialogue_understanding.processor.command_processor
|
|
6
6
|
from rasa.engine.graph import ExecutionContext, GraphComponent
|
|
@@ -37,8 +37,8 @@ class CommandProcessorComponent(GraphComponent):
|
|
|
37
37
|
self,
|
|
38
38
|
tracker: DialogueStateTracker,
|
|
39
39
|
flows: FlowsList,
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
domain: Optional[Domain] = None,
|
|
41
|
+
story_graph: Optional[StoryGraph] = None,
|
|
42
42
|
) -> List[Event]:
|
|
43
43
|
"""Execute commands to update tracker state."""
|
|
44
44
|
return rasa.dialogue_understanding.processor.command_processor.execute_commands(
|
|
@@ -53,7 +53,8 @@ class FlowStackFrameType(str, Enum):
|
|
|
53
53
|
typ: The string to create the `FlowStackFrameType` from.
|
|
54
54
|
|
|
55
55
|
Returns:
|
|
56
|
-
|
|
56
|
+
The created `FlowStackFrameType`.
|
|
57
|
+
"""
|
|
57
58
|
if typ is None:
|
|
58
59
|
return FlowStackFrameType.REGULAR
|
|
59
60
|
elif typ == FlowStackFrameType.INTERRUPT.value:
|
|
@@ -107,7 +108,8 @@ class BaseFlowStackFrame(DialogueStackFrame):
|
|
|
107
108
|
all_flows: All flows in the assistant.
|
|
108
109
|
|
|
109
110
|
Returns:
|
|
110
|
-
|
|
111
|
+
The current flow.
|
|
112
|
+
"""
|
|
111
113
|
flow = all_flows.flow_by_id(self.flow_id)
|
|
112
114
|
if not flow:
|
|
113
115
|
# we shouldn't ever end up with a frame that belongs to a non
|
|
@@ -122,9 +124,20 @@ class BaseFlowStackFrame(DialogueStackFrame):
|
|
|
122
124
|
all_flows: All flows in the assistant.
|
|
123
125
|
|
|
124
126
|
Returns:
|
|
125
|
-
The current flow step.
|
|
127
|
+
The current flow step.
|
|
128
|
+
"""
|
|
126
129
|
flow = self.flow(all_flows)
|
|
127
|
-
|
|
130
|
+
|
|
131
|
+
step_id = self.step_id
|
|
132
|
+
# in 3.11.4 we added the flow_id as a prefix to the step_id
|
|
133
|
+
# this causes issues when loading old dialogues as the prefix is missing
|
|
134
|
+
# (see https://rasahq.atlassian.net/jira/software/c/projects/ENG/boards/43?selectedIssue=ENG-1939)
|
|
135
|
+
# so we try to find the step by adding the flow prefix to old step_ids as well
|
|
136
|
+
# TODO: remove this in 4.0.0
|
|
137
|
+
alternative_step_id = f"{self.flow_id}_{self.step_id}"
|
|
138
|
+
|
|
139
|
+
step = flow.step_by_id(step_id) or flow.step_by_id(alternative_step_id)
|
|
140
|
+
|
|
128
141
|
if not step:
|
|
129
142
|
# we shouldn't ever end up with a frame that belongs to a non
|
|
130
143
|
# existing step, but if we do, we should raise an error
|
|
@@ -209,7 +209,9 @@ def get_collect_steps_excluding_ask_before_filling_for_active_flow(
|
|
|
209
209
|
All collect steps that are part of the current active flow,
|
|
210
210
|
excluding the collect steps that have to be asked before filling.
|
|
211
211
|
"""
|
|
212
|
-
active_frame = top_user_flow_frame(
|
|
212
|
+
active_frame = top_user_flow_frame(
|
|
213
|
+
dialogue_stack, ignore_call_and_link_frames=False
|
|
214
|
+
)
|
|
213
215
|
if active_frame is None:
|
|
214
216
|
return set()
|
|
215
217
|
active_flow = active_frame.flow(all_flows)
|