rasa-pro 3.14.0.dev20250825__py3-none-any.whl → 3.14.0.dev20250922__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 (351) 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 +92 -0
  5. rasa/builder/copilot/__init__.py +0 -0
  6. rasa/builder/copilot/constants.py +31 -0
  7. rasa/builder/copilot/copilot.py +450 -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 +500 -0
  12. rasa/builder/copilot/prompts/__init__.py +0 -0
  13. rasa/builder/copilot/prompts/copilot_system_prompt.jinja2 +766 -0
  14. rasa/builder/copilot/prompts/latest_user_message_context_prompt.jinja2 +61 -0
  15. rasa/builder/copilot/signing.py +305 -0
  16. rasa/builder/copilot/telemetry.py +226 -0
  17. rasa/builder/copilot/templated_messages/__init__.py +0 -0
  18. rasa/builder/copilot/templated_messages/copilot_internal_messages_templates.yml +16 -0
  19. rasa/builder/copilot/templated_messages/copilot_templated_responses.yml +38 -0
  20. rasa/builder/document_retrieval/__init__.py +0 -0
  21. rasa/builder/document_retrieval/constants.py +15 -0
  22. rasa/builder/document_retrieval/inkeep-rag-response-schema.json +64 -0
  23. rasa/builder/document_retrieval/inkeep_document_retrieval.py +238 -0
  24. rasa/builder/document_retrieval/models.py +62 -0
  25. rasa/builder/download.py +140 -0
  26. rasa/builder/exceptions.py +91 -0
  27. rasa/builder/guardrails/__init__.py +1 -0
  28. rasa/builder/guardrails/constants.py +9 -0
  29. rasa/builder/guardrails/exceptions.py +4 -0
  30. rasa/builder/guardrails/lakera.py +206 -0
  31. rasa/builder/guardrails/models.py +231 -0
  32. rasa/builder/guardrails/store.py +238 -0
  33. rasa/builder/guardrails/utils.py +328 -0
  34. rasa/builder/job_manager.py +87 -0
  35. rasa/builder/jobs.py +282 -0
  36. rasa/builder/llm_service.py +246 -0
  37. rasa/builder/logging_utils.py +265 -0
  38. rasa/builder/main.py +234 -0
  39. rasa/builder/models.py +216 -0
  40. rasa/builder/project_generator.py +458 -0
  41. rasa/builder/project_info.py +72 -0
  42. rasa/builder/scrape_rasa_docs.py +97 -0
  43. rasa/builder/service.py +1350 -0
  44. rasa/builder/shared/tracker_context.py +212 -0
  45. rasa/builder/skill_to_bot_prompt.jinja2 +164 -0
  46. rasa/builder/template_cache.py +69 -0
  47. rasa/builder/training_service.py +194 -0
  48. rasa/builder/validation_service.py +97 -0
  49. rasa/cli/project_templates/basic/README.md +23 -0
  50. rasa/cli/project_templates/basic/actions/__init__ +0 -0
  51. rasa/cli/project_templates/basic/actions/action_human_handoff.py +40 -0
  52. rasa/cli/project_templates/basic/actions/actions.md +10 -0
  53. rasa/cli/project_templates/basic/config.yml +29 -0
  54. rasa/cli/project_templates/basic/credentials.yml +33 -0
  55. rasa/cli/project_templates/basic/data/data.md +8 -0
  56. rasa/cli/project_templates/basic/data/general/feedback.yml +21 -0
  57. rasa/cli/project_templates/basic/data/general/goodbye.yml +6 -0
  58. rasa/cli/project_templates/basic/data/general/hello.yml +6 -0
  59. rasa/cli/project_templates/basic/data/general/help.yml +6 -0
  60. rasa/cli/project_templates/basic/data/general/human_handoff.yml +16 -0
  61. rasa/cli/project_templates/basic/data/general/show_faqs.yml +6 -0
  62. rasa/cli/project_templates/basic/data/system/patterns/pattern_cannot_handle.yml +7 -0
  63. rasa/cli/project_templates/basic/data/system/patterns/pattern_completed.yml +7 -0
  64. rasa/cli/project_templates/basic/data/system/patterns/pattern_correction.yml +7 -0
  65. rasa/cli/project_templates/basic/data/system/patterns/pattern_search.yml +8 -0
  66. rasa/cli/project_templates/basic/data/system/patterns/pattern_session_start.yml +8 -0
  67. rasa/cli/project_templates/basic/docs/docs.md +5 -0
  68. rasa/cli/project_templates/basic/docs/template.txt +28 -0
  69. rasa/cli/project_templates/basic/domain/domain.md +11 -0
  70. rasa/cli/project_templates/basic/domain/general/feedback.yml +25 -0
  71. rasa/cli/project_templates/basic/domain/general/goodbye.yml +9 -0
  72. rasa/cli/project_templates/basic/domain/general/hello.yml +7 -0
  73. rasa/cli/project_templates/basic/domain/general/help.yml +21 -0
  74. rasa/cli/project_templates/basic/domain/general/human_handoff.yml +32 -0
  75. rasa/cli/project_templates/basic/domain/general/show_faqs.yml +14 -0
  76. rasa/cli/project_templates/basic/domain/system/patterns/pattern_cannot_handle.yml +5 -0
  77. rasa/cli/project_templates/basic/domain/system/patterns/pattern_session_start.yml +19 -0
  78. rasa/cli/project_templates/basic/endpoints.yml +67 -0
  79. rasa/cli/project_templates/basic/prompts/rephraser_demo_personality_prompt.jinja2 +38 -0
  80. rasa/cli/project_templates/default/config.yml +4 -0
  81. rasa/cli/project_templates/default/endpoints.yml +4 -0
  82. rasa/cli/project_templates/finance/README.md +26 -0
  83. rasa/cli/project_templates/finance/actions/__init__.py +0 -0
  84. rasa/cli/project_templates/finance/actions/accounts/__init__.py +0 -0
  85. rasa/cli/project_templates/finance/actions/accounts/check_balance.py +18 -0
  86. rasa/cli/project_templates/finance/actions/actions.md +15 -0
  87. rasa/cli/project_templates/finance/actions/cards/__init__.py +0 -0
  88. rasa/cli/project_templates/finance/actions/cards/check_that_card_exists.py +21 -0
  89. rasa/cli/project_templates/finance/actions/cards/list_cards.py +22 -0
  90. rasa/cli/project_templates/finance/actions/contacts/__init__.py +0 -0
  91. rasa/cli/project_templates/finance/actions/contacts/add_contact.py +30 -0
  92. rasa/cli/project_templates/finance/actions/contacts/list_contacts.py +22 -0
  93. rasa/cli/project_templates/finance/actions/contacts/remove_contact.py +35 -0
  94. rasa/cli/project_templates/finance/actions/db.py +117 -0
  95. rasa/cli/project_templates/finance/actions/general/__init__.py +0 -0
  96. rasa/cli/project_templates/finance/actions/general/action_human_handoff.py +49 -0
  97. rasa/cli/project_templates/finance/actions/transfers/__init__.py +0 -0
  98. rasa/cli/project_templates/finance/actions/transfers/check_transfer_funds.py +27 -0
  99. rasa/cli/project_templates/finance/actions/transfers/check_transfer_limit.py +36 -0
  100. rasa/cli/project_templates/finance/actions/transfers/execute_recurrent_payment.py +20 -0
  101. rasa/cli/project_templates/finance/actions/transfers/execute_transfer.py +45 -0
  102. rasa/cli/project_templates/finance/actions/transfers/list_transactions.py +32 -0
  103. rasa/cli/project_templates/finance/config.yml +29 -0
  104. rasa/cli/project_templates/finance/credentials.yml +33 -0
  105. rasa/cli/project_templates/finance/data/accounts/check_balance.yml +9 -0
  106. rasa/cli/project_templates/finance/data/accounts/download_statements.yml +26 -0
  107. rasa/cli/project_templates/finance/data/bills/bill_pay_reminder.yml +25 -0
  108. rasa/cli/project_templates/finance/data/cards/activate_card.yml +35 -0
  109. rasa/cli/project_templates/finance/data/cards/block_card.yml +45 -0
  110. rasa/cli/project_templates/finance/data/cards/list_cards.yml +14 -0
  111. rasa/cli/project_templates/finance/data/cards/replace_card.yml +16 -0
  112. rasa/cli/project_templates/finance/data/cards/replace_eligible_card.yml +29 -0
  113. rasa/cli/project_templates/finance/data/contacts/add_contact.yml +33 -0
  114. rasa/cli/project_templates/finance/data/contacts/list_contacts.yml +14 -0
  115. rasa/cli/project_templates/finance/data/contacts/remove_contact.yml +31 -0
  116. rasa/cli/project_templates/finance/data/data.md +14 -0
  117. rasa/cli/project_templates/finance/data/general/bot_challenge.yml +6 -0
  118. rasa/cli/project_templates/finance/data/general/feedback.yml +20 -0
  119. rasa/cli/project_templates/finance/data/general/goodbye.yml +6 -0
  120. rasa/cli/project_templates/finance/data/general/hello.yml +6 -0
  121. rasa/cli/project_templates/finance/data/general/help.yml +9 -0
  122. rasa/cli/project_templates/finance/data/general/human_handoff.yml +16 -0
  123. rasa/cli/project_templates/finance/data/general/welcome.yml +9 -0
  124. rasa/cli/project_templates/finance/data/system/patterns/pattern_completed.yml +7 -0
  125. rasa/cli/project_templates/finance/data/system/patterns/pattern_correction.yml +7 -0
  126. rasa/cli/project_templates/finance/data/system/patterns/pattern_search.yml +8 -0
  127. rasa/cli/project_templates/finance/data/system/patterns/pattern_session_start.yml +8 -0
  128. rasa/cli/project_templates/finance/data/transfers/check_transfer_limit.yml +18 -0
  129. rasa/cli/project_templates/finance/data/transfers/list_transactions.yml +46 -0
  130. rasa/cli/project_templates/finance/data/transfers/move_money_between_accounts.yml +51 -0
  131. rasa/cli/project_templates/finance/data/transfers/transfer_money.yml +34 -0
  132. rasa/cli/project_templates/finance/data/transfers/transfer_money_to_a_third_party.yml +175 -0
  133. rasa/cli/project_templates/finance/db/cards.json +18 -0
  134. rasa/cli/project_templates/finance/db/contacts.json +10 -0
  135. rasa/cli/project_templates/finance/db/my_account.json +6 -0
  136. rasa/cli/project_templates/finance/db/transactions.json +22 -0
  137. rasa/cli/project_templates/finance/docs/docs.md +8 -0
  138. rasa/cli/project_templates/finance/docs/fenlo_banking_faq/account_features/budgeting_analytics.txt +22 -0
  139. rasa/cli/project_templates/finance/docs/fenlo_banking_faq/account_features/multi_currency_accounts.txt +19 -0
  140. rasa/cli/project_templates/finance/docs/fenlo_banking_faq/account_features/premium_benefits.txt +19 -0
  141. rasa/cli/project_templates/finance/docs/fenlo_banking_faq/card_management/contactless_limits.txt +16 -0
  142. rasa/cli/project_templates/finance/docs/fenlo_banking_faq/card_management/freeze_unfreeze_card.txt +16 -0
  143. rasa/cli/project_templates/finance/docs/fenlo_banking_faq/card_management/lost_stolen_card.txt +19 -0
  144. rasa/cli/project_templates/finance/docs/fenlo_banking_faq/money_transfers/instant_payments.txt +19 -0
  145. rasa/cli/project_templates/finance/docs/fenlo_banking_faq/money_transfers/international_transfers.txt +19 -0
  146. rasa/cli/project_templates/finance/docs/fenlo_banking_faq/security_fraud/fraud_protection.txt +22 -0
  147. rasa/cli/project_templates/finance/docs/fenlo_banking_faq/security_fraud/secure_payments.txt +22 -0
  148. rasa/cli/project_templates/finance/domain/accounts/check_balance.yml +15 -0
  149. rasa/cli/project_templates/finance/domain/accounts/download_statements.yml +40 -0
  150. rasa/cli/project_templates/finance/domain/bills/bill_pay_reminder.yml +49 -0
  151. rasa/cli/project_templates/finance/domain/cards/activate_card.yml +24 -0
  152. rasa/cli/project_templates/finance/domain/cards/block_card.yml +44 -0
  153. rasa/cli/project_templates/finance/domain/cards/list_cards.yml +16 -0
  154. rasa/cli/project_templates/finance/domain/cards/replace_card.yml +43 -0
  155. rasa/cli/project_templates/finance/domain/cards/shared.yml +15 -0
  156. rasa/cli/project_templates/finance/domain/contacts/add_contact.yml +37 -0
  157. rasa/cli/project_templates/finance/domain/contacts/list_contacts.yml +16 -0
  158. rasa/cli/project_templates/finance/domain/contacts/remove_contact.yml +32 -0
  159. rasa/cli/project_templates/finance/domain/domain.md +18 -0
  160. rasa/cli/project_templates/finance/domain/general/_shared.yml +39 -0
  161. rasa/cli/project_templates/finance/domain/general/bot_challenge.yml +4 -0
  162. rasa/cli/project_templates/finance/domain/general/cannot_handle.yml +8 -0
  163. rasa/cli/project_templates/finance/domain/general/feedback.yml +25 -0
  164. rasa/cli/project_templates/finance/domain/general/goodbye.yml +7 -0
  165. rasa/cli/project_templates/finance/domain/general/human_handoff.yml +31 -0
  166. rasa/cli/project_templates/finance/domain/general/welcome.yml +39 -0
  167. rasa/cli/project_templates/finance/domain/transfers/check_transfer_limit.yml +32 -0
  168. rasa/cli/project_templates/finance/domain/transfers/list_transactions.yml +44 -0
  169. rasa/cli/project_templates/finance/domain/transfers/shared.yml +17 -0
  170. rasa/cli/project_templates/finance/domain/transfers/transfer_money.yml +221 -0
  171. rasa/cli/project_templates/finance/endpoints.yml +67 -0
  172. rasa/cli/project_templates/finance/prompts/rephraser_demo_personality_prompt.jinja2 +38 -0
  173. rasa/cli/project_templates/finance/tests/e2e_test_cases/accounts/check_balance.yml +9 -0
  174. rasa/cli/project_templates/finance/tests/e2e_test_cases/accounts/download_statements.yml +43 -0
  175. rasa/cli/project_templates/finance/tests/e2e_test_cases/cards/block_card.yml +55 -0
  176. rasa/cli/project_templates/finance/tests/e2e_test_cases/general/bot_challenge.yml +8 -0
  177. rasa/cli/project_templates/finance/tests/e2e_test_cases/general/feedback.yml +46 -0
  178. rasa/cli/project_templates/finance/tests/e2e_test_cases/general/goodbye.yml +9 -0
  179. rasa/cli/project_templates/finance/tests/e2e_test_cases/general/hello.yml +8 -0
  180. rasa/cli/project_templates/finance/tests/e2e_test_cases/general/human_handoff.yml +35 -0
  181. rasa/cli/project_templates/finance/tests/e2e_test_cases/general/patterns.yml +22 -0
  182. rasa/cli/project_templates/finance/tests/e2e_test_cases/transfers/transfer_money.yml +56 -0
  183. rasa/cli/project_templates/telco/README.md +25 -0
  184. rasa/cli/project_templates/telco/actions/__init__.py +0 -0
  185. rasa/cli/project_templates/telco/actions/actions.md +12 -0
  186. rasa/cli/project_templates/telco/actions/billing/__init__.py +0 -0
  187. rasa/cli/project_templates/telco/actions/billing/actions_billing.py +204 -0
  188. rasa/cli/project_templates/telco/actions/general/__init__.py +0 -0
  189. rasa/cli/project_templates/telco/actions/general/action_human_handoff.py +49 -0
  190. rasa/cli/project_templates/telco/actions/network/__init__.py +0 -0
  191. rasa/cli/project_templates/telco/actions/network/actions_get_data_from_db.py +48 -0
  192. rasa/cli/project_templates/telco/actions/network/actions_run_diagnostics.py +28 -0
  193. rasa/cli/project_templates/telco/actions/network/actions_session_start.py +18 -0
  194. rasa/cli/project_templates/telco/config.yml +29 -0
  195. rasa/cli/project_templates/telco/credentials.yml +33 -0
  196. rasa/cli/project_templates/telco/csvs/billing.csv +19 -0
  197. rasa/cli/project_templates/telco/csvs/customers.csv +5 -0
  198. rasa/cli/project_templates/telco/data/billing/flow_understand_bill.yml +45 -0
  199. rasa/cli/project_templates/telco/data/data.md +11 -0
  200. rasa/cli/project_templates/telco/data/general/bot_challenge.yml +6 -0
  201. rasa/cli/project_templates/telco/data/general/feedback.yml +20 -0
  202. rasa/cli/project_templates/telco/data/general/goodbye.yml +6 -0
  203. rasa/cli/project_templates/telco/data/general/hello.yml +6 -0
  204. rasa/cli/project_templates/telco/data/general/human_handoff.yml +16 -0
  205. rasa/cli/project_templates/telco/data/general/patterns.yml +30 -0
  206. rasa/cli/project_templates/telco/data/network/flow_reboot_router.yml +8 -0
  207. rasa/cli/project_templates/telco/data/network/flow_reset_router.yml +7 -0
  208. rasa/cli/project_templates/telco/data/network/flow_solve_internet_issue.yml +73 -0
  209. rasa/cli/project_templates/telco/docs/docs.md +8 -0
  210. rasa/cli/project_templates/telco/docs/network/reset_vs_rboot_router.txt +1 -0
  211. rasa/cli/project_templates/telco/docs/network/restart_router.txt +6 -0
  212. rasa/cli/project_templates/telco/docs/network/run_speed_test.txt +6 -0
  213. rasa/cli/project_templates/telco/domain/billing/understand_bill.yml +102 -0
  214. rasa/cli/project_templates/telco/domain/domain.md +13 -0
  215. rasa/cli/project_templates/telco/domain/general/bot_challenge.yml +4 -0
  216. rasa/cli/project_templates/telco/domain/general/feedback.yml +25 -0
  217. rasa/cli/project_templates/telco/domain/general/goodbye.yml +7 -0
  218. rasa/cli/project_templates/telco/domain/general/hello.yml +5 -0
  219. rasa/cli/project_templates/telco/domain/general/human_handoff.yml +26 -0
  220. rasa/cli/project_templates/telco/domain/general/patterns.yml +33 -0
  221. rasa/cli/project_templates/telco/domain/network/reboot_router.yml +21 -0
  222. rasa/cli/project_templates/telco/domain/network/reset_router.yml +12 -0
  223. rasa/cli/project_templates/telco/domain/network/run_speed_test.yml +25 -0
  224. rasa/cli/project_templates/telco/domain/network/solve_internet_issue.yml +75 -0
  225. rasa/cli/project_templates/telco/domain/shared.yml +129 -0
  226. rasa/cli/project_templates/telco/endpoints.yml +67 -0
  227. rasa/cli/project_templates/telco/prompts/rephraser_demo_personality_prompt.jinja2 +40 -0
  228. rasa/cli/project_templates/telco/tests/e2e_test_cases/billing/understand_bill.yml +67 -0
  229. rasa/cli/project_templates/telco/tests/e2e_test_cases/general/bot_challenge.yml +8 -0
  230. rasa/cli/project_templates/telco/tests/e2e_test_cases/general/feedback.yml +46 -0
  231. rasa/cli/project_templates/telco/tests/e2e_test_cases/general/goodbye.yml +9 -0
  232. rasa/cli/project_templates/telco/tests/e2e_test_cases/general/hello.yml +8 -0
  233. rasa/cli/project_templates/telco/tests/e2e_test_cases/general/human_handoff.yml +35 -0
  234. rasa/cli/project_templates/telco/tests/e2e_test_cases/general/patterns.yml +23 -0
  235. rasa/cli/project_templates/telco/tests/e2e_test_cases/network/solve_internet_issue.yml +57 -0
  236. rasa/cli/project_templates/tutorial/config.yml +2 -1
  237. rasa/cli/scaffold.py +46 -2
  238. rasa/core/actions/action.py +0 -1
  239. rasa/core/actions/action_run_slot_rejections.py +1 -1
  240. rasa/core/actions/direct_custom_actions_executor.py +9 -2
  241. rasa/core/brokers/broker.py +1 -1
  242. rasa/core/brokers/kafka.py +52 -8
  243. rasa/core/channels/development_inspector.py +1 -21
  244. rasa/core/channels/hangouts.py +2 -2
  245. rasa/core/channels/inspector/dist/assets/{arc-1ddec37b.js → arc-35222594.js} +1 -1
  246. rasa/core/channels/inspector/dist/assets/{blockDiagram-38ab4fdb-18af387c.js → blockDiagram-38ab4fdb-a0efbfd3.js} +1 -1
  247. rasa/core/channels/inspector/dist/assets/{c4Diagram-3d4e48cf-250127a3.js → c4Diagram-3d4e48cf-0584c0f2.js} +1 -1
  248. rasa/core/channels/inspector/dist/assets/channel-8e08bed9.js +1 -0
  249. rasa/core/channels/inspector/dist/assets/{classDiagram-70f12bd4-c3388b34.js → classDiagram-70f12bd4-39f40dbe.js} +1 -1
  250. rasa/core/channels/inspector/dist/assets/{classDiagram-v2-f2320105-9c893a82.js → classDiagram-v2-f2320105-1ad755f3.js} +1 -1
  251. rasa/core/channels/inspector/dist/assets/clone-78c82dea.js +1 -0
  252. rasa/core/channels/inspector/dist/assets/{createText-2e5e7dd3-c111213b.js → createText-2e5e7dd3-b0f4f0fe.js} +1 -1
  253. rasa/core/channels/inspector/dist/assets/{edges-e0da2a9e-812a729d.js → edges-e0da2a9e-9039bff9.js} +1 -1
  254. rasa/core/channels/inspector/dist/assets/{erDiagram-9861fffd-fd5051bc.js → erDiagram-9861fffd-65c9b127.js} +1 -1
  255. rasa/core/channels/inspector/dist/assets/{flowDb-956e92f1-3287ac02.js → flowDb-956e92f1-4f08b38e.js} +1 -1
  256. rasa/core/channels/inspector/dist/assets/{flowDiagram-66a62f08-692fb0b2.js → flowDiagram-66a62f08-e95c362a.js} +1 -1
  257. rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-2b08f601.js +1 -0
  258. rasa/core/channels/inspector/dist/assets/{flowchart-elk-definition-4a651766-008376f1.js → flowchart-elk-definition-4a651766-703c3015.js} +1 -1
  259. rasa/core/channels/inspector/dist/assets/{ganttDiagram-c361ad54-df330a69.js → ganttDiagram-c361ad54-699328ea.js} +1 -1
  260. rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-72cf32ee-e03676fb.js → gitGraphDiagram-72cf32ee-04cf4b05.js} +1 -1
  261. rasa/core/channels/inspector/dist/assets/{graph-46fad2ba.js → graph-ee94449e.js} +1 -1
  262. rasa/core/channels/inspector/dist/assets/{index-3862675e-a484ac55.js → index-3862675e-940162b4.js} +1 -1
  263. rasa/core/channels/inspector/dist/assets/{index-a003633f.js → index-c941dcb3.js} +239 -238
  264. rasa/core/channels/inspector/dist/assets/{infoDiagram-f8f76790-3f9e6ec2.js → infoDiagram-f8f76790-c79c2866.js} +1 -1
  265. rasa/core/channels/inspector/dist/assets/{journeyDiagram-49397b02-79f72383.js → journeyDiagram-49397b02-84489d30.js} +1 -1
  266. rasa/core/channels/inspector/dist/assets/{layout-aad098e5.js → layout-a9aa9858.js} +1 -1
  267. rasa/core/channels/inspector/dist/assets/{line-219ab7ae.js → line-eb73cf26.js} +1 -1
  268. rasa/core/channels/inspector/dist/assets/{linear-2cddbe62.js → linear-b3399f9a.js} +1 -1
  269. rasa/core/channels/inspector/dist/assets/{mindmap-definition-fc14e90a-1d41ed99.js → mindmap-definition-fc14e90a-b095bf1a.js} +1 -1
  270. rasa/core/channels/inspector/dist/assets/{pieDiagram-8a3498a8-cc496ee8.js → pieDiagram-8a3498a8-07644b66.js} +1 -1
  271. rasa/core/channels/inspector/dist/assets/{quadrantDiagram-120e2f19-84d32884.js → quadrantDiagram-120e2f19-573a3f9c.js} +1 -1
  272. rasa/core/channels/inspector/dist/assets/{requirementDiagram-deff3bca-c0deb984.js → requirementDiagram-deff3bca-d457e1e1.js} +1 -1
  273. rasa/core/channels/inspector/dist/assets/{sankeyDiagram-04a897e0-b9d7fd62.js → sankeyDiagram-04a897e0-9d26e1a2.js} +1 -1
  274. rasa/core/channels/inspector/dist/assets/{sequenceDiagram-704730f1-7d517565.js → sequenceDiagram-704730f1-3a9cde10.js} +1 -1
  275. rasa/core/channels/inspector/dist/assets/{stateDiagram-587899a1-98ef9b27.js → stateDiagram-587899a1-4f3e8cec.js} +1 -1
  276. rasa/core/channels/inspector/dist/assets/{stateDiagram-v2-d93cdb3a-cee70748.js → stateDiagram-v2-d93cdb3a-e617e5bf.js} +1 -1
  277. rasa/core/channels/inspector/dist/assets/{styles-6aaf32cf-3f9d1c96.js → styles-6aaf32cf-eab30d2f.js} +1 -1
  278. rasa/core/channels/inspector/dist/assets/{styles-9a916d00-67471923.js → styles-9a916d00-09994be2.js} +1 -1
  279. rasa/core/channels/inspector/dist/assets/{styles-c10674c1-bd093fb7.js → styles-c10674c1-b7110364.js} +1 -1
  280. rasa/core/channels/inspector/dist/assets/{svgDrawCommon-08f97a94-675794e8.js → svgDrawCommon-08f97a94-3ebc92ad.js} +1 -1
  281. rasa/core/channels/inspector/dist/assets/{timeline-definition-85554ec2-0ac67617.js → timeline-definition-85554ec2-7d13d2f2.js} +1 -1
  282. rasa/core/channels/inspector/dist/assets/{xychartDiagram-e933f94c-c018dc37.js → xychartDiagram-e933f94c-488385e1.js} +1 -1
  283. rasa/core/channels/inspector/dist/index.html +2 -2
  284. rasa/core/channels/inspector/index.html +1 -1
  285. rasa/core/channels/inspector/src/App.tsx +15 -42
  286. rasa/core/channels/inspector/src/components/Chat.tsx +2 -3
  287. rasa/core/channels/inspector/src/components/DialogueInformation.tsx +20 -3
  288. rasa/core/channels/inspector/src/components/LatencyDisplay.tsx +63 -35
  289. rasa/core/channels/inspector/src/helpers/audio/audiostream.ts +14 -0
  290. rasa/core/channels/inspector/src/types.ts +32 -7
  291. rasa/core/channels/studio_chat.py +43 -43
  292. rasa/core/channels/voice_stream/asr/asr_event.py +1 -1
  293. rasa/core/channels/voice_stream/asr/azure.py +6 -3
  294. rasa/core/channels/voice_stream/asr/deepgram.py +1 -1
  295. rasa/core/channels/voice_stream/audiocodes.py +3 -0
  296. rasa/core/channels/voice_stream/browser_audio.py +55 -3
  297. rasa/core/channels/voice_stream/genesys.py +2 -1
  298. rasa/core/channels/voice_stream/jambonz.py +9 -1
  299. rasa/core/channels/voice_stream/twilio_media_streams.py +16 -0
  300. rasa/core/channels/voice_stream/voice_channel.py +61 -0
  301. rasa/core/concurrent_lock_store.py +66 -16
  302. rasa/core/constants.py +7 -0
  303. rasa/core/iam_credentials_providers/__init__.py +0 -0
  304. rasa/core/iam_credentials_providers/aws_iam_credentials_providers.py +226 -0
  305. rasa/core/iam_credentials_providers/credentials_provider_protocol.py +90 -0
  306. rasa/core/lock_store.py +46 -10
  307. rasa/core/nlg/generator.py +1 -1
  308. rasa/core/policies/enterprise_search_policy.py +4 -7
  309. rasa/core/policies/flows/flow_executor.py +9 -2
  310. rasa/core/processor.py +32 -0
  311. rasa/core/redis_connection_factory.py +469 -0
  312. rasa/core/tracker_stores/redis_tracker_store.py +32 -14
  313. rasa/core/tracker_stores/sql_tracker_store.py +57 -1
  314. rasa/dialogue_understanding/generator/flow_retrieval.py +10 -9
  315. rasa/engine/graph.py +5 -1
  316. rasa/engine/loader.py +12 -0
  317. rasa/engine/storage/local_model_storage.py +83 -3
  318. rasa/model_manager/model_api.py +1 -2
  319. rasa/model_manager/runner_service.py +1 -1
  320. rasa/model_manager/socket_bridge.py +1 -2
  321. rasa/model_manager/trainer_service.py +12 -9
  322. rasa/model_manager/utils.py +1 -29
  323. rasa/model_manager/warm_rasa_process.py +13 -3
  324. rasa/shared/core/constants.py +1 -0
  325. rasa/shared/core/domain.py +62 -15
  326. rasa/shared/core/events.py +2 -0
  327. rasa/shared/core/flows/flow.py +1 -1
  328. rasa/shared/core/flows/flow_step.py +7 -1
  329. rasa/shared/core/flows/steps/call.py +8 -1
  330. rasa/shared/core/flows/yaml_flows_io.py +16 -8
  331. rasa/shared/core/slots.py +4 -0
  332. rasa/shared/importers/importer.py +6 -0
  333. rasa/shared/importers/utils.py +77 -1
  334. rasa/shared/nlu/training_data/schemas/responses.yml +3 -0
  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/utils/pypred.py +38 -0
  342. rasa/validator.py +19 -11
  343. rasa/version.py +1 -1
  344. {rasa_pro-3.14.0.dev20250825.dist-info → rasa_pro-3.14.0.dev20250922.dist-info}/METADATA +27 -25
  345. {rasa_pro-3.14.0.dev20250825.dist-info → rasa_pro-3.14.0.dev20250922.dist-info}/RECORD +348 -109
  346. rasa/core/channels/inspector/dist/assets/channel-59f6d54b.js +0 -1
  347. rasa/core/channels/inspector/dist/assets/clone-26177ddb.js +0 -1
  348. rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-29c03f5a.js +0 -1
  349. {rasa_pro-3.14.0.dev20250825.dist-info → rasa_pro-3.14.0.dev20250922.dist-info}/NOTICE +0 -0
  350. {rasa_pro-3.14.0.dev20250825.dist-info → rasa_pro-3.14.0.dev20250922.dist-info}/WHEEL +0 -0
  351. {rasa_pro-3.14.0.dev20250825.dist-info → rasa_pro-3.14.0.dev20250922.dist-info}/entry_points.txt +0 -0
