rasa-pro 3.12.6.dev1__py3-none-any.whl → 3.12.7.dev1__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.

Files changed (33) hide show
  1. rasa/cli/run.py +10 -6
  2. rasa/cli/utils.py +7 -0
  3. rasa/core/actions/action.py +0 -6
  4. rasa/core/channels/voice_ready/audiocodes.py +46 -17
  5. rasa/core/policies/flows/flow_executor.py +3 -38
  6. rasa/core/processor.py +19 -5
  7. rasa/core/utils.py +53 -0
  8. rasa/dialogue_understanding/commands/cancel_flow_command.py +4 -59
  9. rasa/dialogue_understanding/commands/start_flow_command.py +0 -41
  10. rasa/dialogue_understanding/generator/command_generator.py +67 -0
  11. rasa/dialogue_understanding/generator/llm_based_command_generator.py +2 -12
  12. rasa/dialogue_understanding/patterns/default_flows_for_patterns.yml +0 -61
  13. rasa/dialogue_understanding/processor/command_processor.py +7 -65
  14. rasa/dialogue_understanding/stack/utils.py +0 -38
  15. rasa/e2e_test/utils/validation.py +3 -3
  16. rasa/shared/core/constants.py +0 -8
  17. rasa/shared/core/flows/flow.py +0 -17
  18. rasa/shared/core/flows/flows_yaml_schema.json +3 -38
  19. rasa/shared/core/flows/steps/collect.py +5 -18
  20. rasa/shared/core/flows/utils.py +1 -16
  21. rasa/shared/core/slot_mappings.py +11 -5
  22. rasa/shared/nlu/constants.py +0 -1
  23. rasa/shared/utils/common.py +11 -1
  24. rasa/validator.py +1 -123
  25. rasa/version.py +1 -2
  26. {rasa_pro-3.12.6.dev1.dist-info → rasa_pro-3.12.7.dev1.dist-info}/METADATA +3 -1
  27. {rasa_pro-3.12.6.dev1.dist-info → rasa_pro-3.12.7.dev1.dist-info}/RECORD +30 -33
  28. rasa/core/actions/action_handle_digressions.py +0 -164
  29. rasa/dialogue_understanding/commands/handle_digressions_command.py +0 -144
  30. rasa/dialogue_understanding/patterns/handle_digressions.py +0 -81
  31. {rasa_pro-3.12.6.dev1.dist-info → rasa_pro-3.12.7.dev1.dist-info}/NOTICE +0 -0
  32. {rasa_pro-3.12.6.dev1.dist-info → rasa_pro-3.12.7.dev1.dist-info}/WHEEL +0 -0
  33. {rasa_pro-3.12.6.dev1.dist-info → rasa_pro-3.12.7.dev1.dist-info}/entry_points.txt +0 -0
@@ -1,17 +1,6 @@
1
1
  version: "3.1"
2
2
  responses:
3
3
 
4
- utter_ask_continue_previous_flow:
5
- - text: "Confirm if you would like to continue with the initial topic: {{context.interrupted_flow_id}}?"
6
- metadata:
7
- rephrase: True
8
- template: jinja
9
- buttons:
10
- - title: Continue with the previous topic.
11
- payload: /SetSlots(continue_previous_flow=True)
12
- - title: Switch to new topic.
13
- payload: /SetSlots(continue_previous_flow=False)
14
-
15
4
  utter_ask_rephrase:
16
5
  - text: I’m sorry I am unable to understand you, could you please rephrase?
17
6
 
@@ -20,20 +9,6 @@ responses:
20
9
  metadata:
21
10
  rephrase: True
22
11
 
23
- utter_block_digressions:
24
- - text: "We can look into {{ context.interrupting_flow_id }} later. Let's focus on the current topic: {{ context.interrupted_flow_id }}."
25
- metadata:
26
- rephrase: True
27
- template: jinja
28
- - text: "Let's continue with the current topic: {{ context.interrupted_flow_id }}."
29
- condition:
30
- - type: slot
31
- name: continue_previous_flow
32
- value: True
33
- metadata:
34
- rephrase: True
35
- template: jinja
36
-
37
12
  utter_boolean_slot_rejection:
