rasa-pro 3.12.0.dev11__py3-none-any.whl → 3.12.0.dev12__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 (71) hide show
  1. rasa/cli/inspect.py +1 -20
  2. rasa/cli/shell.py +3 -3
  3. rasa/core/actions/action.py +7 -20
  4. rasa/core/actions/forms.py +5 -10
  5. rasa/core/channels/__init__.py +0 -2
  6. rasa/core/channels/voice_ready/audiocodes.py +23 -42
  7. rasa/core/channels/voice_stream/browser_audio.py +0 -1
  8. rasa/core/channels/voice_stream/call_state.py +1 -7
  9. rasa/core/channels/voice_stream/tts/azure.py +1 -2
  10. rasa/core/channels/voice_stream/tts/cartesia.py +3 -16
  11. rasa/core/channels/voice_stream/twilio_media_streams.py +1 -2
  12. rasa/core/channels/voice_stream/voice_channel.py +1 -2
  13. rasa/core/migrate.py +2 -2
  14. rasa/core/policies/flows/flow_executor.py +42 -36
  15. rasa/core/run.py +3 -4
  16. rasa/dialogue_understanding/commands/can_not_handle_command.py +2 -2
  17. rasa/dialogue_understanding/commands/cancel_flow_command.py +4 -62
  18. rasa/dialogue_understanding/commands/change_flow_command.py +2 -2
  19. rasa/dialogue_understanding/commands/chit_chat_answer_command.py +2 -2
  20. rasa/dialogue_understanding/commands/clarify_command.py +2 -2
  21. rasa/dialogue_understanding/commands/correct_slots_command.py +2 -11
  22. rasa/dialogue_understanding/commands/human_handoff_command.py +2 -2
  23. rasa/dialogue_understanding/commands/knowledge_answer_command.py +2 -2
  24. rasa/dialogue_understanding/commands/repeat_bot_messages_command.py +2 -2
  25. rasa/dialogue_understanding/commands/set_slot_command.py +15 -7
  26. rasa/dialogue_understanding/commands/skip_question_command.py +2 -2
  27. rasa/dialogue_understanding/commands/start_flow_command.py +2 -43
  28. rasa/dialogue_understanding/commands/utils.py +1 -1
  29. rasa/dialogue_understanding/constants.py +0 -1
  30. rasa/dialogue_understanding/generator/command_generator.py +73 -110
  31. rasa/dialogue_understanding/generator/command_parser.py +1 -1
  32. rasa/dialogue_understanding/generator/llm_based_command_generator.py +3 -161
  33. rasa/dialogue_understanding/generator/multi_step/multi_step_llm_command_generator.py +2 -10
  34. rasa/dialogue_understanding/generator/nlu_command_adapter.py +3 -44
  35. rasa/dialogue_understanding/generator/single_step/command_prompt_template.jinja2 +79 -53
  36. rasa/dialogue_understanding/generator/single_step/single_step_llm_command_generator.py +19 -11
  37. rasa/dialogue_understanding/generator/utils.py +1 -32
  38. rasa/dialogue_understanding/patterns/correction.py +1 -13
  39. rasa/dialogue_understanding/patterns/default_flows_for_patterns.yml +2 -62
  40. rasa/dialogue_understanding/processor/command_processor.py +28 -115
  41. rasa/dialogue_understanding/utils.py +0 -31
  42. rasa/dialogue_understanding_test/README.md +0 -50
  43. rasa/dialogue_understanding_test/test_case_simulation/test_case_tracker_simulator.py +3 -3
  44. rasa/model_service.py +0 -4
  45. rasa/model_training.py +27 -24
  46. rasa/shared/core/constants.py +3 -28
  47. rasa/shared/core/domain.py +20 -13
  48. rasa/shared/core/events.py +2 -13
  49. rasa/shared/core/flows/flow.py +0 -17
  50. rasa/shared/core/flows/flows_yaml_schema.json +0 -38
  51. rasa/shared/core/flows/steps/collect.py +1 -18
  52. rasa/shared/core/flows/utils.py +1 -16
  53. rasa/shared/core/slot_mappings.py +108 -144
  54. rasa/shared/core/slots.py +2 -23
  55. rasa/shared/core/trackers.py +1 -3
  56. rasa/shared/nlu/constants.py +0 -1
  57. rasa/shared/utils/llm.py +1 -1
  58. rasa/shared/utils/schemas/domain.yml +1 -0
  59. rasa/telemetry.py +13 -43
  60. rasa/utils/common.py +1 -0
  61. rasa/validator.py +82 -189
  62. rasa/version.py +1 -1
  63. {rasa_pro-3.12.0.dev11.dist-info → rasa_pro-3.12.0.dev12.dist-info}/METADATA +1 -1
  64. {rasa_pro-3.12.0.dev11.dist-info → rasa_pro-3.12.0.dev12.dist-info}/RECORD +67 -71
  65. rasa/core/actions/action_handle_digressions.py +0 -142
  66. rasa/core/channels/voice_stream/genesys.py +0 -331
  67. rasa/dialogue_understanding/commands/handle_digressions_command.py +0 -150
  68. rasa/dialogue_understanding/patterns/handle_digressions.py +0 -81
  69. {rasa_pro-3.12.0.dev11.dist-info → rasa_pro-3.12.0.dev12.dist-info}/NOTICE +0 -0
  70. {rasa_pro-3.12.0.dev11.dist-info → rasa_pro-3.12.0.dev12.dist-info}/WHEEL +0 -0
  71. {rasa_pro-3.12.0.dev11.dist-info → rasa_pro-3.12.0.dev12.dist-info}/entry_points.txt +0 -0