@@ -1,9 +1,37 @@
1
- from typing import Iterable, List, Optional, Text
1
+ from typing import Any, Dict, Iterable, List, Optional, Text
2
+
3
+ from pydantic import BaseModel, Field
2
4
 
3
5
  from rasa.shared.core.domain import Domain
4
6
  from rasa.shared.core.flows import FlowsList
7
+ from rasa.shared.core.flows.yaml_flows_io import KEY_FLOWS, get_flows_as_json
5
8
  from rasa.shared.core.training_data.structures import StoryGraph
9
+ from rasa.shared.importers.importer import TrainingDataImporter
10
+ from rasa.shared.nlu.training_data.formats.rasa_yaml import RasaYAMLWriter
6
11
  from rasa.shared.nlu.training_data.training_data import TrainingData
12
+ from rasa.utils.json_utils import extract_values
13
+
14
+
15
+ class CALMUserData(BaseModel):
16
+ """All pieces that will be uploaded to Rasa Studio."""
17
+
18
+ flows: Dict[str, Any] = Field(default_factory=dict)
19
+ domain: Dict[str, Any] = Field(default_factory=dict)
20
+ config: Dict[str, Any] = Field(default_factory=dict)
21
+ endpoints: Dict[str, Any] = Field(default_factory=dict)
22
+ nlu: Dict[str, Any] = Field(default_factory=dict)
23
+
24
+
25
+ DOMAIN_KEYS = [
26
+ "version",
27
+ "actions",
28
+ "responses",
29
+ "slots",
30
+ "intents",
31
+ "entities",
32
+ "forms",
33
+ "session_config",
34
+ ]
7
35
 
