rasa-pro 3.14.0.dev4__py3-none-any.whl → 3.14.0.dev5__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 (463) hide show
  1. rasa/api.py +0 -5
  2. rasa/builder/README.md +120 -0
  3. rasa/builder/auth.py +176 -0
  4. rasa/builder/config.py +115 -0
  5. rasa/builder/copilot/constants.py +25 -0
  6. rasa/builder/copilot/copilot.py +372 -0
  7. rasa/builder/copilot/copilot_response_handler.py +487 -0
  8. rasa/builder/copilot/copilot_templated_message_provider.py +58 -0
  9. rasa/builder/copilot/exceptions.py +20 -0
  10. rasa/builder/copilot/models.py +431 -0
  11. rasa/builder/copilot/prompts/copilot_system_prompt.jinja2 +726 -0
  12. rasa/builder/copilot/telemetry.py +195 -0
  13. rasa/builder/copilot/templated_messages/copilot_internal_messages_templates.yml +16 -0
  14. rasa/builder/copilot/templated_messages/copilot_templated_responses.yml +26 -0
  15. rasa/builder/document_retrieval/constants.py +15 -0
  16. rasa/builder/document_retrieval/inkeep-rag-response-schema.json +64 -0
  17. rasa/builder/document_retrieval/inkeep_document_retrieval.py +238 -0
  18. rasa/builder/document_retrieval/models.py +62 -0
  19. rasa/builder/download.py +140 -0
  20. rasa/builder/exceptions.py +55 -0
  21. rasa/builder/guardrails/__init__.py +1 -0
  22. rasa/builder/guardrails/constants.py +3 -0
  23. rasa/builder/guardrails/exceptions.py +4 -0
  24. rasa/builder/guardrails/lakera.py +206 -0
  25. rasa/builder/guardrails/models.py +199 -0
  26. rasa/builder/guardrails/utils.py +305 -0
  27. rasa/builder/job_manager.py +87 -0
  28. rasa/builder/jobs.py +234 -0
  29. rasa/builder/llm_service.py +246 -0
  30. rasa/builder/logging_utils.py +209 -0
  31. rasa/builder/main.py +174 -0
  32. rasa/builder/models.py +197 -0
  33. rasa/builder/project_generator.py +450 -0
  34. rasa/builder/project_info.py +72 -0
  35. rasa/builder/scrape_rasa_docs.py +97 -0
  36. rasa/builder/service.py +1142 -0
  37. rasa/builder/shared/tracker_context.py +212 -0
  38. rasa/builder/skill_to_bot_prompt.jinja2 +164 -0
  39. rasa/builder/training_service.py +132 -0
  40. rasa/builder/validation_service.py +93 -0
  41. rasa/cli/arguments/default_arguments.py +0 -12
  42. rasa/cli/arguments/run.py +0 -2
  43. rasa/cli/dialogue_understanding_test.py +0 -4
  44. rasa/cli/e2e_test.py +0 -4
  45. rasa/cli/inspect.py +0 -3
  46. rasa/cli/llm_fine_tuning.py +0 -5
  47. rasa/cli/project_templates/basic/actions/action_api.py +15 -0
  48. rasa/cli/project_templates/basic/actions/action_human_handoff.py +44 -0
  49. rasa/cli/project_templates/basic/config.yml +23 -0
  50. rasa/cli/project_templates/basic/credentials.yml +34 -0
  51. rasa/cli/project_templates/basic/data/general/feedback.yml +20 -0
  52. rasa/cli/project_templates/basic/data/general/goodbye.yml +6 -0
  53. rasa/cli/project_templates/basic/data/general/hello.yml +7 -0
  54. rasa/cli/project_templates/basic/data/general/help.yml +6 -0
  55. rasa/cli/project_templates/basic/data/general/human_handoff.yml +16 -0
  56. rasa/cli/project_templates/basic/data/general/welcome.yml +9 -0
  57. rasa/cli/project_templates/basic/data/system/pattern_completed.yml +7 -0
  58. rasa/cli/project_templates/basic/data/system/pattern_correction.yml +7 -0
  59. rasa/cli/project_templates/basic/data/system/pattern_search.yml +8 -0
  60. rasa/cli/project_templates/basic/data/system/pattern_session_start.yml +8 -0
  61. rasa/cli/project_templates/basic/docs/rasa_assistant_qa.txt +65 -0
  62. rasa/cli/project_templates/basic/docs/template.txt +7 -0
  63. rasa/cli/project_templates/basic/domain/general/assistant_details.yml +12 -0
  64. rasa/cli/project_templates/basic/domain/general/bot_identity.yml +5 -0
  65. rasa/cli/project_templates/basic/domain/general/cannot_handle.yml +5 -0
  66. rasa/cli/project_templates/basic/domain/general/feedback.yml +28 -0
  67. rasa/cli/project_templates/basic/domain/general/goodbye.yml +7 -0
  68. rasa/cli/project_templates/basic/domain/general/help.yml +5 -0
  69. rasa/cli/project_templates/basic/domain/general/human_handoff_domain.yml +35 -0
  70. rasa/cli/project_templates/basic/domain/general/utils.yml +13 -0
  71. rasa/cli/project_templates/basic/domain/general/welcome.yml +7 -0
  72. rasa/cli/project_templates/basic/endpoints.yml +73 -0
  73. rasa/cli/project_templates/basic/prompts/rephraser_demo_personality_prompt.jinja2 +19 -0
  74. rasa/cli/project_templates/finance/actions/__init__.py +46 -0
  75. rasa/cli/project_templates/finance/actions/accounts/action_ask_account.py +47 -0
  76. rasa/cli/project_templates/finance/actions/accounts/action_check_balance.py +40 -0
  77. rasa/cli/project_templates/finance/actions/action_session_start.py +74 -0
  78. rasa/cli/project_templates/finance/actions/cards/action_ask_card.py +48 -0
  79. rasa/cli/project_templates/finance/actions/cards/action_check_card_existence.py +36 -0
  80. rasa/cli/project_templates/finance/actions/cards/action_update_card_status.py +54 -0
  81. rasa/cli/project_templates/finance/actions/database.py +277 -0
  82. rasa/cli/project_templates/finance/actions/transfers/__init__.py +0 -0
  83. rasa/cli/project_templates/finance/actions/transfers/action_add_payee.py +52 -0
  84. rasa/cli/project_templates/finance/actions/transfers/action_ask_account_from.py +51 -0
  85. rasa/cli/project_templates/finance/actions/transfers/action_check_payee_existence.py +40 -0
  86. rasa/cli/project_templates/finance/actions/transfers/action_check_sufficient_funds.py +40 -0
  87. rasa/cli/project_templates/finance/actions/transfers/action_list_payees.py +46 -0
  88. rasa/cli/project_templates/finance/actions/transfers/action_process_immediate_payment.py +18 -0
  89. rasa/cli/project_templates/finance/actions/transfers/action_remove_payee.py +49 -0
  90. rasa/cli/project_templates/finance/actions/transfers/action_schedule_payment.py +19 -0
  91. rasa/cli/project_templates/finance/actions/transfers/action_validate_payment_date.py +36 -0
  92. rasa/cli/project_templates/finance/config.yml +21 -0
  93. rasa/cli/project_templates/finance/credentials.yml +32 -0
  94. rasa/cli/project_templates/finance/csvs/accounts.csv +8 -0
  95. rasa/cli/project_templates/finance/csvs/advisors.csv +7 -0
  96. rasa/cli/project_templates/finance/csvs/appointments.csv +211 -0
  97. rasa/cli/project_templates/finance/csvs/branches.csv +10 -0
  98. rasa/cli/project_templates/finance/csvs/cards.csv +11 -0
  99. rasa/cli/project_templates/finance/csvs/payees.csv +11 -0
  100. rasa/cli/project_templates/finance/csvs/transactions.csv +71 -0
  101. rasa/cli/project_templates/finance/csvs/users.csv +4 -0
  102. rasa/cli/project_templates/finance/data/accounts/check_balance.yml +10 -0
  103. rasa/cli/project_templates/finance/data/cards/block_card.yml +66 -0
  104. rasa/cli/project_templates/finance/data/cards/select_card.yml +12 -0
  105. rasa/cli/project_templates/finance/data/general/bot_identity.yml +6 -0
  106. rasa/cli/project_templates/finance/data/general/feedback.yml +20 -0
  107. rasa/cli/project_templates/finance/data/general/goodbye.yml +6 -0
  108. rasa/cli/project_templates/finance/data/general/hello.yml +7 -0
  109. rasa/cli/project_templates/finance/data/general/help.yml +9 -0
  110. rasa/cli/project_templates/finance/data/general/human_handoff.yml +16 -0
  111. rasa/cli/project_templates/finance/data/general/welcome.yml +9 -0
  112. rasa/cli/project_templates/finance/data/system/patterns/pattern_chitchat.yml +5 -0
  113. rasa/cli/project_templates/finance/data/system/patterns/pattern_completed.yml +7 -0
  114. rasa/cli/project_templates/finance/data/system/patterns/pattern_correction.yml +7 -0
  115. rasa/cli/project_templates/finance/data/system/patterns/pattern_search.yml +8 -0
  116. rasa/cli/project_templates/finance/data/system/patterns/pattern_session_start.yml +8 -0
  117. rasa/cli/project_templates/finance/data/system/source/accounts.json +51 -0
  118. rasa/cli/project_templates/finance/data/system/source/advisors.json +44 -0
  119. rasa/cli/project_templates/finance/data/system/source/appointments.json +1474 -0
  120. rasa/cli/project_templates/finance/data/system/source/branches.json +47 -0
  121. rasa/cli/project_templates/finance/data/system/source/cards.json +72 -0
  122. rasa/cli/project_templates/finance/data/system/source/payees.json +74 -0
  123. rasa/cli/project_templates/finance/data/system/source/transactions.json +492 -0
  124. rasa/cli/project_templates/finance/data/system/source/users.json +29 -0
  125. rasa/cli/project_templates/finance/data/transfers/add_payee.yml +29 -0
  126. rasa/cli/project_templates/finance/data/transfers/list_payees.yml +5 -0
  127. rasa/cli/project_templates/finance/data/transfers/remove_payee.yml +21 -0
  128. rasa/cli/project_templates/finance/data/transfers/transfer_money.yml +67 -0
  129. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/consequences_of_blocking_card.txt +8 -0
  130. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/reasons_to_block_card.txt +8 -0
  131. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/recovering_from_card_fraud.txt +8 -0
  132. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/tips_for_card_security.txt +8 -0
  133. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/what_to_do_if_card_is_lost.txt +8 -0
  134. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/account_balance_security.txt +7 -0
  135. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/common_balance_inquiries.txt +8 -0
  136. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/methods_to_check_balance.txt +8 -0
  137. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/understanding_balance_updates.txt +8 -0
  138. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/what_to_do_if_balance_is_incorrect.txt +8 -0
  139. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/benefits_of_authorised_payees.txt +8 -0
  140. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/common_issues_with_payees.txt +8 -0
  141. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/general_payee_information.txt +8 -0
  142. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/payee_management_tips.txt +8 -0
  143. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/understanding_payee_types.txt +8 -0
  144. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/common_transfer_errors.txt +8 -0
  145. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/fees_for_transfers.txt +8 -0
  146. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/general_transfer_information.txt +8 -0
  147. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/security_tips_for_transfers.txt +8 -0
  148. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/transfer_processing_times.txt +8 -0
  149. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part1.txt +50 -0
  150. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part10.txt +50 -0
  151. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part11.txt +48 -0
  152. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part12.txt +50 -0
  153. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part13.txt +50 -0
  154. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part14.txt +47 -0
  155. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part15.txt +50 -0
  156. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part16.txt +50 -0
  157. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part17.txt +47 -0
  158. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part18.txt +50 -0
  159. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part19.txt +50 -0
  160. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part2.txt +50 -0
  161. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part20.txt +47 -0
  162. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part21.txt +50 -0
  163. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part22.txt +50 -0
  164. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part23.txt +47 -0
  165. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part24.txt +50 -0
  166. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part25.txt +50 -0
  167. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part26.txt +47 -0
  168. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part27.txt +50 -0
  169. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part28.txt +50 -0
  170. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part29.txt +47 -0
  171. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part3.txt +47 -0
  172. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part30.txt +50 -0
  173. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part31.txt +50 -0
  174. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part32.txt +47 -0
  175. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part33.txt +50 -0
  176. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part34.txt +50 -0
  177. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part35.txt +47 -0
  178. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part36.txt +50 -0
  179. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part37.txt +50 -0
  180. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part38.txt +47 -0
  181. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part39.txt +50 -0
  182. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part4.txt +50 -0
  183. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part40.txt +50 -0
  184. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part41.txt +47 -0
  185. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part42.txt +50 -0
  186. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part43.txt +50 -0
  187. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part44.txt +47 -0
  188. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part45.txt +50 -0
  189. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part46.txt +50 -0
  190. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part47.txt +47 -0
  191. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part48.txt +50 -0
  192. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part49.txt +50 -0
  193. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part5.txt +50 -0
  194. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part50.txt +47 -0
  195. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part51.txt +50 -0
  196. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part52.txt +50 -0
  197. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part53.txt +47 -0
  198. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part54.txt +50 -0
  199. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part55.txt +50 -0
  200. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part56.txt +47 -0
  201. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part57.txt +50 -0
  202. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part58.txt +50 -0
  203. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part59.txt +47 -0
  204. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part6.txt +47 -0
  205. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part60.txt +50 -0
  206. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part61.txt +50 -0
  207. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part7.txt +50 -0
  208. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part8.txt +50 -0
  209. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part9.txt +47 -0
  210. rasa/cli/project_templates/finance/domain/accounts/check_balance.yml +11 -0
  211. rasa/cli/project_templates/finance/domain/cards/block_card.yml +101 -0
  212. rasa/cli/project_templates/finance/domain/cards/select_card.yml +12 -0
  213. rasa/cli/project_templates/finance/domain/general/assistant_details.yml +12 -0
  214. rasa/cli/project_templates/finance/domain/general/bot_identity.yml +5 -0
  215. rasa/cli/project_templates/finance/domain/general/cannot_handle.yml +5 -0
  216. rasa/cli/project_templates/finance/domain/general/defaults.yml +24 -0
  217. rasa/cli/project_templates/finance/domain/general/feedback.yml +28 -0
  218. rasa/cli/project_templates/finance/domain/general/goodbye.yml +7 -0
  219. rasa/cli/project_templates/finance/domain/general/help.yml +5 -0
  220. rasa/cli/project_templates/finance/domain/general/human_handoff.yml +30 -0
  221. rasa/cli/project_templates/finance/domain/general/utils.yml +13 -0
  222. rasa/cli/project_templates/finance/domain/general/welcome.yml +8 -0
  223. rasa/cli/project_templates/finance/domain/transfers/add_payee.yml +47 -0
  224. rasa/cli/project_templates/finance/domain/transfers/list_payees.yml +4 -0
  225. rasa/cli/project_templates/finance/domain/transfers/remove_payee.yml +16 -0
  226. rasa/cli/project_templates/finance/domain/transfers/transfer_money.yml +79 -0
  227. rasa/cli/project_templates/finance/endpoints.yml +63 -0
  228. rasa/cli/project_templates/finance/prompts/rephraser_demo_personality_prompt.jinja2 +19 -0
  229. rasa/cli/project_templates/telco/actions/__init__.py +0 -0
  230. rasa/cli/project_templates/telco/actions/actions_billing.py +204 -0
  231. rasa/cli/project_templates/telco/actions/actions_get_data_from_db.py +48 -0
  232. rasa/cli/project_templates/telco/actions/actions_run_diagnostics.py +28 -0
  233. rasa/cli/project_templates/telco/actions/actions_session_start.py +18 -0
  234. rasa/cli/project_templates/telco/config.yml +25 -0
  235. rasa/cli/project_templates/telco/credentials.yml +33 -0
  236. rasa/cli/project_templates/telco/csvs/billing.csv +10 -0
  237. rasa/cli/project_templates/telco/csvs/customers.csv +5 -0
  238. rasa/cli/project_templates/telco/data/flows/flow_global.yml +5 -0
  239. rasa/cli/project_templates/telco/data/flows/flow_reboot_router.yml +8 -0
  240. rasa/cli/project_templates/telco/data/flows/flow_reset_router.yml +7 -0
  241. rasa/cli/project_templates/telco/data/flows/flow_solve_internet_issue.yml +73 -0
  242. rasa/cli/project_templates/telco/data/flows/flow_undertand_bill.yml +45 -0
  243. rasa/cli/project_templates/telco/data/patterns/pattern_completed.yml +7 -0
  244. rasa/cli/project_templates/telco/data/patterns/pattern_human_handoff.yml +6 -0
  245. rasa/cli/project_templates/telco/data/patterns/pattern_search.yml +7 -0
  246. rasa/cli/project_templates/telco/data/patterns/pattern_session_start.yml +9 -0
  247. rasa/cli/project_templates/telco/docs/reset_vs_rboot_router.txt +1 -0
  248. rasa/cli/project_templates/telco/docs/restart_router.txt +6 -0
  249. rasa/cli/project_templates/telco/docs/run_speed_test.txt +6 -0
  250. rasa/cli/project_templates/telco/domain/domain_global.yml +29 -0
  251. rasa/cli/project_templates/telco/domain/domain_patterns.yml +17 -0
  252. rasa/cli/project_templates/telco/domain/domain_reboot_router.yml +20 -0
  253. rasa/cli/project_templates/telco/domain/domain_reset_router.yml +11 -0
  254. rasa/cli/project_templates/telco/domain/domain_run_speed_test.yml +24 -0
  255. rasa/cli/project_templates/telco/domain/domain_solve_internet_issue.yml +74 -0
  256. rasa/cli/project_templates/telco/domain/domain_undertand_bill.yml +102 -0
  257. rasa/cli/project_templates/telco/endpoints.yml +60 -0
  258. rasa/{dialogue_understanding/generator/prompt_templates/agent_command_prompt_v2_gpt_4o_2024_11_20_template.jinja2 → cli/project_templates/telco/prompts/command-generator.jinja2} +3 -7
  259. rasa/cli/project_templates/telco/tests/e2e_results_failed.yml +62 -0
  260. rasa/cli/project_templates/telco/tests/e2e_results_passed.yml +130 -0
  261. rasa/cli/project_templates/telco/tests/e2e_test_cases/billing_test_cases.yml +68 -0
  262. rasa/cli/project_templates/telco/tests/e2e_test_cases/global_test_cases.yml +13 -0
  263. rasa/cli/project_templates/telco/tests/e2e_test_cases/internet_slow_test_case.yml +47 -0
  264. rasa/cli/project_templates/telco/tests/e2e_test_cases/out_of_scope_test_case.yml +21 -0
  265. rasa/cli/project_templates/telco/tests/e2e_test_cases/patterns_test_cases.yml +15 -0
  266. rasa/cli/project_templates/tutorial/config.yml +2 -1
  267. rasa/cli/run.py +0 -4
  268. rasa/cli/scaffold.py +46 -2
  269. rasa/cli/shell.py +0 -3
  270. rasa/constants.py +0 -6
  271. rasa/core/actions/action.py +10 -56
  272. rasa/core/agent.py +0 -16
  273. rasa/core/available_endpoints.py +0 -30
  274. rasa/core/channels/channel.py +4 -3
  275. rasa/core/channels/constants.py +3 -0
  276. rasa/core/channels/development_inspector.py +4 -4
  277. rasa/core/channels/hangouts.py +2 -2
  278. rasa/core/channels/inspector/dist/assets/{arc-63212852.js → arc-18042c22.js} +1 -1
  279. rasa/core/channels/inspector/dist/assets/{blockDiagram-38ab4fdb-eecf6b13.js → blockDiagram-38ab4fdb-fdd6bcfa.js} +1 -1
  280. rasa/core/channels/inspector/dist/assets/{c4Diagram-3d4e48cf-8f798a9a.js → c4Diagram-3d4e48cf-f5ae6786.js} +1 -1
  281. rasa/core/channels/inspector/dist/assets/channel-b9b536fc.js +1 -0
  282. rasa/core/channels/inspector/dist/assets/{classDiagram-70f12bd4-df71a04c.js → classDiagram-70f12bd4-81efba3e.js} +1 -1
  283. rasa/core/channels/inspector/dist/assets/{classDiagram-v2-f2320105-9b275968.js → classDiagram-v2-f2320105-3b6b6a92.js} +1 -1
  284. rasa/core/channels/inspector/dist/assets/clone-78d2ddcf.js +1 -0
  285. rasa/core/channels/inspector/dist/assets/{createText-2e5e7dd3-1c669cad.js → createText-2e5e7dd3-31422447.js} +1 -1
  286. rasa/core/channels/inspector/dist/assets/{edges-e0da2a9e-b1553799.js → edges-e0da2a9e-518a90db.js} +1 -1
  287. rasa/core/channels/inspector/dist/assets/{erDiagram-9861fffd-112388d6.js → erDiagram-9861fffd-a6d3c25a.js} +1 -1
  288. rasa/core/channels/inspector/dist/assets/{flowDb-956e92f1-fdebec47.js → flowDb-956e92f1-e048c2be.js} +1 -1
  289. rasa/core/channels/inspector/dist/assets/{flowDiagram-66a62f08-6280ede1.js → flowDiagram-66a62f08-c7474c91.js} +1 -1
  290. rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-8b09c060.js +1 -0
  291. rasa/core/channels/inspector/dist/assets/{flowchart-elk-definition-4a651766-e1dc03e5.js → flowchart-elk-definition-4a651766-cb4d8723.js} +1 -1
  292. rasa/core/channels/inspector/dist/assets/{ganttDiagram-c361ad54-83f68c51.js → ganttDiagram-c361ad54-346636a2.js} +1 -1
  293. rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-72cf32ee-22f8666f.js → gitGraphDiagram-72cf32ee-7c508874.js} +1 -1
  294. rasa/core/channels/inspector/dist/assets/{graph-ca9e6217.js → graph-14702d8a.js} +1 -1
  295. rasa/core/channels/inspector/dist/assets/{index-3862675e-c5ceb692.js → index-3862675e-f18b534b.js} +1 -1
  296. rasa/core/channels/inspector/dist/assets/index-4d4bdf3a.js +1335 -0
  297. rasa/core/channels/inspector/dist/assets/{infoDiagram-f8f76790-faa9999b.js → infoDiagram-f8f76790-64154b83.js} +1 -1
  298. rasa/core/channels/inspector/dist/assets/{journeyDiagram-49397b02-c4dda8d9.js → journeyDiagram-49397b02-833a5f95.js} +1 -1
  299. rasa/core/channels/inspector/dist/assets/{layout-d4307784.js → layout-5a3b2123.js} +1 -1
  300. rasa/core/channels/inspector/dist/assets/{line-0567aaa7.js → line-2272a8c7.js} +1 -1
  301. rasa/core/channels/inspector/dist/assets/{linear-c11b95cf.js → linear-35bcf273.js} +1 -1
  302. rasa/core/channels/inspector/dist/assets/{mindmap-definition-fc14e90a-0c7d3ca9.js → mindmap-definition-fc14e90a-92dcb0e9.js} +1 -1
  303. rasa/core/channels/inspector/dist/assets/{pieDiagram-8a3498a8-34b433fa.js → pieDiagram-8a3498a8-94dbc900.js} +1 -1
  304. rasa/core/channels/inspector/dist/assets/{quadrantDiagram-120e2f19-4cab816e.js → quadrantDiagram-120e2f19-8b7a9c33.js} +1 -1
  305. rasa/core/channels/inspector/dist/assets/{requirementDiagram-deff3bca-8c22fa9e.js → requirementDiagram-deff3bca-6f7eab81.js} +1 -1
  306. rasa/core/channels/inspector/dist/assets/{sankeyDiagram-04a897e0-70ce9e8e.js → sankeyDiagram-04a897e0-f43e581d.js} +1 -1
  307. rasa/core/channels/inspector/dist/assets/{sequenceDiagram-704730f1-fbcd7fc9.js → sequenceDiagram-704730f1-0bcbefc3.js} +1 -1
  308. rasa/core/channels/inspector/dist/assets/{stateDiagram-587899a1-45f05ea6.js → stateDiagram-587899a1-b8a74083.js} +1 -1
  309. rasa/core/channels/inspector/dist/assets/{stateDiagram-v2-d93cdb3a-beab1ea6.js → stateDiagram-v2-d93cdb3a-2070218f.js} +1 -1
  310. rasa/core/channels/inspector/dist/assets/{styles-6aaf32cf-2f29dbd5.js → styles-6aaf32cf-f1d54e34.js} +1 -1
  311. rasa/core/channels/inspector/dist/assets/{styles-9a916d00-951eac83.js → styles-9a916d00-980de489.js} +1 -1
  312. rasa/core/channels/inspector/dist/assets/{styles-c10674c1-897fbfdd.js → styles-c10674c1-3c03abde.js} +1 -1
  313. rasa/core/channels/inspector/dist/assets/{svgDrawCommon-08f97a94-d667fac1.js → svgDrawCommon-08f97a94-46ba068f.js} +1 -1
  314. rasa/core/channels/inspector/dist/assets/{timeline-definition-85554ec2-e3205144.js → timeline-definition-85554ec2-901f5e3d.js} +1 -1
  315. rasa/core/channels/inspector/dist/assets/{xychartDiagram-e933f94c-4abeb0e2.js → xychartDiagram-e933f94c-acbc628a.js} +1 -1
  316. rasa/core/channels/inspector/dist/index.html +2 -2
  317. rasa/core/channels/inspector/index.html +1 -1
  318. rasa/core/channels/inspector/src/App.tsx +10 -11
  319. rasa/core/channels/inspector/src/components/DialogueInformation.tsx +12 -3
  320. rasa/core/channels/inspector/src/components/DialogueStack.tsx +4 -6
  321. rasa/core/channels/inspector/src/helpers/formatters.ts +3 -24
  322. rasa/core/channels/inspector/src/theme/base/styles.ts +1 -19
  323. rasa/core/channels/inspector/src/types.ts +0 -4
  324. rasa/core/channels/socketio.py +212 -51
  325. rasa/core/channels/studio_chat.py +49 -29
  326. rasa/core/channels/voice_stream/genesys.py +1 -1
  327. rasa/core/channels/voice_stream/voice_channel.py +5 -3
  328. rasa/core/constants.py +0 -4
  329. rasa/core/policies/enterprise_search_policy.py +6 -11
  330. rasa/core/policies/flow_policy.py +4 -4
  331. rasa/core/policies/flows/flow_executor.py +45 -456
  332. rasa/core/policies/intentless_policy.py +1 -1
  333. rasa/core/policies/unexpected_intent_policy.py +0 -1
  334. rasa/core/processor.py +15 -18
  335. rasa/core/run.py +14 -11
  336. rasa/core/tracker_stores/tracker_store.py +7 -3
  337. rasa/core/train.py +1 -1
  338. rasa/core/training/interactive.py +16 -16
  339. rasa/core/training/story_conflict.py +5 -5
  340. rasa/core/utils.py +1 -21
  341. rasa/dialogue_understanding/commands/__init__.py +0 -8
  342. rasa/dialogue_understanding/commands/cancel_flow_command.py +4 -97
  343. rasa/dialogue_understanding/commands/chit_chat_answer_command.py +0 -11
  344. rasa/dialogue_understanding/commands/clarify_command.py +0 -10
  345. rasa/dialogue_understanding/commands/knowledge_answer_command.py +0 -11
  346. rasa/dialogue_understanding/commands/start_flow_command.py +8 -164
  347. rasa/dialogue_understanding/commands/utils.py +2 -6
  348. rasa/dialogue_understanding/generator/command_parser.py +0 -4
  349. rasa/dialogue_understanding/generator/flow_retrieval.py +10 -9
  350. rasa/dialogue_understanding/generator/llm_based_command_generator.py +12 -50
  351. rasa/dialogue_understanding/generator/llm_command_generator.py +1 -1
  352. rasa/dialogue_understanding/generator/multi_step/multi_step_llm_command_generator.py +1 -1
  353. rasa/dialogue_understanding/generator/single_step/compact_llm_command_generator.py +6 -7
  354. rasa/dialogue_understanding/generator/single_step/search_ready_llm_command_generator.py +6 -7
  355. rasa/dialogue_understanding/generator/single_step/single_step_based_llm_command_generator.py +2 -41
  356. rasa/dialogue_understanding/patterns/continue_interrupted.py +1 -163
  357. rasa/dialogue_understanding/patterns/default_flows_for_patterns.yml +8 -52
  358. rasa/dialogue_understanding/processor/command_processor.py +15 -31
  359. rasa/dialogue_understanding/stack/dialogue_stack.py +2 -123
  360. rasa/dialogue_understanding/stack/frames/flow_stack_frame.py +0 -57
  361. rasa/dialogue_understanding/stack/utils.py +2 -17
  362. rasa/dialogue_understanding_test/du_test_runner.py +2 -7
  363. rasa/e2e_test/e2e_test_runner.py +2 -12
  364. rasa/engine/caching.py +2 -2
  365. rasa/engine/recipes/default_components.py +18 -10
  366. rasa/engine/storage/local_model_storage.py +45 -2
  367. rasa/graph_components/validators/default_recipe_validator.py +134 -134
  368. rasa/hooks.py +5 -5
  369. rasa/llm_fine_tuning/utils.py +2 -2
  370. rasa/model_manager/model_api.py +4 -5
  371. rasa/model_manager/runner_service.py +1 -1
  372. rasa/model_manager/socket_bridge.py +20 -14
  373. rasa/model_manager/trainer_service.py +12 -9
  374. rasa/model_manager/utils.py +1 -29
  375. rasa/model_manager/warm_rasa_process.py +1 -1
  376. rasa/nlu/extractors/extractor.py +1 -2
  377. rasa/plugin.py +8 -8
  378. rasa/privacy/privacy_manager.py +2 -11
  379. rasa/server.py +2 -14
  380. rasa/shared/constants.py +0 -5
  381. rasa/shared/core/constants.py +1 -12
  382. rasa/shared/core/domain.py +58 -11
  383. rasa/shared/core/events.py +0 -327
  384. rasa/shared/core/flows/flow_step.py +7 -1
  385. rasa/shared/core/flows/flows_list.py +2 -2
  386. rasa/shared/core/flows/flows_yaml_schema.json +186 -112
  387. rasa/shared/core/flows/steps/call.py +5 -53
  388. rasa/shared/core/flows/validation.py +7 -46
  389. rasa/shared/core/flows/yaml_flows_io.py +17 -9
  390. rasa/shared/core/slots.py +6 -2
  391. rasa/shared/core/trackers.py +2 -5
  392. rasa/shared/exceptions.py +0 -4
  393. rasa/shared/importers/importer.py +6 -0
  394. rasa/shared/importers/utils.py +77 -1
  395. rasa/shared/providers/_utils.py +60 -44
  396. rasa/shared/providers/embedding/default_litellm_embedding_client.py +2 -0
  397. rasa/shared/providers/llm/_base_litellm_client.py +7 -39
  398. rasa/shared/providers/llm/default_litellm_llm_client.py +2 -0
  399. rasa/shared/providers/llm/litellm_router_llm_client.py +4 -8
  400. rasa/shared/providers/llm/llm_client.py +3 -7
  401. rasa/shared/providers/llm/llm_response.py +0 -49
  402. rasa/shared/providers/llm/self_hosted_llm_client.py +4 -8
  403. rasa/shared/utils/llm.py +5 -28
  404. rasa/shared/utils/schemas/events.py +0 -42
  405. rasa/shared/utils/yaml.py +1 -3
  406. rasa/studio/upload.py +16 -47
  407. rasa/telemetry.py +97 -23
  408. rasa/tracing/instrumentation/instrumentation.py +10 -12
  409. rasa/tracing/instrumentation/intentless_policy_instrumentation.py +4 -4
  410. rasa/utils/common.py +0 -79
  411. rasa/utils/io.py +27 -9
  412. rasa/utils/json_utils.py +6 -1
  413. rasa/utils/log_utils.py +6 -2
  414. rasa/utils/ml_utils.py +1 -1
  415. rasa/utils/openapi.py +144 -0
  416. rasa/utils/tensorflow/rasa_layers.py +1 -1
  417. rasa/utils/train_utils.py +15 -15
  418. rasa/validator.py +21 -19
  419. rasa/version.py +1 -1
  420. {rasa_pro-3.14.0.dev4.dist-info → rasa_pro-3.14.0.dev5.dist-info}/METADATA +17 -14
  421. {rasa_pro-3.14.0.dev4.dist-info → rasa_pro-3.14.0.dev5.dist-info}/RECORD +431 -200
  422. rasa/agents/agent_factory.py +0 -122
  423. rasa/agents/agent_manager.py +0 -162
  424. rasa/agents/constants.py +0 -40
  425. rasa/agents/core/agent_protocol.py +0 -107
  426. rasa/agents/core/types.py +0 -70
  427. rasa/agents/exceptions.py +0 -8
  428. rasa/agents/protocol/__init__.py +0 -5
  429. rasa/agents/protocol/a2a/a2a_agent.py +0 -662
  430. rasa/agents/protocol/mcp/mcp_base_agent.py +0 -676
  431. rasa/agents/protocol/mcp/mcp_open_agent.py +0 -276
  432. rasa/agents/protocol/mcp/mcp_task_agent.py +0 -469
  433. rasa/agents/schemas/__init__.py +0 -12
  434. rasa/agents/schemas/agent_input.py +0 -38
  435. rasa/agents/schemas/agent_output.py +0 -26
  436. rasa/agents/schemas/agent_tool_result.py +0 -51
  437. rasa/agents/schemas/agent_tool_schema.py +0 -134
  438. rasa/agents/templates/mcp_open_agent_prompt_template.jinja2 +0 -15
  439. rasa/agents/templates/mcp_task_agent_prompt_template.jinja2 +0 -17
  440. rasa/agents/utils.py +0 -72
  441. rasa/core/available_agents.py +0 -199
  442. rasa/core/channels/inspector/dist/assets/channel-0cd70adf.js +0 -1
  443. rasa/core/channels/inspector/dist/assets/clone-a0f9c4ed.js +0 -1
  444. rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-de9cc4aa.js +0 -1
  445. rasa/core/channels/inspector/dist/assets/index-3e293924.js +0 -1353
  446. rasa/core/policies/flows/mcp_tool_executor.py +0 -277
  447. rasa/dialogue_understanding/commands/continue_agent_command.py +0 -91
  448. rasa/dialogue_understanding/commands/restart_agent_command.py +0 -162
  449. rasa/dialogue_understanding/generator/prompt_templates/agent_command_prompt_v2_claude_3_5_sonnet_20240620_template.jinja2 +0 -61
  450. rasa/dialogue_understanding/generator/prompt_templates/agent_command_prompt_v3_claude_3_5_sonnet_20240620_template.jinja2 +0 -81
  451. rasa/dialogue_understanding/generator/prompt_templates/agent_command_prompt_v3_gpt_4o_2024_11_20_template.jinja2 +0 -81
  452. rasa/shared/agents/utils.py +0 -35
  453. rasa/shared/utils/mcp/server_connection.py +0 -157
  454. /rasa/{agents → builder}/__init__.py +0 -0
  455. /rasa/{agents/core → builder/copilot}/__init__.py +0 -0
  456. /rasa/{agents/protocol/a2a → builder/copilot/prompts}/__init__.py +0 -0
  457. /rasa/{agents/protocol/mcp → builder/copilot/templated_messages}/__init__.py +0 -0
  458. /rasa/{agents/templates → builder/document_retrieval}/__init__.py +0 -0
  459. /rasa/{shared/agents → cli/project_templates/finance/actions/accounts}/__init__.py +0 -0
  460. /rasa/{shared/utils/mcp → cli/project_templates/finance/actions/cards}/__init__.py +0 -0
  461. {rasa_pro-3.14.0.dev4.dist-info → rasa_pro-3.14.0.dev5.dist-info}/NOTICE +0 -0
  462. {rasa_pro-3.14.0.dev4.dist-info → rasa_pro-3.14.0.dev5.dist-info}/WHEEL +0 -0
  463. {rasa_pro-3.14.0.dev4.dist-info → rasa_pro-3.14.0.dev5.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,212 @@
1
+ from typing import Any, Dict, List, Optional
2
+
3
+ from pydantic import BaseModel, Field
4
+
5
+ from rasa.builder.copilot.constants import ROLE_ASSISTANT, ROLE_USER
6
+ from rasa.shared.core.constants import DEFAULT_SLOT_NAMES
7
+ from rasa.shared.core.events import (
8
+ ActionExecuted,
9
+ BotUttered,
10
+ FlowCompleted,
11
+ FlowStarted,
12
+ SlotSet,
13
+ UserUttered,
14
+ )
15
+ from rasa.shared.core.trackers import DialogueStateTracker
16
+
17
+
18
+ class AssistantMessage(BaseModel):
19
+ text: str
20
+
21
+
22
+ class UserMessage(BaseModel):
23
+ text: str
24
+ predicted_commands: List[str] = Field(default_factory=list)
25
+
26
+
27
+ class TrackerEvent(BaseModel):
28
+ event: str
29
+ data: Dict[str, Any] = Field(default_factory=dict)
30
+
31
+
32
+ class AssistantConversationTurn(BaseModel):
33
+ user_message: Optional[UserMessage] = None
34
+ assistant_messages: List[AssistantMessage] = Field(default_factory=list)
35
+ context_events: List[TrackerEvent] = Field(default_factory=list)
36
+
37
+
38
+ class CurrentState(BaseModel):
39
+ latest_message: Optional[str] = None
40
+ active_flow: Optional[str] = None
41
+ flow_stack: Optional[List[Dict[str, Any]]] = None
42
+ slots: Optional[Dict[str, Any]] = None
43
+ latest_action: Optional[str] = None
44
+ followup_action: Optional[str] = None
45
+
46
+
47
+ class TrackerContext(BaseModel):
48
+ conversation_turns: List[AssistantConversationTurn]
49
+ current_state: CurrentState
50
+
51
+ def to_openai_format(self) -> List[Dict[str, Any]]:
52
+ """Convert the TrackerContext to a format suitable for OpenAI.
53
+
54
+ Returns:
55
+ A list of user and assistant messages in the format suitable for OpenAI.
56
+ """
57
+ messages: List[Dict[str, Any]] = []
58
+ for turn in self.conversation_turns:
59
+ if turn.user_message:
60
+ messages.append({"role": ROLE_USER, "content": turn.user_message.text})
61
+ for message in turn.assistant_messages:
62
+ messages.append({"role": ROLE_ASSISTANT, "content": message.text})
63
+ return messages
64
+
65
+ @classmethod
66
+ def from_tracker(
67
+ cls, tracker: Optional[DialogueStateTracker], max_turns: int = 10
68
+ ) -> Optional["TrackerContext"]:
69
+ """Convert a tracker to a TrackerContext."""
70
+ if not tracker or not tracker.events:
71
+ return None
72
+
73
+ conversation_turns = cls._build_conversation_turns(tracker)
74
+ conversation_turns = conversation_turns[-max_turns:]
75
+ current_state = cls._build_current_state(tracker)
76
+
77
+ return cls(
78
+ conversation_turns=conversation_turns,
79
+ current_state=current_state,
80
+ )
81
+
82
+ @classmethod
83
+ def _build_conversation_turns(
84
+ cls, tracker: DialogueStateTracker
85
+ ) -> List[AssistantConversationTurn]:
86
+ """Build conversation turns from tracker events."""
87
+ conversation_turns: List[AssistantConversationTurn] = []
88
+ current_user_message: Optional[UserMessage] = None
89
+ current_assistant_messages: List[AssistantMessage] = []
90
+ current_context_events: List[TrackerEvent] = []
91
+
92
+ for event in tracker.applied_events():
93
+ if isinstance(event, UserUttered):
94
+ # Save previous turn if exists and has content. A new turn starts with a
95
+ # user message. However, since it's possible that "turn" started with an
96
+ # assistant message, we save that turn without the user message.
97
+ if (
98
+ current_user_message
99
+ or current_assistant_messages
100
+ or current_context_events
101
+ ):
102
+ conversation_turns.append(
103
+ AssistantConversationTurn(
104
+ user_message=current_user_message,
105
+ assistant_messages=current_assistant_messages,
106
+ context_events=current_context_events,
107
+ )
108
+ )
109
+ current_assistant_messages = []
110
+ current_context_events = []
111
+
112
+ # Start new turn
113
+
114
+ # Fetch the predicted commands for the user message
115
+ predicted_commands = (
116
+ [command.get("command") for command in event.commands]
117
+ if event.commands
118
+ else []
119
+ )
120
+
121
+ current_user_message = UserMessage(
122
+ text=event.text or "",
123
+ predicted_commands=predicted_commands,
124
+ )
125
+
126
+ # Assistant conversation turn can have multiple messages from the assistant
127
+ elif isinstance(event, BotUttered):
128
+ current_assistant_messages.append(
129
+ AssistantMessage(text=event.text or "")
130
+ )
131
+
132
+ # Handle non-user and non-assistant events. These are useful for more
133
+ # adding context to the conversation turn.
134
+ else:
135
+ context_event = cls._process_tracker_event(event)
136
+ if context_event:
137
+ current_context_events.append(context_event)
138
+
139
+ # Add the final turn if there is one
140
+ if current_user_message or current_assistant_messages:
141
+ conversation_turns.append(
142
+ AssistantConversationTurn(
143
+ user_message=current_user_message,
144
+ assistant_messages=current_assistant_messages,
145
+ context_events=current_context_events,
146
+ )
147
+ )
148
+
149
+ return conversation_turns
150
+
151
+ @staticmethod
152
+ def _process_tracker_event(event: Any) -> Optional[TrackerEvent]:
153
+ if isinstance(event, ActionExecuted):
154
+ return TrackerEvent(
155
+ event=ActionExecuted.type_name,
156
+ data={"action_name": event.action_name, "confidence": event.confidence},
157
+ )
158
+
159
+ elif isinstance(event, SlotSet) and event.key not in DEFAULT_SLOT_NAMES:
160
+ return TrackerEvent(
161
+ event=SlotSet.type_name,
162
+ data={"slot_name": event.key, "slot_value": event.value},
163
+ )
164
+
165
+ elif isinstance(event, FlowStarted):
166
+ return TrackerEvent(
167
+ event=FlowStarted.type_name,
168
+ data={"flow_id": event.flow_id},
169
+ )
170
+
171
+ elif isinstance(event, FlowCompleted):
172
+ return TrackerEvent(
173
+ event=FlowCompleted.type_name,
174
+ data={"flow_id": event.flow_id},
175
+ )
176
+ else:
177
+ return None
178
+
179
+ @classmethod
180
+ def _build_current_state(cls, tracker: DialogueStateTracker) -> CurrentState:
181
+ """Build the current state from the tracker."""
182
+ latest_message = tracker.latest_message.text if tracker.latest_message else None
183
+ latest_action = (
184
+ tracker.latest_action.get("action_name") if tracker.latest_action else None
185
+ )
186
+ followup_action = tracker.followup_action
187
+ flow_stack = tracker.stack.as_dict() if tracker.stack else None
188
+ slots = cls._extract_non_default_slots(tracker)
189
+ active_flow = tracker.active_flow
190
+
191
+ return CurrentState(
192
+ latest_message=latest_message,
193
+ active_flow=active_flow,
194
+ flow_stack=flow_stack,
195
+ latest_action=latest_action,
196
+ followup_action=followup_action,
197
+ slots=slots,
198
+ )
199
+
200
+ @classmethod
201
+ def _extract_non_default_slots(
202
+ cls, tracker: DialogueStateTracker
203
+ ) -> Optional[Dict[str, Any]]:
204
+ """Extract non-default slot values from the tracker."""
205
+ if not tracker.slots:
206
+ return None
207
+
208
+ return {
209
+ k: str(v.value)
210
+ for k, v in tracker.slots.items()
211
+ if v is not None and k not in DEFAULT_SLOT_NAMES
212
+ }
@@ -0,0 +1,164 @@
1
+ # Rasa CALM Flow and Domain YAML Generator
2
+
3
+ You are an expert in creating Rasa CALM flows and domain JSON configurations. Your task is to generate these JSON files based on a user's description of a conversational skill. The user may not be familiar with Rasa, so it's crucial to interpret their requirements accurately and create a well-structured, functional Rasa configuration.
4
+
5
+ ## Input
6
+ You will receive a description of a conversational skill. This description will be inserted where you see [USER_SKILL_DESCRIPTION] in this prompt.
7
+
8
+ ## Output
9
+ Generate a JSON configurations that includes:
10
+ 1. A Rasa CALM flow JSON
11
+ 2. A corresponding Rasa domain JSON
12
+
13
+ Ensure that both parts of the JSONs are complete, well-structured, and compatible with each other.
14
+
15
+ ## Example
16
+ Here's an example of a skill description and the corresponding JSON outputs and custom action code
17
+
18
+ Skill Description: "Create a skill for transferring money. It should ask for the recipient and amount, check the user has enough balance, and then confirm with the user before finalizing the transfer."
19
+
20
+ CALM BOT JSON:
21
+ ```json
22
+ {
23
+ "flows": {
24
+ "transfer_money": {
25
+ "description": "This flow lets users send money to friends and family.",
26
+ "steps": [
27
+ {
28
+ "collect": "recipient"
29
+ },
30
+ {
31
+ "collect": "amount",
32
+ "description": "the number of US dollars to send"
33
+ },
34
+ {
35
+ "action": "action_check_sufficient_funds",
36
+ "next": [
37
+ {
38
+ "if": "not slots.has_sufficient_funds",
39
+ "then": [
40
+ {
41
+ "action": "utter_insufficient_funds",
42
+ "next": "END"
43
+ }
44
+ ]
45
+ },
46
+ {
47
+ "else": "final_confirmation"
48
+ }
49
+ ]
50
+ },
51
+ {
52
+ "collect": "final_confirmation",
53
+ "id": "final_confirmation",
54
+ "next": [
55
+ {
56
+ "if": "not slots.final_confirmation",
57
+ "then": [
58
+ {
59
+ "action": "utter_transfer_cancelled",
60
+ "next": "END"
61
+ }
62
+ ]
63
+ },
64
+ {
65
+ "else": "transfer_successful"
66
+ }
67
+ ]
68
+ },
69
+ {
70
+ "action": "utter_transfer_complete",
71
+ "id": "transfer_successful"
72
+ }
73
+ ]
74
+ }
75
+ },
76
+ "domain": {
77
+ "actions": [
78
+ "action_check_sufficient_funds"
79
+ ],
80
+ "slots": {
81
+ "recipient": {
82
+ "type": "Text",
83
+ "mappings": [
84
+ {
85
+ "type": "from_llm"
86
+ }
87
+ ]
88
+ },
89
+ "has_sufficient_funds": {
90
+ "type": "bool",
91
+ "mappings": [
92
+ {
93
+ "type": "custom"
94
+ }
95
+ ]
96
+ }
97
+ },
98
+ "responses": {
99
+ "utter_ask_recipient": [
100
+ {
101
+ "text": "Who would you like to send money to?"
102
+ }
103
+ ],
104
+ "utter_ask_final_confirmation": [
105
+ {
106
+ "text": "Please confirm: you want to transfer {amount} to {recipient}?"
107
+ }
108
+ ],
109
+ "utter_transfer_cancelled": [
110
+ {
111
+ "text": "Your transfer has been cancelled."
112
+ }
113
+ ],
114
+ "utter_insufficient_funds": [
115
+ {
116
+ "text": "You do not have enough funds to make this transaction."
117
+ }
118
+ ]
119
+ }
120
+ }
121
+ }
122
+ ```
123
+
124
+ ## Guidelines for CALM Flow JSON:
125
+ - Start a `flow` with the name of the flow as the key in `flows`
126
+ - Include a `description` for the skill
127
+ - Use `steps` to outline the conversation flow
128
+ - Implement `collect` steps for gathering information
129
+ - `collect` steps should reference an existing slot
130
+ - For a collect step referencing a slot `A`, there should be a corresponding `utter_ask_A`
131
+ utterance that is used in the collect step to ask for the information to be stored in `A`
132
+ - Use `action` steps for custom actions
133
+ - Implement conditional logic with `if`, `then`, and `else` where appropriate
134
+ - Use `next` to define the flow between steps. If the flow should end after a step, add next: END.
135
+ - The content after `then` or `else` can be: the id of another step defined in the flow, a list of steps, or an END
136
+ - End the flow with an appropriate action or message
137
+
138
+ ## Guidelines for Domain JSON:
139
+ - Include all necessary `actions`
140
+ - Define all required `slots` with appropriate types. Type should be one of 'float', 'bool', 'text', or 'categorical'
141
+ - Slots filled by a 'collect' step should have mapping 'from_llm' and slots set by custom actions should have a 'custom' mapping
142
+ - Provide `responses` for all bot turns
143
+
144
+ ## Guidelines for Custom Actions
145
+ - Ensure all actions mentioned in the flow are properly defined in the domains list of actions.
146
+
147
+ ## Important Notes:
148
+ - Ensure that the flow logic is coherent and follows a natural conversation pattern
149
+ - All custom actions in the flow should be listed in the domain's `actions` section
150
+ - All slots collected in the flow should be defined in the domain's `slots` section
151
+ - Provide appropriate `utter_` responses for each user interaction
152
+ - Use realistic and appropriate names for actions, slots, and responses
153
+ - Consider error handling and alternative conversation paths
154
+ - Aim for a balance between simplicity and functionality
155
+
156
+ Now, please generate Rasa CALM flow and domain JSON based on the initial bot data.
157
+ Modify the initial bot data where it makes sense based on the users description
158
+ of the skill (e.g. the initial bot greeting utter_greet).
159
+
160
+ INITIAL BOT DATA:
161
+ {{project_data|tojson}}
162
+
163
+ USER_SKILL_DESCRIPTION:
164
+ {{skill_description}}
@@ -0,0 +1,132 @@
1
+ """Functions for training and loading Rasa models."""
2
+
3
+ import os
4
+ import tempfile
5
+
6
+ import structlog
7
+
8
+ from rasa.builder import config
9
+ from rasa.builder.exceptions import AgentLoadError, TrainingError
10
+ from rasa.core import agent
11
+ from rasa.core.utils import AvailableEndpoints, read_endpoints_from_path
12
+ from rasa.model_training import TrainingResult, train
13
+ from rasa.shared.importers.importer import TrainingDataImporter
14
+ from rasa.shared.utils.yaml import dump_obj_as_yaml_to_string
15
+
16
+ structlogger = structlog.get_logger()
17
+
18
+
19
+ async def train_and_load_agent(importer: TrainingDataImporter) -> agent.Agent:
20
+ """Train a model and load an agent.
21
+
22
+ Args:
23
+ importer: Training data importer with domain, flows, and config
24
+
25
+ Returns:
26
+ Loaded and ready agent
27
+
28
+ Raises:
29
+ TrainingError: If training fails
30
+ AgentLoadError: If agent loading fails
31
+ """
32
+ try:
33
+ # Setup endpoints for training validation
34
+ await _setup_endpoints()
35
+
36
+ # Train the model
37
+ training_result = await _train_model(importer)
38
+
39
+ # Load the agent
40
+ agent_instance = await _load_agent(training_result.model)
41
+
42
+ # Verify agent is ready
43
+ if not agent_instance.is_ready():
44
+ raise AgentLoadError("Agent failed to load properly - model is not ready")
45
+
46
+ structlogger.info("training.agent_ready", model_path=training_result.model)
47
+
48
+ return agent_instance
49
+
50
+ except (TrainingError, AgentLoadError):
51
+ raise
52
+ except Exception as e:
53
+ raise TrainingError(f"Unexpected error during training: {e}")
54
+ except SystemExit as e:
55
+ raise TrainingError(f"SystemExit during training: {e}")
56
+
57
+
58
+ async def _setup_endpoints() -> None:
59
+ """Setup endpoints configuration for training."""
60
+ try:
61
+ with tempfile.NamedTemporaryFile(
62
+ mode="w", suffix=".yml", delete=False
63
+ ) as temp_file:
64
+ endpoints_yaml = dump_obj_as_yaml_to_string(config.get_default_endpoints())
65
+ temp_file.write(endpoints_yaml)
66
+ temp_file.flush()
67
+
68
+ # Reset and load endpoints
69
+ AvailableEndpoints.reset_instance()
70
+ read_endpoints_from_path(temp_file.name)
71
+
72
+ structlogger.debug("training.endpoints_setup", temp_file=temp_file.name)
73
+
74
+ except Exception as e:
75
+ raise TrainingError(f"Failed to setup endpoints: {e}")
76
+
77
+
78
+ async def _train_model(importer: TrainingDataImporter) -> TrainingResult:
79
+ """Train the Rasa model."""
80
+ try:
81
+ structlogger.info("training.started")
82
+
83
+ training_result = await train(
84
+ domain="",
85
+ config="",
86
+ training_files=None,
87
+ file_importer=importer,
88
+ )
89
+
90
+ if not training_result or not training_result.model:
91
+ raise TrainingError("Training completed but no model was produced")
92
+
93
+ structlogger.info("training.completed", model_path=training_result.model)
94
+
95
+ return training_result
96
+
97
+ except Exception as e:
98
+ raise TrainingError(f"Model training failed: {e}")
99
+
100
+
101
+ async def _load_agent(model_path: str) -> agent.Agent:
102
+ """Load the trained agent."""
103
+ try:
104
+ structlogger.info("training.loading_agent", model_path=model_path)
105
+
106
+ available_endpoints = AvailableEndpoints.get_instance()
107
+ if available_endpoints is None:
108
+ raise AgentLoadError("No endpoints available for agent loading")
109
+
110
+ structlogger.debug(
111
+ "training.loading_agent.cwd",
112
+ cwd=os.getcwd(),
113
+ model_path=model_path,
114
+ )
115
+
116
+ agent_instance = await agent.load_agent(
117
+ model_path=model_path,
118
+ remote_storage=None,
119
+ endpoints=available_endpoints,
120
+ )
121
+
122
+ if agent_instance is None:
123
+ raise AgentLoadError("Agent loading returned None")
124
+
125
+ structlogger.info("training.agent_loaded", model_path=model_path)
126
+
127
+ return agent_instance
128
+
129
+ except AgentLoadError:
130
+ raise
131
+ except Exception as e:
132
+ raise AgentLoadError(f"Failed to load agent: {e}")
@@ -0,0 +1,93 @@
1
+ """Functions for validating Rasa projects."""
2
+
3
+ import sys
4
+ from contextlib import contextmanager
5
+ from typing import Any, Dict, Generator, Optional
6
+
7
+ import structlog
8
+ from structlog.testing import capture_logs
9
+
10
+ from rasa.builder import config
11
+ from rasa.builder.exceptions import ValidationError
12
+ from rasa.cli.utils import validate_files
13
+ from rasa.shared.importers.importer import TrainingDataImporter
14
+
15
+ structlogger = structlog.get_logger()
16
+
17
+
18
+ @contextmanager
19
+ def _mock_sys_exit() -> Generator[Dict[str, bool], Any, None]:
20
+ """Context manager to prevent sys.exit from being called during validation."""
21
+ was_sys_exit_called = {"value": False}
22
+
23
+ def sys_exit_mock(code: int = 0) -> None:
24
+ was_sys_exit_called["value"] = True
25
+
26
+ original_exit = sys.exit
27
+ sys.exit = sys_exit_mock # type: ignore[assignment]
28
+
29
+ try:
30
+ yield was_sys_exit_called
31
+ finally:
32
+ sys.exit = original_exit
33
+
34
+
35
+ async def validate_project(importer: TrainingDataImporter) -> Optional[str]:
36
+ """Validate a Rasa project.
37
+
38
+ Args:
39
+ importer: Training data importer with domain, flows, and config
40
+
41
+ Returns:
42
+ None if validation passes, error message if validation fails.
43
+
44
+ Raises:
45
+ ValidationError: If validation fails
46
+ """
47
+ try:
48
+ with _mock_sys_exit() as exit_tracker:
49
+ with capture_logs() as cap_logs:
50
+ validate_files(
51
+ fail_on_warnings=config.VALIDATION_FAIL_ON_WARNINGS,
52
+ max_history=config.VALIDATION_MAX_HISTORY,
53
+ importer=importer,
54
+ )
55
+
56
+ if exit_tracker["value"]:
57
+ error_logs = [
58
+ log for log in cap_logs if log.get("log_level") != "debug"
59
+ ]
60
+ structlogger.error(
61
+ "validation.failed.sys_exit",
62
+ error_logs=error_logs,
63
+ )
64
+ raise ValidationError(
65
+ "Validation failed with sys.exit", validation_logs=error_logs
66
+ )
67
+
68
+ structlogger.info("validation.success")
69
+ return None
70
+
71
+ except ValidationError:
72
+ raise
73
+
74
+ except Exception as e:
75
+ error_msg = f"Validation failed with exception: {e}"
76
+
77
+ error_logs = [log for log in cap_logs if log.get("log_level") != "debug"]
78
+
79
+ structlogger.error(
80
+ "validation.failed.exception", error=str(e), validation_logs=error_logs
81
+ )
82
+ raise ValidationError(error_msg, validation_logs=error_logs)
83
+
84
+ except SystemExit as e:
85
+ error_logs = [log for log in cap_logs if log.get("log_level") != "debug"]
86
+
87
+ structlogger.error(
88
+ "validation.failed.sys_exit",
89
+ error_logs=error_logs,
90
+ )
91
+ raise ValidationError(
92
+ f"SystemExit during validation: {e}", validation_logs=error_logs
93
+ )
@@ -3,7 +3,6 @@ import logging
3
3
  from enum import Enum
4
4
  from typing import List, Optional, Text, Union
5
5
 
6
- from rasa.core.constants import DEFAULT_SUB_AGENTS
7
6
  from rasa.core.persistor import RemoteStorageType, StorageType, parse_remote_storage
8
7
  from rasa.shared.constants import (
9
8
  DEFAULT_CONFIG_PATH,
@@ -218,14 +217,3 @@ def add_skip_validation_flag(
218
217
  action="append",
219
218
  help="Skip YAML validation for selected parts of the training data.",
220
219
  )
221
-
222
-
223
- def add_sub_agents_param(
224
- parser: Union[argparse.ArgumentParser, argparse._ActionsContainer],
225
- ) -> None:
226
- parser.add_argument(
227
- "--sub-agents",
228
- type=str,
229
- default=DEFAULT_SUB_AGENTS,
230
- help="Directory that specifies sub-agents to use (default: %(default)s).",
231
- )
rasa/cli/arguments/run.py CHANGED
@@ -7,7 +7,6 @@ from rasa.cli.arguments.default_arguments import (
7
7
  add_model_param,
8
8
  add_remote_storage_param,
9
9
  add_skip_validation_flag,
10
- add_sub_agents_param,
11
10
  )
12
11
  from rasa.core import constants
13
12
  from rasa.env import (
@@ -25,7 +24,6 @@ def set_run_arguments(parser: argparse.ArgumentParser) -> None:
25
24
  add_server_arguments(parser)
26
25
  add_inspect_argument(parser)
27
26
  add_skip_validation_flag(parser)
28
- add_sub_agents_param(parser)
29
27
 
30
28
 
31
29
  def set_run_action_arguments(parser: argparse.ArgumentParser) -> None:
@@ -14,7 +14,6 @@ from rasa.cli.arguments.default_arguments import (
14
14
  add_endpoint_param,
15
15
  add_model_param,
16
16
  add_remote_storage_param,
17
- add_sub_agents_param,
18
17
  )
19
18
  from rasa.core.agent import Agent
20
19
  from rasa.core.available_endpoints import AvailableEndpoints
@@ -175,8 +174,6 @@ def add_du_test_arguments(parser: argparse.ArgumentParser) -> None:
175
174
  ),
176
175
  )
177
176
 
178
- add_sub_agents_param(du_arguments)
179
-
180
177
 
181
178
  def ensure_calm_only_bot(agent: Agent) -> None:
182
179
  if agent.domain is None or agent.processor is None:
@@ -221,7 +218,6 @@ def execute_dialogue_understanding_tests(args: argparse.Namespace) -> None:
221
218
  model_path=args.model,
222
219
  model_server=endpoints.model,
223
220
  remote_storage=args.remote_storage,
224
- sub_agents_path=args.sub_agents,
225
221
  )
