rasa-pro 3.11.0a4.dev3__py3-none-any.whl → 3.11.0rc2__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 (184) hide show
  1. rasa/__main__.py +22 -12
  2. rasa/api.py +1 -1
  3. rasa/cli/arguments/default_arguments.py +1 -2
  4. rasa/cli/arguments/shell.py +5 -1
  5. rasa/cli/e2e_test.py +1 -1
  6. rasa/cli/evaluate.py +8 -8
  7. rasa/cli/inspect.py +6 -4
  8. rasa/cli/llm_fine_tuning.py +1 -1
  9. rasa/cli/project_templates/calm/config.yml +5 -7
  10. rasa/cli/project_templates/calm/endpoints.yml +8 -0
  11. rasa/cli/project_templates/tutorial/config.yml +8 -5
  12. rasa/cli/project_templates/tutorial/data/flows.yml +1 -1
  13. rasa/cli/project_templates/tutorial/data/patterns.yml +5 -0
  14. rasa/cli/project_templates/tutorial/domain.yml +14 -0
  15. rasa/cli/project_templates/tutorial/endpoints.yml +7 -7
  16. rasa/cli/run.py +1 -1
  17. rasa/cli/scaffold.py +4 -2
  18. rasa/cli/studio/studio.py +18 -8
  19. rasa/cli/utils.py +5 -0
  20. rasa/cli/x.py +8 -8
  21. rasa/constants.py +1 -1
  22. rasa/core/actions/action_repeat_bot_messages.py +17 -0
  23. rasa/core/channels/channel.py +20 -0
  24. rasa/core/channels/inspector/dist/assets/{arc-6852c607.js → arc-bc141fb2.js} +1 -1
  25. rasa/core/channels/inspector/dist/assets/{c4Diagram-d0fbc5ce-acc952b2.js → c4Diagram-d0fbc5ce-be2db283.js} +1 -1
  26. rasa/core/channels/inspector/dist/assets/{classDiagram-936ed81e-848a7597.js → classDiagram-936ed81e-55366915.js} +1 -1
  27. rasa/core/channels/inspector/dist/assets/{classDiagram-v2-c3cb15f1-a73d3e68.js → classDiagram-v2-c3cb15f1-bb529518.js} +1 -1
  28. rasa/core/channels/inspector/dist/assets/{createText-62fc7601-e5ee049d.js → createText-62fc7601-b0ec81d6.js} +1 -1
  29. rasa/core/channels/inspector/dist/assets/{edges-f2ad444c-771e517e.js → edges-f2ad444c-6166330c.js} +1 -1
  30. rasa/core/channels/inspector/dist/assets/{erDiagram-9d236eb7-aa347178.js → erDiagram-9d236eb7-5ccc6a8e.js} +1 -1
  31. rasa/core/channels/inspector/dist/assets/{flowDb-1972c806-651fc57d.js → flowDb-1972c806-fca3bfe4.js} +1 -1
  32. rasa/core/channels/inspector/dist/assets/{flowDiagram-7ea5b25a-ca67804f.js → flowDiagram-7ea5b25a-4739080f.js} +1 -1
  33. rasa/core/channels/inspector/dist/assets/flowDiagram-v2-855bc5b3-736177bf.js +1 -0
  34. rasa/core/channels/inspector/dist/assets/{flowchart-elk-definition-abe16c3d-2dbc568d.js → flowchart-elk-definition-abe16c3d-7c1b0e0f.js} +1 -1
  35. rasa/core/channels/inspector/dist/assets/{ganttDiagram-9b5ea136-25a65bd8.js → ganttDiagram-9b5ea136-772fd050.js} +1 -1
  36. rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-99d0ae7c-fdc7378d.js → gitGraphDiagram-99d0ae7c-8eae1dc9.js} +1 -1
  37. rasa/core/channels/inspector/dist/assets/{index-2c4b9a3b-6f1fd606.js → index-2c4b9a3b-f55afcdf.js} +1 -1
  38. rasa/core/channels/inspector/dist/assets/{index-efdd30c1.js → index-e7cef9de.js} +68 -68
  39. rasa/core/channels/inspector/dist/assets/{infoDiagram-736b4530-cb1a041a.js → infoDiagram-736b4530-124d4a14.js} +1 -1
  40. rasa/core/channels/inspector/dist/assets/{journeyDiagram-df861f2b-14609879.js → journeyDiagram-df861f2b-7c4fae44.js} +1 -1
  41. rasa/core/channels/inspector/dist/assets/{layout-2490f52b.js → layout-b9885fb6.js} +1 -1
  42. rasa/core/channels/inspector/dist/assets/{line-40186f1f.js → line-7c59abb6.js} +1 -1
  43. rasa/core/channels/inspector/dist/assets/{linear-08814e93.js → linear-4776f780.js} +1 -1
  44. rasa/core/channels/inspector/dist/assets/{mindmap-definition-beec6740-1a534584.js → mindmap-definition-beec6740-2332c46c.js} +1 -1
  45. rasa/core/channels/inspector/dist/assets/{pieDiagram-dbbf0591-72397b61.js → pieDiagram-dbbf0591-8fb39303.js} +1 -1
  46. rasa/core/channels/inspector/dist/assets/{quadrantDiagram-4d7f4fd6-3bb0b6a3.js → quadrantDiagram-4d7f4fd6-3c7180a2.js} +1 -1
  47. rasa/core/channels/inspector/dist/assets/{requirementDiagram-6fc4c22a-57334f61.js → requirementDiagram-6fc4c22a-e910bcb8.js} +1 -1
  48. rasa/core/channels/inspector/dist/assets/{sankeyDiagram-8f13d901-111e1297.js → sankeyDiagram-8f13d901-ead16c89.js} +1 -1
  49. rasa/core/channels/inspector/dist/assets/{sequenceDiagram-b655622a-10bcfe62.js → sequenceDiagram-b655622a-29a02a19.js} +1 -1
  50. rasa/core/channels/inspector/dist/assets/{stateDiagram-59f0c015-acaf7513.js → stateDiagram-59f0c015-042b3137.js} +1 -1
  51. rasa/core/channels/inspector/dist/assets/{stateDiagram-v2-2b26beab-3ec2a235.js → stateDiagram-v2-2b26beab-2178c0f3.js} +1 -1
  52. rasa/core/channels/inspector/dist/assets/{styles-080da4f6-62730289.js → styles-080da4f6-23ffa4fc.js} +1 -1
  53. rasa/core/channels/inspector/dist/assets/{styles-3dcbcfbf-5284ee76.js → styles-3dcbcfbf-94f59763.js} +1 -1
  54. rasa/core/channels/inspector/dist/assets/{styles-9c745c82-642435e3.js → styles-9c745c82-78a6bebc.js} +1 -1
  55. rasa/core/channels/inspector/dist/assets/{svgDrawCommon-4835440b-b250a350.js → svgDrawCommon-4835440b-eae2a6f6.js} +1 -1
  56. rasa/core/channels/inspector/dist/assets/{timeline-definition-5b62e21b-c2b147ed.js → timeline-definition-5b62e21b-5c968d92.js} +1 -1
  57. rasa/core/channels/inspector/dist/assets/{xychartDiagram-2b33534f-f92cfea9.js → xychartDiagram-2b33534f-fd3db0d5.js} +1 -1
  58. rasa/core/channels/inspector/dist/index.html +1 -1
  59. rasa/core/channels/inspector/src/App.tsx +1 -1
  60. rasa/core/channels/inspector/src/helpers/audiostream.ts +77 -16
  61. rasa/core/channels/socketio.py +2 -1
  62. rasa/core/channels/telegram.py +1 -1
  63. rasa/core/channels/twilio.py +1 -1
  64. rasa/core/channels/voice_ready/audiocodes.py +12 -0
  65. rasa/core/channels/voice_ready/jambonz.py +15 -4
  66. rasa/core/channels/voice_ready/twilio_voice.py +6 -21
  67. rasa/core/channels/voice_stream/asr/asr_event.py +5 -0
  68. rasa/core/channels/voice_stream/asr/azure.py +122 -0
  69. rasa/core/channels/voice_stream/asr/deepgram.py +16 -6
  70. rasa/core/channels/voice_stream/audio_bytes.py +1 -0
  71. rasa/core/channels/voice_stream/browser_audio.py +31 -8
  72. rasa/core/channels/voice_stream/call_state.py +23 -0
  73. rasa/core/channels/voice_stream/tts/azure.py +6 -2
  74. rasa/core/channels/voice_stream/tts/cartesia.py +10 -6
  75. rasa/core/channels/voice_stream/tts/tts_engine.py +1 -0
  76. rasa/core/channels/voice_stream/twilio_media_streams.py +27 -18
  77. rasa/core/channels/voice_stream/util.py +4 -4
  78. rasa/core/channels/voice_stream/voice_channel.py +189 -39
  79. rasa/core/featurizers/single_state_featurizer.py +22 -1
  80. rasa/core/featurizers/tracker_featurizers.py +115 -18
  81. rasa/core/nlg/contextual_response_rephraser.py +32 -30
  82. rasa/core/persistor.py +86 -39
  83. rasa/core/policies/enterprise_search_policy.py +119 -60
  84. rasa/core/policies/flows/flow_executor.py +7 -4
  85. rasa/core/policies/intentless_policy.py +78 -22
  86. rasa/core/policies/ted_policy.py +58 -33
  87. rasa/core/policies/unexpected_intent_policy.py +15 -7
  88. rasa/core/processor.py +25 -0
  89. rasa/core/training/interactive.py +34 -35
  90. rasa/core/utils.py +8 -3
  91. rasa/dialogue_understanding/coexistence/llm_based_router.py +39 -12
  92. rasa/dialogue_understanding/commands/change_flow_command.py +6 -0
  93. rasa/dialogue_understanding/commands/user_silence_command.py +59 -0
  94. rasa/dialogue_understanding/commands/utils.py +5 -0
  95. rasa/dialogue_understanding/generator/constants.py +2 -0
  96. rasa/dialogue_understanding/generator/flow_retrieval.py +49 -4
  97. rasa/dialogue_understanding/generator/llm_based_command_generator.py +37 -23
  98. rasa/dialogue_understanding/generator/multi_step/multi_step_llm_command_generator.py +57 -10
  99. rasa/dialogue_understanding/generator/nlu_command_adapter.py +19 -1
  100. rasa/dialogue_understanding/generator/single_step/single_step_llm_command_generator.py +71 -11
  101. rasa/dialogue_understanding/patterns/default_flows_for_patterns.yml +39 -0
  102. rasa/dialogue_understanding/patterns/user_silence.py +37 -0
  103. rasa/dialogue_understanding/processor/command_processor.py +21 -1
  104. rasa/e2e_test/e2e_test_case.py +85 -6
  105. rasa/e2e_test/e2e_test_runner.py +4 -2
  106. rasa/e2e_test/utils/io.py +1 -1
  107. rasa/engine/validation.py +316 -10
  108. rasa/model_manager/config.py +15 -3
  109. rasa/model_manager/model_api.py +15 -7
  110. rasa/model_manager/runner_service.py +8 -6
  111. rasa/model_manager/socket_bridge.py +6 -3
  112. rasa/model_manager/trainer_service.py +7 -5
  113. rasa/model_manager/utils.py +28 -7
  114. rasa/model_service.py +9 -2
  115. rasa/model_training.py +2 -0
  116. rasa/nlu/classifiers/diet_classifier.py +38 -25
  117. rasa/nlu/classifiers/logistic_regression_classifier.py +22 -9
  118. rasa/nlu/classifiers/sklearn_intent_classifier.py +37 -16
  119. rasa/nlu/extractors/crf_entity_extractor.py +93 -50
  120. rasa/nlu/featurizers/sparse_featurizer/count_vectors_featurizer.py +45 -16
  121. rasa/nlu/featurizers/sparse_featurizer/lexical_syntactic_featurizer.py +52 -17
  122. rasa/nlu/featurizers/sparse_featurizer/regex_featurizer.py +5 -3
  123. rasa/nlu/tokenizers/whitespace_tokenizer.py +3 -14
  124. rasa/server.py +3 -1
  125. rasa/shared/constants.py +36 -3
  126. rasa/shared/core/constants.py +7 -0
  127. rasa/shared/core/domain.py +26 -0
  128. rasa/shared/core/flows/flow.py +5 -0
  129. rasa/shared/core/flows/flows_list.py +5 -1
  130. rasa/shared/core/flows/flows_yaml_schema.json +10 -0
  131. rasa/shared/core/flows/utils.py +39 -0
  132. rasa/shared/core/flows/validation.py +96 -0
  133. rasa/shared/core/slots.py +5 -0
  134. rasa/shared/nlu/training_data/features.py +120 -2
  135. rasa/shared/providers/_configs/azure_openai_client_config.py +5 -3
  136. rasa/shared/providers/_configs/litellm_router_client_config.py +200 -0
  137. rasa/shared/providers/_configs/model_group_config.py +167 -0
  138. rasa/shared/providers/_configs/openai_client_config.py +1 -1
  139. rasa/shared/providers/_configs/rasa_llm_client_config.py +73 -0
  140. rasa/shared/providers/_configs/self_hosted_llm_client_config.py +1 -0
  141. rasa/shared/providers/_configs/utils.py +16 -0
  142. rasa/shared/providers/embedding/_base_litellm_embedding_client.py +18 -29
  143. rasa/shared/providers/embedding/azure_openai_embedding_client.py +54 -21
  144. rasa/shared/providers/embedding/litellm_router_embedding_client.py +135 -0
  145. rasa/shared/providers/llm/_base_litellm_client.py +37 -31
  146. rasa/shared/providers/llm/azure_openai_llm_client.py +50 -29
  147. rasa/shared/providers/llm/litellm_router_llm_client.py +127 -0
  148. rasa/shared/providers/llm/rasa_llm_client.py +112 -0
  149. rasa/shared/providers/llm/self_hosted_llm_client.py +1 -1
  150. rasa/shared/providers/mappings.py +19 -0
  151. rasa/shared/providers/router/__init__.py +0 -0
  152. rasa/shared/providers/router/_base_litellm_router_client.py +149 -0
  153. rasa/shared/providers/router/router_client.py +73 -0
  154. rasa/shared/utils/common.py +8 -0
  155. rasa/shared/utils/health_check/__init__.py +0 -0
  156. rasa/shared/utils/health_check/embeddings_health_check_mixin.py +31 -0
  157. rasa/shared/utils/health_check/health_check.py +256 -0
  158. rasa/shared/utils/health_check/llm_health_check_mixin.py +31 -0
  159. rasa/shared/utils/io.py +28 -6
  160. rasa/shared/utils/llm.py +353 -46
  161. rasa/shared/utils/yaml.py +111 -73
  162. rasa/studio/auth.py +3 -5
  163. rasa/studio/config.py +13 -4
  164. rasa/studio/constants.py +1 -0
  165. rasa/studio/data_handler.py +10 -3
  166. rasa/studio/upload.py +81 -26
  167. rasa/telemetry.py +92 -17
  168. rasa/tracing/config.py +2 -0
  169. rasa/tracing/instrumentation/attribute_extractors.py +94 -17
  170. rasa/tracing/instrumentation/instrumentation.py +121 -0
  171. rasa/utils/common.py +5 -0
  172. rasa/utils/io.py +7 -81
  173. rasa/utils/log_utils.py +9 -2
  174. rasa/utils/sanic_error_handler.py +32 -0
  175. rasa/utils/tensorflow/feature_array.py +366 -0
  176. rasa/utils/tensorflow/model_data.py +2 -193
  177. rasa/validator.py +70 -0
  178. rasa/version.py +1 -1
  179. {rasa_pro-3.11.0a4.dev3.dist-info → rasa_pro-3.11.0rc2.dist-info}/METADATA +11 -10
  180. {rasa_pro-3.11.0a4.dev3.dist-info → rasa_pro-3.11.0rc2.dist-info}/RECORD +183 -163
  181. rasa/core/channels/inspector/dist/assets/flowDiagram-v2-855bc5b3-587d82d8.js +0 -1
  182. {rasa_pro-3.11.0a4.dev3.dist-info → rasa_pro-3.11.0rc2.dist-info}/NOTICE +0 -0
  183. {rasa_pro-3.11.0a4.dev3.dist-info → rasa_pro-3.11.0rc2.dist-info}/WHEEL +0 -0
  184. {rasa_pro-3.11.0a4.dev3.dist-info → rasa_pro-3.11.0rc2.dist-info}/entry_points.txt +0 -0
