rasa-pro 3.14.0.dev3__py3-none-any.whl → 3.14.0.dev4__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 (93) hide show
  1. rasa/agents/constants.py +8 -0
  2. rasa/agents/core/agent_protocol.py +1 -2
  3. rasa/agents/protocol/a2a/a2a_agent.py +628 -17
  4. rasa/agents/protocol/mcp/mcp_base_agent.py +4 -2
  5. rasa/core/actions/action.py +13 -8
  6. rasa/core/available_agents.py +3 -0
  7. rasa/core/channels/development_inspector.py +3 -3
  8. rasa/core/channels/hangouts.py +2 -2
  9. rasa/core/channels/inspector/dist/assets/{arc-2e78c586.js → arc-63212852.js} +1 -1
  10. rasa/core/channels/inspector/dist/assets/{blockDiagram-38ab4fdb-806b712e.js → blockDiagram-38ab4fdb-eecf6b13.js} +1 -1
  11. rasa/core/channels/inspector/dist/assets/{c4Diagram-3d4e48cf-0745efa9.js → c4Diagram-3d4e48cf-8f798a9a.js} +1 -1
  12. rasa/core/channels/inspector/dist/assets/channel-0cd70adf.js +1 -0
  13. rasa/core/channels/inspector/dist/assets/{classDiagram-70f12bd4-7bd1082b.js → classDiagram-70f12bd4-df71a04c.js} +1 -1
  14. rasa/core/channels/inspector/dist/assets/{classDiagram-v2-f2320105-d937ba49.js → classDiagram-v2-f2320105-9b275968.js} +1 -1
  15. rasa/core/channels/inspector/dist/assets/clone-a0f9c4ed.js +1 -0
  16. rasa/core/channels/inspector/dist/assets/{createText-2e5e7dd3-a2a564ca.js → createText-2e5e7dd3-1c669cad.js} +1 -1
  17. rasa/core/channels/inspector/dist/assets/{edges-e0da2a9e-b5256940.js → edges-e0da2a9e-b1553799.js} +1 -1
  18. rasa/core/channels/inspector/dist/assets/{erDiagram-9861fffd-e6883ad2.js → erDiagram-9861fffd-112388d6.js} +1 -1
  19. rasa/core/channels/inspector/dist/assets/{flowDb-956e92f1-e576fc02.js → flowDb-956e92f1-fdebec47.js} +1 -1
  20. rasa/core/channels/inspector/dist/assets/{flowDiagram-66a62f08-2e298d01.js → flowDiagram-66a62f08-6280ede1.js} +1 -1
  21. rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-de9cc4aa.js +1 -0
  22. rasa/core/channels/inspector/dist/assets/{flowchart-elk-definition-4a651766-dd7b150a.js → flowchart-elk-definition-4a651766-e1dc03e5.js} +1 -1
  23. rasa/core/channels/inspector/dist/assets/{ganttDiagram-c361ad54-5b79575c.js → ganttDiagram-c361ad54-83f68c51.js} +1 -1
  24. rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-72cf32ee-3016f40a.js → gitGraphDiagram-72cf32ee-22f8666f.js} +1 -1
  25. rasa/core/channels/inspector/dist/assets/{graph-3e19170f.js → graph-ca9e6217.js} +1 -1
  26. rasa/core/channels/inspector/dist/assets/{index-3862675e-eb9c86de.js → index-3862675e-c5ceb692.js} +1 -1
  27. rasa/core/channels/inspector/dist/assets/{index-1bd9135e.js → index-3e293924.js} +3 -3
  28. rasa/core/channels/inspector/dist/assets/{infoDiagram-f8f76790-b4280e4d.js → infoDiagram-f8f76790-faa9999b.js} +1 -1
  29. rasa/core/channels/inspector/dist/assets/{journeyDiagram-49397b02-556091f8.js → journeyDiagram-49397b02-c4dda8d9.js} +1 -1
  30. rasa/core/channels/inspector/dist/assets/{layout-08436411.js → layout-d4307784.js} +1 -1
  31. rasa/core/channels/inspector/dist/assets/{line-683c4f3b.js → line-0567aaa7.js} +1 -1
  32. rasa/core/channels/inspector/dist/assets/{linear-cee6d791.js → linear-c11b95cf.js} +1 -1
  33. rasa/core/channels/inspector/dist/assets/{mindmap-definition-fc14e90a-a0bf0b1a.js → mindmap-definition-fc14e90a-0c7d3ca9.js} +1 -1
  34. rasa/core/channels/inspector/dist/assets/{pieDiagram-8a3498a8-3730d5c4.js → pieDiagram-8a3498a8-34b433fa.js} +1 -1
  35. rasa/core/channels/inspector/dist/assets/{quadrantDiagram-120e2f19-12a20fed.js → quadrantDiagram-120e2f19-4cab816e.js} +1 -1
  36. rasa/core/channels/inspector/dist/assets/{requirementDiagram-deff3bca-b9732102.js → requirementDiagram-deff3bca-8c22fa9e.js} +1 -1
  37. rasa/core/channels/inspector/dist/assets/{sankeyDiagram-04a897e0-a2e72776.js → sankeyDiagram-04a897e0-70ce9e8e.js} +1 -1
  38. rasa/core/channels/inspector/dist/assets/{sequenceDiagram-704730f1-8b7a76bb.js → sequenceDiagram-704730f1-fbcd7fc9.js} +1 -1
  39. rasa/core/channels/inspector/dist/assets/{stateDiagram-587899a1-e65853ac.js → stateDiagram-587899a1-45f05ea6.js} +1 -1
  40. rasa/core/channels/inspector/dist/assets/{stateDiagram-v2-d93cdb3a-6f58a44b.js → stateDiagram-v2-d93cdb3a-beab1ea6.js} +1 -1
  41. rasa/core/channels/inspector/dist/assets/{styles-6aaf32cf-df25b934.js → styles-6aaf32cf-2f29dbd5.js} +1 -1
  42. rasa/core/channels/inspector/dist/assets/{styles-9a916d00-88357141.js → styles-9a916d00-951eac83.js} +1 -1
  43. rasa/core/channels/inspector/dist/assets/{styles-c10674c1-d600174d.js → styles-c10674c1-897fbfdd.js} +1 -1
  44. rasa/core/channels/inspector/dist/assets/{svgDrawCommon-08f97a94-4adc3e0b.js → svgDrawCommon-08f97a94-d667fac1.js} +1 -1
  45. rasa/core/channels/inspector/dist/assets/{timeline-definition-85554ec2-42816fa1.js → timeline-definition-85554ec2-e3205144.js} +1 -1
  46. rasa/core/channels/inspector/dist/assets/{xychartDiagram-e933f94c-621eb66a.js → xychartDiagram-e933f94c-4abeb0e2.js} +1 -1
  47. rasa/core/channels/inspector/dist/index.html +1 -1
  48. rasa/core/channels/inspector/src/components/DialogueStack.tsx +1 -1
  49. rasa/core/channels/studio_chat.py +6 -6
  50. rasa/core/channels/voice_stream/genesys.py +1 -1
  51. rasa/core/policies/flows/flow_executor.py +42 -1
  52. rasa/core/policies/intentless_policy.py +1 -1
  53. rasa/core/policies/unexpected_intent_policy.py +1 -0
  54. rasa/core/processor.py +12 -14
  55. rasa/core/tracker_stores/tracker_store.py +3 -7
  56. rasa/core/train.py +1 -1
  57. rasa/core/training/interactive.py +16 -16
  58. rasa/core/training/story_conflict.py +5 -5
  59. rasa/dialogue_understanding/generator/llm_command_generator.py +1 -1
  60. rasa/dialogue_understanding/generator/multi_step/multi_step_llm_command_generator.py +1 -1
  61. rasa/e2e_test/e2e_test_runner.py +7 -2
  62. rasa/engine/caching.py +2 -2
  63. rasa/engine/recipes/default_components.py +10 -18
  64. rasa/graph_components/validators/default_recipe_validator.py +134 -134
  65. rasa/hooks.py +5 -5
  66. rasa/llm_fine_tuning/utils.py +2 -2
  67. rasa/model_manager/warm_rasa_process.py +1 -1
  68. rasa/nlu/extractors/extractor.py +2 -1
  69. rasa/plugin.py +8 -8
  70. rasa/privacy/privacy_manager.py +11 -2
  71. rasa/server.py +4 -2
  72. rasa/shared/core/events.py +9 -1
  73. rasa/shared/core/flows/yaml_flows_io.py +1 -1
  74. rasa/shared/core/slots.py +2 -2
  75. rasa/shared/core/trackers.py +5 -2
  76. rasa/shared/exceptions.py +4 -0
  77. rasa/shared/utils/yaml.py +3 -1
  78. rasa/tracing/instrumentation/instrumentation.py +8 -8
  79. rasa/tracing/instrumentation/intentless_policy_instrumentation.py +4 -4
  80. rasa/utils/log_utils.py +1 -1
  81. rasa/utils/ml_utils.py +1 -1
  82. rasa/utils/tensorflow/rasa_layers.py +1 -1
  83. rasa/utils/train_utils.py +15 -15
  84. rasa/validator.py +16 -14
  85. rasa/version.py +1 -1
  86. {rasa_pro-3.14.0.dev3.dist-info → rasa_pro-3.14.0.dev4.dist-info}/METADATA +12 -15
  87. {rasa_pro-3.14.0.dev3.dist-info → rasa_pro-3.14.0.dev4.dist-info}/RECORD +90 -90
  88. rasa/core/channels/inspector/dist/assets/channel-c436ca7c.js +0 -1
  89. rasa/core/channels/inspector/dist/assets/clone-50dd656b.js +0 -1
  90. rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-2b2aeaf8.js +0 -1
  91. {rasa_pro-3.14.0.dev3.dist-info → rasa_pro-3.14.0.dev4.dist-info}/NOTICE +0 -0
  92. {rasa_pro-3.14.0.dev3.dist-info → rasa_pro-3.14.0.dev4.dist-info}/WHEEL +0 -0
  93. {rasa_pro-3.14.0.dev3.dist-info → rasa_pro-3.14.0.dev4.dist-info}/entry_points.txt +0 -0