@@ -1032,7 +1032,6 @@ class SlotSet(Event):
1032
1032
  value: Optional[Any] = None,
1033
1033
  timestamp: Optional[float] = None,
1034
1034
  metadata: Optional[Dict[Text, Any]] = None,
1035
- filled_by: Optional[str] = None,
1036
1035
  ) -> None:
1037
1036
  """Creates event to set slot.
1038
1037
 
@@ -1044,7 +1043,6 @@ class SlotSet(Event):
1044
1043
  """
1045
1044
  self.key = key
1046
1045
  self.value = value
1047
- self._filled_by = filled_by
1048
1046
  super().__init__(timestamp, metadata)
1049
1047
 
1050
1048
  def __repr__(self) -> Text:
@@ -1062,14 +1060,6 @@ class SlotSet(Event):
1062
1060
 
1063
1061
  return (self.key, self.value) == (other.key, other.value)
1064
1062
 
1065
- @property
1066
- def filled_by(self) -> Optional[str]:
1067
- return self._filled_by
1068
-
1069
- @filled_by.setter
1070
- def filled_by(self, value: str) -> None:
1071
- self._filled_by = value
1072
-
1073
1063
  def as_story_string(self) -> Text:
1074
1064
  """Returns text representation of event."""
1075
1065
  props = json.dumps({self.key: self.value}, ensure_ascii=False)
@@ -1091,7 +1081,7 @@ class SlotSet(Event):
1091
1081
  def as_dict(self) -> Dict[Text, Any]:
1092
1082
  """Returns serialized event."""
1093
1083
  d = super().as_dict()
1094
- d.update({"name": self.key, "value": self.value, "filled_by": self.filled_by})
1084
+ d.update({"name": self.key, "value": self.value})
1095
1085
  return d
1096
1086
 
1097
1087
  @classmethod
@@ -1102,14 +1092,13 @@ class SlotSet(Event):
1102
1092
  parameters.get("value"),
1103
1093
  parameters.get("timestamp"),
1104
1094
  parameters.get("metadata"),
1105
- filled_by=parameters.get("filled_by"),
1106
1095
  )
1107
1096
  except KeyError as e:
1108
1097
  raise ValueError(f"Failed to parse set slot event. {e}")
1109
1098
 
1110
1099
  def apply_to(self, tracker: "DialogueStateTracker") -> None:
1111
1100
  """Applies event to current conversation state."""
1112
- tracker._set_slot(self.key, self.value, self.filled_by)
1101
+ tracker._set_slot(self.key, self.value)
1113
1102
 
1114
1103
 
1115
1104
  class Restarted(AlwaysEqualEventMixin):
@@ -11,10 +11,6 @@ from pypred import Predicate
11
11
 
12
12
  import rasa.shared.utils.io
13
13
  from rasa.shared.constants import RASA_DEFAULT_FLOW_PATTERN_PREFIX
14
- from rasa.shared.core.constants import (
15
- KEY_ASK_CONFIRM_DIGRESSIONS,
16
- KEY_BLOCK_DIGRESSIONS,
17
- )
18
14
  from rasa.shared.core.flows.flow_path import FlowPath, FlowPathsList, PathNode
19
15
  from rasa.shared.core.flows.flow_step import FlowStep