@@ -20,6 +20,8 @@ import numpy as np
20
20
  import scipy.sparse
21
21
  from sklearn.model_selection import train_test_split
22
22
 
23
+ from rasa.utils.tensorflow.feature_array import FeatureArray
24
+
23
25
  logger = logging.getLogger(__name__)
24
26
 
25
27
 
@@ -37,199 +39,6 @@ def ragged_array_to_ndarray(ragged_array: Iterable[np.ndarray]) -> np.ndarray:
37
39
  return np.array(ragged_array, dtype=object)
38
40
 
39
41
 
40
- class FeatureArray(np.ndarray):
41
- """Stores any kind of features ready to be used by a RasaModel.
42
-
43
- Next to the input numpy array of features, it also received the number of
44
- dimensions of the features.
45
- As our features can have 1 to 4 dimensions we might have different number of numpy
46
- arrays stacked. The number of dimensions helps us to figure out how to handle this
47
- particular feature array. Also, it is automatically determined whether the feature
48
- array is sparse or not and the number of units is determined as well.
49
-
50
- Subclassing np.array: https://numpy.org/doc/stable/user/basics.subclassing.html
51
- """
52
-
53
- def __new__(
54
- cls, input_array: np.ndarray, number_of_dimensions: int
55
- ) -> "FeatureArray":
56
- """Create and return a new object. See help(type) for accurate signature."""
57
- FeatureArray._validate_number_of_dimensions(number_of_dimensions, input_array)
58
-
59
- feature_array = np.asarray(input_array).view(cls)
60
-
61
- if number_of_dimensions <= 2:
62
- feature_array.units = input_array.shape[-1]
63
- feature_array.is_sparse = isinstance(input_array[0], scipy.sparse.spmatrix)
64
- elif number_of_dimensions == 3:
65
- feature_array.units = input_array[0].shape[-1]
66
- feature_array.is_sparse = isinstance(input_array[0], scipy.sparse.spmatrix)
67
- elif number_of_dimensions == 4:
68
- feature_array.units = input_array[0][0].shape[-1]
69
- feature_array.is_sparse = isinstance(
70
- input_array[0][0], scipy.sparse.spmatrix
71
- )
72
- else:
73
- raise ValueError(
74
- f"Number of dimensions '{number_of_dimensions}' currently not "
75
- f"supported."
76
- )
77
-
78
- feature_array.number_of_dimensions = number_of_dimensions
79
-
80
- return feature_array
81
-
82
- def __init__(
83
- self, input_array: Any, number_of_dimensions: int, **kwargs: Any
84
- ) -> None:
85
- """Initialize. FeatureArray.
86
-
87
- Needed in order to avoid 'Invalid keyword argument number_of_dimensions
88
- to function FeatureArray.__init__ '
89
- Args:
90
- input_array: the array that contains features
91
- number_of_dimensions: number of dimensions in input_array
92
- """
93
- super().__init__(**kwargs)
94
- self.number_of_dimensions = number_of_dimensions
95
-
96
- def __array_finalize__(self, obj: Optional[np.ndarray]) -> None:
97
- """This method is called when the system allocates a new array from obj.
98
-
99
- Args:
100
- obj: A subclass (subtype) of ndarray.
101
- """
102
- if obj is None:
103
- return
104
-
105
- self.units = getattr(obj, "units", None)
106
- self.number_of_dimensions = getattr(obj, "number_of_dimensions", None) # type: ignore[assignment]
107
- self.is_sparse = getattr(obj, "is_sparse", None)
108
-
109
- default_attributes = {
110
- "units": self.units,
111
- "number_of_dimensions": self.number_of_dimensions,
112
- "is_spare": self.is_sparse,
113
- }
114
- self.__dict__.update(default_attributes)
115
-
116
- # pytype: disable=attribute-error
117
- def __array_ufunc__(
118
- self, ufunc: Any, method: Text, *inputs: Any, **kwargs: Any
119
- ) -> Any:
120
- """Overwrite this method as we are subclassing numpy array.
121
-
122
- Args:
123
- ufunc: The ufunc object that was called.
124
- method: A string indicating which Ufunc method was called
125
- (one of "__call__", "reduce", "reduceat", "accumulate", "outer",
126
- "inner").
127
- *inputs: A tuple of the input arguments to the ufunc.
128
- **kwargs: Any additional arguments
129
-
130
- Returns:
131
- The result of the operation.
132
- """
133
- f = {
134
- "reduce": ufunc.reduce,
135
- "accumulate": ufunc.accumulate,
136
- "reduceat": ufunc.reduceat,
137
- "outer": ufunc.outer,
138
- "at": ufunc.at,
139
- "__call__": ufunc,
140
- }
141
- # convert the inputs to np.ndarray to prevent recursion, call the function,
142
- # then cast it back as FeatureArray
143
- output = FeatureArray(
144
- f[method](*(i.view(np.ndarray) for i in inputs), **kwargs),
145
- number_of_dimensions=kwargs["number_of_dimensions"],
146
- )
147
- output.__dict__ = self.__dict__ # carry forward attributes
148
- return output
149
-
150
- def __reduce__(self) -> Tuple[Any, Any, Any]:
151
- """Needed in order to pickle this object.
152
-
153
- Returns:
154
- A tuple.
155
- """
156
- pickled_state = super(FeatureArray, self).__reduce__()
157
- if isinstance(pickled_state, str):
158
- raise TypeError("np array __reduce__ returned string instead of tuple.")
159
- new_state = pickled_state[2] + (
160
- self.number_of_dimensions,
161
- self.is_sparse,
162
- self.units,
163
- )
164
- return pickled_state[0], pickled_state[1], new_state
165
-
166
- def __setstate__(self, state: Any, **kwargs: Any) -> None:
167
- """Sets the state.
168
-
169
- Args:
170
- state: The state argument must be a sequence that contains the following
171
- elements version, shape, dtype, isFortan, rawdata.
172
- **kwargs: Any additional parameter
173
- """
174
- # Needed in order to load the object
175
- self.number_of_dimensions = state[-3]
176
- self.is_sparse = state[-2]
177
- self.units = state[-1]
178
- super(FeatureArray, self).__setstate__(state[0:-3], **kwargs)
179
-
180
- # pytype: enable=attribute-error
181
-
182
- @staticmethod
183
- def _validate_number_of_dimensions(
184
- number_of_dimensions: int, input_array: np.ndarray
185
- ) -> None:
186
- """Validates if the the input array has given number of dimensions.
187
-
188
- Args:
189
- number_of_dimensions: number of dimensions
190
- input_array: input array
191
-
192
- Raises: ValueError in case the dimensions do not match
193
- """
194
- _sub_array = input_array
195
- dim = 0
196
- # Go number_of_dimensions into the given input_array
197
- for i in range(1, number_of_dimensions + 1):
198
- _sub_array = _sub_array[0]
199
- if isinstance(_sub_array, scipy.sparse.spmatrix):
200
- dim = i
201
- break
202
- if isinstance(_sub_array, np.ndarray) and _sub_array.shape[0] == 0:
203
- # sequence dimension is 0, we are dealing with "fake" features
204
- dim = i
205
- break
206
-
207
- # If the resulting sub_array is sparse, the remaining number of dimensions
208
- # should be at least 2
209
- if isinstance(_sub_array, scipy.sparse.spmatrix):
210
- if dim > 2:
211
- raise ValueError(
212
- f"Given number of dimensions '{number_of_dimensions}' does not "
213
- f"match dimensions of given input array: {input_array}."
214
- )
215
- elif isinstance(_sub_array, np.ndarray) and _sub_array.shape[0] == 0:
216
- # sequence dimension is 0, we are dealing with "fake" features,
217
- # but they should be of dim 2
218
- if dim > 2:
219
- raise ValueError(
220
- f"Given number of dimensions '{number_of_dimensions}' does not "
221
- f"match dimensions of given input array: {input_array}."
222
- )
223
- # If the resulting sub_array is dense, the sub_array should be a single number
224
- elif not np.issubdtype(type(_sub_array), np.integer) and not isinstance(
225
- _sub_array, (np.float32, np.float64)
226
- ):
227
- raise ValueError(
228
- f"Given number of dimensions '{number_of_dimensions}' does not match "
229
- f"dimensions of given input array: {input_array}."
230
- )
231
-
232
-
233
42
  class FeatureSignature(NamedTuple):