@@ -10,46 +10,40 @@ from rasa.core.policies.flow_policy import FlowPolicy
10
10
  from rasa.core.policies.memoization import AugmentedMemoizationPolicy, MemoizationPolicy
11
11
  from rasa.core.policies.policy import Policy, SupportedData
12
12
  from rasa.core.policies.rule_policy import RulePolicy
13
- from rasa.core.policies.ted_policy import TEDPolicy
14
- from rasa.core.policies.unexpected_intent_policy import UnexpecTEDIntentPolicy
13
+
14
+ # from rasa.core.policies.ted_policy import TEDPolicy
15
+ # from rasa.core.policies.unexpected_intent_policy import UnexpecTEDIntentPolicy
15
16
  from rasa.engine.graph import ExecutionContext, GraphComponent, GraphSchema, SchemaNode
16
17
  from rasa.engine.storage.resource import Resource
17
18
  from rasa.engine.storage.storage import ModelStorage
18
- from rasa.nlu.classifiers.diet_classifier import DIETClassifier
19
- from rasa.nlu.extractors.crf_entity_extractor import (
20
- CRFEntityExtractor,
21
- CRFEntityExtractorOptions,
22
- )
19
+
20
+ # from rasa.nlu.classifiers.diet_classifier import DIETClassifier
21
+ # from rasa.nlu.extractors.crf_entity_extractor import (
22
+ # CRFEntityExtractor,
23
+ # CRFEntityExtractorOptions,
24
+ # )
23
25
  from rasa.nlu.extractors.entity_synonyms import EntitySynonymMapper
