rasa-pro 3.14.0.dev10__py3-none-any.whl → 3.14.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 (295) hide show
  1. rasa/__main__.py +15 -3
  2. rasa/agents/agent_factory.py +1 -1
  3. rasa/agents/agent_manager.py +52 -3
  4. rasa/agents/constants.py +3 -0
  5. rasa/agents/core/types.py +11 -0
  6. rasa/agents/protocol/__init__.py +11 -3
  7. rasa/agents/protocol/a2a/a2a_agent.py +45 -5
  8. rasa/agents/protocol/mcp/mcp_base_agent.py +14 -5
  9. rasa/agents/protocol/mcp/mcp_open_agent.py +27 -13
  10. rasa/agents/protocol/mcp/mcp_task_agent.py +42 -31
  11. rasa/agents/schemas/agent_tool_result.py +0 -2
  12. rasa/agents/schemas/agent_tool_schema.py +55 -3
  13. rasa/agents/templates/mcp_open_agent_prompt_template.jinja2 +6 -6
  14. rasa/agents/templates/mcp_task_agent_prompt_template.jinja2 +5 -5
  15. rasa/agents/utils.py +42 -3
  16. rasa/builder/copilot/telemetry.py +35 -19
  17. rasa/builder/main.py +5 -14
  18. rasa/builder/project_generator.py +1 -1
  19. rasa/builder/service.py +5 -0
  20. rasa/builder/template_cache.py +9 -184
  21. rasa/cli/project_templates/basic/data/data.md +5 -6
  22. rasa/cli/project_templates/basic/domain/domain.md +5 -2
  23. rasa/cli/project_templates/finance/README.md +8 -7
  24. rasa/cli/project_templates/finance/actions/__init__.py +0 -46
  25. rasa/cli/project_templates/finance/actions/accounts/check_balance.py +18 -0
  26. rasa/cli/project_templates/finance/actions/{transfers/action_process_immediate_payment.py → cards/check_that_card_exists.py} +6 -3
  27. rasa/cli/project_templates/finance/actions/cards/list_cards.py +22 -0
  28. rasa/cli/project_templates/finance/actions/contacts/__init__.py +0 -0
  29. rasa/cli/project_templates/finance/actions/contacts/add_contact.py +30 -0
  30. rasa/cli/project_templates/finance/actions/contacts/list_contacts.py +22 -0
  31. rasa/cli/project_templates/finance/actions/contacts/remove_contact.py +35 -0
  32. rasa/cli/project_templates/finance/actions/db.py +117 -0
  33. rasa/cli/project_templates/finance/actions/transfers/check_transfer_funds.py +27 -0
  34. rasa/cli/project_templates/finance/actions/transfers/check_transfer_limit.py +36 -0
  35. rasa/cli/project_templates/finance/actions/transfers/execute_recurrent_payment.py +20 -0
  36. rasa/cli/project_templates/finance/actions/transfers/execute_transfer.py +45 -0
  37. rasa/cli/project_templates/finance/actions/transfers/list_transactions.py +32 -0
  38. rasa/cli/project_templates/finance/config.yml +6 -0
  39. rasa/cli/project_templates/finance/credentials.yml +7 -6
  40. rasa/cli/project_templates/finance/data/accounts/check_balance.yml +3 -4
  41. rasa/cli/project_templates/finance/data/accounts/download_statements.yml +26 -0
  42. rasa/cli/project_templates/finance/data/bills/bill_pay_reminder.yml +25 -0
  43. rasa/cli/project_templates/finance/data/cards/activate_card.yml +35 -0
  44. rasa/cli/project_templates/finance/data/cards/block_card.yml +37 -58
  45. rasa/cli/project_templates/finance/data/cards/list_cards.yml +14 -0
  46. rasa/cli/project_templates/finance/data/cards/replace_card.yml +16 -0
  47. rasa/cli/project_templates/finance/data/cards/replace_eligible_card.yml +29 -0
  48. rasa/cli/project_templates/finance/data/contacts/add_contact.yml +33 -0
  49. rasa/cli/project_templates/finance/data/contacts/list_contacts.yml +14 -0
  50. rasa/cli/project_templates/finance/data/contacts/remove_contact.yml +31 -0
  51. rasa/cli/project_templates/finance/data/data.md +6 -3
  52. rasa/cli/project_templates/finance/data/general/agent_details.yml +6 -0
  53. rasa/cli/project_templates/finance/data/general/hello.yml +1 -2
  54. rasa/cli/project_templates/finance/data/general/human_handoff.yml +1 -1
  55. rasa/cli/project_templates/finance/data/transfers/check_transfer_limit.yml +18 -0
  56. rasa/cli/project_templates/finance/data/transfers/list_transactions.yml +46 -0
  57. rasa/cli/project_templates/finance/data/transfers/move_money_between_accounts.yml +51 -0
  58. rasa/cli/project_templates/finance/data/transfers/transfer_money.yml +29 -62
  59. rasa/cli/project_templates/finance/data/transfers/transfer_money_to_a_third_party.yml +175 -0
  60. rasa/cli/project_templates/finance/db/cards.json +18 -0
  61. rasa/cli/project_templates/finance/db/contacts.json +10 -0
  62. rasa/cli/project_templates/finance/db/my_account.json +6 -0
  63. rasa/cli/project_templates/finance/db/transactions.json +22 -0
  64. rasa/cli/project_templates/finance/docs/docs.md +8 -0
  65. rasa/cli/project_templates/finance/docs/fenlo_banking_faq/account_features/budgeting_analytics.txt +22 -0
  66. rasa/cli/project_templates/finance/docs/fenlo_banking_faq/account_features/multi_currency_accounts.txt +19 -0
  67. rasa/cli/project_templates/finance/docs/fenlo_banking_faq/account_features/premium_benefits.txt +19 -0
  68. rasa/cli/project_templates/finance/docs/fenlo_banking_faq/card_management/contactless_limits.txt +16 -0
  69. rasa/cli/project_templates/finance/docs/fenlo_banking_faq/card_management/freeze_unfreeze_card.txt +16 -0
  70. rasa/cli/project_templates/finance/docs/fenlo_banking_faq/card_management/lost_stolen_card.txt +19 -0
  71. rasa/cli/project_templates/finance/docs/fenlo_banking_faq/money_transfers/instant_payments.txt +19 -0
  72. rasa/cli/project_templates/finance/docs/fenlo_banking_faq/money_transfers/international_transfers.txt +19 -0
  73. rasa/cli/project_templates/finance/docs/fenlo_banking_faq/security_fraud/fraud_protection.txt +22 -0
  74. rasa/cli/project_templates/finance/docs/fenlo_banking_faq/security_fraud/secure_payments.txt +22 -0
  75. rasa/cli/project_templates/finance/domain/_system/patterns/pattern_session_start.yml +11 -0
  76. rasa/cli/project_templates/finance/domain/accounts/check_balance.yml +9 -5
  77. rasa/cli/project_templates/finance/domain/accounts/download_statements.yml +40 -0
  78. rasa/cli/project_templates/finance/domain/bills/bill_pay_reminder.yml +49 -0
  79. rasa/cli/project_templates/finance/domain/cards/activate_card.yml +24 -0
  80. rasa/cli/project_templates/finance/domain/cards/block_card.yml +33 -90
  81. rasa/cli/project_templates/finance/domain/cards/list_cards.yml +16 -0
  82. rasa/cli/project_templates/finance/domain/cards/replace_card.yml +43 -0
  83. rasa/cli/project_templates/finance/domain/cards/shared.yml +15 -0
  84. rasa/cli/project_templates/finance/domain/contacts/add_contact.yml +37 -0
  85. rasa/cli/project_templates/finance/domain/contacts/list_contacts.yml +16 -0
  86. rasa/cli/project_templates/finance/domain/contacts/remove_contact.yml +32 -0
  87. rasa/cli/project_templates/finance/domain/domain.md +9 -1
  88. rasa/cli/project_templates/finance/domain/general/_shared.yml +53 -0
  89. rasa/cli/project_templates/finance/domain/general/agent_details.yml +19 -0
  90. rasa/cli/project_templates/finance/domain/general/cannot_handle.yml +5 -2
  91. rasa/cli/project_templates/finance/domain/general/feedback.yml +0 -3
  92. rasa/cli/project_templates/finance/domain/general/human_handoff.yml +7 -3
  93. rasa/cli/project_templates/finance/domain/general/welcome.yml +5 -2
  94. rasa/cli/project_templates/finance/domain/transfers/check_transfer_limit.yml +32 -0
  95. rasa/cli/project_templates/finance/domain/transfers/list_transactions.yml +44 -0
  96. rasa/cli/project_templates/finance/domain/transfers/shared.yml +17 -0
  97. rasa/cli/project_templates/finance/domain/transfers/transfer_money.yml +203 -61
  98. rasa/cli/project_templates/finance/endpoints.yml +3 -2
  99. rasa/cli/project_templates/finance/prompts/rephraser_demo_personality_prompt.jinja2 +31 -12
  100. rasa/cli/project_templates/telco/data/data.md +1 -1
  101. rasa/cli/project_templates/telco/docs/docs.md +3 -0
  102. rasa/cli/project_templates/telco/domain/domain.md +1 -2
  103. rasa/constants.py +1 -1
  104. rasa/core/actions/direct_custom_actions_executor.py +9 -2
  105. rasa/core/actions/grpc_custom_action_executor.py +9 -4
  106. rasa/core/agent.py +2 -3
  107. rasa/core/available_agents.py +1 -1
  108. rasa/core/brokers/broker.py +1 -1
  109. rasa/core/brokers/kafka.py +52 -8
  110. rasa/core/channels/__init__.py +82 -35
  111. rasa/core/channels/inspector/README.md +1 -1
  112. rasa/core/channels/telegram.py +4 -9
  113. rasa/core/channels/voice_stream/twilio_media_streams.py +5 -1
  114. rasa/core/concurrent_lock_store.py +66 -16
  115. rasa/core/iam_credentials_providers/aws_iam_credentials_providers.py +76 -1
  116. rasa/core/iam_credentials_providers/credentials_provider_protocol.py +1 -1
  117. rasa/core/lock_store.py +41 -7
  118. rasa/core/policies/flows/agent_executor.py +632 -0
  119. rasa/core/policies/flows/flow_executor.py +3 -417
  120. rasa/core/policies/flows/mcp_tool_executor.py +32 -12
  121. rasa/core/processor.py +49 -28
  122. rasa/core/run.py +22 -0
  123. rasa/dialogue_understanding/commands/cancel_flow_command.py +1 -1
  124. rasa/dialogue_understanding/commands/chit_chat_answer_command.py +11 -3
  125. rasa/dialogue_understanding/commands/clarify_command.py +11 -3
  126. rasa/dialogue_understanding/commands/knowledge_answer_command.py +11 -3
  127. rasa/dialogue_understanding/generator/prompt_templates/agent_command_prompt_v2_claude_3_5_sonnet_20240620_template.jinja2 +3 -3
  128. rasa/dialogue_understanding/generator/prompt_templates/agent_command_prompt_v2_gpt_4o_2024_11_20_template.jinja2 +3 -3
  129. rasa/dialogue_understanding/generator/prompt_templates/agent_command_prompt_v3_claude_3_5_sonnet_20240620_template.jinja2 +3 -3
  130. rasa/dialogue_understanding/generator/prompt_templates/agent_command_prompt_v3_gpt_4o_2024_11_20_template.jinja2 +3 -3
  131. rasa/dialogue_understanding/generator/single_step/single_step_based_llm_command_generator.py +2 -0
  132. rasa/dialogue_understanding/processor/command_processor.py +70 -0
  133. rasa/dialogue_understanding/stack/dialogue_stack.py +0 -25
  134. rasa/engine/loader.py +12 -0
  135. rasa/engine/recipes/default_components.py +111 -82
  136. rasa/engine/recipes/default_recipe.py +79 -22
  137. rasa/engine/runner/dask.py +8 -5
  138. rasa/graph_components/validators/default_recipe_validator.py +59 -19
  139. rasa/model_manager/warm_rasa_process.py +13 -3
  140. rasa/model_training.py +0 -14
  141. rasa/nlu/classifiers/logistic_regression_classifier.py +1 -22
  142. rasa/nlu/classifiers/mitie_intent_classifier.py +3 -0
  143. rasa/nlu/classifiers/sklearn_intent_classifier.py +1 -3
  144. rasa/nlu/extractors/crf_entity_extractor.py +9 -10
  145. rasa/nlu/extractors/mitie_entity_extractor.py +3 -0
  146. rasa/nlu/extractors/spacy_entity_extractor.py +3 -0
  147. rasa/nlu/featurizers/dense_featurizer/mitie_featurizer.py +2 -0
  148. rasa/nlu/featurizers/dense_featurizer/spacy_featurizer.py +3 -0
  149. rasa/nlu/featurizers/sparse_featurizer/count_vectors_featurizer.py +4 -2
  150. rasa/nlu/featurizers/sparse_featurizer/lexical_syntactic_featurizer.py +4 -0
  151. rasa/nlu/tokenizers/jieba_tokenizer.py +3 -4
  152. rasa/nlu/tokenizers/mitie_tokenizer.py +3 -2
  153. rasa/nlu/tokenizers/spacy_tokenizer.py +3 -2
  154. rasa/nlu/utils/mitie_utils.py +3 -0
  155. rasa/nlu/utils/spacy_utils.py +3 -2
  156. rasa/telemetry.py +63 -0
  157. rasa/tracing/instrumentation/attribute_extractors.py +6 -1
  158. rasa/utils/log_utils.py +95 -4
  159. rasa/utils/tensorflow/__init__.py +0 -22
  160. rasa/utils/tensorflow/callback.py +17 -7
  161. rasa/utils/tensorflow/layers.py +10 -7
  162. rasa/utils/tensorflow/rasa_layers.py +1 -1
  163. rasa/version.py +1 -1
  164. {rasa_pro-3.14.0.dev10.dist-info → rasa_pro-3.14.0.dev12.dist-info}/METADATA +96 -89
  165. {rasa_pro-3.14.0.dev10.dist-info → rasa_pro-3.14.0.dev12.dist-info}/RECORD +168 -239
  166. rasa/cli/project_templates/finance/actions/accounts/action_ask_account.py +0 -47
  167. rasa/cli/project_templates/finance/actions/accounts/action_check_balance.py +0 -40
  168. rasa/cli/project_templates/finance/actions/action_session_start.py +0 -74
  169. rasa/cli/project_templates/finance/actions/cards/action_ask_card.py +0 -48
  170. rasa/cli/project_templates/finance/actions/cards/action_check_card_existence.py +0 -36
  171. rasa/cli/project_templates/finance/actions/cards/action_update_card_status.py +0 -54
  172. rasa/cli/project_templates/finance/actions/database.py +0 -277
  173. rasa/cli/project_templates/finance/actions/transfers/action_add_payee.py +0 -52
  174. rasa/cli/project_templates/finance/actions/transfers/action_ask_account_from.py +0 -51
  175. rasa/cli/project_templates/finance/actions/transfers/action_check_payee_existence.py +0 -40
  176. rasa/cli/project_templates/finance/actions/transfers/action_check_sufficient_funds.py +0 -40
  177. rasa/cli/project_templates/finance/actions/transfers/action_list_payees.py +0 -46
  178. rasa/cli/project_templates/finance/actions/transfers/action_remove_payee.py +0 -49
  179. rasa/cli/project_templates/finance/actions/transfers/action_schedule_payment.py +0 -19
  180. rasa/cli/project_templates/finance/actions/transfers/action_validate_payment_date.py +0 -36
  181. rasa/cli/project_templates/finance/csvs/accounts.csv +0 -8
  182. rasa/cli/project_templates/finance/csvs/advisors.csv +0 -7
  183. rasa/cli/project_templates/finance/csvs/appointments.csv +0 -211
  184. rasa/cli/project_templates/finance/csvs/branches.csv +0 -10
  185. rasa/cli/project_templates/finance/csvs/cards.csv +0 -11
  186. rasa/cli/project_templates/finance/csvs/payees.csv +0 -11
  187. rasa/cli/project_templates/finance/csvs/transactions.csv +0 -71
  188. rasa/cli/project_templates/finance/csvs/users.csv +0 -4
  189. rasa/cli/project_templates/finance/data/cards/select_card.yml +0 -12
  190. rasa/cli/project_templates/finance/data/general/bot_identity.yml +0 -6
  191. rasa/cli/project_templates/finance/data/system/patterns/pattern_chitchat.yml +0 -5
  192. rasa/cli/project_templates/finance/data/system/source/accounts.json +0 -51
  193. rasa/cli/project_templates/finance/data/system/source/advisors.json +0 -44
  194. rasa/cli/project_templates/finance/data/system/source/appointments.json +0 -1474
  195. rasa/cli/project_templates/finance/data/system/source/branches.json +0 -47
  196. rasa/cli/project_templates/finance/data/system/source/cards.json +0 -72
  197. rasa/cli/project_templates/finance/data/system/source/payees.json +0 -74
  198. rasa/cli/project_templates/finance/data/system/source/transactions.json +0 -492
  199. rasa/cli/project_templates/finance/data/system/source/users.json +0 -29
  200. rasa/cli/project_templates/finance/data/transfers/add_payee.yml +0 -29
  201. rasa/cli/project_templates/finance/data/transfers/list_payees.yml +0 -5
  202. rasa/cli/project_templates/finance/data/transfers/remove_payee.yml +0 -21
  203. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/consequences_of_blocking_card.txt +0 -8
  204. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/reasons_to_block_card.txt +0 -8
  205. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/recovering_from_card_fraud.txt +0 -8
  206. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/tips_for_card_security.txt +0 -8
  207. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/what_to_do_if_card_is_lost.txt +0 -8
  208. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/account_balance_security.txt +0 -7
  209. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/common_balance_inquiries.txt +0 -8
  210. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/methods_to_check_balance.txt +0 -8
  211. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/understanding_balance_updates.txt +0 -8
  212. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/what_to_do_if_balance_is_incorrect.txt +0 -8
  213. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/benefits_of_authorised_payees.txt +0 -8
  214. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/common_issues_with_payees.txt +0 -8
  215. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/general_payee_information.txt +0 -8
  216. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/payee_management_tips.txt +0 -8
  217. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/understanding_payee_types.txt +0 -8
  218. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/common_transfer_errors.txt +0 -8
  219. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/fees_for_transfers.txt +0 -8
  220. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/general_transfer_information.txt +0 -8
  221. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/security_tips_for_transfers.txt +0 -8
  222. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/transfer_processing_times.txt +0 -8
  223. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part1.txt +0 -50
  224. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part10.txt +0 -50
  225. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part11.txt +0 -48
  226. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part12.txt +0 -50
  227. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part13.txt +0 -50
  228. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part14.txt +0 -47
  229. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part15.txt +0 -50
  230. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part16.txt +0 -50
  231. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part17.txt +0 -47
  232. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part18.txt +0 -50
  233. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part19.txt +0 -50
  234. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part2.txt +0 -50
  235. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part20.txt +0 -47
  236. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part21.txt +0 -50
  237. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part22.txt +0 -50
  238. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part23.txt +0 -47
  239. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part24.txt +0 -50
  240. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part25.txt +0 -50
  241. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part26.txt +0 -47
  242. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part27.txt +0 -50
  243. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part28.txt +0 -50
  244. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part29.txt +0 -47
  245. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part3.txt +0 -47
  246. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part30.txt +0 -50
  247. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part31.txt +0 -50
  248. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part32.txt +0 -47
  249. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part33.txt +0 -50
  250. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part34.txt +0 -50
  251. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part35.txt +0 -47
  252. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part36.txt +0 -50
  253. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part37.txt +0 -50
  254. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part38.txt +0 -47
  255. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part39.txt +0 -50
  256. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part4.txt +0 -50
  257. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part40.txt +0 -50
  258. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part41.txt +0 -47
  259. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part42.txt +0 -50
  260. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part43.txt +0 -50
  261. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part44.txt +0 -47
  262. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part45.txt +0 -50
  263. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part46.txt +0 -50
  264. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part47.txt +0 -47
  265. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part48.txt +0 -50
  266. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part49.txt +0 -50
  267. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part5.txt +0 -50
  268. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part50.txt +0 -47
  269. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part51.txt +0 -50
  270. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part52.txt +0 -50
  271. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part53.txt +0 -47
  272. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part54.txt +0 -50
  273. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part55.txt +0 -50
  274. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part56.txt +0 -47
  275. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part57.txt +0 -50
  276. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part58.txt +0 -50
  277. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part59.txt +0 -47
  278. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part6.txt +0 -47
  279. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part60.txt +0 -50
  280. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part61.txt +0 -50
  281. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part7.txt +0 -50
  282. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part8.txt +0 -50
  283. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part9.txt +0 -47
  284. rasa/cli/project_templates/finance/domain/cards/select_card.yml +0 -12
  285. rasa/cli/project_templates/finance/domain/general/bot_identity.yml +0 -5
  286. rasa/cli/project_templates/finance/domain/general/defaults.yml +0 -24
  287. rasa/cli/project_templates/finance/domain/general/goodbye.yml +0 -7
  288. rasa/cli/project_templates/finance/domain/general/help.yml +0 -5
  289. rasa/cli/project_templates/finance/domain/general/utils.yml +0 -13
  290. rasa/cli/project_templates/finance/domain/transfers/add_payee.yml +0 -47
  291. rasa/cli/project_templates/finance/domain/transfers/list_payees.yml +0 -4
  292. rasa/cli/project_templates/finance/domain/transfers/remove_payee.yml +0 -16
  293. {rasa_pro-3.14.0.dev10.dist-info → rasa_pro-3.14.0.dev12.dist-info}/NOTICE +0 -0
  294. {rasa_pro-3.14.0.dev10.dist-info → rasa_pro-3.14.0.dev12.dist-info}/WHEEL +0 -0
  295. {rasa_pro-3.14.0.dev10.dist-info → rasa_pro-3.14.0.dev12.dist-info}/entry_points.txt +0 -0