38
13
  - text: "Sorry, the value you provided, `{{value}}`, is not valid. Please respond with a valid value."
39
14
  metadata:
@@ -60,12 +35,6 @@ responses:
60
35
  rephrase: True
61
36
  template: jinja
62
37
 
63
- utter_continue_interruption:
64
- - text: "Let's continue with the chosen topic instead: {{ context.interrupting_flow_id }}."
65
- metadata:
66
- rephrase: True
67
- template: jinja
68
-
69
38
  utter_corrected_previous_input:
70
39
  - text: "Ok, I am updating {{ context.corrected_slots.keys()|join(', ') }} to {{ context.new_slot_values | join(', ') }} respectively."
71
40
  metadata:
@@ -150,10 +119,6 @@ slots:
150
119
  type: float
151
120
  initial_value: 0.0
152
121
  max_value: 1000000
153
- continue_previous_flow:
154
- type: bool
155
- mappings:
156
- - type: from_llm
157
122
 
158
123
  flows:
159
124
  pattern_cancel_flow:
@@ -197,7 +162,6 @@ flows:
197
162
  steps:
198
163
  - action: action_clarify_flows
199
164
  - action: utter_clarification_options_rasa
200
- - action: action_listen
201
165
 
202
166
  pattern_code_change:
203
167
  description: Conversation repair flow for cleaning the stack after an assistant update
@@ -247,31 +211,6 @@ flows:
247
211
  next: END
248
212
  - else: END
249
213
 
250
- pattern_handle_digressions:
251
- description: Conversation repair flow for handling digressions
252
- name: pattern handle digressions
253
- steps:
254
- - noop: true
255
- id: branching
256
- next:
257
- - if: context.ask_confirm_digressions contains context.interrupting_flow_id
258
- then: continue_previous_flow
259
- - if: context.block_digressions contains context.interrupting_flow_id
260
- then: block_digression
261
- - else: continue_digression
262
- - id: continue_previous_flow
263
- collect: continue_previous_flow
264
- next:
265
- - if: slots.continue_previous_flow
266
- then: block_digression
267
- - else: continue_digression
268
- - id: block_digression
269
- action: action_block_digression
270
- next: END
271
- - id: continue_digression
272
- action: action_continue_digression
273
- next: END
274
-
275
214
  pattern_human_handoff:
276
215
  description: Conversation repair flow for switching users to a human agent if their request can't be handled
277
216
  name: pattern human handoff