24
26
  from rasa.nlu.extractors.mitie_entity_extractor import MitieEntityExtractor
25
27
  from rasa.nlu.extractors.regex_entity_extractor import RegexEntityExtractor
26
28
  from rasa.nlu.featurizers.featurizer import Featurizer
27
29
  from rasa.nlu.featurizers.sparse_featurizer.regex_featurizer import RegexFeaturizer
28
- from rasa.nlu.selectors.response_selector import ResponseSelector
30
+
31
+ # from rasa.nlu.selectors.response_selector import ResponseSelector
29
32
  from rasa.nlu.tokenizers.tokenizer import Tokenizer
30
33
  from rasa.shared.constants import (
31
- DEFAULT_CONFIG_PATH,
32
34
  DOCS_URL_COMPONENTS,
33
- DOCS_URL_DEFAULT_ACTIONS,
34
35
  DOCS_URL_NLU_BASED_POLICIES,
35
- DOCS_URL_RULES,
36
36
  )
37
- from rasa.shared.core.constants import (
38
- ACTION_BACK_NAME,
39
- ACTION_RESTART_NAME,
40
- USER_INTENT_BACK,
41
- USER_INTENT_RESTART,
42
- )
43
- from rasa.shared.core.domain import Domain, InvalidDomain
37
+ from rasa.shared.core.domain import Domain
44
38
  from rasa.shared.core.training_data.structures import RuleStep, StoryGraph
45
39
  from rasa.shared.exceptions import InvalidConfigException
46
40
  from rasa.shared.importers.importer import TrainingDataImporter
47
41
  from rasa.shared.nlu.training_data.training_data import TrainingData
48
42
 
49
43
  # TODO: Can we replace this with the registered types from the regitry?
50
- TRAINABLE_EXTRACTORS = [MitieEntityExtractor, CRFEntityExtractor, DIETClassifier]
44
+ TRAINABLE_EXTRACTORS = [MitieEntityExtractor] # , CRFEntityExtractor, DIETClassifier]
51
45
  # TODO: replace these once the Recipe is merged (used in tests)
52
- POLICY_CLASSSES = {TEDPolicy, MemoizationPolicy, RulePolicy}
46
+ POLICY_CLASSSES = {MemoizationPolicy, RulePolicy}
53
47
 
54
48
 
55
49
  def _types_to_str(types: Iterable[Type]) -> Text:
@@ -135,16 +129,17 @@ class DefaultV1RecipeValidator(GraphComponent):
135
129
  """
136
130
  if (
137
131
  training_data.response_examples
138
- and ResponseSelector not in self._component_types
132
+ # and ResponseSelector not in self._component_types
139
133
  ):
140
- rasa.shared.utils.io.raise_warning(
141
- f"You have defined training data with examples for training a response "
142
- f"selector, but your NLU configuration does not include a response "
143
- f"selector component. "
144
- f"To train a model on your response selector data, add a "
145
- f"'{ResponseSelector.__name__}' to your configuration.",
146
- docs=DOCS_URL_COMPONENTS,
147
- )
134
+ pass
135
+ # rasa.shared.utils.io.raise_warning(
136
+ # f"You have defined training data with examples for training a response " # noqa: E501
137
+ # f"selector, but your NLU configuration does not include a response "
138
+ # f"selector component. "
139
+ # f"To train a model on your response selector data, add a "
140
+ # f"'{ResponseSelector.__name__}' to your configuration.",
141
+ # docs=DOCS_URL_COMPONENTS,
142
+ # )
148
143
 
149
144
  if training_data.entity_examples and self._component_types.isdisjoint(
150
145
  TRAINABLE_EXTRACTORS
@@ -158,21 +153,21 @@ class DefaultV1RecipeValidator(GraphComponent):
158
153
  docs=DOCS_URL_COMPONENTS,
159
154
  )
160
155
 
161
- if training_data.entity_examples and self._component_types.isdisjoint(
162
- {DIETClassifier, CRFEntityExtractor}
163
- ):
164
- if training_data.entity_roles_groups_used():
165
- rasa.shared.utils.io.raise_warning(
166
- f"You have defined training data with entities that "
167
- f"have roles/groups, but your NLU configuration does not "
168
- f"include a '{DIETClassifier.__name__}' "
169
- f"or a '{CRFEntityExtractor.__name__}'. "
170
- f"To train entities that have roles/groups, "
171
- f"add either '{DIETClassifier.__name__}' "
172
- f"or '{CRFEntityExtractor.__name__}' to your "
173
- f"configuration.",
174
- docs=DOCS_URL_COMPONENTS,
175
- )
156
+ # if training_data.entity_examples and self._component_types.isdisjoint(
157
+ # {DIETClassifier, CRFEntityExtractor}
158
+ # ):
159
+ # if training_data.entity_roles_groups_used():
160
+ # rasa.shared.utils.io.raise_warning(
161
+ # f"You have defined training data with entities that "
162
+ # f"have roles/groups, but your NLU configuration does not "
163
+ # f"include a '{DIETClassifier.__name__}' "
164
+ # f"or a '{CRFEntityExtractor.__name__}'. "
165
+ # f"To train entities that have roles/groups, "
166
+ # f"add either '{DIETClassifier.__name__}' "
167
+ # f"or '{CRFEntityExtractor.__name__}' to your "
168
+ # f"configuration.",
169
+ # docs=DOCS_URL_COMPONENTS,
170
+ # )
176
171
 
177
172
  if training_data.regex_features and self._component_types.isdisjoint(
178
173
  [RegexFeaturizer, RegexEntityExtractor]
@@ -202,45 +197,45 @@ class DefaultV1RecipeValidator(GraphComponent):
202
197
  docs=DOCS_URL_COMPONENTS,
203
198
  )
204
199
 
205
- if training_data.lookup_tables:
206
- if self._component_types.isdisjoint([CRFEntityExtractor, DIETClassifier]):
207
- rasa.shared.utils.io.raise_warning(
208
- f"You have defined training data consisting of lookup tables, but "
209
- f"your NLU configuration does not include any components "
210
- f"that uses the features created from the lookup table. "
211
- f"To make use of the features that are created with the "
212
- f"help of the lookup tables, "
213
- f"add a '{DIETClassifier.__name__}' or a "
214
- f"'{CRFEntityExtractor.__name__}' "
215
- f"with the 'pattern' feature "
216
- f"to your configuration.",
217
- docs=DOCS_URL_COMPONENTS,
218
- )
219
-
220
- elif CRFEntityExtractor in self._component_types:
221
- crf_schema_nodes = [
222
- schema_node
223
- for schema_node in self._graph_schema.nodes.values()
224
- if schema_node.uses == CRFEntityExtractor
225
- ]
226
- has_pattern_feature = any(
227
- CRFEntityExtractorOptions.PATTERN in feature_list
228
- for crf in crf_schema_nodes
229
- for feature_list in crf.config.get("features", [])
230
- )
231
-
232
- if not has_pattern_feature:
233
- rasa.shared.utils.io.raise_warning(
234
- f"You have defined training data consisting of "
235
- f"lookup tables, but your NLU configuration's "
236
- f"'{CRFEntityExtractor.__name__}' "
237
- f"does not include the "
238
- f"'pattern' feature. To featurize lookup tables, "
239
- f"add the 'pattern' feature to the "
240
- f"'{CRFEntityExtractor.__name__}' "
241
- "in your configuration.",
242
- docs=DOCS_URL_COMPONENTS,
243
- )
200
+ # if training_data.lookup_tables:
201
+ # if self._component_types.isdisjoint([CRFEntityExtractor, DIETClassifier]):
202
+ # rasa.shared.utils.io.raise_warning(
203
+ # f"You have defined training data consisting of lookup tables, but " # noqa: E501
204
+ # f"your NLU configuration does not include any components "
205
+ # f"that uses the features created from the lookup table. "
206
+ # f"To make use of the features that are created with the "
207
+ # f"help of the lookup tables, "
208
+ # f"add a '{DIETClassifier.__name__}' or a "
209
+ # f"'{CRFEntityExtractor.__name__}' "
210
+ # f"with the 'pattern' feature "
211
+ # f"to your configuration.",
212
+ # docs=DOCS_URL_COMPONENTS,
213
+ # )
214
+
215
+ # elif CRFEntityExtractor in self._component_types:
216
+ # crf_schema_nodes = [
217
+ # schema_node
218
+ # for schema_node in self._graph_schema.nodes.values()
219
+ # if schema_node.uses == CRFEntityExtractor
220
+ # ]
221
+ # has_pattern_feature = any(
222
+ # CRFEntityExtractorOptions.PATTERN in feature_list
223
+ # for crf in crf_schema_nodes
224
+ # for feature_list in crf.config.get("features", [])
225
+ # )
226
+
227
+ # if not has_pattern_feature:
228
+ # rasa.shared.utils.io.raise_warning(
229
+ # f"You have defined training data consisting of "
230
+ # f"lookup tables, but your NLU configuration's "
231
+ # f"'{CRFEntityExtractor.__name__}' "
232
+ # f"does not include the "
233
+ # f"'pattern' feature. To featurize lookup tables, "
234
+ # f"add the 'pattern' feature to the "
235
+ # f"'{CRFEntityExtractor.__name__}' "
236
+ # "in your configuration.",
237
+ # docs=DOCS_URL_COMPONENTS,
238
+ # )
244
239
 
245
240
  if (
246
241
  training_data.entity_synonyms
@@ -392,21 +387,22 @@ class DefaultV1RecipeValidator(GraphComponent):
392
387
 
393
388
  def _warn_if_no_policy_handles_default_intents(self) -> None:
394
389
  """Warns if there is no policy handling the default intents."""
395
- policies_handling_default_indents = (RulePolicy, FlowPolicy)
396
-
397
- contains_policy_handling_default_intents = any(
398
- issubclass(node.uses, policies_handling_default_indents)
399
- for node in self._policy_schema_nodes
400
- )
401
- if not contains_policy_handling_default_intents:
402
- rasa.shared.utils.io.raise_warning(
403
- f"'{RulePolicy.__name__}' is not included in the model's "
404
- f"policy configuration. Default intents such as "
405
- f"'{USER_INTENT_RESTART}' and '{USER_INTENT_BACK}' will "
406
- f"not trigger actions '{ACTION_RESTART_NAME}' and "
407
- f"'{ACTION_BACK_NAME}'.",
408
- docs=DOCS_URL_DEFAULT_ACTIONS,
409
- )
390
+ # policies_handling_default_indents = (RulePolicy, FlowPolicy)
391
+ #
392
+ # contains_policy_handling_default_intents = any(
393
+ # issubclass(node.uses, policies_handling_default_indents)
394
+ # for node in self._policy_schema_nodes
395
+ # )
396
+ # if not contains_policy_handling_default_intents:
397
+ # rasa.shared.utils.io.raise_warning(
398
+ # f"'{RulePolicy.__name__}' is not included in the model's "
399
+ # f"policy configuration. Default intents such as "
400
+ # f"'{USER_INTENT_RESTART}' and '{USER_INTENT_BACK}' will "
401
+ # f"not trigger actions '{ACTION_RESTART_NAME}' and "
402
+ # f"'{ACTION_BACK_NAME}'.",
403
+ # docs=DOCS_URL_DEFAULT_ACTIONS,
404
+ # )
405
+ pass
410
406
 
411
407
  def _raise_if_domain_contains_form_names_but_no_rule_policy_given(
412
408
  self, domain: Domain
@@ -416,19 +412,20 @@ class DefaultV1RecipeValidator(GraphComponent):
416
412
  Raises:
417
413
  `InvalidConfigException` if domain and rule policies do not match
418
414
  """