@@ -11,38 +11,21 @@ from rasa.dialogue_understanding.generator import (
11
11
  LLMCommandGenerator,
12
12
  )
13
13
  from rasa.dialogue_understanding.generator.nlu_command_adapter import NLUCommandAdapter
14
- from rasa.engine.graph import GraphComponent
15
14
  from rasa.nlu.classifiers.fallback_classifier import FallbackClassifier
16
15
  from rasa.nlu.classifiers.keyword_intent_classifier import KeywordIntentClassifier
17
- from rasa.nlu.classifiers.logistic_regression_classifier import (
18
- LogisticRegressionClassifier,
19
- )
20
- from rasa.nlu.classifiers.mitie_intent_classifier import MitieIntentClassifier
21
- from rasa.nlu.classifiers.sklearn_intent_classifier import SklearnIntentClassifier
22
- from rasa.nlu.extractors.crf_entity_extractor import CRFEntityExtractor
23
16
  from rasa.nlu.extractors.duckling_entity_extractor import DucklingEntityExtractor
24
17
  from rasa.nlu.extractors.entity_synonyms import EntitySynonymMapper
25
- from rasa.nlu.extractors.mitie_entity_extractor import MitieEntityExtractor
26
18
  from rasa.nlu.extractors.regex_entity_extractor import RegexEntityExtractor