234
43
  """Signature of feature arrays.
235
44
 
rasa/validator.py CHANGED
@@ -22,6 +22,11 @@ from rasa.shared.core.flows.steps.collect import CollectInformationFlowStep
22
22
  from rasa.shared.core.flows.steps.action import ActionFlowStep
23
23
  from rasa.shared.core.flows.steps.link import LinkFlowStep
24
24
  from rasa.shared.core.flows import FlowsList
25
+ from rasa.shared.core.flows.utils import (
26
+ warn_deprecated_collect_step_config,
27
+ get_duplicate_slot_persistence_config_error_message,
28
+ get_invalid_slot_persistence_config_error_message,
29
+ )
25
30
  import rasa.shared.nlu.constants
26
31
  from rasa.shared.constants import (
27
32
  ASSISTANT_ID_DEFAULT_VALUE,
@@ -55,6 +60,7 @@ from rasa.shared.importers.importer import TrainingDataImporter
55
60
  from rasa.shared.nlu.constants import COMMANDS
56
61
  from rasa.shared.nlu.training_data.message import Message
57
62
  from rasa.shared.nlu.training_data.training_data import TrainingData
63
+
58
64
  import rasa.shared.utils.cli
59
65
  import rasa.shared.utils.io
60
66
 
@@ -1237,6 +1243,7 @@ class Validator:
1237
1243
  self.verify_flows_steps_against_domain(),
1238
1244
  self.verify_unique_flows(),
1239
1245
  self.verify_predicates(),
1246
+ self.verify_slot_persistence_configuration(),
1240
1247
  ]
1241
1248
 
1242
1249
  all_good = all(flow_validation_conditions)
@@ -1533,3 +1540,66 @@ class Validator:
1533
1540
  ),
1534
1541
  )
1535
1542
  return False
1543
+
1544
+ def verify_slot_persistence_configuration(self) -> bool:
1545
+ """Verifies the validity of slot persistence after flow ends configuration.
1546
+
1547
+ Only slots used in either a collect step or a set_slot step can be persisted and
1548
+ the configuration can either set at the flow level or the collect step level,
1549
+ but not both.
1550
+
1551
+ Returns:
1552
+ bool: True if all slot persistence configuration is valid, False otherwise.
1553
+
1554
+ Raises:
1555
+ DeprecationWarning: If reset_after_flow_ends is used in collect steps.
1556
+ """
1557
+ all_good = True
1558
+
1559
+ for flow in self.flows.underlying_flows:
1560
+ flow_id = flow.id
1561
+ persist_slots = flow.persisted_slots
1562
+ has_flow_level_persistence = True if persist_slots else False
1563
+ flow_slots = set()
1564
+
1565
+ for step in flow.steps_with_calls_resolved:
1566
+ if isinstance(step, SetSlotsFlowStep):
1567
+ flow_slots.update([slot["key"] for slot in step.slots])
1568
+
1569
+ elif isinstance(step, CollectInformationFlowStep):
1570
+ collect_step = step.collect
1571
+ flow_slots.add(collect_step)
1572
+ if not step.reset_after_flow_ends:
1573
+ warn_deprecated_collect_step_config(flow_id, collect_step)
1574
+
1575
+ if has_flow_level_persistence:
1576
+ structlogger.error(
1577
+ "validator.verify_slot_persistence_configuration.duplicate_config",
1578
+ flow=flow_id,
1579
+ collect_step=collect_step,
1580
+ event_info=get_duplicate_slot_persistence_config_error_message(
1581
+ flow_id, collect_step
1582
+ ),
1583
+ )
1584
+ all_good = False
1585
+
1586
+ if has_flow_level_persistence:
1587
+ if not self._is_persist_slots_valid(persist_slots, flow_slots, flow_id):
1588
+ all_good = False
1589
+ return all_good
1590
+
1591
+ def _is_persist_slots_valid(
1592
+ self, persist_slots: List[str], flow_slots: Set[str], flow_id: str
1593
+ ) -> bool:
1594
+ invalid_slots = set(persist_slots) - flow_slots
1595
+ is_valid = False if invalid_slots else True
1596
+
1597
+ if invalid_slots:
1598
+ structlogger.error(
1599
+ "validator.verify_slot_persistence_configuration.invalid_persist_slot",
1600
+ flow=flow_id,
1601
+ event_info=get_invalid_slot_persistence_config_error_message(
1602
+ flow_id, invalid_slots
1603
+ ),
1604
+ )
1605
+ return is_valid
rasa/version.py CHANGED
@@ -1,3 +1,3 @@
1
1
  # this file will automatically be changed,
2
2
  # do not add anything but the version number here!
3
- __version__ = "3.11.0a4.dev3"
3
+ __version__ = "3.11.0rc2"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rasa-pro
3
- Version: 3.11.0a4.dev3
3
+ Version: 3.11.0rc2
4
4
  Summary: State-of-the-art open-core Conversational AI framework for Enterprises that natively leverages generative AI for effortless assistant development.
5
5
  Home-page: https://rasa.com
6
6
  Keywords: nlp,machine-learning,machine-learning-library,bot,bots,botkit,rasa conversational-agents,conversational-ai,chatbot,chatbot-framework,bot-framework
@@ -35,7 +35,6 @@ Requires-Dist: attrs (>=23.1,<23.2)
35
35
  Requires-Dist: azure-storage-blob (>=12.16.0,<12.17.0)
36
36
  Requires-Dist: boto3 (>=1.35.15,<1.36.0)
37
37
  Requires-Dist: certifi (>=2024.07.04)
38
- Requires-Dist: cloudpickle (>=2.2.1,<3.1)
39
38
  Requires-Dist: colorama (>=0.4.6,<0.5.0) ; sys_platform == "win32"
40
39
  Requires-Dist: colorclass (>=2.2,<2.3)
41
40
  Requires-Dist: coloredlogs (>=15,<16)
@@ -44,6 +43,7 @@ Requires-Dist: confluent-kafka (>=2.3.0,<3.0.0)
44
43
  Requires-Dist: cryptography (>=42.0.5)
45
44
  Requires-Dist: cvg-python-sdk (>=0.5.1,<0.6.0)
46
45
  Requires-Dist: dask (>=2024.7.0,<2024.8.0)
46
+ Requires-Dist: demoji (>=1.1.0,<2.0.0)
47
47
  Requires-Dist: diskcache (>=5.6.3,<5.7.0)
48
48
  Requires-Dist: dnspython (==2.6.1)
49
49
  Requires-Dist: faiss-cpu (>=1.7.4,<2.0.0)
@@ -58,20 +58,19 @@ Requires-Dist: importlib-metadata (>=8.5.0,<8.6.0)
58
58
  Requires-Dist: importlib-resources (==6.1.3)
59
59
  Requires-Dist: jieba (>=0.42.1,<0.43) ; extra == "jieba" or extra == "full"
60
60
  Requires-Dist: jinja2 (>=3.1.4,<4.0.0)
61
- Requires-Dist: joblib (>=1.2.0,<1.3.0)
62
61
  Requires-Dist: jsonpatch (>=1.33,<2.0)
63
62
  Requires-Dist: jsonpickle (>=3.0,<3.1)
64
63
  Requires-Dist: jsonschema (>=4.22)
65
64
  Requires-Dist: keras (==2.14.0)
66
65
  Requires-Dist: langchain (>=0.2.0,<0.3.0)
67
66
  Requires-Dist: langchain-community (>=0.2.0,<0.3.0)
68
- Requires-Dist: litellm (>=1.50.0,<1.51.0)
67
+ Requires-Dist: litellm (>=1.52.6,<1.53.0)
69
68
  Requires-Dist: matplotlib (>=3.7,<3.8)
70
69
  Requires-Dist: mattermostwrapper (>=2.2,<2.3)
71
70
  Requires-Dist: mlflow (>=2.15.1,<3.0.0) ; extra == "mlflow"
72
71
  Requires-Dist: networkx (>=3.1,<3.2)
73
- Requires-Dist: numpy (>=1.23.5,<1.25.0) ; python_version >= "3.9" and python_version < "3.11"
74
- Requires-Dist: openai (>=1.52.0,<1.53.0)
72
+ Requires-Dist: numpy (>=1.26.4,<1.27.0)
73
+ Requires-Dist: openai (>=1.55.3,<1.56.0)
75
74
  Requires-Dist: openpyxl (>=3.1.5,<4.0.0)
76
75
  Requires-Dist: opentelemetry-api (>=1.16.0,<1.17.0)
77
76
  Requires-Dist: opentelemetry-exporter-jaeger (>=1.16.0,<1.17.0)
@@ -104,24 +103,26 @@ Requires-Dist: pyyaml (>=6.0)
104
103
  Requires-Dist: qdrant-client (>=1.9.0,<2.0.0)
105
104
  Requires-Dist: questionary (>=1.10.0,<2.1.0)
106
105
  Requires-Dist: randomname (>=0.2.1,<0.3.0)
107
- Requires-Dist: rasa-sdk (==3.11.0.dev1)
106
+ Requires-Dist: rasa-sdk (==3.11.0rc1)
108
107
  Requires-Dist: redis (>=4.6.0,<6.0)
109
108
  Requires-Dist: regex (>=2022.10.31,<2022.11)
110
109
  Requires-Dist: requests (>=2.31.0,<2.32.0)
111
110
  Requires-Dist: rich (>=13.4.2,<14.0.0)
112
111
  Requires-Dist: rocketchat_API (>=1.30.0,<1.31.0)
113
112
  Requires-Dist: ruamel.yaml (>=0.17.21,<0.17.22)
113
+ Requires-Dist: safetensors (>=0.4.5,<0.5.0)
114
114
  Requires-Dist: sanic (>=22.12,<22.13)
115
115
  Requires-Dist: sanic-cors (>=2.2.0,<2.3.0)
116
116
  Requires-Dist: sanic-jwt (>=1.8.0,<2.0.0)
117
117
  Requires-Dist: sanic-routing (>=22.8.0,<23.0.0)
118
- Requires-Dist: scikit-learn (>=1.1.3,<1.2) ; python_version >= "3.9" and python_version < "3.11"
119
- Requires-Dist: scipy (>=1.10.1,<1.11.0) ; python_version >= "3.9" and python_version < "3.11"
118
+ Requires-Dist: scikit-learn (>=1.5.1,<1.6.0)
119
+ Requires-Dist: scipy (>=1.13.1,<1.14.0)
120
120
  Requires-Dist: sentencepiece[sentencepiece] (>=0.1.99,<0.2.0) ; extra == "transformers" or extra == "full"
121
121
  Requires-Dist: sentry-sdk (>=1.14.0,<1.15.0)
122
122
  Requires-Dist: setuptools (>=70.0.0,<70.1.0)
123
123
  Requires-Dist: sklearn-crfsuite (>=0.3.6,<0.4.0)
124
- Requires-Dist: slack-sdk (>=3.27.1,<4.0.0)
124
+ Requires-Dist: skops (>=0.10.0,<0.11.0)
125
+ Requires-Dist: slack-sdk (>=3.27.1,<3.28.0)
125
126
  Requires-Dist: spacy (>=3.5.4,<4.0.0) ; extra == "spacy" or extra == "full"
126
127
  Requires-Dist: structlog (>=23.1.0,<23.2.0)
127
128
  Requires-Dist: structlog-sentry (>=2.0.3,<3.0.0)