419
- contains_rule_policy = any(
420
- schema_node
421
- for schema_node in self._graph_schema.nodes.values()
422
- if issubclass(schema_node.uses, RulePolicy)
423
- )
424
-
425
- if domain.form_names and not contains_rule_policy:
426
- raise InvalidDomain(
427
- "You have defined a form action, but have not added the "
428
- f"'{RulePolicy.__name__}' to your policy ensemble. "
429
- f"Either remove all forms from your domain or add the "
430
- f"'{RulePolicy.__name__}' to your policy configuration."
431
- )
415
+ pass
416
+ # contains_rule_policy = any(
417
+ # schema_node
418
+ # for schema_node in self._graph_schema.nodes.values()
419
+ # if issubclass(schema_node.uses, RulePolicy)
420
+ # )
421
+
422
+ # if domain.form_names and not contains_rule_policy:
423
+ # raise InvalidDomain(
424
+ # "You have defined a form action, but have not added the "
425
+ # f"'{RulePolicy.__name__}' to your policy ensemble. "
426
+ # f"Either remove all forms from your domain or add the "
427
+ # f"'{RulePolicy.__name__}' to your policy configuration."
428
+ # )
432
429
 
433
430
  def _raise_if_dm1_and_calm_policies_used_at_the_same_time(self) -> None:
434
431
  """Validates that there exists a rule policy if forms are defined.
@@ -447,11 +444,11 @@ class DefaultV1RecipeValidator(GraphComponent):
447
444
 
448
445
  # if we are using a flow policy, there shouldn't be any dm1 policies
449
446
  dm1_policies = (
450
- RulePolicy,
451
- TEDPolicy,
447
+ # RulePolicy,
448
+ # TEDPolicy,
452
449
  MemoizationPolicy,
453
450
  AugmentedMemoizationPolicy,
454
- UnexpecTEDIntentPolicy,
451
+ # UnexpecTEDIntentPolicy,
455
452
  )
456
453
 
457
454
  for schema_node in self._graph_schema.nodes.values():
@@ -472,10 +469,11 @@ class DefaultV1RecipeValidator(GraphComponent):
472
469
  `InvalidDomain` if domain and rule policies do not match
473
470
  """
