rasa-pro 3.14.0.dev20250825__py3-none-any.whl → 3.14.0.dev20250901__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 (350) hide show
  1. rasa/builder/README.md +120 -0
  2. rasa/builder/__init__.py +0 -0
  3. rasa/builder/auth.py +176 -0
  4. rasa/builder/config.py +91 -0
  5. rasa/builder/copilot/__init__.py +0 -0
  6. rasa/builder/copilot/constants.py +28 -0
  7. rasa/builder/copilot/copilot.py +376 -0
  8. rasa/builder/copilot/copilot_response_handler.py +522 -0
  9. rasa/builder/copilot/copilot_templated_message_provider.py +58 -0
  10. rasa/builder/copilot/exceptions.py +32 -0
  11. rasa/builder/copilot/models.py +464 -0
  12. rasa/builder/copilot/prompts/__init__.py +0 -0
  13. rasa/builder/copilot/prompts/copilot_system_prompt.jinja2 +771 -0
  14. rasa/builder/copilot/signing.py +305 -0
  15. rasa/builder/copilot/telemetry.py +200 -0
  16. rasa/builder/copilot/templated_messages/__init__.py +0 -0
  17. rasa/builder/copilot/templated_messages/copilot_internal_messages_templates.yml +16 -0
  18. rasa/builder/copilot/templated_messages/copilot_templated_responses.yml +38 -0
  19. rasa/builder/document_retrieval/__init__.py +0 -0
  20. rasa/builder/document_retrieval/constants.py +15 -0
  21. rasa/builder/document_retrieval/inkeep-rag-response-schema.json +64 -0
  22. rasa/builder/document_retrieval/inkeep_document_retrieval.py +238 -0
  23. rasa/builder/document_retrieval/models.py +62 -0
  24. rasa/builder/download.py +147 -0
  25. rasa/builder/exceptions.py +91 -0
  26. rasa/builder/guardrails/__init__.py +1 -0
  27. rasa/builder/guardrails/constants.py +9 -0
  28. rasa/builder/guardrails/exceptions.py +4 -0
  29. rasa/builder/guardrails/lakera.py +206 -0
  30. rasa/builder/guardrails/models.py +231 -0
  31. rasa/builder/guardrails/store.py +238 -0
  32. rasa/builder/guardrails/utils.py +328 -0
  33. rasa/builder/job_manager.py +87 -0
  34. rasa/builder/jobs.py +270 -0
  35. rasa/builder/llm_service.py +246 -0
  36. rasa/builder/logging_utils.py +265 -0
  37. rasa/builder/main.py +258 -0
  38. rasa/builder/models.py +216 -0
  39. rasa/builder/project_generator.py +462 -0
  40. rasa/builder/project_info.py +72 -0
  41. rasa/builder/scrape_rasa_docs.py +97 -0
  42. rasa/builder/service.py +1335 -0
  43. rasa/builder/shared/tracker_context.py +212 -0
  44. rasa/builder/skill_to_bot_prompt.jinja2 +164 -0
  45. rasa/builder/training_service.py +124 -0
  46. rasa/builder/validation_service.py +97 -0
  47. rasa/cli/project_templates/basic/actions/__init__ +0 -0
  48. rasa/cli/project_templates/basic/actions/action_human_handoff.py +40 -0
  49. rasa/cli/project_templates/basic/config.yml +27 -0
  50. rasa/cli/project_templates/basic/credentials.yml +33 -0
  51. rasa/cli/project_templates/basic/data/data.md +9 -0
  52. rasa/cli/project_templates/basic/data/general/feedback.yml +21 -0
  53. rasa/cli/project_templates/basic/data/general/goodbye.yml +6 -0
  54. rasa/cli/project_templates/basic/data/general/hello.yml +6 -0
  55. rasa/cli/project_templates/basic/data/general/help.yml +6 -0
  56. rasa/cli/project_templates/basic/data/general/human_handoff.yml +16 -0
  57. rasa/cli/project_templates/basic/data/general/show_faqs.yml +6 -0
  58. rasa/cli/project_templates/basic/data/system/patterns/pattern_cannot_handle.yml +7 -0
  59. rasa/cli/project_templates/basic/data/system/patterns/pattern_completed.yml +7 -0
  60. rasa/cli/project_templates/basic/data/system/patterns/pattern_correction.yml +7 -0
  61. rasa/cli/project_templates/basic/data/system/patterns/pattern_search.yml +8 -0
  62. rasa/cli/project_templates/basic/data/system/patterns/pattern_session_start.yml +8 -0
  63. rasa/cli/project_templates/basic/docs/docs.md +5 -0
  64. rasa/cli/project_templates/basic/docs/template.txt +28 -0
  65. rasa/cli/project_templates/basic/domain/domain.md +9 -0
  66. rasa/cli/project_templates/basic/domain/general/feedback.yml +25 -0
  67. rasa/cli/project_templates/basic/domain/general/goodbye.yml +9 -0
  68. rasa/cli/project_templates/basic/domain/general/hello.yml +7 -0
  69. rasa/cli/project_templates/basic/domain/general/help.yml +21 -0
  70. rasa/cli/project_templates/basic/domain/general/human_handoff.yml +32 -0
  71. rasa/cli/project_templates/basic/domain/general/show_faqs.yml +14 -0
  72. rasa/cli/project_templates/basic/domain/system/patterns/pattern_cannot_handle.yml +5 -0
  73. rasa/cli/project_templates/basic/domain/system/patterns/pattern_session_start.yml +19 -0
  74. rasa/cli/project_templates/basic/endpoints.yml +63 -0
  75. rasa/cli/project_templates/basic/prompts/rephraser_demo_personality_prompt.jinja2 +38 -0
  76. rasa/cli/project_templates/finance/actions/__init__.py +46 -0
  77. rasa/cli/project_templates/finance/actions/accounts/__init__.py +0 -0
  78. rasa/cli/project_templates/finance/actions/accounts/action_ask_account.py +47 -0
  79. rasa/cli/project_templates/finance/actions/accounts/action_check_balance.py +40 -0
  80. rasa/cli/project_templates/finance/actions/action_session_start.py +74 -0
  81. rasa/cli/project_templates/finance/actions/cards/__init__.py +0 -0
  82. rasa/cli/project_templates/finance/actions/cards/action_ask_card.py +48 -0
  83. rasa/cli/project_templates/finance/actions/cards/action_check_card_existence.py +36 -0
  84. rasa/cli/project_templates/finance/actions/cards/action_update_card_status.py +54 -0
  85. rasa/cli/project_templates/finance/actions/database.py +277 -0
  86. rasa/cli/project_templates/finance/actions/transfers/__init__.py +0 -0
  87. rasa/cli/project_templates/finance/actions/transfers/action_add_payee.py +52 -0
  88. rasa/cli/project_templates/finance/actions/transfers/action_ask_account_from.py +51 -0
  89. rasa/cli/project_templates/finance/actions/transfers/action_check_payee_existence.py +40 -0
  90. rasa/cli/project_templates/finance/actions/transfers/action_check_sufficient_funds.py +40 -0
  91. rasa/cli/project_templates/finance/actions/transfers/action_list_payees.py +46 -0
  92. rasa/cli/project_templates/finance/actions/transfers/action_process_immediate_payment.py +18 -0
  93. rasa/cli/project_templates/finance/actions/transfers/action_remove_payee.py +49 -0
  94. rasa/cli/project_templates/finance/actions/transfers/action_schedule_payment.py +19 -0
  95. rasa/cli/project_templates/finance/actions/transfers/action_validate_payment_date.py +36 -0
  96. rasa/cli/project_templates/finance/config.yml +21 -0
  97. rasa/cli/project_templates/finance/credentials.yml +32 -0
  98. rasa/cli/project_templates/finance/csvs/accounts.csv +8 -0
  99. rasa/cli/project_templates/finance/csvs/advisors.csv +7 -0
  100. rasa/cli/project_templates/finance/csvs/appointments.csv +211 -0
  101. rasa/cli/project_templates/finance/csvs/branches.csv +10 -0
  102. rasa/cli/project_templates/finance/csvs/cards.csv +11 -0
  103. rasa/cli/project_templates/finance/csvs/payees.csv +11 -0
  104. rasa/cli/project_templates/finance/csvs/transactions.csv +71 -0
  105. rasa/cli/project_templates/finance/csvs/users.csv +4 -0
  106. rasa/cli/project_templates/finance/data/accounts/check_balance.yml +10 -0
  107. rasa/cli/project_templates/finance/data/cards/block_card.yml +66 -0
  108. rasa/cli/project_templates/finance/data/cards/select_card.yml +12 -0
  109. rasa/cli/project_templates/finance/data/general/bot_identity.yml +6 -0
  110. rasa/cli/project_templates/finance/data/general/feedback.yml +20 -0
  111. rasa/cli/project_templates/finance/data/general/goodbye.yml +6 -0
  112. rasa/cli/project_templates/finance/data/general/hello.yml +7 -0
  113. rasa/cli/project_templates/finance/data/general/help.yml +9 -0
  114. rasa/cli/project_templates/finance/data/general/human_handoff.yml +16 -0
  115. rasa/cli/project_templates/finance/data/general/welcome.yml +9 -0
  116. rasa/cli/project_templates/finance/data/system/patterns/pattern_chitchat.yml +5 -0
  117. rasa/cli/project_templates/finance/data/system/patterns/pattern_completed.yml +7 -0
  118. rasa/cli/project_templates/finance/data/system/patterns/pattern_correction.yml +7 -0
  119. rasa/cli/project_templates/finance/data/system/patterns/pattern_search.yml +8 -0
  120. rasa/cli/project_templates/finance/data/system/patterns/pattern_session_start.yml +8 -0
  121. rasa/cli/project_templates/finance/data/system/source/accounts.json +51 -0
  122. rasa/cli/project_templates/finance/data/system/source/advisors.json +44 -0
  123. rasa/cli/project_templates/finance/data/system/source/appointments.json +1474 -0
  124. rasa/cli/project_templates/finance/data/system/source/branches.json +47 -0
  125. rasa/cli/project_templates/finance/data/system/source/cards.json +72 -0
  126. rasa/cli/project_templates/finance/data/system/source/payees.json +74 -0
  127. rasa/cli/project_templates/finance/data/system/source/transactions.json +492 -0
  128. rasa/cli/project_templates/finance/data/system/source/users.json +29 -0
  129. rasa/cli/project_templates/finance/data/transfers/add_payee.yml +29 -0
  130. rasa/cli/project_templates/finance/data/transfers/list_payees.yml +5 -0
  131. rasa/cli/project_templates/finance/data/transfers/remove_payee.yml +21 -0
  132. rasa/cli/project_templates/finance/data/transfers/transfer_money.yml +67 -0
  133. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/consequences_of_blocking_card.txt +8 -0
  134. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/reasons_to_block_card.txt +8 -0
  135. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/recovering_from_card_fraud.txt +8 -0
  136. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/tips_for_card_security.txt +8 -0
  137. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/what_to_do_if_card_is_lost.txt +8 -0
  138. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/account_balance_security.txt +7 -0
  139. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/common_balance_inquiries.txt +8 -0
  140. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/methods_to_check_balance.txt +8 -0
  141. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/understanding_balance_updates.txt +8 -0
  142. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/what_to_do_if_balance_is_incorrect.txt +8 -0
  143. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/benefits_of_authorised_payees.txt +8 -0
  144. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/common_issues_with_payees.txt +8 -0
  145. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/general_payee_information.txt +8 -0
  146. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/payee_management_tips.txt +8 -0
  147. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/understanding_payee_types.txt +8 -0
  148. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/common_transfer_errors.txt +8 -0
  149. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/fees_for_transfers.txt +8 -0
  150. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/general_transfer_information.txt +8 -0
  151. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/security_tips_for_transfers.txt +8 -0
  152. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/transfer_processing_times.txt +8 -0
  153. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part1.txt +50 -0
  154. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part10.txt +50 -0
  155. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part11.txt +48 -0
  156. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part12.txt +50 -0
  157. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part13.txt +50 -0
  158. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part14.txt +47 -0
  159. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part15.txt +50 -0
  160. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part16.txt +50 -0
  161. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part17.txt +47 -0
  162. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part18.txt +50 -0
  163. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part19.txt +50 -0
  164. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part2.txt +50 -0
  165. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part20.txt +47 -0
  166. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part21.txt +50 -0
  167. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part22.txt +50 -0
  168. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part23.txt +47 -0
  169. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part24.txt +50 -0
  170. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part25.txt +50 -0
  171. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part26.txt +47 -0
  172. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part27.txt +50 -0
  173. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part28.txt +50 -0
  174. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part29.txt +47 -0
  175. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part3.txt +47 -0
  176. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part30.txt +50 -0
  177. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part31.txt +50 -0
  178. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part32.txt +47 -0
  179. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part33.txt +50 -0
  180. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part34.txt +50 -0
  181. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part35.txt +47 -0
  182. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part36.txt +50 -0
  183. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part37.txt +50 -0
  184. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part38.txt +47 -0
  185. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part39.txt +50 -0
  186. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part4.txt +50 -0
  187. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part40.txt +50 -0
  188. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part41.txt +47 -0
  189. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part42.txt +50 -0
  190. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part43.txt +50 -0
  191. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part44.txt +47 -0
  192. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part45.txt +50 -0
  193. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part46.txt +50 -0
  194. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part47.txt +47 -0
  195. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part48.txt +50 -0
  196. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part49.txt +50 -0
  197. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part5.txt +50 -0
  198. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part50.txt +47 -0
  199. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part51.txt +50 -0
  200. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part52.txt +50 -0
  201. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part53.txt +47 -0
  202. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part54.txt +50 -0
  203. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part55.txt +50 -0
  204. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part56.txt +47 -0
  205. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part57.txt +50 -0
  206. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part58.txt +50 -0
  207. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part59.txt +47 -0
  208. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part6.txt +47 -0
  209. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part60.txt +50 -0
  210. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part61.txt +50 -0
  211. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part7.txt +50 -0
  212. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part8.txt +50 -0
  213. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part9.txt +47 -0
  214. rasa/cli/project_templates/finance/domain/accounts/check_balance.yml +11 -0
  215. rasa/cli/project_templates/finance/domain/cards/block_card.yml +101 -0
  216. rasa/cli/project_templates/finance/domain/cards/select_card.yml +12 -0
  217. rasa/cli/project_templates/finance/domain/general/assistant_details.yml +12 -0
  218. rasa/cli/project_templates/finance/domain/general/bot_identity.yml +5 -0
  219. rasa/cli/project_templates/finance/domain/general/cannot_handle.yml +5 -0
  220. rasa/cli/project_templates/finance/domain/general/defaults.yml +24 -0
  221. rasa/cli/project_templates/finance/domain/general/feedback.yml +28 -0
  222. rasa/cli/project_templates/finance/domain/general/goodbye.yml +7 -0
  223. rasa/cli/project_templates/finance/domain/general/help.yml +5 -0
  224. rasa/cli/project_templates/finance/domain/general/human_handoff.yml +30 -0
  225. rasa/cli/project_templates/finance/domain/general/utils.yml +13 -0
  226. rasa/cli/project_templates/finance/domain/general/welcome.yml +8 -0
  227. rasa/cli/project_templates/finance/domain/transfers/add_payee.yml +47 -0
  228. rasa/cli/project_templates/finance/domain/transfers/list_payees.yml +4 -0
  229. rasa/cli/project_templates/finance/domain/transfers/remove_payee.yml +16 -0
  230. rasa/cli/project_templates/finance/domain/transfers/transfer_money.yml +79 -0
  231. rasa/cli/project_templates/finance/endpoints.yml +63 -0
  232. rasa/cli/project_templates/finance/prompts/rephraser_demo_personality_prompt.jinja2 +19 -0
  233. rasa/cli/project_templates/telco/actions/__init__.py +0 -0
  234. rasa/cli/project_templates/telco/actions/billing/__init__.py +0 -0
  235. rasa/cli/project_templates/telco/actions/billing/actions_billing.py +204 -0
  236. rasa/cli/project_templates/telco/actions/general/__init__.py +0 -0
  237. rasa/cli/project_templates/telco/actions/general/action_human_handoff.py +49 -0
  238. rasa/cli/project_templates/telco/actions/network/__init__.py +0 -0
  239. rasa/cli/project_templates/telco/actions/network/actions_get_data_from_db.py +48 -0
  240. rasa/cli/project_templates/telco/actions/network/actions_run_diagnostics.py +28 -0
  241. rasa/cli/project_templates/telco/actions/network/actions_session_start.py +18 -0
  242. rasa/cli/project_templates/telco/config.yml +27 -0
  243. rasa/cli/project_templates/telco/credentials.yml +33 -0
  244. rasa/cli/project_templates/telco/csvs/billing.csv +19 -0
  245. rasa/cli/project_templates/telco/csvs/customers.csv +5 -0
  246. rasa/cli/project_templates/telco/data/billing/flow_understand_bill.yml +45 -0
  247. rasa/cli/project_templates/telco/data/general/bot_challenge.yml +6 -0
  248. rasa/cli/project_templates/telco/data/general/feedback.yml +20 -0
  249. rasa/cli/project_templates/telco/data/general/goodbye.yml +6 -0
  250. rasa/cli/project_templates/telco/data/general/hello.yml +6 -0
  251. rasa/cli/project_templates/telco/data/general/human_handoff.yml +16 -0
  252. rasa/cli/project_templates/telco/data/general/patterns.yml +30 -0
  253. rasa/cli/project_templates/telco/data/network/flow_reboot_router.yml +8 -0
  254. rasa/cli/project_templates/telco/data/network/flow_reset_router.yml +7 -0
  255. rasa/cli/project_templates/telco/data/network/flow_solve_internet_issue.yml +73 -0
  256. rasa/cli/project_templates/telco/docs/docs.md +5 -0
  257. rasa/cli/project_templates/telco/docs/network/reset_vs_rboot_router.txt +1 -0
  258. rasa/cli/project_templates/telco/docs/network/restart_router.txt +6 -0
  259. rasa/cli/project_templates/telco/docs/network/run_speed_test.txt +6 -0
  260. rasa/cli/project_templates/telco/domain/billing/domain_undertand_bill.yml +102 -0
  261. rasa/cli/project_templates/telco/domain/general/bot_challenge.yml +4 -0
  262. rasa/cli/project_templates/telco/domain/general/feedback.yml +25 -0
  263. rasa/cli/project_templates/telco/domain/general/goodbye.yml +7 -0
  264. rasa/cli/project_templates/telco/domain/general/hello.yml +5 -0
  265. rasa/cli/project_templates/telco/domain/general/human_handoff.yml +29 -0
  266. rasa/cli/project_templates/telco/domain/general/patterns.yml +33 -0
  267. rasa/cli/project_templates/telco/domain/network/domain_reboot_router.yml +21 -0
  268. rasa/cli/project_templates/telco/domain/network/domain_reset_router.yml +12 -0
  269. rasa/cli/project_templates/telco/domain/network/domain_run_speed_test.yml +25 -0
  270. rasa/cli/project_templates/telco/domain/network/domain_solve_internet_issue.yml +75 -0
  271. rasa/cli/project_templates/telco/domain/shared.yml +129 -0
  272. rasa/cli/project_templates/telco/endpoints.yml +63 -0
  273. rasa/cli/project_templates/telco/prompts/rephraser_demo_personality_prompt.jinja2 +40 -0
  274. rasa/cli/project_templates/tutorial/config.yml +2 -1
  275. rasa/cli/scaffold.py +46 -2
  276. rasa/core/actions/action.py +0 -1
  277. rasa/core/channels/inspector/dist/assets/{arc-1ddec37b.js → arc-18042c22.js} +1 -1
  278. rasa/core/channels/inspector/dist/assets/{blockDiagram-38ab4fdb-18af387c.js → blockDiagram-38ab4fdb-fdd6bcfa.js} +1 -1
  279. rasa/core/channels/inspector/dist/assets/{c4Diagram-3d4e48cf-250127a3.js → c4Diagram-3d4e48cf-f5ae6786.js} +1 -1
  280. rasa/core/channels/inspector/dist/assets/channel-b9b536fc.js +1 -0
  281. rasa/core/channels/inspector/dist/assets/{classDiagram-70f12bd4-c3388b34.js → classDiagram-70f12bd4-81efba3e.js} +1 -1
  282. rasa/core/channels/inspector/dist/assets/{classDiagram-v2-f2320105-9c893a82.js → classDiagram-v2-f2320105-3b6b6a92.js} +1 -1
  283. rasa/core/channels/inspector/dist/assets/clone-78d2ddcf.js +1 -0
  284. rasa/core/channels/inspector/dist/assets/{createText-2e5e7dd3-c111213b.js → createText-2e5e7dd3-31422447.js} +1 -1
  285. rasa/core/channels/inspector/dist/assets/{edges-e0da2a9e-812a729d.js → edges-e0da2a9e-518a90db.js} +1 -1
  286. rasa/core/channels/inspector/dist/assets/{erDiagram-9861fffd-fd5051bc.js → erDiagram-9861fffd-a6d3c25a.js} +1 -1
  287. rasa/core/channels/inspector/dist/assets/{flowDb-956e92f1-3287ac02.js → flowDb-956e92f1-e048c2be.js} +1 -1
  288. rasa/core/channels/inspector/dist/assets/{flowDiagram-66a62f08-692fb0b2.js → flowDiagram-66a62f08-c7474c91.js} +1 -1
  289. rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-8b09c060.js +1 -0
  290. rasa/core/channels/inspector/dist/assets/{flowchart-elk-definition-4a651766-008376f1.js → flowchart-elk-definition-4a651766-cb4d8723.js} +1 -1
  291. rasa/core/channels/inspector/dist/assets/{ganttDiagram-c361ad54-df330a69.js → ganttDiagram-c361ad54-346636a2.js} +1 -1
  292. rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-72cf32ee-e03676fb.js → gitGraphDiagram-72cf32ee-7c508874.js} +1 -1
  293. rasa/core/channels/inspector/dist/assets/{graph-46fad2ba.js → graph-14702d8a.js} +1 -1
  294. rasa/core/channels/inspector/dist/assets/{index-3862675e-a484ac55.js → index-3862675e-f18b534b.js} +1 -1
  295. rasa/core/channels/inspector/dist/assets/{index-a003633f.js → index-4d4bdf3a.js} +231 -231
  296. rasa/core/channels/inspector/dist/assets/{infoDiagram-f8f76790-3f9e6ec2.js → infoDiagram-f8f76790-64154b83.js} +1 -1
  297. rasa/core/channels/inspector/dist/assets/{journeyDiagram-49397b02-79f72383.js → journeyDiagram-49397b02-833a5f95.js} +1 -1
  298. rasa/core/channels/inspector/dist/assets/{layout-aad098e5.js → layout-5a3b2123.js} +1 -1
  299. rasa/core/channels/inspector/dist/assets/{line-219ab7ae.js → line-2272a8c7.js} +1 -1
  300. rasa/core/channels/inspector/dist/assets/{linear-2cddbe62.js → linear-35bcf273.js} +1 -1
  301. rasa/core/channels/inspector/dist/assets/{mindmap-definition-fc14e90a-1d41ed99.js → mindmap-definition-fc14e90a-92dcb0e9.js} +1 -1
  302. rasa/core/channels/inspector/dist/assets/{pieDiagram-8a3498a8-cc496ee8.js → pieDiagram-8a3498a8-94dbc900.js} +1 -1
  303. rasa/core/channels/inspector/dist/assets/{quadrantDiagram-120e2f19-84d32884.js → quadrantDiagram-120e2f19-8b7a9c33.js} +1 -1
  304. rasa/core/channels/inspector/dist/assets/{requirementDiagram-deff3bca-c0deb984.js → requirementDiagram-deff3bca-6f7eab81.js} +1 -1
  305. rasa/core/channels/inspector/dist/assets/{sankeyDiagram-04a897e0-b9d7fd62.js → sankeyDiagram-04a897e0-f43e581d.js} +1 -1
  306. rasa/core/channels/inspector/dist/assets/{sequenceDiagram-704730f1-7d517565.js → sequenceDiagram-704730f1-0bcbefc3.js} +1 -1
  307. rasa/core/channels/inspector/dist/assets/{stateDiagram-587899a1-98ef9b27.js → stateDiagram-587899a1-b8a74083.js} +1 -1
  308. rasa/core/channels/inspector/dist/assets/{stateDiagram-v2-d93cdb3a-cee70748.js → stateDiagram-v2-d93cdb3a-2070218f.js} +1 -1
  309. rasa/core/channels/inspector/dist/assets/{styles-6aaf32cf-3f9d1c96.js → styles-6aaf32cf-f1d54e34.js} +1 -1
  310. rasa/core/channels/inspector/dist/assets/{styles-9a916d00-67471923.js → styles-9a916d00-980de489.js} +1 -1
  311. rasa/core/channels/inspector/dist/assets/{styles-c10674c1-bd093fb7.js → styles-c10674c1-3c03abde.js} +1 -1
  312. rasa/core/channels/inspector/dist/assets/{svgDrawCommon-08f97a94-675794e8.js → svgDrawCommon-08f97a94-46ba068f.js} +1 -1
  313. rasa/core/channels/inspector/dist/assets/{timeline-definition-85554ec2-0ac67617.js → timeline-definition-85554ec2-901f5e3d.js} +1 -1
  314. rasa/core/channels/inspector/dist/assets/{xychartDiagram-e933f94c-c018dc37.js → xychartDiagram-e933f94c-acbc628a.js} +1 -1
  315. rasa/core/channels/inspector/dist/index.html +2 -2
  316. rasa/core/channels/inspector/index.html +1 -1
  317. rasa/core/channels/inspector/src/App.tsx +10 -11
  318. rasa/core/channels/inspector/src/components/DialogueInformation.tsx +12 -3
  319. rasa/core/channels/studio_chat.py +25 -7
  320. rasa/core/policies/enterprise_search_policy.py +4 -7
  321. rasa/core/policies/flows/flow_executor.py +8 -1
  322. rasa/dialogue_understanding/generator/flow_retrieval.py +10 -9
  323. rasa/engine/storage/local_model_storage.py +45 -2
  324. rasa/model_manager/model_api.py +1 -2
  325. rasa/model_manager/runner_service.py +1 -1
  326. rasa/model_manager/trainer_service.py +12 -9
  327. rasa/model_manager/utils.py +1 -29
  328. rasa/shared/core/domain.py +62 -15
  329. rasa/shared/core/flows/flow_step.py +7 -1
  330. rasa/shared/core/flows/steps/call.py +8 -1
  331. rasa/shared/core/flows/yaml_flows_io.py +16 -8
  332. rasa/shared/core/slots.py +4 -0
  333. rasa/shared/importers/importer.py +6 -0
  334. rasa/shared/importers/utils.py +77 -1
  335. rasa/studio/upload.py +12 -46
  336. rasa/telemetry.py +97 -23
  337. rasa/utils/io.py +27 -9
  338. rasa/utils/json_utils.py +6 -1
  339. rasa/utils/log_utils.py +5 -1
  340. rasa/utils/openapi.py +144 -0
  341. rasa/validator.py +7 -3
  342. rasa/version.py +1 -1
  343. {rasa_pro-3.14.0.dev20250825.dist-info → rasa_pro-3.14.0.dev20250901.dist-info}/METADATA +9 -10
  344. {rasa_pro-3.14.0.dev20250825.dist-info → rasa_pro-3.14.0.dev20250901.dist-info}/RECORD +347 -73
  345. rasa/core/channels/inspector/dist/assets/channel-59f6d54b.js +0 -1
  346. rasa/core/channels/inspector/dist/assets/clone-26177ddb.js +0 -1
  347. rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-29c03f5a.js +0 -1
  348. {rasa_pro-3.14.0.dev20250825.dist-info → rasa_pro-3.14.0.dev20250901.dist-info}/NOTICE +0 -0
  349. {rasa_pro-3.14.0.dev20250825.dist-info → rasa_pro-3.14.0.dev20250901.dist-info}/WHEEL +0 -0
  350. {rasa_pro-3.14.0.dev20250825.dist-info → rasa_pro-3.14.0.dev20250901.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,124 @@
1
+ """Functions for training and loading Rasa models."""
2
+
3
+ import os
4
+ from pathlib import Path
5
+
6
+ import structlog
7
+
8
+ from rasa.builder.exceptions import AgentLoadError, TrainingError
9
+ from rasa.builder.models import TrainingInput
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
+
15
+ structlogger = structlog.get_logger()
16
+
17
+
18
+ async def train_and_load_agent(input: TrainingInput) -> agent.Agent:
19
+ """Train a model and load an agent.
20
+
21
+ Args:
22
+ input: Training input with importer and endpoints file
23
+
24
+ Returns:
25
+ Loaded and ready agent
26
+
27
+ Raises:
28
+ TrainingError: If training fails
29
+ AgentLoadError: If agent loading fails
30
+ """
31
+ try:
32
+ # Setup endpoints for training validation
33
+ await _setup_endpoints(input.endpoints_file)
34
+
35
+ # Train the model
36
+ training_result = await _train_model(input.importer)
37
+
38
+ # Load the agent
39
+ agent_instance = await _load_agent(training_result.model)
40
+
41
+ # Verify agent is ready
42
+ if not agent_instance.is_ready():
43
+ raise AgentLoadError("Agent failed to load properly - model is not ready")
44
+
45
+ structlogger.info("training.agent_ready", model_path=training_result.model)
46
+
47
+ return agent_instance
48
+
49
+ except (TrainingError, AgentLoadError):
50
+ raise
51
+ except Exception as e:
52
+ raise TrainingError(f"Unexpected error during training: {e}")
53
+ except SystemExit as e:
54
+ raise TrainingError(f"SystemExit during training: {e}")
55
+
56
+
57
+ async def _setup_endpoints(endpoints_file: Path) -> None:
58
+ """Setup endpoints configuration for training."""
59
+ try:
60
+ # Reset and load endpoints
61
+ AvailableEndpoints.reset_instance()
62
+ read_endpoints_from_path(endpoints_file)
63
+
64
+ structlogger.debug("training.endpoints_setup", endpoints_file=endpoints_file)
65
+
66
+ except Exception as e:
67
+ raise TrainingError(f"Failed to setup endpoints: {e}")
68
+
69
+
70
+ async def _train_model(importer: TrainingDataImporter) -> TrainingResult:
71
+ """Train the Rasa model."""
72
+ try:
73
+ structlogger.info("training.started")
74
+
75
+ training_result = await train(
76
+ domain="",
77
+ config="",
78
+ training_files=None,
79
+ file_importer=importer,
80
+ )
81
+
82
+ if not training_result or not training_result.model:
83
+ raise TrainingError("Training completed but no model was produced")
84
+
85
+ structlogger.info("training.completed", model_path=training_result.model)
86
+
87
+ return training_result
88
+
89
+ except Exception as e:
90
+ raise TrainingError(f"Model training failed: {e}")
91
+
92
+
93
+ async def _load_agent(model_path: str) -> agent.Agent:
94
+ """Load the trained agent."""
95
+ try:
96
+ structlogger.info("training.loading_agent", model_path=model_path)
97
+
98
+ available_endpoints = AvailableEndpoints.get_instance()
99
+ if available_endpoints is None:
100
+ raise AgentLoadError("No endpoints available for agent loading")
101
+
102
+ structlogger.debug(
103
+ "training.loading_agent.cwd",
104
+ cwd=os.getcwd(),
105
+ model_path=model_path,
106
+ )
107
+
108
+ agent_instance = await agent.load_agent(
109
+ model_path=model_path,
110
+ remote_storage=None,
111
+ endpoints=available_endpoints,
112
+ )
113
+
114
+ if agent_instance is None:
115
+ raise AgentLoadError("Agent loading returned None")
116
+
117
+ structlogger.info("training.agent_loaded", model_path=model_path)
118
+
119
+ return agent_instance
120
+
121
+ except AgentLoadError:
122
+ raise
123
+ except Exception as e:
124
+ raise AgentLoadError(f"Failed to load agent: {e}")
@@ -0,0 +1,97 @@
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
+
9
+ from rasa.builder import config
10
+ from rasa.builder.exceptions import ValidationError
11
+ from rasa.builder.logging_utils import capture_validation_logs
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
+ with capture_validation_logs() as captured_logs:
48
+ try:
49
+ with _mock_sys_exit() as exit_tracker:
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 captured_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 = [
78
+ log for log in captured_logs if log.get("log_level") != "debug"
79
+ ]
80
+
81
+ structlogger.error(
82
+ "validation.failed.exception", error=str(e), validation_logs=error_logs
83
+ )
84
+ raise ValidationError(error_msg, validation_logs=error_logs)
85
+
86
+ except SystemExit as e:
87
+ error_logs = [
88
+ log for log in captured_logs if log.get("log_level") != "debug"
89
+ ]
90
+
91
+ structlogger.error(
92
+ "validation.failed.sys_exit",
93
+ error_logs=error_logs,
94
+ )
95
+ raise ValidationError(
96
+ f"SystemExit during validation: {e}", validation_logs=error_logs
97
+ )
File without changes
@@ -0,0 +1,40 @@
1
+ from typing import Any, Dict, List, Text
2
+
3
+ import openai
4
+ from rasa_sdk import Action, Tracker
5
+ from rasa_sdk.executor import CollectingDispatcher
6
+ from rasa_sdk.types import DomainDict
7
+
8
+
9
+ class ActionHumanHandoff(Action):
10
+ def name(self) -> Text:
11
+ return "action_human_handoff"
12
+
13
+ async def run(
14
+ self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: DomainDict
15
+ ) -> List[Dict[Text, Any]]:
16
+ convo: List[str] = []
17
+ for event in tracker.events:
18
+ if event.get("event") == "user":
19
+ user_text = str(event.get("text") or "")
20
+ convo.append(f"user - {user_text}")
21
+ elif event.get("event") == "bot":
22
+ bot_text = str(event.get("text") or "")
23
+ convo.append(f"bot - {bot_text}")
24
+ prompt = (
25
+ f"The following is a conversation between a bot and a human user. "
26
+ f"Please summarise so that a human agent can easily understand the "
27
+ f"important context. Conversation: "
28
+ f"{convo}"
29
+ )
30
+ response = openai.chat.completions.create(
31
+ model="gpt-4o",
32
+ messages=[{"role": "user", "content": prompt}],
33
+ )
34
+ summarised_conversation = (
35
+ response.choices[0].message.content or "No summary available"
36
+ )
37
+ dispatcher.utter_message(
38
+ response="utter_transfer_to_manager", summary=summarised_conversation
39
+ )
40
+ return []
@@ -0,0 +1,27 @@
1
+ # Rasa Assistant Configuration
2
+ # This file controls your assistant's language, message processing pipeline, and conversation policies.
3
+ # For full documentation, see: https://rasa.com/docs/pro/build/configuring-assistant
4
+ recipe: default.v1
5
+ language: en
6
+
7
+ # The assistant project unique identifier
8
+ # This default value must be replaced with a unique assistant name within your deployment
9
+ assistant_id: placeholder_default
10
+
11
+ pipeline:
12
+ - name: SearchReadyLLMCommandGenerator
13
+ llm:
14
+ model_group: openai-gpt-4o
15
+ flow_retrieval:
16
+ active: false
17
+
18
+
19
+ policies:
20
+ - name: FlowPolicy
21
+ - name: EnterpriseSearchPolicy
22
+ vector_store:
23
+ type: "faiss"
24
+ source: "./docs"
25
+ llm:
26
+ model_group: openai-gpt-4o
27
+ check_relevancy: true