20
16
  from rasa.shared.core.flows.flow_step_links import (
@@ -37,7 +33,6 @@ from rasa.shared.core.flows.steps.constants import (
37
33
  START_STEP,
38
34
  )
39
35
  from rasa.shared.core.flows.steps.continuation import ContinueFlowStep
40
- from rasa.shared.core.flows.utils import extract_digression_prop
41
36
  from rasa.shared.core.slots import Slot
42
37
 
43
38
  structlogger = structlog.get_logger()
@@ -67,10 +62,6 @@ class Flow:
67
62
  """The path to the file where the flow is stored."""
68
63
  persisted_slots: List[str] = field(default_factory=list)
69
64
  """The list of slots that should be persisted after the flow ends."""
70
- ask_confirm_digressions: List[str] = field(default_factory=list)
71
- """The flow ids for which the assistant should ask for confirmation."""
72
- block_digressions: List[str] = field(default_factory=list)
73
- """The flow ids that the assistant should block from digressing to."""
74
65
 
75
66
  @staticmethod
76
67
  def from_json(
@@ -107,10 +98,6 @@ class Flow:
107
98
  # data. When the model is trained, take the provided file_path.
108
99
  file_path=data.get("file_path") if "file_path" in data else file_path,
109
100
  persisted_slots=data.get("persisted_slots", []),
110
- ask_confirm_digressions=extract_digression_prop(
111
- KEY_ASK_CONFIRM_DIGRESSIONS, data
112
- ),
113
- block_digressions=extract_digression_prop(KEY_BLOCK_DIGRESSIONS, data),
114
101
  )
115
102
 
116
103
  def get_full_name(self) -> str:
@@ -185,10 +172,6 @@ class Flow:
185
172
  data["file_path"] = self.file_path
186
173
  if self.persisted_slots:
187
174
  data["persisted_slots"] = self.persisted_slots
188
- if self.ask_confirm_digressions:
189
- data[KEY_ASK_CONFIRM_DIGRESSIONS] = self.ask_confirm_digressions
190
- if self.block_digressions:
191
- data[KEY_BLOCK_DIGRESSIONS] = self.block_digressions
192
175
 
193
176
  return data
194
177
 
@@ -217,12 +217,6 @@
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
  },
@@ -253,32 +247,6 @@
253
247
  }
254
248
  }
255
249
  },
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
250
  "flow": {
283
251
  "required": [
284
252
  "steps",
@@ -314,12 +282,6 @@
314
282
  },
315
283
  "persisted_slots": {
316
284
  "$ref": "#/$defs/persisted_slots"
317
- },
318
- "ask_confirm_digressions": {
319
- "$ref": "#/$defs/ask_confirm_digressions"
320
- },
321
- "block_digressions": {
322
- "$ref": "#/$defs/block_digressions"
323
285
  }
324
286
  }
325
287
  },
@@ -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
 
14
9
 
15
10
  @dataclass
@@ -64,10 +59,6 @@ class CollectInformationFlowStep(FlowStep):
64
59
  """Whether to always ask the question even if the slot is already filled."""
65
60
  reset_after_flow_ends: bool = True
66
61
  """Whether to reset the slot value at the end of the flow."""
67
- ask_confirm_digressions: List[str] = field(default_factory=list)
68
- """The flow id digressions for which the assistant should ask for confirmation."""
69
- block_digressions: List[str] = field(default_factory=list)
70
- """The flow id digressions that should be blocked during the flow step."""
71
62
 
72
63
  @classmethod
73
64
  def from_json(
@@ -95,10 +86,6 @@ class CollectInformationFlowStep(FlowStep):
95
86
  SlotRejection.from_dict(rejection)
96
87
  for rejection in data.get("rejections", [])
97
88
  ],
98
- ask_confirm_digressions=extract_digression_prop(
99
- KEY_ASK_CONFIRM_DIGRESSIONS, data
100
- ),
101
- block_digressions=extract_digression_prop(KEY_BLOCK_DIGRESSIONS, data),
102
89
  **base.__dict__,
103
90
  )
104
91
 
@@ -114,10 +101,6 @@ class CollectInformationFlowStep(FlowStep):
114
101
  data["ask_before_filling"] = self.ask_before_filling
115
102
  data["reset_after_flow_ends"] = self.reset_after_flow_ends
116
103
  data["rejections"] = [rejection.as_dict() for rejection in self.rejections]
117
- data["ask_confirm_digressions"] = self.ask_confirm_digressions
118
- data["block_digressions"] = (
119
- self.block_digressions if self.block_digressions else False
120
- )
121
104
 
122
105
  return data
123
106
 
@@ -1,10 +1,9 @@
1
- from typing import Any, Dict, List, Set
1
+ from typing import Set
2
2
 
3
3
  from rasa.shared.utils.io import raise_deprecation_warning
4
4
 
5
5
  RESET_PROPERTY_NAME = "reset_after_flow_ends"
6
6
  PERSIST_PROPERTY_NAME = "persisted_slots"
7
- ALL_LABEL = "ALL"
8
7
 
9
8
 
10
9
  def warn_deprecated_collect_step_config(flow_id: str, collect_step: str) -> None:
@@ -39,17 +38,3 @@ def get_invalid_slot_persistence_config_error_message(
39
38
  f"are neither used in a collect step nor a set_slot step of the flow. "
40
39
  f"Please remove such slots from the '{PERSIST_PROPERTY_NAME}' property."
41
40
  )
42
-
43
-
44
- def extract_digression_prop(prop: str, data: Dict[str, Any]) -> List[str]:
45
- """Extracts the digression property from the data.
46
-
47
- There can be two types of properties: ask_confirm_digressions and
48
- block_digressions.
49
- """
50
- digression_property = data.get(prop, [])
51
-
52
- if isinstance(digression_property, bool):
53
- digression_property = [ALL_LABEL] if digression_property else []
54
-
55
- return digression_property