27
- from rasa.nlu.extractors.spacy_entity_extractor import SpacyEntityExtractor
28
- from rasa.nlu.featurizers.dense_featurizer.mitie_featurizer import MitieFeaturizer
29
- from rasa.nlu.featurizers.dense_featurizer.spacy_featurizer import SpacyFeaturizer
30
19
  from rasa.nlu.featurizers.sparse_featurizer.count_vectors_featurizer import (
31
20
  CountVectorsFeaturizer,
32
21
  )
33
- from rasa.nlu.featurizers.sparse_featurizer.lexical_syntactic_featurizer import (
34
- LexicalSyntacticFeaturizer,
35
- )
36
22
  from rasa.nlu.featurizers.sparse_featurizer.regex_featurizer import RegexFeaturizer
37
- from rasa.nlu.tokenizers.jieba_tokenizer import JiebaTokenizer
38
- from rasa.nlu.tokenizers.mitie_tokenizer import MitieTokenizer
39
- from rasa.nlu.tokenizers.spacy_tokenizer import SpacyTokenizer
40
23
  from rasa.nlu.tokenizers.whitespace_tokenizer import WhitespaceTokenizer
41
- from rasa.nlu.utils.mitie_utils import MitieNLP
42
- from rasa.nlu.utils.spacy_utils import SpacyNLP
43
24
  from rasa.shared.utils.common import conditional_import