8
36
 
9
37
  def training_data_from_paths(paths: Iterable[Text], language: Text) -> TrainingData:
@@ -34,3 +62,51 @@ def flows_from_paths(files: List[Text]) -> FlowsList:
34
62
  )
35
63
  flows.validate()
36
64
  return flows
65
+
66
+
67
+ def extract_calm_import_parts_from_importer(
68
+ importer: TrainingDataImporter,
69
+ config: Optional[Dict[str, Any]] = None,
70
+ endpoints: Optional[Dict[str, Any]] = None,
71
+ ) -> CALMUserData:
72
+ """Extracts CALMUserData from a TrainingDataImporter.
73
+
74
+ Args:
75
+ importer: The training data importer
76
+ data_paths: The path(s) to the training data for flows
77
+ config: Optional config dict, if not provided will use importer.get_config()
78
+ endpoints: Optional endpoints dict, defaults to empty dict
79
+
80
+ Returns:
81
+ CALMUserData containing flows, domain, config, endpoints, and nlu data
82
+ """
83
+ # Extract config
84
+ if config is None:
85
+ config = importer.get_config()
86
+
87
+ # Extract domain
88
+ domain_from_files = importer.get_user_domain().as_dict()
89
+ domain = extract_values(domain_from_files, DOMAIN_KEYS)
90
+
91
+ # Extract flows
92
+ flows = importer.get_user_flows()
93
+ flows_dict = {KEY_FLOWS: get_flows_as_json(flows)}
94
+
95
+ # Extract NLU data
96
+ nlu_data = importer.get_nlu_data()
97
+ nlu_examples = nlu_data.filter_training_examples(
98
+ lambda ex: ex.get("intent") in nlu_data.intents
99
+ )
100
+ nlu_dict = RasaYAMLWriter().training_data_to_dict(nlu_examples)
101
+
102
+ # Use provided endpoints or default to empty dict
103
+ if endpoints is None:
104
+ endpoints = {}
105
+
106
+ return CALMUserData(
107
+ flows=flows_dict or {},
108
+ domain=domain or {},
109
+ config=config or {},
110
+ endpoints=endpoints or {},
111
+ nlu=nlu_dict or {},
112
+ )
@@ -72,6 +72,9 @@ schema;responses:
72
72
  allowempty: True