474
471
  for schema_node in self._graph_schema.nodes.values():
475
- if schema_node.uses == RulePolicy:
476
- RulePolicy.raise_if_incompatible_with_domain(
477
- config=schema_node.config, domain=domain
478
- )
472
+ # if schema_node.uses == RulePolicy:
473
+ # RulePolicy.raise_if_incompatible_with_domain(
474
+ # config=schema_node.config, domain=domain
475
+ # )
476
+ pass
479
477
 
480
478
  def _validate_policy_priorities(self) -> None:
481
479
  """Checks if every policy has a valid priority value.
@@ -531,20 +529,22 @@ class DefaultV1RecipeValidator(GraphComponent):
531
529
  )
532
530
 
533
531
  if consuming_rule_data and not contains_rule_tracker:
534
- rasa.shared.utils.io.raise_warning(
535
- f"Found a rule-based policy in your configuration but "
536
- f"no rule-based training data. Please add rule-based "
537
- f"stories to your training data or "
538
- f"remove the rule-based policy "
539
- f"(`{RulePolicy.__name__}`) from your "
540
- f"your configuration.",
541
- docs=DOCS_URL_RULES,
542
- )
532
+ # rasa.shared.utils.io.raise_warning(
533
+ # f"Found a rule-based policy in your configuration but "
534
+ # f"no rule-based training data. Please add rule-based "
535
+ # f"stories to your training data or "
536
+ # f"remove the rule-based policy "
537
+ # f"(`{RulePolicy.__name__}`) from your "
538
+ # f"your configuration.",
539
+ # docs=DOCS_URL_RULES,
540
+ # )
541
+ pass
543
542
  elif not consuming_rule_data and contains_rule_tracker:
544
- rasa.shared.utils.io.raise_warning(
545
- f"Found rule-based training data but no policy supporting rule-based "
546
- f"data. Please add `{RulePolicy.__name__}` "
547
- f"or another rule-supporting "
548
- f"policy to the `policies` section in `{DEFAULT_CONFIG_PATH}`.",
549
- docs=DOCS_URL_RULES,
550
- )
543
+ # rasa.shared.utils.io.raise_warning(
544
+ # f"Found rule-based training data but no policy supporting rule-based "
545
+ # f"data. Please add `{RulePolicy.__name__}` "
546
+ # f"or another rule-supporting "
547
+ # f"policy to the `policies` section in `{DEFAULT_CONFIG_PATH}`.",
548
+ # docs=DOCS_URL_RULES,
549
+ # )
550
+ pass
rasa/hooks.py CHANGED
@@ -19,7 +19,7 @@ hookimpl = pluggy.HookimplMarker("rasa")
19
19
  logger = logging.getLogger(__name__)
20
20
 
21
21
 
22
- @hookimpl # type: ignore[misc]
22
+ @hookimpl
23
23
  def refine_cli(
24
24
  subparsers: "SubParsersAction",
25
25
  parent_parsers: List[argparse.ArgumentParser],
@@ -37,7 +37,7 @@ def refine_cli(
37
37
  return None
38
38
 
39
39
 
40
- @hookimpl # type: ignore[misc]
40
+ @hookimpl
41
41
  def configure_commandline(cmdline_arguments: argparse.Namespace) -> Optional[Text]:
42
42
  from rasa.cli import x as rasa_x
43
43
  from rasa.tracing import config
@@ -59,21 +59,21 @@ def configure_commandline(cmdline_arguments: argparse.Namespace) -> Optional[Tex
59
59
  return endpoints_file
60
60
 
61
61
 
62
- @hookimpl # type: ignore[misc]
62
+ @hookimpl
63
63
  def init_telemetry(endpoints_file: Optional[Text]) -> None:
64
64
  import rasa.telemetry
65
65
 
66
66
  rasa.telemetry.identify_endpoint_config_traits(endpoints_file)
67
67
 
68
68
 
69
- @hookimpl # type: ignore[misc]
69
+ @hookimpl
70
70
  def init_managers(endpoints_file: Optional[Text]) -> None:
71
71
  from rasa.core.secrets_manager.factory import load_secret_manager
72
72
 
73
73
  load_secret_manager(endpoints_file)
74
74
 
75
75
 
76
- @hookimpl # type: ignore[misc]
76
+ @hookimpl
77
77
  def create_tracker_store(
78
78
  endpoint_config: Union["TrackerStore", "EndpointConfig"],
79
79
  domain: "Domain",
@@ -61,9 +61,9 @@ def patch_invoke_llm_in_generators(mock_impl: Callable) -> Generator:
61
61
  try:
62
62
  # apply the monkey-patch everywhere
63
63
  for cls in originals:
64
- cls.invoke_llm = mock_impl # type: ignore[assignment]
64
+ cls.invoke_llm = mock_impl # type: ignore[method-assign]
65
65
  yield
66
66
  finally:
67
67
  # restore originals (even if an exception happened)
68
68
  for cls, orig in originals.items():
69
- cls.invoke_llm = orig # type: ignore[assignment]
69
+ cls.invoke_llm = orig # type: ignore[method-assign]
@@ -157,8 +157,8 @@ def warmup() -> None:
157
157
  import pandas # noqa: F401
158
158
  import presidio_analyzer # noqa: F401
159
159
  import spacy # noqa: F401
160
- import tensorflow # noqa: F401
161
160
 
161
+ # import tensorflow
162
162
  import rasa.validator # noqa: F401
163
163
  except ImportError:
164
164
  pass
@@ -2,7 +2,8 @@ import abc
2
2
  from typing import Any, Dict, List, NamedTuple, Optional, Text, Tuple
3
3
 
4
4
  import rasa.shared.utils.io
5
- import rasa.utils.train_utils
5
+
6
+ # import rasa.utils.train_utils
6
7
  from rasa.nlu.constants import (
7
8
  ENTITY_ATTRIBUTE_CONFIDENCE_GROUP,
8
9
  ENTITY_ATTRIBUTE_CONFIDENCE_ROLE,
rasa/plugin.py CHANGED
@@ -37,7 +37,7 @@ def init_hooks(manager: pluggy.PluginManager) -> None:
37
37
  manager.register(hooks)
38
38
 
39
39
 
40
- @hookspec # type: ignore[misc]
40
+ @hookspec
41
41
  def refine_cli(
42
42
  subparsers: SubParsersAction,
43
43
  parent_parsers: List[argparse.ArgumentParser],
@@ -45,22 +45,22 @@ def refine_cli(
45
45
  """Customizable hook for adding CLI commands."""
46
46
 
47
47
 
48
- @hookspec # type: ignore[misc]
48
+ @hookspec
49
49
  def configure_commandline(cmdline_arguments: argparse.Namespace) -> Optional[Text]:
50
50
  """Hook specification for configuring plugin CLI."""
51
51
 
52
52
 
53
- @hookspec # type: ignore[misc]
53
+ @hookspec
54
54
  def init_telemetry(endpoints_file: Optional[Text]) -> None:
55
55
  """Hook specification for initialising plugin telemetry."""
56
56
 
57
57
 
58
- @hookspec # type: ignore[misc]
58
+ @hookspec
59
59
  def init_managers(endpoints_file: Optional[Text]) -> None:
60
60
  """Hook specification for initialising managers."""
61
61
 
62
62
 
63
- @hookspec(firstresult=True) # type: ignore[misc]
63
+ @hookspec(firstresult=True)
64
64
  def create_tracker_store( # type: ignore[empty-body]
65
65
  endpoint_config: Union["TrackerStore", "EndpointConfig"],
66
66
  domain: "Domain",
@@ -69,7 +69,7 @@ def create_tracker_store( # type: ignore[empty-body]
69
69
  """Hook specification for wrapping with AuthRetryTrackerStore."""
70
70
 
71
71
 
72
- @hookspec # type: ignore[misc]
72
+ @hookspec
73
73
  def after_server_stop() -> None:
74
74
  """Hook specification for stopping the server.