44
25
 
45
- # Conditional imports for TensorFlow-dependent components
26
+ # Conditional imports for components with external dependencies
27
+
28
+ # components dependent on tensorflow
46
29
  TEDPolicy, TED_POLICY_AVAILABLE = conditional_import(
47
30
  "rasa.core.policies.ted_policy", "TEDPolicy"
48
31
  )
@@ -62,40 +45,82 @@ ResponseSelector, RESPONSE_SELECTOR_AVAILABLE = conditional_import(
62
45
  "rasa.nlu.selectors.response_selector", "ResponseSelector"
63
46
  )
64
47
 
48
+ # components dependent on skops
49
+ LogisticRegressionClassifier, LOGISTIC_REGRESSION_CLASSIFIER_AVAILABLE = (
50
+ conditional_import(
51
+ "rasa.nlu.classifiers.logistic_regression_classifier",
52
+ "LogisticRegressionClassifier",
53
+ )
54
+ )
55
+ SklearnIntentClassifier, SKLEARN_INTENT_CLASSIFIER_AVAILABLE = conditional_import(
56
+ "rasa.nlu.classifiers.sklearn_intent_classifier", "SklearnIntentClassifier"
57
+ )
58
+
59
+ # components dependent on spacy
60
+ LexicalSyntacticFeaturizer, LEXICAL_SYNTACTIC_FEATURIZER_AVAILABLE = conditional_import(
61
+ "rasa.nlu.featurizers.sparse_featurizer.lexical_syntactic_featurizer",
62
+ "LexicalSyntacticFeaturizer",
63
+ )
64
+ SpacyFeaturizer, SPACY_FEATURIZER_AVAILABLE = conditional_import(
65
+ "rasa.nlu.featurizers.dense_featurizer.spacy_featurizer", "SpacyFeaturizer"
66
+ )
67
+ SpacyTokenizer, SPACY_TOKENIZER_AVAILABLE = conditional_import(
68
+ "rasa.nlu.tokenizers.spacy_tokenizer", "SpacyTokenizer"
69
+ )
70
+ SpacyEntityExtractor, SPACY_ENTITY_EXTRACTOR_AVAILABLE = conditional_import(
71
+ "rasa.nlu.extractors.spacy_entity_extractor", "SpacyEntityExtractor"
72
+ )
73
+ SpacyNLP, SPACY_NLP_AVAILABLE = conditional_import(
74
+ "rasa.nlu.utils.spacy_utils", "SpacyNLP"
75
+ )
76
+
77
+ # components dependent on sklearn_crfsuite
78
+ CRFEntityExtractor, CRF_ENTITY_EXTRACTOR_AVAILABLE = conditional_import(
79
+ "rasa.nlu.extractors.crf_entity_extractor", "CRFEntityExtractor"
80
+ )
81
+
82
+ # components dependent on mitie
83
+ MitieFeaturizer, MITIE_FEATURIZER_AVAILABLE = conditional_import(
84
+ "rasa.nlu.featurizers.dense_featurizer.mitie_featurizer", "MitieFeaturizer"
85
+ )
86
+ MitieTokenizer, MITIE_TOKENIZER_AVAILABLE = conditional_import(
87
+ "rasa.nlu.tokenizers.mitie_tokenizer", "MitieTokenizer"
88
+ )
89
+ MitieIntentClassifier, MITIE_INTENT_CLASSIFIER_AVAILABLE = conditional_import(
90
+ "rasa.nlu.classifiers.mitie_intent_classifier", "MitieIntentClassifier"
91
+ )
92
+ MitieEntityExtractor, MITIE_ENTITY_EXTRACTOR_AVAILABLE = conditional_import(
93
+ "rasa.nlu.extractors.mitie_entity_extractor", "MitieEntityExtractor"
94
+ )
95
+ MitieNLP, MITIE_NLP_AVAILABLE = conditional_import(
96
+ "rasa.nlu.utils.mitie_utils", "MitieNLP"
97
+ )
98
+
99
+ # components dependent on jieba
100
+ JiebaTokenizer, JIEBA_TOKENIZER_AVAILABLE = conditional_import(
101
+ "rasa.nlu.tokenizers.jieba_tokenizer", "JiebaTokenizer"
102
+ )
103
+
104
+ # Base components that are always available (no external dependencies)
65
105
  DEFAULT_COMPONENTS = [
66
- # Message Classifiers
106
+ # Classifiers
67
107
  FallbackClassifier,
68
108
  KeywordIntentClassifier,
69
- MitieIntentClassifier,
70
- SklearnIntentClassifier,
71
- LogisticRegressionClassifier,
72
109
  NLUCommandAdapter,
73
110
  LLMCommandGenerator,
74
111
  LLMBasedRouter,
75
112
  IntentBasedRouter,
76
- # Response Selectors
77
- # Message Entity Extractors
78
- CRFEntityExtractor,
113
+ # Entity Extractors
79
114
  DucklingEntityExtractor,
80
115
  EntitySynonymMapper,
81
- MitieEntityExtractor,
82
- SpacyEntityExtractor,
83
116
  RegexEntityExtractor,
84
- # Message Feauturizers
85
- LexicalSyntacticFeaturizer,
86
- MitieFeaturizer,
87
- SpacyFeaturizer,
117
+ # Featurizers
88
118
  CountVectorsFeaturizer,
89
119
  RegexFeaturizer,
90
120
  # Tokenizers
91
- JiebaTokenizer,
92
- MitieTokenizer,
93
- SpacyTokenizer,
94
121
  WhitespaceTokenizer,
95
122
  # Language Model Providers
96
- MitieNLP,
97
- SpacyNLP,
98
- # Dialogue Management Policies
123
+ # Policies
99
124
  RulePolicy,
100
125
  MemoizationPolicy,
101
126
  AugmentedMemoizationPolicy,
@@ -104,52 +129,56 @@ DEFAULT_COMPONENTS = [
104
129
  IntentlessPolicy,
105
130
  ]
106
131
 
132
+ # Conditionally add components based on dependencies
107
133
 
108
- class ComponentInserter:
109
- """Manages insertion of components at specific positions with index adjustment."""
110
-
111
- def __init__(self, insertion_points: dict[str, int]):
112
- self.insertion_points = insertion_points
113
- self.insertion_counts = {category: 0 for category in insertion_points}
134
+ # components dependent on tensorflow
135
+ if DIET_CLASSIFIER_AVAILABLE:
136
+ DEFAULT_COMPONENTS.append(DIETClassifier)
137
+ if CONVERT_FEATURIZER_AVAILABLE:
138
+ DEFAULT_COMPONENTS.append(ConveRTFeaturizer)
139
+ if LANGUAGE_MODEL_FEATURIZER_AVAILABLE:
140
+ DEFAULT_COMPONENTS.append(LanguageModelFeaturizer)
141
+ if RESPONSE_SELECTOR_AVAILABLE:
142
+ DEFAULT_COMPONENTS.append(ResponseSelector)
143
+ if TED_POLICY_AVAILABLE:
144
+ DEFAULT_COMPONENTS.append(TEDPolicy)
145
+ if UNEXPECTED_INTENT_POLICY_AVAILABLE:
146
+ DEFAULT_COMPONENTS.append(UnexpecTEDIntentPolicy)
114
147
 
115
- def insert_if_available(
116
- self, component: GraphComponent, is_available: bool, category: str
117
- ) -> None:
118
- """Insert a component at the appropriate position if available."""
119
- if is_available and component is not None:
120
- # Calculate the adjusted index based on insertions in earlier categories
121
- adjusted_index = self.insertion_points[category]
122
- for cat, count in self.insertion_counts.items():
123
- if self.insertion_points[cat] < self.insertion_points[category]:
124
- adjusted_index += count
148
+ # components dependent on skops
149
+ if LOGISTIC_REGRESSION_CLASSIFIER_AVAILABLE:
150
+ DEFAULT_COMPONENTS.append(LogisticRegressionClassifier)
151
+ if SKLEARN_INTENT_CLASSIFIER_AVAILABLE:
152
+ DEFAULT_COMPONENTS.append(SklearnIntentClassifier)
125
153
 
126
- DEFAULT_COMPONENTS.insert(adjusted_index, component)
127
- self.insertion_counts[category] += 1
154
+ # components dependent on spacy
155
+ if LEXICAL_SYNTACTIC_FEATURIZER_AVAILABLE:
156
+ DEFAULT_COMPONENTS.append(LexicalSyntacticFeaturizer)
157
+ if SPACY_FEATURIZER_AVAILABLE:
158
+ DEFAULT_COMPONENTS.append(SpacyFeaturizer)
159
+ if SPACY_TOKENIZER_AVAILABLE:
160
+ DEFAULT_COMPONENTS.append(SpacyTokenizer)
161
+ if SPACY_ENTITY_EXTRACTOR_AVAILABLE:
162
+ DEFAULT_COMPONENTS.append(SpacyEntityExtractor)
163
+ if SPACY_NLP_AVAILABLE:
164
+ DEFAULT_COMPONENTS.append(SpacyNLP)
128
165
 
166
+ # components dependent on mitie
167
+ if MITIE_FEATURIZER_AVAILABLE:
168
+ DEFAULT_COMPONENTS.append(MitieFeaturizer)
169
+ if MITIE_TOKENIZER_AVAILABLE:
170
+ DEFAULT_COMPONENTS.append(MitieTokenizer)
171
+ if MITIE_INTENT_CLASSIFIER_AVAILABLE:
172
+ DEFAULT_COMPONENTS.append(MitieIntentClassifier)
173
+ if MITIE_ENTITY_EXTRACTOR_AVAILABLE:
174
+ DEFAULT_COMPONENTS.append(MitieEntityExtractor)
175
+ if MITIE_NLP_AVAILABLE:
176
+ DEFAULT_COMPONENTS.append(MitieNLP)
129
177
 
130
- # Define insertion points by component category to preserve order
131
- INSERTION_POINTS = {
132
- "classifiers": 1,
133
- "response_selectors": 11,
134
- "featurizers": 20,
135
- "policies": 35,
136
- }
178
+ # components dependent on jieba
179
+ if JIEBA_TOKENIZER_AVAILABLE:
180
+ DEFAULT_COMPONENTS.append(JiebaTokenizer)
137
181
 
138
- # Create inserter instance
139
- inserter = ComponentInserter(INSERTION_POINTS)
140
-
141
- # Conditionally add TensorFlow-dependent components
142
- inserter.insert_if_available(DIETClassifier, DIET_CLASSIFIER_AVAILABLE, "classifiers")
143
- inserter.insert_if_available(
144
- ResponseSelector, RESPONSE_SELECTOR_AVAILABLE, "response_selectors"
145
- )
146
- inserter.insert_if_available(
147
- ConveRTFeaturizer, CONVERT_FEATURIZER_AVAILABLE, "featurizers"
148
- )
149
- inserter.insert_if_available(
150
- LanguageModelFeaturizer, LANGUAGE_MODEL_FEATURIZER_AVAILABLE, "featurizers"
151
- )
152
- inserter.insert_if_available(TEDPolicy, TED_POLICY_AVAILABLE, "policies")
153
- inserter.insert_if_available(
154
- UnexpecTEDIntentPolicy, UNEXPECTED_INTENT_POLICY_AVAILABLE, "policies"
155
- )
182
+ # components dependent on sklearn_crfsuite
183
+ if CRF_ENTITY_EXTRACTOR_AVAILABLE:
184
+ DEFAULT_COMPONENTS.append(CRFEntityExtractor)
@@ -183,9 +183,23 @@ class DefaultV1Recipe(Recipe):
183
183
  # Importing all the default Rasa components will automatically register them
184
184
  from rasa.engine.recipes.default_components import (
185
185
  CONVERT_FEATURIZER_AVAILABLE,
186
+ CRF_ENTITY_EXTRACTOR_AVAILABLE,
186
187
  DIET_CLASSIFIER_AVAILABLE,
188
+ JIEBA_TOKENIZER_AVAILABLE,
187
189
  LANGUAGE_MODEL_FEATURIZER_AVAILABLE,
190
+ LEXICAL_SYNTACTIC_FEATURIZER_AVAILABLE,
191
+ LOGISTIC_REGRESSION_CLASSIFIER_AVAILABLE,
192
+ MITIE_ENTITY_EXTRACTOR_AVAILABLE,
193
+ MITIE_FEATURIZER_AVAILABLE,
194
+ MITIE_INTENT_CLASSIFIER_AVAILABLE,
195
+ MITIE_NLP_AVAILABLE,
196
+ MITIE_TOKENIZER_AVAILABLE,
188
197
  RESPONSE_SELECTOR_AVAILABLE,
198
+ SKLEARN_INTENT_CLASSIFIER_AVAILABLE,
199
+ SPACY_ENTITY_EXTRACTOR_AVAILABLE,
200
+ SPACY_FEATURIZER_AVAILABLE,
201
+ SPACY_NLP_AVAILABLE,
202
+ SPACY_TOKENIZER_AVAILABLE,
189
203
  TED_POLICY_AVAILABLE,
190
204
  UNEXPECTED_INTENT_POLICY_AVAILABLE,
191
205
  )
@@ -207,27 +221,45 @@ class DefaultV1Recipe(Recipe):
207
221
  "Please use Python 3.11 or earlier for TensorFlow-based components. "
208
222
  )