226
222
  except AgentNotReady as error:
227
223
  structlogger.error(
rasa/cli/e2e_test.py CHANGED
@@ -17,7 +17,6 @@ from rasa.cli.arguments.default_arguments import (
17
17
  add_endpoint_param,
18
18
  add_model_param,
19
19
  add_remote_storage_param,
20
- add_sub_agents_param,
21
20
  )
22
21
  from rasa.core.available_endpoints import AvailableEndpoints
23
22
  from rasa.core.exceptions import AgentNotReady
@@ -148,8 +147,6 @@ def add_e2e_test_arguments(parser: argparse.ArgumentParser) -> None:
148
147
  help="Directory where to save coverage report to.",
149
148
  )
150
149
 
151
- add_sub_agents_param(parser)
152
-
153
150
 
154
151
  def execute_e2e_tests(args: argparse.Namespace) -> None:
155
152
  """Run the end-to-end tests.
@@ -195,7 +192,6 @@ def execute_e2e_tests(args: argparse.Namespace) -> None:
195
192
  model_server=endpoints.model,
196
193
  endpoints=endpoints,
197
194
  test_case_path=Path(test_case_path),
198
- sub_agents_path=args.sub_agents,
199
195
  )
200
196
  except AgentNotReady as error:
201
197
  structlogger.error(