75
75
 
@@ -78,11 +78,11 @@ def after_server_stop() -> None:
78
78
  """
79
79
 
80
80
 
81
- @hookspec # type: ignore[misc]
81
+ @hookspec
82
82
  def after_new_user_message(tracker: "DialogueStateTracker") -> None:
83
83
  """Hook specification for after a new user message is received."""
84
84
 
85
85
 
86
- @hookspec # type: ignore[misc]
86
+ @hookspec
87
87
  def after_action_executed(tracker: "DialogueStateTracker") -> None:
88
88
  """Hook specification for after an action is executed."""
@@ -264,10 +264,19 @@ class BackgroundPrivacyManager:
264
264
  )
265
265
  return None
266
266
 
267
- latest_user_message = tracker.get_last_event_for(
267
+ latest_user_message_event = tracker.get_last_event_for(
268
268
  UserUttered, event_verbosity=EventVerbosity.ALL
269
269
  )
270
- if latest_user_message is None or not latest_user_message.text:
270
+ if latest_user_message_event is None or not isinstance(
271
+ latest_user_message_event, UserUttered
272
+ ):
273
+ structlogger.debug(
274
+ "rasa.privacy_manager.no_user_message.skipping_processing",
275
+ )
276
+ return None
277
+
278
+ latest_user_message: UserUttered = latest_user_message_event
279
+ if not latest_user_message.text:
271
280
  structlogger.debug(
272
281
  "rasa.privacy_manager.no_user_message.skipping_processing",
273
282
  )
rasa/server.py CHANGED
@@ -244,7 +244,7 @@ def requires_auth(
244
244
  @wraps(f)
245
245
  async def decorated(
246
246
  request: Request, *args: Any, **kwargs: Any
247
- ) -> response.HTTPResponse:
247
+ ) -> Union[response.HTTPResponse, Coroutine[Any, Any, response.HTTPResponse]]:
248
248
  provided = request.args.get("token", None)
249
249
 
250
250
  # noinspection PyProtectedMember
@@ -677,7 +677,9 @@ def inject_temp_dir(f: Callable[..., Coroutine]) -> Callable:
677
677
  """