@@ -18,9 +18,6 @@ from rasa.dialogue_understanding.commands import (
18
18
  from rasa.dialogue_understanding.commands.handle_code_change_command import (
19
19
  HandleCodeChangeCommand,
20
20
  )
21
- from rasa.dialogue_understanding.commands.handle_digressions_command import (
22
- HandleDigressionsCommand,
23
- )
24
21
  from rasa.dialogue_understanding.commands.set_slot_command import SetSlotExtractor
25
22
  from rasa.dialogue_understanding.commands.utils import (
26
23
  create_validate_frames_from_slot_set_events,
@@ -454,21 +451,7 @@ def clean_up_commands(
454
451
  )
455
452
  continue
456
453
 
457
- if should_add_handle_digressions_command(tracker, all_flows, top_flow_id):
458
- handle_digression_command = HandleDigressionsCommand(flow=command.flow)
459
- if handle_digression_command in clean_commands:
460
- structlogger.debug(
461
- "command_processor.clean_up_commands.skip_handle_digressions.command_already_present",
462
- command=handle_digression_command,
463
- )
464
- continue
465
- clean_commands.append(handle_digression_command)
466
- structlogger.debug(
467
- "command_processor.clean_up_commands.push_handle_digressions",
468
- command=command,
469
- )
470
- else:
471
- clean_commands.append(command)
454
+ clean_commands.append(command)
472
455
 
473
456
  # handle chitchat command differently from other free-form answer commands
474
457
  elif isinstance(command, ChitChatAnswerCommand):
@@ -503,21 +486,9 @@ def clean_up_commands(
503
486
  # when coexistence is enabled, by default there will be a SetSlotCommand
504
487
  # for the ROUTE_TO_CALM_SLOT slot.
505
488
  if tracker.has_coexistence_routing_slot and len(clean_commands) > 2:
506
- clean_commands = filter_cannot_handle_command_for_skipped_slots(clean_commands)
489
+ clean_commands = filter_cannot_handle_command(clean_commands)
507
490
  elif not tracker.has_coexistence_routing_slot and len(clean_commands) > 1:
508
- clean_commands = filter_cannot_handle_command_for_skipped_slots(clean_commands)
509
-
510
- # remove cancel flow when there is a handle digression command
511
- # otherwise the cancel command will cancel the active flow which defined a specific
512
- # behavior for the digression
513
- if contains_command(clean_commands, HandleDigressionsCommand) and contains_command(
514
- clean_commands, CancelFlowCommand
515
- ):
516
- clean_commands = [
517
- command
518
- for command in clean_commands
519
- if not isinstance(command, CancelFlowCommand)
520
- ]
491
+ clean_commands = filter_cannot_handle_command(clean_commands)
521
492
 
522
493
  clean_commands = ensure_max_number_of_command_type(
523
494
  clean_commands, RepeatBotMessagesCommand, 1
@@ -857,12 +828,12 @@ def should_slot_be_set(
857
828
  return True
858
829
 
859
830
 
860
- def filter_cannot_handle_command_for_skipped_slots(
831
+ def filter_cannot_handle_command(
861
832
  clean_commands: List[Command],
862
833
  ) -> List[Command]:
863
- """Filter out a 'cannot handle' command for skipped slots.
834
+ """Filter out a 'cannot handle' command.
864
835
 
865
- This is used to filter out a 'cannot handle' command for skipped slots
836
+ This is used to filter out a 'cannot handle' command
866
837
  in case other commands are present.
867
838
 
868
839
  Returns:
@@ -871,34 +842,5 @@ def filter_cannot_handle_command_for_skipped_slots(
871
842
  return [
872
843
  command
873
844
  for command in clean_commands
874
- if not (
875
- isinstance(command, CannotHandleCommand)
876
- and command.reason
877
- and CANNOT_HANDLE_REASON == command.reason
878
- )
845
+ if not isinstance(command, CannotHandleCommand)
879
846
  ]
880
-
881
-
882
- def should_add_handle_digressions_command(
883
- tracker: DialogueStateTracker, all_flows: FlowsList, top_flow_id: str
884
- ) -> bool:
885
- """Check if a handle digressions command should be added to the commands.
886
-
887
- The command should replace a StartFlow command only if we are at a collect step of
888
- a flow and a new flow is predicted by the command generator to start.
889
- """
890
- current_flow = all_flows.flow_by_id(top_flow_id)
891
- current_flow_condition = current_flow and (
892
- current_flow.ask_confirm_digressions or current_flow.block_digressions
893
- )
894
-
895
- collect_info = get_current_collect_step(tracker.stack, all_flows)
896
-
897
- if collect_info and (
898
- collect_info.ask_confirm_digressions
899
- or collect_info.block_digressions
900
- or current_flow_condition
901
- ):
902
- return True
903
-
904
- return False
@@ -4,9 +4,6 @@ from typing import List, Optional, Set, Tuple
4
4
  from rasa.dialogue_understanding.patterns.collect_information import (
5
5
  CollectInformationPatternFlowStackFrame,
6
6
  )
7
- from rasa.dialogue_understanding.patterns.continue_interrupted import (
8
- ContinueInterruptedPatternFlowStackFrame,
9
- )
10
7
  from rasa.dialogue_understanding.stack.dialogue_stack import DialogueStack
11
8
  from rasa.dialogue_understanding.stack.frames import (
12
9
  BaseFlowStackFrame,
@@ -221,38 +218,3 @@ def get_collect_steps_excluding_ask_before_filling_for_active_flow(
221
218
  for step in active_flow.get_collect_steps()
222
219
  if not step.ask_before_filling
223
220
  )
224
-
225
-
226
- def remove_digression_from_stack(stack: DialogueStack, flow_id: str) -> DialogueStack:
227
- """Remove a specific flow frame from the stack and other frames that reference it.
228
-
229
- The main use-case is to prevent duplicate digressions from being added to the stack.
230
-
231
- Args:
232
- stack: The dialogue stack.
233
- flow_id: The flow to remove.
234
-
235
- Returns:
236
- The updated dialogue stack.
237
- """
238
- updated_stack = stack.copy()
239
- original_frames = updated_stack.frames[:]
240
- found_digression_index = -1
241
- for index, frame in enumerate(original_frames):
242
- if isinstance(frame, BaseFlowStackFrame) and frame.flow_id == flow_id:
243
- updated_stack.frames.pop(index)
244
- found_digression_index = index
245
-
246
- # we also need to remove the `ContinueInterruptedPatternFlowStackFrame`
247
- elif (
248
- isinstance(frame, ContinueInterruptedPatternFlowStackFrame)
249
- and frame.previous_flow_name == flow_id
250
- and found_digression_index + 1 == index
251
- ):
252
- # we know that this frame is always added after the digressing flow frame
253
- # that was blocked previously by action_block_digressions,
254
- # so this check would occur after the digressing flow was popped.
255
- # Therefore, we need to update the index dynamically before popping.
256
- updated_stack.frames.pop(index - 1)
257
-
258
- return updated_stack
@@ -7,6 +7,7 @@ import structlog
7
7
  import rasa.shared.utils.io
8
8
  from rasa.e2e_test.constants import SCHEMA_FILE_PATH
9
9
  from rasa.e2e_test.e2e_test_case import Fixture, Metadata
10
+ from rasa.exceptions import ModelNotFound
10
11
  from rasa.shared.utils.yaml import read_schema_file
11
12
 
12
13
  if TYPE_CHECKING:
@@ -152,10 +153,9 @@ def validate_model_path(model_path: Optional[str], parameter: str, default: str)
152
153
  return model_path
153
154
 
154
155
  if model_path and not Path(model_path).exists():
155
- rasa.shared.utils.io.raise_warning(
156
+ raise ModelNotFound(
156
157
  f"The provided model path '{model_path}' could not be found. "
157
- f"Using default location '{default}' instead.",
158
- UserWarning,
158
+ "Provide an existing model path."
159
159
  )
160
160
 
161
161
  elif model_path is None:
@@ -52,8 +52,6 @@ ACTION_TRIGGER_CHITCHAT = "action_trigger_chitchat"
52
52
  ACTION_RESET_ROUTING = "action_reset_routing"
53
53
  ACTION_HANGUP = "action_hangup"
54
54
  ACTION_REPEAT_BOT_MESSAGES = "action_repeat_bot_messages"
55
- ACTION_BLOCK_DIGRESSION = "action_block_digression"
56
- ACTION_CONTINUE_DIGRESSION = "action_continue_digression"
57
55
 
58
56
  ACTION_METADATA_EXECUTION_SUCCESS = "execution_success"
59
57
  ACTION_METADATA_EXECUTION_ERROR_MESSAGE = "execution_error_message"
@@ -84,8 +82,6 @@ DEFAULT_ACTION_NAMES = [
84
82
  ACTION_RESET_ROUTING,
85
83
  ACTION_HANGUP,
86
84
  ACTION_REPEAT_BOT_MESSAGES,
87
- ACTION_BLOCK_DIGRESSION,
88
- ACTION_CONTINUE_DIGRESSION,
89
85
  ]
90
86
 
91
87
  ACTION_SHOULD_SEND_DOMAIN = "send_domain"
@@ -205,8 +201,4 @@ CLASSIFIER_NAME_FALLBACK = "FallbackClassifier"
205
201
 
206
202
  POLICIES_THAT_EXTRACT_ENTITIES = {"TEDPolicy"}
207
203
 
208
- # digression constants
209
- KEY_ASK_CONFIRM_DIGRESSIONS = "ask_confirm_digressions"
210
- KEY_BLOCK_DIGRESSIONS = "block_digressions"
211
-
212
204
  ERROR_CODE_KEY = "error_code"
@@ -13,10 +13,6 @@ from pypred import Predicate
13
13
  import rasa.shared.utils.io
14
14
  from rasa.engine.language import Language
15
15
  from rasa.shared.constants import RASA_DEFAULT_FLOW_PATTERN_PREFIX
16
- from rasa.shared.core.constants import (
17
- KEY_ASK_CONFIRM_DIGRESSIONS,
18
- KEY_BLOCK_DIGRESSIONS,
19
- )
20
16
  from rasa.shared.core.flows.constants import (
21
17
  KEY_ALWAYS_INCLUDE_IN_PROMPT,
22
18
  KEY_DESCRIPTION,
@@ -52,7 +48,6 @@ from rasa.shared.core.flows.steps.constants import (
52
48
  START_STEP,
53
49
  )
54
50
  from rasa.shared.core.flows.steps.continuation import ContinueFlowStep
55
- from rasa.shared.core.flows.utils import extract_digression_prop
56
51
  from rasa.shared.core.slots import Slot
57
52
 
58
53
  structlogger = structlog.get_logger()
@@ -94,10 +89,6 @@ class Flow:
94
89
  """The path to the file where the flow is stored."""
95
90
  persisted_slots: List[str] = field(default_factory=list)
96
91
  """The list of slots that should be persisted after the flow ends."""
97
- ask_confirm_digressions: List[str] = field(default_factory=list)
98
- """The flow ids for which the assistant should ask for confirmation."""
99
- block_digressions: List[str] = field(default_factory=list)
100
- """The flow ids that the assistant should block from digressing to."""
101
92
  run_pattern_completed: bool = True
102
93
  """Whether the pattern_completed flow should be run after the flow ends."""
103
94
 
@@ -138,10 +129,6 @@ class Flow:
138
129
  # data. When the model is trained, take the provided file_path.
139
130
  file_path=data.get(KEY_FILE_PATH) if KEY_FILE_PATH in data else file_path,
140
131
  persisted_slots=data.get(KEY_PERSISTED_SLOTS, []),
141
- ask_confirm_digressions=extract_digression_prop(
142
- KEY_ASK_CONFIRM_DIGRESSIONS, data
143
- ),
144
- block_digressions=extract_digression_prop(KEY_BLOCK_DIGRESSIONS, data),
145
132
  run_pattern_completed=data.get(KEY_RUN_PATTERN_COMPLETED, True),
146
133
  translation=extract_translations(
147
134
  translation_data=data.get(KEY_TRANSLATION, {})
@@ -220,10 +207,6 @@ class Flow:
220
207
  data[KEY_FILE_PATH] = self.file_path
221
208
  if self.persisted_slots:
222
209
  data[KEY_PERSISTED_SLOTS] = self.persisted_slots
223
- if self.ask_confirm_digressions:
224
- data[KEY_ASK_CONFIRM_DIGRESSIONS] = self.ask_confirm_digressions
225
- if self.block_digressions:
226
- data[KEY_BLOCK_DIGRESSIONS] = self.block_digressions
227
210
  if self.run_pattern_completed is not None:
228
211
  data["run_pattern_completed"] = self.run_pattern_completed
229
212
  if self.translation:
@@ -217,15 +217,12 @@
217
217
  "reset_after_flow_ends": {
218
218
  "type": "boolean"
219
219
  },
220
- "ask_confirm_digressions": {
221
- "$ref": "#/$defs/ask_confirm_digressions"
222
- },
223
- "block_digressions": {
224
- "$ref": "#/$defs/block_digressions"
225
- },
226
220
  "utter": {
227
221
  "type": "string"
228
222
  },
223
+ "force_slot_filling": {
224
+ "type": "boolean"
225
+ },
229
226
  "rejections": {
230
227
  "type": "array",
231
228
  "schema_name": "list of rejections",
@@ -253,32 +250,6 @@
253
250
  }
254
251
  }
255
252
  },
256
- "ask_confirm_digressions": {
257
- "oneOf": [
258
- {
259
- "type": "boolean"
260
- },
261
- {
262
- "type": "array",
263
- "items": {
264
- "type": "string"
265
- }
266
- }
267
- ]
268
- },
269
- "block_digressions": {
270
- "oneOf": [
271
- {
272
- "type": "boolean"
273
- },
274
- {
275
- "type": "array",
276
- "items": {
277
- "type": "string"
278
- }
279
- }
280
- ]
281
- },
282
253
  "flow": {
283
254
  "required": [
284
255
  "steps",
@@ -340,12 +311,6 @@
340
311
  "persisted_slots": {
341
312
  "$ref": "#/$defs/persisted_slots"
342
313
  },
343
- "ask_confirm_digressions": {
344
- "$ref": "#/$defs/ask_confirm_digressions"
345
- },
346
- "block_digressions": {
347
- "$ref": "#/$defs/block_digressions"
348
- },
349
314
  "run_pattern_completed": {
350
315
  "type": "boolean"
351
316
  }
@@ -1,15 +1,10 @@
1
1
  from __future__ import annotations
2
2
 
3
- from dataclasses import dataclass, field
3
+ from dataclasses import dataclass
4
4
  from typing import Any, Dict, List, Set, Text
5
5
 
6
6
  from rasa.shared.constants import ACTION_ASK_PREFIX, UTTER_ASK_PREFIX
7
- from rasa.shared.core.constants import (
8
- KEY_ASK_CONFIRM_DIGRESSIONS,
9
- KEY_BLOCK_DIGRESSIONS,
10
- )
11
7
  from rasa.shared.core.flows.flow_step import FlowStep
12
- from rasa.shared.core.flows.utils import extract_digression_prop
13
8
  from rasa.shared.core.slots import SlotRejection
14
9
 
15
10
 
@@ -29,10 +24,8 @@ class CollectInformationFlowStep(FlowStep):
29
24
  """Whether to always ask the question even if the slot is already filled."""
30
25
  reset_after_flow_ends: bool = True
31
26
  """Whether to reset the slot value at the end of the flow."""
32
- ask_confirm_digressions: List[str] = field(default_factory=list)
33
- """The flow id digressions for which the assistant should ask for confirmation."""
34
- block_digressions: List[str] = field(default_factory=list)
35
- """The flow id digressions that should be blocked during the flow step."""
27
+ force_slot_filling: bool = False
28
+ """Whether to keep only the SetSlot command for the collected slot."""
36
29
 
37
30
  @classmethod
38
31
  def from_json(
@@ -60,10 +53,7 @@ class CollectInformationFlowStep(FlowStep):
60
53
  SlotRejection.from_dict(rejection)
61
54
  for rejection in data.get("rejections", [])
62
55
  ],
63
- ask_confirm_digressions=extract_digression_prop(
64
- KEY_ASK_CONFIRM_DIGRESSIONS, data
65
- ),
66
- block_digressions=extract_digression_prop(KEY_BLOCK_DIGRESSIONS, data),
56
+ force_slot_filling=data.get("force_slot_filling", False),
67
57
  **base.__dict__,
68
58
  )
69
59
 
@@ -79,10 +69,7 @@ class CollectInformationFlowStep(FlowStep):
79
69
  data["ask_before_filling"] = self.ask_before_filling
80
70
  data["reset_after_flow_ends"] = self.reset_after_flow_ends
81
71
  data["rejections"] = [rejection.as_dict() for rejection in self.rejections]
82
- data["ask_confirm_digressions"] = self.ask_confirm_digressions
83
- data["block_digressions"] = (
84
- self.block_digressions if self.block_digressions else False
85
- )
72
+ data["force_slot_filling"] = self.force_slot_filling
86
73
 
87
74
  return data
88
75
 
@@ -1,4 +1,4 @@
1
- from typing import TYPE_CHECKING, Any, Dict, List, Set, Text
1
+ from typing import TYPE_CHECKING, Any, Dict, Set, Text
2
2
 
3
3
  from rasa.shared.utils.io import raise_deprecation_warning
4
4
 
@@ -8,7 +8,6 @@ if TYPE_CHECKING:
8
8
 
9
9
  RESET_PROPERTY_NAME = "reset_after_flow_ends"
10
10
  PERSIST_PROPERTY_NAME = "persisted_slots"
11
- ALL_LABEL = "ALL"
12
11
 
13
12
 
14
13
  def warn_deprecated_collect_step_config() -> None:
@@ -45,20 +44,6 @@ def get_invalid_slot_persistence_config_error_message(
45
44
  )
46
45
 
47
46
 
48
- def extract_digression_prop(prop: str, data: Dict[str, Any]) -> List[str]:
49
- """Extracts the digression property from the data.
50
-
51
- There can be two types of properties: ask_confirm_digressions and
52
- block_digressions.
53
- """
54
- digression_property = data.get(prop, [])
55
-
56
- if isinstance(digression_property, bool):
57
- digression_property = [ALL_LABEL] if digression_property else []
58
-
59
- return digression_property
60
-
61
-
62
47
  def extract_translations(
63
48
  translation_data: Dict[Text, Any],
64
49
  ) -> Dict[Text, "FlowLanguageTranslation"]:
@@ -648,12 +648,14 @@ class SlotFillingManager:
648
648
  output_channel: "OutputChannel",
649
649
  nlg: "NaturalLanguageGenerator",
650
650
  recreate_tracker: bool = False,
651
+ slot_events: Optional[List[Event]] = None,
651
652
  ) -> List[Event]:
652
653
  from rasa.core.actions.action import RemoteAction
653
654
  from rasa.shared.core.trackers import DialogueStateTracker
654
655
  from rasa.utils.endpoints import ClientResponseError
655
656
 
656
- slot_events: List[Event] = []
657
+ validated_slot_events: List[Event] = []
658
+ slot_events = slot_events if slot_events is not None else []
657
659
  remote_action = RemoteAction(custom_action, self._action_endpoint)
658
660
  disallowed_types = set()
659
661
 
@@ -673,9 +675,9 @@ class SlotFillingManager:
673
675
  )
674
676
  for event in custom_events:
675
677
  if isinstance(event, SlotSet):
676
- slot_events.append(event)
678
+ validated_slot_events.append(event)
677
679
  elif isinstance(event, BotUttered):
678
- slot_events.append(event)
680
+ validated_slot_events.append(event)
679
681
  else:
680
682
  disallowed_types.add(event.type_name)
681
683
  except (RasaException, ClientResponseError) as e:
@@ -699,7 +701,7 @@ class SlotFillingManager:
699
701
  f"updated with this event.",
700
702
  )
701
703
 
702
- return slot_events
704
+ return validated_slot_events
703
705
 
704
706
  async def execute_validation_action(
705
707
  self,
@@ -722,7 +724,11 @@ class SlotFillingManager:
722
724
  return cast(List[Event], slot_events)
723
725
 
724
726
  validate_events = await self._run_custom_action(
725
- ACTION_VALIDATE_SLOT_MAPPINGS, output_channel, nlg, recreate_tracker=True
727
+ ACTION_VALIDATE_SLOT_MAPPINGS,
728
+ output_channel,
729
+ nlg,
730
+ recreate_tracker=True,
731
+ slot_events=cast(List[Event], slot_events),
726
732
  )
727
733
  validated_slot_names = [
728
734
  event.key for event in validate_events if isinstance(event, SlotSet)
@@ -55,4 +55,3 @@ SPLIT_ENTITIES_BY_COMMA_DEFAULT_VALUE = True
55
55
  SINGLE_ENTITY_ALLOWED_INTERLEAVING_CHARSET = {".", ",", " ", ";"}
56
56
 
57
57
  SET_SLOT_COMMAND = "set slot"
58
- HANDLE_DIGRESSIONS_COMMAND = "handle digressions"
@@ -7,7 +7,17 @@ import os
7
7
  import pkgutil
8
8
  import sys
9
9
  from types import ModuleType
10
- from typing import Any, Callable, Collection, Dict, List, Optional, Sequence, Text, Type
10
+ from typing import (
11
+ Any,
12
+ Callable,
13
+ Collection,
14
+ Dict,
15
+ List,
16
+ Optional,
17
+ Sequence,
18
+ Text,
19
+ Type,
20
+ )
11
21
 
12
22
  import rasa.shared.utils.io
13
23
  from rasa.exceptions import MissingDependencyException