73
73
  channel:
74
74
  type: "str"
75
+ allow_interruptions:
76
+ type: "bool"
77
+ required: False
75
78
  metadata:
76
79
  type: "any"
77
80
  condition:
rasa/studio/upload.py CHANGED
@@ -7,7 +7,6 @@ from typing import Any, Dict, Iterable, List, Optional, Set, Text, Tuple, Union
7
7
  import questionary
8
8
  import requests
9
9
  import structlog
10
- from pydantic import BaseModel, Field
11
10
 
12
11
  import rasa.cli.telemetry
13
12
  import rasa.cli.utils
@@ -24,9 +23,13 @@ from rasa.shared.constants import (
24
23
  DEFAULT_DOMAIN_PATHS,
25
24
  )
26
25
  from rasa.shared.core.domain import Domain
27
- from rasa.shared.core.flows.yaml_flows_io import YAMLFlowsReader, YamlFlowsWriter
26
+ from rasa.shared.core.flows.yaml_flows_io import YAMLFlowsReader
28
27
  from rasa.shared.exceptions import RasaException
29
- from rasa.shared.importers.importer import FlowSyncImporter, TrainingDataImporter
28
+ from rasa.shared.importers.importer import TrainingDataImporter
29
+ from rasa.shared.importers.utils import (
30
+ CALMUserData,
31
+ extract_calm_import_parts_from_importer,
32
+ )
30
33
  from rasa.shared.nlu.training_data.formats.rasa_yaml import (
31
34
  RasaYAMLReader,
32
35
  RasaYAMLWriter,
@@ -34,7 +37,6 @@ from rasa.shared.nlu.training_data.formats.rasa_yaml import (
34
37
  from rasa.shared.utils.llm import collect_custom_prompts
35
38
  from rasa.shared.utils.yaml import (
36
39
  dump_obj_as_yaml_to_string,
37
- read_yaml,
38
40
  read_yaml_file,
39
41
  )
40
42
  from rasa.studio import results_logger
@@ -43,6 +45,7 @@ from rasa.studio.config import StudioConfig
43
45
  from rasa.studio.results_logger import StudioResult, with_studio_error_handler
44
46
  from rasa.studio.utils import validate_argument_paths
45
47
  from rasa.telemetry import track_upload_to_studio_failed
48
+ from rasa.utils.json_utils import extract_values
46
49
 
47
50
  structlogger = structlog.get_logger()
48
51
 
@@ -68,16 +71,6 @@ DOMAIN_KEYS = [
68
71
  ]
69
72
 
70
73
 
71
- class CALMImportParts(BaseModel):
72
- """All pieces that will be uploaded to Rasa Studio."""
73
-
74
- flows: Dict[str, Any]
75
- domain: Dict[str, Any]
76
- config: Dict[str, Any]
77
- endpoints: Dict[str, Any]
78
- nlu: Dict[str, Any] = Field(default_factory=dict)
79
-
80
-
81
74
  def _get_selected_entities_and_intents(
82
75
  args: argparse.Namespace,
83
76
  intents_from_files: Set[Text],
@@ -195,11 +188,6 @@ config_keys = [
195
188
  ]
196
189
 
197
190
 
198
- def extract_values(data: Dict, keys: List[Text]) -> Dict:
199
- """Extracts values for given keys from a dictionary."""
200
- return {key: data.get(key) for key in keys if data.get(key)}
201
-
202
-
203
191
  def _get_assistant_name(config: Dict[Text, Any]) -> str:
204
192
  config_assistant_id = config.get("assistant_id", "")
205
193
  assistant_name = questionary.text(
@@ -238,7 +226,7 @@ def build_calm_import_parts(
238
226
  config_path: Text,
239
227
  endpoints_path: Optional[Text] = None,
240
228
  assistant_name: Optional[Text] = None,
241
- ) -> Tuple[str, CALMImportParts]:
229
+ ) -> Tuple[str, CALMUserData]:
242
230
  """Builds the parts of the assistant to be uploaded to Studio.
243
231
 
244
232
  Args:
@@ -251,9 +239,11 @@ def build_calm_import_parts(
251
239
  Returns:
252
240
  The assistant name and the parts to be uploaded
253
241
  """
242
+ training_data_paths = data_path if isinstance(data_path, list) else [str(data_path)]
254
243
  importer = TrainingDataImporter.load_from_dict(
255
244
  domain_path=domain_path,
256
245
  config_path=config_path,
246
+ training_data_paths=training_data_paths,
257
247
  expand_env_vars=False,
258
248
  )
259
249
 
@@ -261,34 +251,10 @@ def build_calm_import_parts(
261
251
  endpoints = read_yaml_file(endpoints_path, expand_env_vars=False)
262
252
  assistant_name = assistant_name or _get_assistant_name(config)
263
253
 
264
- domain_from_files = importer.get_user_domain().as_dict()
265
- domain = extract_values(domain_from_files, DOMAIN_KEYS)
266
-
267
- training_data_paths = data_path if isinstance(data_path, list) else [str(data_path)]
268
- flow_importer = FlowSyncImporter.load_from_dict(
269
- training_data_paths=training_data_paths, expand_env_vars=False
270
- )
271
-
272
- flows = list(flow_importer.get_user_flows())
273
- flows_yaml = YamlFlowsWriter().dumps(flows)
274
- flows = read_yaml(flows_yaml, expand_env_vars=False)
275
-
276
- nlu_importer = TrainingDataImporter.load_from_dict(
277
- training_data_paths=training_data_paths, expand_env_vars=False
278
- )
279
- nlu_data = nlu_importer.get_nlu_data()
280
- nlu_examples = nlu_data.filter_training_examples(
281
- lambda ex: ex.get("intent") in nlu_data.intents
282
- )
283
- nlu_examples_yaml = RasaYAMLWriter().dumps(nlu_examples)
284
- nlu = read_yaml(nlu_examples_yaml, expand_env_vars=False)
285
-
286
- parts = CALMImportParts(
287
- flows=flows,
288
- domain=domain,
254
+ parts = extract_calm_import_parts_from_importer(
255
+ importer=importer,
289
256
  config=config,
290
257
  endpoints=endpoints,
291
- nlu=nlu,
292
258
  )
293
259
 
294
260
  return assistant_name, parts
rasa/telemetry.py CHANGED
@@ -3,7 +3,6 @@ import contextlib
3
3
  import hashlib
4
4
  import inspect
5
5
  import json
6
- import logging
7
6
  import multiprocessing
8
7
  import os
9
8
  import platform
@@ -70,7 +69,7 @@ if typing.TYPE_CHECKING:
70
69
  from rasa.shared.importers.importer import TrainingDataImporter
71
70
  from rasa.shared.nlu.training_data.training_data import TrainingData
72
71
 
73
- logger = logging.getLogger(__name__)
72
+ structlogger = structlog.get_logger()
74
73
 
75
74
  SEGMENT_TRACK_ENDPOINT = "https://api.segment.io/v1/track"
76
75
  SEGMENT_IDENTIFY_ENDPOINT = "https://api.segment.io/v1/identify"
@@ -197,6 +196,10 @@ TELEMETRY_E2E_TEST_CONVERSION_EVENT = "E2E Test Conversion Completed"
197
196
  E2E_TEST_CONVERSION_FILE_TYPE = "file_type"
198
197
  E2E_TEST_CONVERSION_TEST_CASE_COUNT = "test_case_count"
199
198
 
199
+ # Copilot telemetry
200
+ TELEMETRY_COPILOT_USER_MESSAGE_EVENT = "copilot_user_message"
201
+ TELEMETRY_COPILOT_BOT_MESSAGE_EVENT = "copilot_bot_message"
202
+
200
203
 
201
204
  def print_telemetry_reporting_info() -> None:
202
205
  """Print telemetry information to std out."""
@@ -255,7 +258,11 @@ def _is_telemetry_enabled_in_configuration() -> bool:
255
258
 
256
259
  return stored_config[CONFIG_TELEMETRY_ENABLED]
257
260
  except ValueError as e:
258
- logger.debug(f"Could not read telemetry settings from configuration file: {e}")
261
+ structlogger.debug(
262
+ "telemetry.is_telemetry_enabled_in_configuration.error",
263
+ error=str(e),
264
+ event_info="Could not read telemetry settings from configuration file",
265
+ )
259
266
 
260
267
  # seems like there is no config, we'll create one and enable telemetry
261
268
  success = _write_default_telemetry_configuration()
@@ -272,7 +279,10 @@ def is_telemetry_enabled() -> bool:
272
279
  from rasa.utils import licensing
273
280
 
274
281
  if licensing.is_champion_server_license():
275
- logger.debug("Telemetry is enabled for developer licenses.")
282
+ structlogger.debug(
283
+ "telemetry.enabled.developer_license",
284
+ event_info="Telemetry is enabled for developer licenses.",
285
+ )
276
286
  return True
277
287
 
278
288
  telemetry_environ = os.environ.get(TELEMETRY_ENABLED_ENVIRONMENT_VARIABLE)
@@ -308,9 +318,13 @@ def initialize_telemetry() -> bool:
308
318
 
309
319
  return telemetry_environ.lower() == "true"
310
320
  except Exception as e: # skipcq:PYL-W0703
311
- logger.exception(
312
- f"Failed to initialize telemetry reporting: {e}."
313
- f"Telemetry reporting will be disabled."
321
+ structlogger.exception(
322
+ "telemetry.initialize_telemetry.error",
323
+ error=str(e),
324
+ event_info=(
325
+ "Failed to initialize telemetry reporting. "
326
+ "Telemetry reporting will be disabled."
327
+ ),
314
328
  )
315
329
  return False
316
330
 
@@ -481,7 +495,10 @@ def print_telemetry_payload(payload: Dict[Text, Any]) -> None:
481
495
  payload: payload to be delivered to segment.
482
496
  """
483
497
  payload_json = json.dumps(payload, indent=2)
484
- logger.debug(f"Telemetry payload: {payload_json}")
498
+ structlogger.debug(
499
+ "telemetry.print_telemetry_payload.debug",
500
+ event_info=f"Telemetry payload: {payload_json}",
501
+ )
485
502
 
486
503
 
487
504
  def _get_telemetry_write_key() -> Optional[Text]:
@@ -535,10 +552,24 @@ def _send_request(url: Text, payload: Dict[Text, Any]) -> None:
535
552
  if not write_key:
536
553
  # If RASA_TELEMETRY_WRITE_KEY is empty or `None`, telemetry has not
537
554
  # been enabled for this build (e.g. because it is running from source)
538
- logger.debug("Skipping request to external service: telemetry key not set.")
555
+ structlogger.debug(
556
+ "telemetry.send_request.no_telemetry_key",
557
+ event_info="Skipping request to external service: telemetry key not set.",
558
+ )
539
559
  return
540
560
 
541
- headers = rasa.telemetry.segment_request_header(write_key)
561
+ send_segment_request(url, payload, write_key)
562
+
563
+
564
+ def send_segment_request(url: Text, payload: Dict[Text, Any], write_key: Text) -> None:
565
+ """Send a request to the Segment API.
566
+
567
+ Args:
568
+ url: URL of the Segment API endpoint
569
+ payload: payload to send to the Segment API
570
+ write_key: write key for the Segment API
571
+ """
572
+ headers = segment_request_header(write_key)
542
573
 
543
574
  resp = requests.post(
544
575
  url=url,
@@ -548,15 +579,22 @@ def _send_request(url: Text, payload: Dict[Text, Any]) -> None:
548
579
  )
549
580
  # handle different failure cases
550
581
  if resp.status_code != 200:
551
- logger.debug(
552
- f"Segment telemetry request returned a {resp.status_code} response. "
553
- f"Body: {resp.text}"
582
+ structlogger.debug(
583
+ "telemetry.send_segment_request.error_response",
584
+ event_info=(
585
+ f"Segment telemetry request returned a {resp.status_code} "
586
+ f"response. Body: {resp.text}"
587
+ ),
554
588
  )
555
589
  else:
556
590
  data = resp.json()
557
591
  if not data.get("success"):
558
- logger.debug(
559
- f"Segment telemetry request returned a failure. Response: {data}"
592
+ structlogger.debug(
593
+ "telemetry.send_segment_request.failure",
594
+ event_info=(
595
+ f"Segment telemetry request returned a failure. "
596
+ f"Response: {data}"
597
+ ),
560
598
  )
561
599
 
562
600
 
@@ -609,6 +647,15 @@ def with_default_context_fields(
609
647
  return {**_default_context_fields(), **context}
610
648
 
611
649
 
650
+ def get_deployment_stack() -> Text:
651
+ """Return the deployment stack.
652
+
653
+ Returns:
654
+ The deployment stack.
655
+ """
656
+ return os.environ.get("DEPLOYMENT_STACK", "")
657
+
658
+
612
659
  def _default_context_fields() -> Dict[Text, Any]:
613
660
  """Return a dictionary that contains the default context values.
614
661
 
@@ -632,6 +679,7 @@ def _default_context_fields() -> Dict[Text, Any]:
632
679
  "cpu": multiprocessing.cpu_count(),
633
680
  "docker": _is_docker(),
634
681
  "license_hash": get_license_hash(),
682
+ "deployment_stack": get_deployment_stack(),
635
683
  "company": property_of_active_license(
636
684
  lambda active_license: active_license.company
637
685
  ),
@@ -663,7 +711,10 @@ def _track(
663
711
  telemetry_id = get_telemetry_id()
664
712
 
665
713
  if not telemetry_id:
666
- logger.debug("Will not report telemetry events as no ID was found.")
714
+ structlogger.debug(
715
+ "telemetry.track.no_id_found",
716
+ event_info="Will not report telemetry events as no ID was found.",
717
+ )
667
718
  return
668
719
 
669
720
  if not properties:
@@ -681,7 +732,11 @@ def _track(
681
732
  with_default_context_fields(context),
682
733
  )
683
734
  except Exception as e: # skipcq:PYL-W0703
684
- logger.debug(f"Skipping telemetry reporting: {e}")
735
+ structlogger.debug(
736
+ "telemetry.track.error",
737
+ error=str(e),
738
+ event_info="Skipping telemetry reporting",
739
+ )
685
740
 
686
741
 
687
742
  def _identify(
@@ -702,7 +757,10 @@ def _identify(
702
757
  telemetry_id = get_telemetry_id()
703
758
 
704
759
  if not telemetry_id:
705
- logger.debug("Will not report telemetry events as no ID was found.")
760
+ structlogger.debug(
761
+ "telemetry.identify.no_id_found",
762
+ event_info="Will not report telemetry events as no ID was found.",
763
+ )
706
764
  return
707
765
 
708
766
  if not traits:
@@ -710,7 +768,11 @@ def _identify(
710
768
 
711
769
  _send_traits(telemetry_id, traits, with_default_context_fields(context))
712
770
  except Exception as e:
713
- logger.debug(f"Skipping telemetry reporting: {e}")
771
+ structlogger.debug(
772
+ "telemetry.identify.error",
773
+ error=str(e),
774
+ event_info="Skipping telemetry reporting",
775
+ )
714
776
 
715
777
 
716
778
  def _send_traits(
@@ -868,13 +930,16 @@ def strip_sensitive_data_from_sentry_event(
868
930
 
869
931
 
870
932
  @ensure_telemetry_enabled
871
- def initialize_error_reporting() -> None:
933
+ def initialize_error_reporting(private_mode: bool = True) -> None:
872
934
  """Sets up automated error reporting.
873
935
 
874
936
  Exceptions are reported to sentry. We avoid sending any metadata (local
875
937
  variables, paths, ...) to make sure we don't compromise any data. Only the
876
938
  exception and its stacktrace is logged and only if the exception origins
877
939
  from the `rasa` package.
940
+
941
+ Args:
942
+ private_mode: If True, try to send as little data as possible.
878
943
  """
879
944
  import sentry_sdk
880
945
  from sentry_sdk import configure_scope
@@ -892,11 +957,18 @@ def initialize_error_reporting() -> None:
892
957
 
893
958
  telemetry_id = get_telemetry_id()
894
959
 
960
+ # in hello rasa we use a different project, so we need to be able
961
+ # to set the whole url. since we can't change the behavior of sentry in pro
962
+ # we have two kinds of keys, full urls and jsut the key within the fixed rasa
963
+ # pro project.
964
+ if not key.startswith("https://"):
965
+ key = f"https://{key}.ingest.sentry.io/2801673"
966
+
895
967
  # this is a very defensive configuration, avoiding as many integrations as
896
968
  # possible. it also submits very little data (exception with error message
897
969
  # and line numbers).
898
970
  sentry_sdk.init(
899
- f"https://{key}.ingest.sentry.io/2801673",
971
+ key,
900
972
  before_send=before_send,
901
973
  integrations=[
902
974
  ExcepthookIntegration(),
@@ -916,7 +988,7 @@ def initialize_error_reporting() -> None:
916
988
  OSError,
917
989
  ],
918
990
  in_app_include=["rasa"], # only submit errors in this package
919
- include_local_variables=False, # don't submit local variables
991
+ include_local_variables=not private_mode,
920
992
  release=f"rasa-{rasa.__version__}",
921
993
  default_integrations=False,
922
994
  environment="development" if in_continuous_integration() else "production",
@@ -937,6 +1009,7 @@ def initialize_error_reporting() -> None:
937
1009
  # os is a nested dict, hence we report it separately
938
1010
  scope.set_context("Operating System", default_context.pop("os"))
939
1011
  scope.set_context("Environment", default_context)
1012
+ structlogger.debug("telemetry.sentry.initialized")
940
1013
 
941
1014
 
942
1015
  @contextlib.contextmanager
@@ -1426,6 +1499,7 @@ def track_shell_started(model_type: Text, assistant_id: Text) -> None:
1426
1499
 
1427
1500
  Args:
1428
1501
  model_type: Type of the model, core / nlu or rasa.
1502
+ assistant_id: ID of the assistant being inspected.
1429
1503
  """
1430
1504
  _track(
1431
1505
  TELEMETRY_SHELL_STARTED_EVENT,
@@ -1997,7 +2071,7 @@ def _extract_stream_pii(event_broker: Optional["EventBroker"]) -> bool:
1997
2071
  def track_privacy_enabled(
1998
2072
  privacy_config: "PrivacyConfig", event_broker: Optional["EventBroker"]
1999
2073
  ) -> None:
2000
- """Track when PII management capability is enabled"""
2074
+ """Track when PII management capability is enabled."""
2001
2075
  stream_pii = _extract_stream_pii(event_broker)
2002
2076
  privacy_properties = _extract_privacy_enabled_event_properties(
2003
2077
  privacy_config, stream_pii
rasa/utils/io.py CHANGED
@@ -26,6 +26,7 @@ from typing_extensions import Protocol
26
26
 
27
27
  import rasa.shared.constants
28
28
  import rasa.shared.utils.io
29
+ from rasa.shared.exceptions import RasaException
29
30
 
30
31
  if TYPE_CHECKING:
31
32
  from prompt_toolkit.validation import Validator
@@ -124,9 +125,7 @@ def create_path(file_path: Text) -> None:
124
125
  def file_type_validator(
125
126
  valid_file_types: List[Text], error_message: Text
126
127
  ) -> Type["Validator"]:
127
- """Creates a `Validator` class which can be used with `questionary` to validate
128
- file paths.
129
- """
128
+ """Creates a file type validator class for the questionary package."""
130
129
 
131
130
  def is_valid(path: Text) -> bool:
132
131
  return path is not None and any(
@@ -137,9 +136,7 @@ def file_type_validator(
137
136
 
138
137
 
139
138
  def not_empty_validator(error_message: Text) -> Type["Validator"]:
140
- """Creates a `Validator` class which can be used with `questionary` to validate
141
- that the user entered something other than whitespace.
142
- """
139
+ """Creates a not empty validator class for the questionary package."""
143
140
 
144
141
  def is_valid(input: Text) -> bool:
145
142
  return input is not None and input.strip() != ""
@@ -150,9 +147,7 @@ def not_empty_validator(error_message: Text) -> Type["Validator"]:
150
147
  def create_validator(
151
148
  function: Callable[[Text], bool], error_message: Text
152
149
  ) -> Type["Validator"]:
153
- """Helper method to create `Validator` classes from callable functions. Should be
154
- removed when questionary supports `Validator` objects.
155
- """
150
+ """Helper method to create a validator class from a callable function."""
156
151
  from prompt_toolkit.document import Document
157
152
  from prompt_toolkit.validation import ValidationError, Validator
158
153
 
@@ -250,3 +245,26 @@ def write_yaml(
250
245
 
251
246
  with Path(target).open("w", encoding="utf-8") as outfile:
252
247
  dumper.dump(data, outfile, transform=transform)
248
+
249
+
250
+ class InvalidPathException(RasaException):
251
+ """Raised if a path is invalid - e.g. path traversal is detected."""
252
+
253
+
254
+ def subpath(parent: str, child: str) -> str:
255
+ """Return the path to the child directory of the parent directory.
256
+
257
+ Ensures, that child doesn't navigate to parent directories. Prevents
258
+ path traversal. Raises an InvalidPathException if the path is invalid.
259
+
260
+ Based on Snyk's directory traversal mitigation:
261
+ https://learn.snyk.io/lesson/directory-traversal/
262
+ """
263
+ safe_path = os.path.abspath(os.path.join(parent, child))
264
+ parent = os.path.abspath(parent)
265
+
266
+ common_base = os.path.commonpath([parent, safe_path])
267
+ if common_base != parent:
268
+ raise InvalidPathException(f"Invalid path: {safe_path}")
269
+
270
+ return safe_path
rasa/utils/json_utils.py CHANGED
@@ -1,6 +1,6 @@
1
1
  import json
2
2
  from decimal import Decimal
3
- from typing import Any, Text
3
+ from typing import Any, Dict, List, Text
4
4
 
5
5
 
6
6
  class DecimalEncoder(json.JSONEncoder):
@@ -58,3 +58,8 @@ def replace_decimals_with_floats(obj: Any) -> Any:
58
58
  Input `obj` with all `Decimal` types replaced by `float`s.
59
59
  """
60
60
  return json.loads(json.dumps(obj, cls=DecimalEncoder))
61
+
62
+
63
+ def extract_values(data: Dict, keys: List[Text]) -> Dict:
64
+ """Extracts values for given keys from a dictionary."""
65
+ return {key: data.get(key) for key in keys if data.get(key)}
rasa/utils/log_utils.py CHANGED
@@ -3,7 +3,7 @@ from __future__ import annotations
3
3
  import logging
4
4
  import os
5
5
  import sys
6
- from typing import Any, Optional
6
+ from typing import Any, List, Optional
7
7
 
8
8
  import structlog
9
9
  from structlog.dev import ConsoleRenderer
@@ -37,6 +37,7 @@ class HumanConsoleRenderer(ConsoleRenderer):
37
37
  def configure_structlog(
38
38
  log_level: Optional[int] = None,
39
39
  include_time: bool = False,
40
+ additional_processors: Optional[List[structlog.typing.Processor]] = None,
40
41
  ) -> None:
41
42
  """Configure logging of the server."""
42
43
  if log_level is None: # Log level NOTSET is 0 so we use `is None` here
@@ -75,6 +76,9 @@ def configure_structlog(
75
76
  if include_time:
76
77
  shared_processors.append(structlog.processors.TimeStamper(fmt="iso"))
77
78
 
79
+ if additional_processors:
80
+ shared_processors.extend(additional_processors)
81
+
78
82
  if not FORCE_JSON_LOGGING and sys.stderr.isatty():
79
83
  # Pretty printing when we run in a terminal session.
80
84
  # Automatically prints pretty tracebacks when "rich" is installed