678
678
 
679
679
  @wraps(f)
680
- async def decorated_function(*args: Any, **kwargs: Any) -> HTTPResponse:
680
+ async def decorated_function(
681
+ *args: Any, **kwargs: Any
682
+ ) -> Union[HTTPResponse, Coroutine[Any, Any, HTTPResponse]]:
681
683
  with TempDirectoryPath(get_temp_dir_name()) as directory:
682
684
  # Decorated request handles need to have a parameter `temporary_directory`
683
685
  return await f(*args, temporary_directory=Path(directory), **kwargs)
@@ -2730,14 +2730,22 @@ class AgentStarted(SkipEventInMDStoryMixin):
2730
2730
  flow_id: str,
2731
2731
  timestamp: Optional[float] = None,
2732
2732
  metadata: Optional[Dict[str, Any]] = None,
2733
+ context_id: Optional[str] = None,
2733
2734
  ) -> None:
2734
2735
  self.agent_id = agent_id
2735
2736
  self.flow_id = flow_id
2737
+ self.context_id = context_id
2736
2738
  super().__init__(timestamp, metadata)
2737
2739
 
2738
2740
  def __repr__(self) -> str:
2739
2741
  """Returns event as string for debugging."""
2740
- return f"AgentStarted(agent: {self.agent_id}, flow: {self.flow_id})"
2742
+ if self.context_id:
2743
+ return (
2744
+ f"AgentStarted(agent: {self.agent_id}, flow: {self.flow_id}, "
2745
+ f"context_id: {self.context_id})"
2746
+ )
2747
+ else:
2748
+ return f"AgentStarted(agent: {self.agent_id}, flow: {self.flow_id})"
2741
2749
 
2742
2750
  def __str__(self) -> str:
2743
2751
  """Returns event as human-readable string."""
@@ -127,7 +127,7 @@ class YAMLFlowsReader:
127
127
  If a schema does not have a `schema_name` set, we will use the
128
128
  `type` instead as a fallback.
129
129
  """
130
- return schema.get("schema_name", schema.get("type"))
130
+ return str(schema.get("schema_name", schema.get("type") or "unknown"))
131
131
 
132
132
  def schema_names(schemas: List[Dict[str, Any]]) -> List[str]:
133
133
  """Get the names of the schemas.
rasa/shared/core/slots.py CHANGED
@@ -68,9 +68,9 @@ class SlotRejection:
68
68
 
69
69
 
70
70
  class SlotValidation(BaseModel):
71
- rejections: List[SlotRejection] = Field(alias=REJECTIONS)
71
+ rejections: List[SlotRejection] = Field(alias=REJECTIONS) # type: ignore[literal-required]
72
72
  """how the slot value is validated using predicate evaluation."""
73
- refill_utter: str = Field(alias=REFILL_UTTER)
73
+ refill_utter: str = Field(alias=REFILL_UTTER) # type: ignore[literal-required]
74
74
  """The utterance that the assistant uses to ask for the slot."""
75
75
 
76
76
  @staticmethod
@@ -849,7 +849,7 @@ class DialogueStateTracker:
849
849
  action_names_to_exclude: Optional[List[Text]] = None,
850
850
  skip: int = 0,
851
851
  event_verbosity: EventVerbosity = EventVerbosity.APPLIED,
852
- ) -> Optional["EventTypeAlias"]:
852
+ ) -> Optional[Event]:
853
853
  """Gets the last event of a given type which was actually applied.
854
854
 
855
855
  Args:
@@ -889,9 +889,12 @@ class DialogueStateTracker:
889
889
  Returns:
890
890
  `True` if last executed action had name `name`, otherwise `False`.
891
891
  """
892
- last: Optional[ActionExecuted] = self.get_last_event_for(
892
+ last_event = self.get_last_event_for(
893
893
  ActionExecuted, action_names_to_exclude=[ACTION_LISTEN_NAME], skip=skip
894
894
  )
895
+ last: Optional[ActionExecuted] = (
896
+ last_event if isinstance(last_event, ActionExecuted) else None
897
+ )
895
898
  return last is not None and last.action_name == name
896
899
 
897
900
  ###
rasa/shared/exceptions.py CHANGED
@@ -169,3 +169,7 @@ class ProviderClientValidationError(RasaException):
169
169
 
170
170
  class FinetuningDataPreparationException(RasaException):
171
171
  """Raised when there is an error in data preparation for fine-tuning."""
172
+
173
+
174
+ class AgentInitializationException(RasaException):
175
+ """Raised when there is an error during the initialization of an agent."""
rasa/shared/utils/yaml.py CHANGED
@@ -335,7 +335,9 @@ class YamlValidationException(YamlException, ValueError):
335
335
  )
336
336
  if found_lc:
337
337
  return line_offset
338
- return this_line + line_offset
338
+ if this_line is not None:
339
+ return this_line + line_offset
340
+ return line_offset
339
341
  return line
340
342
  elif isinstance(current, list) and head.isdigit():
341
343
  return (