209
223
 
210
- # Check for TensorFlow components that failed to load
224
+ # Check for nlu components that failed to load
211
225
  # because conditional module import of those components did not succeed
212
- tensorflow_component_availability = {
226
+ nlu_components = {
227
+ # tensorflow-dependent components
213
228
  "DIETClassifier": DIET_CLASSIFIER_AVAILABLE,
214
229
  "TEDPolicy": TED_POLICY_AVAILABLE,
215
230
  "UnexpecTEDIntentPolicy": UNEXPECTED_INTENT_POLICY_AVAILABLE,
216
231
  "ResponseSelector": RESPONSE_SELECTOR_AVAILABLE,
217
232
  "ConveRTFeaturizer": CONVERT_FEATURIZER_AVAILABLE,
218
233
  "LanguageModelFeaturizer": LANGUAGE_MODEL_FEATURIZER_AVAILABLE,
234
+ # nlu components dependent on other dependencies than tensorflow
235
+ "LogisticRegressionClassifier": LOGISTIC_REGRESSION_CLASSIFIER_AVAILABLE,
236
+ "SklearnIntentClassifier": SKLEARN_INTENT_CLASSIFIER_AVAILABLE,
237
+ "LexicalSyntacticFeaturizer": LEXICAL_SYNTACTIC_FEATURIZER_AVAILABLE,
238
+ "MitieFeaturizer": MITIE_FEATURIZER_AVAILABLE,
239
+ "SpacyFeaturizer": SPACY_FEATURIZER_AVAILABLE,
240
+ "JiebaTokenizer": JIEBA_TOKENIZER_AVAILABLE,
241
+ "MitieTokenizer": MITIE_TOKENIZER_AVAILABLE,
242
+ "SpacyTokenizer": SPACY_TOKENIZER_AVAILABLE,
243
+ "MitieIntentClassifier": MITIE_INTENT_CLASSIFIER_AVAILABLE,
244
+ "MitieEntityExtractor": MITIE_ENTITY_EXTRACTOR_AVAILABLE,
245
+ "SpacyEntityExtractor": SPACY_ENTITY_EXTRACTOR_AVAILABLE,
246
+ "MitieNLP": MITIE_NLP_AVAILABLE,
247
+ "SpacyNLP": SPACY_NLP_AVAILABLE,
248
+ "CRFEntityExtractor": CRF_ENTITY_EXTRACTOR_AVAILABLE,
219
249
  }
220
250
 
221
- if name in tensorflow_component_availability:
222
- # TensorFlow-dependent component failed to load
223
- # if TensorFlow is not available
224
- if not tensorflow_component_availability[name]:
225
- raise InvalidConfigException(
226
- f"{name} requires TensorFlow. "
227
- "Please install it with: "
228
- "`pip install rasa[tensorflow]`. "
229
- "If using poetry, install it with "
230
- "`poetry install --extras tensorflow`."
251
+ if name in nlu_components:
252
+ # nlu-dependent component failed to load
253
+ # because nlu dependency group not installed
254
+ if not nlu_components[name]:
255
+ from rasa.exceptions import MissingDependencyException
256
+
257
+ raise MissingDependencyException(
258
+ f"The {name} component requires additional dependencies "
259
+ f"which are not installed. "
260
+ f"Please install the required extra by running: "
261
+ f"pip install 'rasa-pro[nlu]' OR "
262
+ f"poetry add 'rasa-pro[nlu]'"
231
263
  )
232
264
 
233
265
  raise InvalidConfigException(
@@ -525,17 +557,42 @@ class DefaultV1Recipe(Recipe):
525
557
  component: Type[GraphComponent],
526
558
  component_config: Dict[Text, Any],
527
559
  ) -> Dict[Text, Any]:
528
- from rasa.nlu.classifiers.mitie_intent_classifier import MitieIntentClassifier
529
- from rasa.nlu.classifiers.sklearn_intent_classifier import (
530
- SklearnIntentClassifier,
531
- )
532
- from rasa.nlu.extractors.mitie_entity_extractor import MitieEntityExtractor
560
+ # Try to import MitieIntentClassifier, but handle ImportError gracefully
561
+ # since the dependencies for it may not be installed
562
+ try:
563
+ from rasa.nlu.classifiers.mitie_intent_classifier import (
564
+ MitieIntentClassifier,
565
+ )
566
+ except ImportError:
567
+ MitieIntentClassifier = None # type: ignore
533
568
 
534
- cli_args_mapping: Dict[Type[GraphComponent], List[Text]] = {
535
- MitieIntentClassifier: ["num_threads"],
536
- MitieEntityExtractor: ["num_threads"],
537
- SklearnIntentClassifier: ["num_threads"],
538
- }
569
+ # Try to import MitieEntityExtractor, but handle ImportError gracefully
570
+ # since the dependencies for it may not be installed
571
+ try:
572
+ from rasa.nlu.extractors.mitie_entity_extractor import MitieEntityExtractor
573
+ except ImportError:
574
+ MitieEntityExtractor = None # type: ignore
575
+
576
+ # Try to import SklearnIntentClassifier, but handle ImportError gracefully
577
+ # since the dependencies for it may not be installed
578
+ try:
579
+ from rasa.nlu.classifiers.sklearn_intent_classifier import (
580
+ SklearnIntentClassifier,
581
+ )
582
+ except ImportError:
583
+ SklearnIntentClassifier = None # type: ignore
584
+
585
+ cli_args_mapping: Dict[Type[GraphComponent], List[Text]] = {}
586
+
587
+ # Only add components if they were successfully imported
588
+ if MitieIntentClassifier is not None:
589
+ cli_args_mapping[MitieIntentClassifier] = ["num_threads"]
590
+
591
+ if MitieEntityExtractor is not None:
592
+ cli_args_mapping[MitieEntityExtractor] = ["num_threads"]
593
+
594
+ if SklearnIntentClassifier is not None:
595
+ cli_args_mapping[SklearnIntentClassifier] = ["num_threads"]
539
596
 
540
597
  config_from_cli = {
541
598
  param: cli_parameters[param]
@@ -1,18 +1,18 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import asyncio
4
- import logging
5
4
  from typing import Any, Dict, List, Optional, Text
6
5
 
7
6
  import dask.core
8
7
  import dask.local
8
+ import structlog
9
9
 
10
10
  from rasa.engine.exceptions import GraphRunError
11
11
  from rasa.engine.graph import ExecutionContext, GraphNode, GraphNodeHook, GraphSchema
12
12
  from rasa.engine.runner.interface import GraphRunner
13
13
  from rasa.engine.storage.storage import ModelStorage
14
14
 
15
- logger = logging.getLogger(__name__)
15
+ structlogger = structlog.get_logger()
16
16
 
17
17
 
18
18
  class DaskGraphRunner(GraphRunner):
@@ -94,9 +94,12 @@ class DaskGraphRunner(GraphRunner):
94
94
  if inputs:
95
95
  self._add_inputs_to_graph(inputs, run_graph)
96
96
 
97
- logger.debug(
98
- f"Running graph with inputs: {inputs}, targets: {targets} "
99
- f"and {self._execution_context}."
97
+ structlogger.debug(
98
+ "rasa.engine.runner.dask.run",
99
+ event_info="Running graph with inputs, targets and execution context.",
100
+ inputs=inputs,
101
+ targets=targets,
102
+ execution_context=self._execution_context,
100
103
  )
101
104
 
102
105
  try:
@@ -13,12 +13,7 @@ from rasa.core.policies.rule_policy import RulePolicy
13
13
  from rasa.engine.graph import ExecutionContext, GraphComponent, GraphSchema, SchemaNode
14
14
  from rasa.engine.storage.resource import Resource
15
15
  from rasa.engine.storage.storage import ModelStorage
16
- from rasa.nlu.extractors.crf_entity_extractor import (
17
- CRFEntityExtractor,
18
- CRFEntityExtractorOptions,
19
- )
20
16
  from rasa.nlu.extractors.entity_synonyms import EntitySynonymMapper
21
- from rasa.nlu.extractors.mitie_entity_extractor import MitieEntityExtractor
22
17
  from rasa.nlu.extractors.regex_entity_extractor import RegexEntityExtractor
23
18
  from rasa.nlu.featurizers.featurizer import Featurizer
24
19
  from rasa.nlu.featurizers.sparse_featurizer.regex_featurizer import RegexFeaturizer
@@ -57,8 +52,23 @@ ResponseSelector, RESPONSE_SELECTOR_AVAILABLE = conditional_import(
57
52
  "rasa.nlu.selectors.response_selector", "ResponseSelector"
58
53
  )
59
54
 
60
- # TODO: Can we replace this with the registered types from the regitry?
61
- TRAINABLE_EXTRACTORS = [MitieEntityExtractor, CRFEntityExtractor]
55
+ # Conditional imports for nlu components requiring other dependencies than tensorflow
56
+ MitieEntityExtractor, MITIE_ENTITY_EXTRACTOR_AVAILABLE = conditional_import(
57
+ "rasa.nlu.extractors.mitie_entity_extractor", "MitieEntityExtractor"
58
+ )
59
+ CRFEntityExtractor, CRF_ENTITY_EXTRACTOR_AVAILABLE = conditional_import(
60
+ "rasa.nlu.extractors.crf_entity_extractor", "CRFEntityExtractor"
61
+ )
62
+ CRFEntityExtractorOptions, _ = conditional_import(
63
+ "rasa.nlu.extractors.crf_entity_extractor", "CRFEntityExtractorOptions"
64
+ )
65
+
66
+ # TODO: Can we replace this with the registered types from the registry?
67
+ TRAINABLE_EXTRACTORS = []
68
+ if CRF_ENTITY_EXTRACTOR_AVAILABLE:
69
+ TRAINABLE_EXTRACTORS.append(CRFEntityExtractor)
70
+ if MITIE_ENTITY_EXTRACTOR_AVAILABLE:
71
+ TRAINABLE_EXTRACTORS.append(MitieEntityExtractor)
62
72
  if DIET_CLASSIFIER_AVAILABLE:
63
73
  TRAINABLE_EXTRACTORS.append(DIETClassifier)
64
74
  # TODO: replace these once the Recipe is merged (used in tests)
@@ -173,18 +183,27 @@ class DefaultV1RecipeValidator(GraphComponent):
173
183
  docs=DOCS_URL_COMPONENTS,
174
184
  )
175
185
 
186
+ available_extractors = {DIETClassifier}
187
+ if CRF_ENTITY_EXTRACTOR_AVAILABLE:
188
+ available_extractors.add(CRFEntityExtractor)
189
+
176
190
  if training_data.entity_examples and self._component_types.isdisjoint(
177
- {DIETClassifier, CRFEntityExtractor}
191
+ available_extractors
178
192
  ):
179
193
  if training_data.entity_roles_groups_used():
194
+ crf_name = (
195
+ CRFEntityExtractor.__name__
196
+ if CRFEntityExtractor
197
+ else "CRFEntityExtractor"
198
+ )
180
199
  rasa.shared.utils.io.raise_warning(
181
200
  f"You have defined training data with entities that "
182
201
  f"have roles/groups, but your NLU configuration does not "
183
202
  f"include a '{DIETClassifier.__name__}' "
184
- f"or a '{CRFEntityExtractor.__name__}'. "
203
+ f"or a '{crf_name}'. "
185
204
  f"To train entities that have roles/groups, "
186
205
  f"add either '{DIETClassifier.__name__}' "
187
- f"or '{CRFEntityExtractor.__name__}' to your "
206
+ f"or '{crf_name}' to your "
188
207
  f"configuration.",
189
208
  docs=DOCS_URL_COMPONENTS,
190
209
  )
@@ -218,7 +237,16 @@ class DefaultV1RecipeValidator(GraphComponent):
218
237
  )
219
238
 
220
239
  if training_data.lookup_tables:
221
- if self._component_types.isdisjoint([CRFEntityExtractor, DIETClassifier]):
240
+ lookup_extractors = [DIETClassifier]
241
+ if CRF_ENTITY_EXTRACTOR_AVAILABLE:
242
+ lookup_extractors.append(CRFEntityExtractor)
243
+
244
+ if self._component_types.isdisjoint(lookup_extractors):
245
+ crf_name = (
246
+ CRFEntityExtractor.__name__
247
+ if CRFEntityExtractor
248
+ else "CRFEntityExtractor"
249
+ )
222
250
  rasa.shared.utils.io.raise_warning(
223
251
  f"You have defined training data consisting of lookup tables, but "
224
252
  f"your NLU configuration does not include any components "
@@ -226,33 +254,45 @@ class DefaultV1RecipeValidator(GraphComponent):
226
254
  f"To make use of the features that are created with the "
227
255
  f"help of the lookup tables, "
228
256
  f"add a '{DIETClassifier.__name__}' or a "
229
- f"'{CRFEntityExtractor.__name__}' "
257
+ f"'{crf_name}' "
230
258
  f"with the 'pattern' feature "
231
259
  f"to your configuration.",
232
260
  docs=DOCS_URL_COMPONENTS,
233
261
  )
234
262
 
235
- elif CRFEntityExtractor in self._component_types:
263
+ elif (
264
+ CRF_ENTITY_EXTRACTOR_AVAILABLE
265
+ and CRFEntityExtractor in self._component_types
266
+ ):
236
267
  crf_schema_nodes = [
237
268
  schema_node
238
269
  for schema_node in self._graph_schema.nodes.values()
239
270
  if schema_node.uses == CRFEntityExtractor
240
271
  ]
241
- has_pattern_feature = any(
242
- CRFEntityExtractorOptions.PATTERN in feature_list
243
- for crf in crf_schema_nodes
244
- for feature_list in crf.config.get("features", [])
272
+ has_pattern_feature = (
273
+ any(
274
+ CRFEntityExtractorOptions.PATTERN in feature_list
275
+ for crf in crf_schema_nodes
276
+ for feature_list in crf.config.get("features", [])
277
+ )
278
+ if CRFEntityExtractorOptions
279
+ else False
245
280
  )
246
281
 
247
282
  if not has_pattern_feature:
283
+ crf_name = (
284
+ CRFEntityExtractor.__name__
285
+ if CRFEntityExtractor
286
+ else "CRFEntityExtractor"
287
+ )
248
288
  rasa.shared.utils.io.raise_warning(
249
289
  f"You have defined training data consisting of "
250
290
  f"lookup tables, but your NLU configuration's "
251
- f"'{CRFEntityExtractor.__name__}' "
291
+ f"'{crf_name}' "
252
292
  f"does not include the "
253
293
  f"'pattern' feature. To featurize lookup tables, "
254
294
  f"add the 'pattern' feature to the "
255
- f"'{CRFEntityExtractor.__name__}' "
295
+ f"'{crf_name}' "
256
296
  "in your configuration.",
257
297
  docs=DOCS_URL_COMPONENTS,
258
298
  )
@@ -1,6 +1,7 @@
1
1
  import os
2
2
  import shlex
3
3
  import subprocess
4
+ import time
4
5
  import uuid
5
6
  from dataclasses import dataclass
6
7
  from typing import List
@@ -149,19 +150,28 @@ def warmup() -> None:
149
150
  We import them now, so that the training / deployment can later
150
151
  directly start.
151
152
  """
153
+ start_time = time.time()
152
154
  try:
153
155
  import langchain # noqa: F401
154
156
  import litellm # noqa: F401
155
157
  import matplotlib # noqa: F401
156
158
  import numpy # noqa: F401
157
159
  import pandas # noqa: F401
158
- import presidio_analyzer # noqa: F401
159
- import spacy # noqa: F401
160
160
  import tensorflow # noqa: F401
161
161
 
162
162
  import rasa.validator # noqa: F401
163
- except ImportError:
163
+ except ImportError as e:
164
+ structlogger.warning(
165
+ "model_trainer.warmup_error",
166
+ error=str(e),
167
+ )
164
168
  pass
169
+ finally:
170
+ end_time = time.time()
171
+ structlogger.debug(
172
+ "model_trainer.warmup_time",
173
+ time_in_seconds=end_time - start_time,
174
+ )
165
175
 
166
176
 
167
177
  def warm_rasa_main() -> None:
rasa/model_training.py CHANGED
@@ -201,20 +201,6 @@ async def train(
201
201
  config, domain, training_files, core_additional_arguments
202
202
  )
203
203
 
204
- # Check TensorFlow availability and warn if not available
205
- import importlib.util
206
-
207
- if importlib.util.find_spec("tensorflow") is None:
208
- structlogger.warning(
209
- "model_training.train.tensorflow_not_available",
210
- event_info=(
211
- "TensorFlow is not installed. Components requiring TensorFlow "
212
- "(DIETClassifier, TEDPolicy, UnexpecTEDIntentPolicy, ResponseSelector, "
213
- "ConveRTFeaturizer, LanguageModelFeaturizer) "
214
- "will not be available."
215
- ),
216
- )
217
-
218
204
  stories = file_importer.get_stories()
219
205
  flows = file_importer.get_flows()
220
206
  nlu_data = file_importer.get_nlu_data()
@@ -1,5 +1,6 @@
1
1
  from typing import Any, Dict, List, Text, Tuple, Type
2
2
 
3
+ import skops.io as sio
3
4
  import structlog
4
5
  from scipy.sparse import csr_matrix, hstack, vstack
5
6
  from sklearn.exceptions import NotFittedError
@@ -21,21 +22,6 @@ from rasa.utils.tensorflow.constants import RANKING_LENGTH
21
22
  structlogger = structlog.get_logger()
22
23
 
23
24
 
24
- def _check_skops_dependency() -> None:
25
- """Check if skops is available and raise error if not."""
26
- import importlib.util
27
-
28
- if importlib.util.find_spec("skops") is None:
29
- from rasa.exceptions import MissingDependencyException
30
-
31
- raise MissingDependencyException(
32
- "The LogisticRegressionClassifier requires the 'skops' package "
33
- "to save and load trained models. "
34
- "To install it, run: `pip install rasa[skops]` or `pip install skops`. "
35
- "If using poetry, run `poetry install --extras skops`. "
36
- )
37
-
38
-
39
25
  @DefaultV1Recipe.register(
40
26
  DefaultV1Recipe.ComponentType.INTENT_CLASSIFIER, is_trainable=True
41
27
  )
@@ -166,7 +152,6 @@ class LogisticRegressionClassifier(IntentClassifier, GraphComponent):
166
152
  execution_context: ExecutionContext,
167
153
  ) -> "LogisticRegressionClassifier":
168
154
  """Creates a new untrained component (see parent class for full docstring)."""
169
- _check_skops_dependency()
170
155
  return cls(config, execution_context.node_name, model_storage, resource)
171
156
 
172
157
  def process(self, messages: List[Message]) -> List[Message]:
@@ -199,9 +184,6 @@ class LogisticRegressionClassifier(IntentClassifier, GraphComponent):
199
184
 
200
185
  def persist(self) -> None:
201
186
  """Persist this model into the passed directory."""
202
- _check_skops_dependency()
203
- import skops.io as sio
204
-
205
187
  with self._model_storage.write_to(self._resource) as model_dir:
206
188
  path = model_dir / f"{self._resource.name}.skops"
207
189
  sio.dump(self.clf, path)
@@ -220,9 +202,6 @@ class LogisticRegressionClassifier(IntentClassifier, GraphComponent):
220
202
  **kwargs: Any,
221
203
  ) -> "LogisticRegressionClassifier":
222
204
  """Loads trained component (see parent class for full docstring)."""
223
- _check_skops_dependency()
224
- import skops.io as sio
225
-
226
205
  try:
227
206
  with model_storage.read_from(resource) as model_dir:
228
207
  classifier_file = model_dir / f"{resource.name}.skops"