rasa-pro 3.14.0a15__py3-none-any.whl → 3.14.0a17__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 (331) hide show
  1. rasa/builder/config.py +1 -0
  2. rasa/builder/copilot/constants.py +3 -0
  3. rasa/builder/copilot/copilot.py +127 -31
  4. rasa/builder/copilot/models.py +34 -0
  5. rasa/builder/copilot/prompts/copilot_system_prompt.jinja2 +183 -188
  6. rasa/builder/copilot/prompts/latest_user_message_context_prompt.jinja2 +61 -0
  7. rasa/builder/copilot/telemetry.py +46 -20
  8. rasa/builder/document_retrieval/models.py +3 -3
  9. rasa/builder/jobs.py +15 -5
  10. rasa/builder/main.py +14 -5
  11. rasa/builder/models.py +7 -7
  12. rasa/builder/project_generator.py +128 -23
  13. rasa/builder/service.py +42 -27
  14. rasa/builder/template_cache.py +183 -9
  15. rasa/cli/project_templates/basic/README.md +23 -0
  16. rasa/cli/project_templates/basic/actions/actions.md +10 -0
  17. rasa/cli/project_templates/basic/config.yml +4 -4
  18. rasa/cli/project_templates/basic/data/data.md +5 -6
  19. rasa/cli/project_templates/basic/domain/domain.md +7 -5
  20. rasa/cli/project_templates/basic/domain/general/show_faqs.yml +1 -1
  21. rasa/cli/project_templates/basic/endpoints.yml +1 -1
  22. rasa/cli/project_templates/finance/README.md +26 -0
  23. rasa/cli/project_templates/finance/actions/__init__.py +0 -46
  24. rasa/cli/project_templates/finance/actions/accounts/check_balance.py +18 -0
  25. rasa/cli/project_templates/finance/actions/actions.md +15 -0
  26. rasa/cli/project_templates/finance/actions/{transfers/action_process_immediate_payment.py → cards/check_that_card_exists.py} +6 -3
  27. rasa/cli/project_templates/finance/actions/cards/list_cards.py +22 -0
  28. rasa/cli/project_templates/finance/actions/contacts/__init__.py +0 -0
  29. rasa/cli/project_templates/finance/actions/contacts/add_contact.py +30 -0
  30. rasa/cli/project_templates/finance/actions/contacts/list_contacts.py +22 -0
  31. rasa/cli/project_templates/finance/actions/contacts/remove_contact.py +35 -0
  32. rasa/cli/project_templates/finance/actions/db.py +117 -0
  33. rasa/cli/project_templates/finance/actions/transfers/check_transfer_funds.py +27 -0
  34. rasa/cli/project_templates/finance/actions/transfers/check_transfer_limit.py +36 -0
  35. rasa/cli/project_templates/finance/actions/transfers/execute_recurrent_payment.py +20 -0
  36. rasa/cli/project_templates/finance/actions/transfers/execute_transfer.py +45 -0
  37. rasa/cli/project_templates/finance/actions/transfers/list_transactions.py +32 -0
  38. rasa/cli/project_templates/finance/config.yml +6 -0
  39. rasa/cli/project_templates/finance/credentials.yml +7 -6
  40. rasa/cli/project_templates/finance/data/accounts/check_balance.yml +3 -4
  41. rasa/cli/project_templates/finance/data/accounts/download_statements.yml +26 -0
  42. rasa/cli/project_templates/finance/data/bills/bill_pay_reminder.yml +25 -0
  43. rasa/cli/project_templates/finance/data/cards/activate_card.yml +35 -0
  44. rasa/cli/project_templates/finance/data/cards/block_card.yml +37 -58
  45. rasa/cli/project_templates/finance/data/cards/list_cards.yml +14 -0
  46. rasa/cli/project_templates/finance/data/cards/replace_card.yml +16 -0
  47. rasa/cli/project_templates/finance/data/cards/replace_eligible_card.yml +29 -0
  48. rasa/cli/project_templates/finance/data/contacts/add_contact.yml +33 -0
  49. rasa/cli/project_templates/finance/data/contacts/list_contacts.yml +14 -0
  50. rasa/cli/project_templates/finance/data/contacts/remove_contact.yml +31 -0
  51. rasa/cli/project_templates/finance/data/data.md +14 -0
  52. rasa/cli/project_templates/finance/data/general/agent_details.yml +6 -0
  53. rasa/cli/project_templates/finance/data/general/hello.yml +1 -2
  54. rasa/cli/project_templates/finance/data/general/help.yml +2 -2
  55. rasa/cli/project_templates/finance/data/general/human_handoff.yml +1 -1
  56. rasa/cli/project_templates/finance/data/transfers/check_transfer_limit.yml +18 -0
  57. rasa/cli/project_templates/finance/data/transfers/list_transactions.yml +46 -0
  58. rasa/cli/project_templates/finance/data/transfers/move_money_between_accounts.yml +51 -0
  59. rasa/cli/project_templates/finance/data/transfers/transfer_money.yml +29 -62
  60. rasa/cli/project_templates/finance/data/transfers/transfer_money_to_a_third_party.yml +175 -0
  61. rasa/cli/project_templates/finance/db/cards.json +18 -0
  62. rasa/cli/project_templates/finance/db/contacts.json +10 -0
  63. rasa/cli/project_templates/finance/db/my_account.json +6 -0
  64. rasa/cli/project_templates/finance/db/transactions.json +22 -0
  65. rasa/cli/project_templates/finance/docs/docs.md +8 -0
  66. rasa/cli/project_templates/finance/docs/fenlo_banking_faq/account_features/budgeting_analytics.txt +22 -0
  67. rasa/cli/project_templates/finance/docs/fenlo_banking_faq/account_features/multi_currency_accounts.txt +19 -0
  68. rasa/cli/project_templates/finance/docs/fenlo_banking_faq/account_features/premium_benefits.txt +19 -0
  69. rasa/cli/project_templates/finance/docs/fenlo_banking_faq/card_management/contactless_limits.txt +16 -0
  70. rasa/cli/project_templates/finance/docs/fenlo_banking_faq/card_management/freeze_unfreeze_card.txt +16 -0
  71. rasa/cli/project_templates/finance/docs/fenlo_banking_faq/card_management/lost_stolen_card.txt +19 -0
  72. rasa/cli/project_templates/finance/docs/fenlo_banking_faq/money_transfers/instant_payments.txt +19 -0
  73. rasa/cli/project_templates/finance/docs/fenlo_banking_faq/money_transfers/international_transfers.txt +19 -0
  74. rasa/cli/project_templates/finance/docs/fenlo_banking_faq/security_fraud/fraud_protection.txt +22 -0
  75. rasa/cli/project_templates/finance/docs/fenlo_banking_faq/security_fraud/secure_payments.txt +22 -0
  76. rasa/cli/project_templates/finance/domain/_system/patterns/pattern_session_start.yml +11 -0
  77. rasa/cli/project_templates/finance/domain/accounts/check_balance.yml +9 -5
  78. rasa/cli/project_templates/finance/domain/accounts/download_statements.yml +40 -0
  79. rasa/cli/project_templates/finance/domain/bills/bill_pay_reminder.yml +49 -0
  80. rasa/cli/project_templates/finance/domain/cards/activate_card.yml +24 -0
  81. rasa/cli/project_templates/finance/domain/cards/block_card.yml +33 -90
  82. rasa/cli/project_templates/finance/domain/cards/list_cards.yml +16 -0
  83. rasa/cli/project_templates/finance/domain/cards/replace_card.yml +43 -0
  84. rasa/cli/project_templates/finance/domain/cards/shared.yml +15 -0
  85. rasa/cli/project_templates/finance/domain/contacts/add_contact.yml +37 -0
  86. rasa/cli/project_templates/finance/domain/contacts/list_contacts.yml +16 -0
  87. rasa/cli/project_templates/finance/domain/contacts/remove_contact.yml +32 -0
  88. rasa/cli/project_templates/finance/domain/domain.md +18 -0
  89. rasa/cli/project_templates/finance/domain/general/_shared.yml +53 -0
  90. rasa/cli/project_templates/finance/domain/general/agent_details.yml +31 -0
  91. rasa/cli/project_templates/finance/domain/general/cannot_handle.yml +5 -2
  92. rasa/cli/project_templates/finance/domain/general/feedback.yml +0 -3
  93. rasa/cli/project_templates/finance/domain/general/human_handoff.yml +7 -3
  94. rasa/cli/project_templates/finance/domain/general/welcome.yml +5 -2
  95. rasa/cli/project_templates/finance/domain/transfers/check_transfer_limit.yml +32 -0
  96. rasa/cli/project_templates/finance/domain/transfers/list_transactions.yml +44 -0
  97. rasa/cli/project_templates/finance/domain/transfers/shared.yml +17 -0
  98. rasa/cli/project_templates/finance/domain/transfers/transfer_money.yml +203 -61
  99. rasa/cli/project_templates/finance/endpoints.yml +4 -3
  100. rasa/cli/project_templates/finance/prompts/rephraser_demo_personality_prompt.jinja2 +31 -12
  101. rasa/cli/project_templates/telco/README.md +25 -0
  102. rasa/cli/project_templates/telco/actions/actions.md +12 -0
  103. rasa/cli/project_templates/telco/config.yml +4 -4
  104. rasa/cli/project_templates/telco/data/data.md +11 -0
  105. rasa/cli/project_templates/telco/data/general/human_handoff.yml +1 -1
  106. rasa/cli/project_templates/telco/docs/docs.md +3 -0
  107. rasa/cli/project_templates/telco/domain/domain.md +13 -0
  108. rasa/cli/project_templates/telco/domain/general/human_handoff.yml +3 -6
  109. rasa/cli/project_templates/telco/endpoints.yml +1 -1
  110. rasa/cli/project_templates/telco/prompts/rephraser_demo_personality_prompt.jinja2 +1 -1
  111. rasa/cli/project_templates/telco/tests/e2e_test_cases/billing/understand_bill.yml +67 -0
  112. rasa/cli/project_templates/telco/tests/e2e_test_cases/general/bot_challenge.yml +8 -0
  113. rasa/cli/project_templates/telco/tests/e2e_test_cases/general/feedback.yml +46 -0
  114. rasa/cli/project_templates/telco/tests/e2e_test_cases/general/goodbye.yml +9 -0
  115. rasa/cli/project_templates/telco/tests/e2e_test_cases/general/hello.yml +8 -0
  116. rasa/cli/project_templates/telco/tests/e2e_test_cases/general/human_handoff.yml +35 -0
  117. rasa/cli/project_templates/telco/tests/e2e_test_cases/general/patterns.yml +23 -0
  118. rasa/cli/project_templates/telco/tests/e2e_test_cases/network/solve_internet_issue.yml +57 -0
  119. rasa/core/brokers/broker.py +1 -1
  120. rasa/core/brokers/kafka.py +52 -8
  121. rasa/core/channels/development_inspector.py +1 -21
  122. rasa/core/channels/hangouts.py +2 -2
  123. rasa/core/channels/inspector/dist/assets/{arc-c24d8d79.js → arc-35222594.js} +1 -1
  124. rasa/core/channels/inspector/dist/assets/{blockDiagram-38ab4fdb-1b6b9f26.js → blockDiagram-38ab4fdb-a0efbfd3.js} +1 -1
  125. rasa/core/channels/inspector/dist/assets/{c4Diagram-3d4e48cf-da91d0f9.js → c4Diagram-3d4e48cf-0584c0f2.js} +1 -1
  126. rasa/core/channels/inspector/dist/assets/channel-8e08bed9.js +1 -0
  127. rasa/core/channels/inspector/dist/assets/{classDiagram-70f12bd4-6067f302.js → classDiagram-70f12bd4-39f40dbe.js} +1 -1
  128. rasa/core/channels/inspector/dist/assets/{classDiagram-v2-f2320105-705d024a.js → classDiagram-v2-f2320105-1ad755f3.js} +1 -1
  129. rasa/core/channels/inspector/dist/assets/clone-78c82dea.js +1 -0
  130. rasa/core/channels/inspector/dist/assets/{createText-2e5e7dd3-3751dffe.js → createText-2e5e7dd3-b0f4f0fe.js} +1 -1
  131. rasa/core/channels/inspector/dist/assets/{edges-e0da2a9e-7b25b4af.js → edges-e0da2a9e-9039bff9.js} +1 -1
  132. rasa/core/channels/inspector/dist/assets/{erDiagram-9861fffd-eb7deea8.js → erDiagram-9861fffd-65c9b127.js} +1 -1
  133. rasa/core/channels/inspector/dist/assets/{flowDb-956e92f1-67235ff6.js → flowDb-956e92f1-4f08b38e.js} +1 -1
  134. rasa/core/channels/inspector/dist/assets/{flowDiagram-66a62f08-34c3a16a.js → flowDiagram-66a62f08-e95c362a.js} +1 -1
  135. rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-2b08f601.js +1 -0
  136. rasa/core/channels/inspector/dist/assets/{flowchart-elk-definition-4a651766-f1a93631.js → flowchart-elk-definition-4a651766-703c3015.js} +1 -1
  137. rasa/core/channels/inspector/dist/assets/{ganttDiagram-c361ad54-a68cbad1.js → ganttDiagram-c361ad54-699328ea.js} +1 -1
  138. rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-72cf32ee-0b1e4a1d.js → gitGraphDiagram-72cf32ee-04cf4b05.js} +1 -1
  139. rasa/core/channels/inspector/dist/assets/{graph-f3c1d212.js → graph-ee94449e.js} +1 -1
  140. rasa/core/channels/inspector/dist/assets/{index-3862675e-34cbca30.js → index-3862675e-940162b4.js} +1 -1
  141. rasa/core/channels/inspector/dist/assets/{index-051c5a6e.js → index-c941dcb3.js} +41 -40
  142. rasa/core/channels/inspector/dist/assets/{infoDiagram-f8f76790-e69960a1.js → infoDiagram-f8f76790-c79c2866.js} +1 -1
  143. rasa/core/channels/inspector/dist/assets/{journeyDiagram-49397b02-8dd3296a.js → journeyDiagram-49397b02-84489d30.js} +1 -1
  144. rasa/core/channels/inspector/dist/assets/{layout-e93126bc.js → layout-a9aa9858.js} +1 -1
  145. rasa/core/channels/inspector/dist/assets/{line-15eb1e26.js → line-eb73cf26.js} +1 -1
  146. rasa/core/channels/inspector/dist/assets/{linear-fec95d33.js → linear-b3399f9a.js} +1 -1
  147. rasa/core/channels/inspector/dist/assets/{mindmap-definition-fc14e90a-2557813e.js → mindmap-definition-fc14e90a-b095bf1a.js} +1 -1
  148. rasa/core/channels/inspector/dist/assets/{pieDiagram-8a3498a8-40d756b1.js → pieDiagram-8a3498a8-07644b66.js} +1 -1
  149. rasa/core/channels/inspector/dist/assets/{quadrantDiagram-120e2f19-a48cbdcd.js → quadrantDiagram-120e2f19-573a3f9c.js} +1 -1
  150. rasa/core/channels/inspector/dist/assets/{requirementDiagram-deff3bca-dc778150.js → requirementDiagram-deff3bca-d457e1e1.js} +1 -1
  151. rasa/core/channels/inspector/dist/assets/{sankeyDiagram-04a897e0-10026b94.js → sankeyDiagram-04a897e0-9d26e1a2.js} +1 -1
  152. rasa/core/channels/inspector/dist/assets/{sequenceDiagram-704730f1-3b2ed10a.js → sequenceDiagram-704730f1-3a9cde10.js} +1 -1
  153. rasa/core/channels/inspector/dist/assets/{stateDiagram-587899a1-c5f3b3fb.js → stateDiagram-587899a1-4f3e8cec.js} +1 -1
  154. rasa/core/channels/inspector/dist/assets/{stateDiagram-v2-d93cdb3a-e503656b.js → stateDiagram-v2-d93cdb3a-e617e5bf.js} +1 -1
  155. rasa/core/channels/inspector/dist/assets/{styles-6aaf32cf-a683ce56.js → styles-6aaf32cf-eab30d2f.js} +1 -1
  156. rasa/core/channels/inspector/dist/assets/{styles-9a916d00-02bcdcee.js → styles-9a916d00-09994be2.js} +1 -1
  157. rasa/core/channels/inspector/dist/assets/{styles-c10674c1-8e90dbb9.js → styles-c10674c1-b7110364.js} +1 -1
  158. rasa/core/channels/inspector/dist/assets/{svgDrawCommon-08f97a94-7c23fc1e.js → svgDrawCommon-08f97a94-3ebc92ad.js} +1 -1
  159. rasa/core/channels/inspector/dist/assets/{timeline-definition-85554ec2-c42faec8.js → timeline-definition-85554ec2-7d13d2f2.js} +1 -1
  160. rasa/core/channels/inspector/dist/assets/{xychartDiagram-e933f94c-5e3bb0ea.js → xychartDiagram-e933f94c-488385e1.js} +1 -1
  161. rasa/core/channels/inspector/dist/index.html +1 -1
  162. rasa/core/channels/inspector/src/App.tsx +0 -7
  163. rasa/core/channels/inspector/src/components/DialogueInformation.tsx +9 -1
  164. rasa/core/channels/inspector/src/components/LatencyDisplay.tsx +63 -35
  165. rasa/core/channels/inspector/src/helpers/audio/audiostream.ts +14 -0
  166. rasa/core/channels/inspector/src/types.ts +32 -7
  167. rasa/core/channels/studio_chat.py +21 -40
  168. rasa/core/channels/voice_stream/asr/asr_event.py +1 -1
  169. rasa/core/channels/voice_stream/asr/azure.py +6 -3
  170. rasa/core/channels/voice_stream/asr/deepgram.py +1 -1
  171. rasa/core/channels/voice_stream/audiocodes.py +3 -0
  172. rasa/core/channels/voice_stream/browser_audio.py +53 -3
  173. rasa/core/channels/voice_stream/genesys.py +2 -1
  174. rasa/core/channels/voice_stream/jambonz.py +9 -1
  175. rasa/core/channels/voice_stream/twilio_media_streams.py +16 -0
  176. rasa/core/channels/voice_stream/voice_channel.py +61 -0
  177. rasa/core/constants.py +6 -0
  178. rasa/core/iam_credentials_providers/__init__.py +0 -0
  179. rasa/core/iam_credentials_providers/aws_iam_credentials_providers.py +141 -0
  180. rasa/core/iam_credentials_providers/credentials_provider_protocol.py +89 -0
  181. rasa/core/lock_store.py +41 -7
  182. rasa/core/processor.py +32 -0
  183. rasa/core/redis_connection_factory.py +411 -0
  184. rasa/core/tracker_stores/redis_tracker_store.py +32 -14
  185. rasa/core/tracker_stores/sql_tracker_store.py +57 -1
  186. rasa/model_manager/socket_bridge.py +1 -2
  187. rasa/shared/core/constants.py +1 -0
  188. rasa/shared/core/events.py +2 -0
  189. rasa/shared/nlu/training_data/schemas/responses.yml +3 -0
  190. rasa/version.py +1 -1
  191. {rasa_pro-3.14.0a15.dist-info → rasa_pro-3.14.0a17.dist-info}/METADATA +14 -14
  192. {rasa_pro-3.14.0a15.dist-info → rasa_pro-3.14.0a17.dist-info}/RECORD +200 -249
  193. rasa/cli/project_templates/finance/actions/accounts/action_ask_account.py +0 -47
  194. rasa/cli/project_templates/finance/actions/accounts/action_check_balance.py +0 -40
  195. rasa/cli/project_templates/finance/actions/action_session_start.py +0 -74
  196. rasa/cli/project_templates/finance/actions/cards/action_ask_card.py +0 -48
  197. rasa/cli/project_templates/finance/actions/cards/action_check_card_existence.py +0 -36
  198. rasa/cli/project_templates/finance/actions/cards/action_update_card_status.py +0 -54
  199. rasa/cli/project_templates/finance/actions/database.py +0 -277
  200. rasa/cli/project_templates/finance/actions/transfers/action_add_payee.py +0 -52
  201. rasa/cli/project_templates/finance/actions/transfers/action_ask_account_from.py +0 -51
  202. rasa/cli/project_templates/finance/actions/transfers/action_check_payee_existence.py +0 -40
  203. rasa/cli/project_templates/finance/actions/transfers/action_check_sufficient_funds.py +0 -40
  204. rasa/cli/project_templates/finance/actions/transfers/action_list_payees.py +0 -46
  205. rasa/cli/project_templates/finance/actions/transfers/action_remove_payee.py +0 -49
  206. rasa/cli/project_templates/finance/actions/transfers/action_schedule_payment.py +0 -19
  207. rasa/cli/project_templates/finance/actions/transfers/action_validate_payment_date.py +0 -36
  208. rasa/cli/project_templates/finance/csvs/accounts.csv +0 -8
  209. rasa/cli/project_templates/finance/csvs/advisors.csv +0 -7
  210. rasa/cli/project_templates/finance/csvs/appointments.csv +0 -211
  211. rasa/cli/project_templates/finance/csvs/branches.csv +0 -10
  212. rasa/cli/project_templates/finance/csvs/cards.csv +0 -11
  213. rasa/cli/project_templates/finance/csvs/payees.csv +0 -11
  214. rasa/cli/project_templates/finance/csvs/transactions.csv +0 -71
  215. rasa/cli/project_templates/finance/csvs/users.csv +0 -4
  216. rasa/cli/project_templates/finance/data/cards/select_card.yml +0 -12
  217. rasa/cli/project_templates/finance/data/general/bot_identity.yml +0 -6
  218. rasa/cli/project_templates/finance/data/system/patterns/pattern_chitchat.yml +0 -5
  219. rasa/cli/project_templates/finance/data/system/source/accounts.json +0 -51
  220. rasa/cli/project_templates/finance/data/system/source/advisors.json +0 -44
  221. rasa/cli/project_templates/finance/data/system/source/appointments.json +0 -1474
  222. rasa/cli/project_templates/finance/data/system/source/branches.json +0 -47
  223. rasa/cli/project_templates/finance/data/system/source/cards.json +0 -72
  224. rasa/cli/project_templates/finance/data/system/source/payees.json +0 -74
  225. rasa/cli/project_templates/finance/data/system/source/transactions.json +0 -492
  226. rasa/cli/project_templates/finance/data/system/source/users.json +0 -29
  227. rasa/cli/project_templates/finance/data/transfers/add_payee.yml +0 -29
  228. rasa/cli/project_templates/finance/data/transfers/list_payees.yml +0 -5
  229. rasa/cli/project_templates/finance/data/transfers/remove_payee.yml +0 -21
  230. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/consequences_of_blocking_card.txt +0 -8
  231. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/reasons_to_block_card.txt +0 -8
  232. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/recovering_from_card_fraud.txt +0 -8
  233. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/tips_for_card_security.txt +0 -8
  234. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/what_to_do_if_card_is_lost.txt +0 -8
  235. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/account_balance_security.txt +0 -7
  236. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/common_balance_inquiries.txt +0 -8
  237. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/methods_to_check_balance.txt +0 -8
  238. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/understanding_balance_updates.txt +0 -8
  239. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/what_to_do_if_balance_is_incorrect.txt +0 -8
  240. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/benefits_of_authorised_payees.txt +0 -8
  241. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/common_issues_with_payees.txt +0 -8
  242. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/general_payee_information.txt +0 -8
  243. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/payee_management_tips.txt +0 -8
  244. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/understanding_payee_types.txt +0 -8
  245. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/common_transfer_errors.txt +0 -8
  246. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/fees_for_transfers.txt +0 -8
  247. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/general_transfer_information.txt +0 -8
  248. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/security_tips_for_transfers.txt +0 -8
  249. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/transfer_processing_times.txt +0 -8
  250. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part1.txt +0 -50
  251. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part10.txt +0 -50
  252. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part11.txt +0 -48
  253. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part12.txt +0 -50
  254. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part13.txt +0 -50
  255. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part14.txt +0 -47
  256. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part15.txt +0 -50
  257. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part16.txt +0 -50
  258. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part17.txt +0 -47
  259. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part18.txt +0 -50
  260. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part19.txt +0 -50
  261. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part2.txt +0 -50
  262. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part20.txt +0 -47
  263. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part21.txt +0 -50
  264. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part22.txt +0 -50
  265. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part23.txt +0 -47
  266. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part24.txt +0 -50
  267. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part25.txt +0 -50
  268. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part26.txt +0 -47
  269. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part27.txt +0 -50
  270. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part28.txt +0 -50
  271. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part29.txt +0 -47
  272. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part3.txt +0 -47
  273. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part30.txt +0 -50
  274. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part31.txt +0 -50
  275. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part32.txt +0 -47
  276. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part33.txt +0 -50
  277. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part34.txt +0 -50
  278. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part35.txt +0 -47
  279. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part36.txt +0 -50
  280. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part37.txt +0 -50
  281. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part38.txt +0 -47
  282. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part39.txt +0 -50
  283. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part4.txt +0 -50
  284. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part40.txt +0 -50
  285. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part41.txt +0 -47
  286. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part42.txt +0 -50
  287. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part43.txt +0 -50
  288. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part44.txt +0 -47
  289. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part45.txt +0 -50
  290. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part46.txt +0 -50
  291. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part47.txt +0 -47
  292. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part48.txt +0 -50
  293. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part49.txt +0 -50
  294. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part5.txt +0 -50
  295. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part50.txt +0 -47
  296. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part51.txt +0 -50
  297. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part52.txt +0 -50
  298. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part53.txt +0 -47
  299. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part54.txt +0 -50
  300. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part55.txt +0 -50
  301. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part56.txt +0 -47
  302. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part57.txt +0 -50
  303. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part58.txt +0 -50
  304. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part59.txt +0 -47
  305. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part6.txt +0 -47
  306. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part60.txt +0 -50
  307. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part61.txt +0 -50
  308. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part7.txt +0 -50
  309. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part8.txt +0 -50
  310. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part9.txt +0 -47
  311. rasa/cli/project_templates/finance/domain/cards/select_card.yml +0 -12
  312. rasa/cli/project_templates/finance/domain/general/assistant_details.yml +0 -12
  313. rasa/cli/project_templates/finance/domain/general/bot_identity.yml +0 -5
  314. rasa/cli/project_templates/finance/domain/general/defaults.yml +0 -24
  315. rasa/cli/project_templates/finance/domain/general/goodbye.yml +0 -7
  316. rasa/cli/project_templates/finance/domain/general/help.yml +0 -5
  317. rasa/cli/project_templates/finance/domain/general/utils.yml +0 -13
  318. rasa/cli/project_templates/finance/domain/transfers/add_payee.yml +0 -47
  319. rasa/cli/project_templates/finance/domain/transfers/list_payees.yml +0 -4
  320. rasa/cli/project_templates/finance/domain/transfers/remove_payee.yml +0 -16
  321. rasa/core/channels/inspector/dist/assets/channel-d2444dfd.js +0 -1
  322. rasa/core/channels/inspector/dist/assets/clone-281a0990.js +0 -1
  323. rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-aa4cca3b.js +0 -1
  324. /rasa/cli/project_templates/telco/domain/billing/{domain_undertand_bill.yml → understand_bill.yml} +0 -0
  325. /rasa/cli/project_templates/telco/domain/network/{domain_reboot_router.yml → reboot_router.yml} +0 -0
  326. /rasa/cli/project_templates/telco/domain/network/{domain_reset_router.yml → reset_router.yml} +0 -0
  327. /rasa/cli/project_templates/telco/domain/network/{domain_run_speed_test.yml → run_speed_test.yml} +0 -0
  328. /rasa/cli/project_templates/telco/domain/network/{domain_solve_internet_issue.yml → solve_internet_issue.yml} +0 -0
  329. {rasa_pro-3.14.0a15.dist-info → rasa_pro-3.14.0a17.dist-info}/NOTICE +0 -0
  330. {rasa_pro-3.14.0a15.dist-info → rasa_pro-3.14.0a17.dist-info}/WHEEL +0 -0
  331. {rasa_pro-3.14.0a15.dist-info → rasa_pro-3.14.0a17.dist-info}/entry_points.txt +0 -0
@@ -105,6 +105,7 @@ class TwilioMediaStreamsInputChannel(VoiceInputChannel):
105
105
  server_url: str,
106
106
  asr_config: Dict,
107
107
  tts_config: Dict,
108
+ interruptions: Optional[Dict[str, int]] = None,
108
109
  username: Optional[Text] = None,
109
110
  password: Optional[Text] = None,
110
111
  ):
@@ -112,6 +113,7 @@ class TwilioMediaStreamsInputChannel(VoiceInputChannel):
112
113
  server_url=server_url,
113
114
  asr_config=asr_config,
114
115
  tts_config=tts_config,
116
+ interruptions=interruptions,
115
117
  )
116
118
  self.username = username
117
119
  self.password = password
@@ -195,6 +197,20 @@ class TwilioMediaStreamsInputChannel(VoiceInputChannel):
195
197
  self.tts_cache,
196
198
  )
197
199
 
200
+ async def interrupt_playback(
201
+ self, ws: Websocket, call_parameters: CallParameters
202
+ ) -> None:
203
+ """Interrupt the current playback of audio."""
204
+ logger.debug("twilio_media_streams.interrupt_playback")
205
+ await ws.send(
206
+ json.dumps(
207
+ {
208
+ "event": "clear",
209
+ "streamSid": call_parameters.stream_id,
210
+ }
211
+ )
212
+ )
213
+
198
214
  def blueprint(
199
215
  self, on_new_message: Callable[[UserMessage], Awaitable[Any]]
200
216
  ) -> Blueprint:
@@ -2,6 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  import asyncio
4
4
  import copy
5
+ import string
5
6
  import time
6
7
  from dataclasses import asdict, dataclass
7
8
  from typing import Any, AsyncIterator, Awaitable, Callable, Dict, List, Optional, Tuple
@@ -53,6 +54,13 @@ from rasa.utils.io import remove_emojis
53
54
  logger = structlog.get_logger(__name__)
54
55
 
55
56
  # define constants for the voice channel
57
+ DEFAULT_INTERRUPTION_MIN_WORDS = 3
58
+
59
+
60
+ @dataclass
61
+ class InterruptionConfig:
62
+ enabled: bool = False
63
+ min_words: int = DEFAULT_INTERRUPTION_MIN_WORDS
56
64
 
57
65
 
58
66
  @dataclass
@@ -270,6 +278,10 @@ class VoiceOutputChannel(OutputChannel):
270
278
  except (WebsocketClosed, ServerError):
271
279
  call_state.connection_failed = True
272
280
 
281
+ # Is the response interruptible?
282
+ allow_interruptions = kwargs.get("allow_interruptions", True)
283
+ call_state.channel_data["allow_interruptions"] = allow_interruptions
284
+
273
285
  if cached_audio_bytes:
274
286
  audio_stream = self.chunk_audio(cached_audio_bytes)
275
287
  else:
@@ -368,6 +380,7 @@ class VoiceInputChannel(InputChannel):
368
380
  server_url: str,
369
381
  asr_config: Dict,
370
382
  tts_config: Dict,
383
+ interruptions: Optional[Dict[str, Any]] = None,
371
384
  ):
372
385
  if self.requires_voice_license:
373
386
  validate_voice_license_scope()
@@ -376,12 +389,21 @@ class VoiceInputChannel(InputChannel):
376
389
  self.asr_config = asr_config
377
390
  self.tts_config = tts_config
378
391
  self.tts_cache = TTSCache(tts_config.get("cache_size", 1000))
392
+ if interruptions:
393
+ self.interruption_config = InterruptionConfig(**interruptions)
394
+ else:
395
+ self.interruption_config = InterruptionConfig()
396
+
397
+ if self.interruption_config.enabled:
398
+ mark_as_beta_feature(f"Interruption Handling in {self.name()}")
379
399
 
380
400
  logger.info(
381
401
  "voice_channel.initialized",
402
+ name=self.name(),
382
403
  server_url=self.server_url,
383
404
  asr_config=self.asr_config,
384
405
  tts_config=self.tts_config,
406
+ interruption_config=self.interruption_config,
385
407
  )
386
408
 
387
409
  def get_sender_id(self, call_parameters: CallParameters) -> str:
@@ -463,6 +485,43 @@ class VoiceInputChannel(InputChannel):
463
485
  """Map a channel input message to a voice channel action."""
464
486
  raise NotImplementedError
465
487
 
488
+ def should_interrupt(self, e: ASREvent) -> bool:
489
+ """Determine if the current ASR event should interrupt playback.
490
+ Returns True if the bot response is interruptible
491
+ And if the user spoke more than 3 words.
492
+
493
+ Arguments:
494
+ e: The ASR event to evaluate.
495
+
496
+ Returns:
497
+ True if the event should interrupt playback, False otherwise.
498
+ """
499
+ # Are interruptions are enabled for the channel?
500
+ if not self.interruption_config.enabled:
501
+ return False
502
+
503
+ # Is the bot response interruptible?
504
+ if not call_state.channel_data.get("allow_interruptions", True):
505
+ return False
506
+
507
+ # Did the user speak more than 3 words?
508
+ min_words = self.interruption_config.min_words
509
+ if isinstance(e, UserIsSpeaking):
510
+ translator = str.maketrans("", "", string.punctuation)
511
+ words = e.text.translate(translator).split()
512
+ return len(words) >= min_words
513
+ return False
514
+
515
+ async def interrupt_playback(
516
+ self, ws: Websocket, call_parameters: CallParameters
517
+ ) -> None:
518
+ """Interrupt the current playback of audio.
519
+
520
+ This function is used for interruption handling.
521
+ As not all channels support flushing bot audio buffer,
522
+ if a channel does not implement it. It has no effect."""
523
+ pass
524
+
466
525
  async def run_audio_streaming(
467
526
  self,
468
527
  on_new_message: Callable[[UserMessage], Awaitable[Any]],
@@ -598,6 +657,8 @@ class VoiceInputChannel(InputChannel):
598
657
  call_state.user_speech_start_time = time.time()
599
658
  self._cancel_silence_timeout_watcher()
600
659
  call_state.is_user_speaking = True
660
+ if self.should_interrupt(e):
661
+ await self.interrupt_playback(voice_websocket, call_parameters)
601
662
  elif isinstance(e, UserSilence):
602
663
  output_channel = self.create_output_channel(voice_websocket, tts_engine)
603
664
  message = UserMessage(
rasa/core/constants.py CHANGED
@@ -112,3 +112,9 @@ ACTIVE_FLOW_METADATA_KEY = "active_flow"
112
112
  STEP_ID_METADATA_KEY = "step_id"
113
113
  KEY_IS_CALM_SYSTEM = "is_calm_system"
114
114
  KEY_IS_COEXISTENCE_ASSISTANT = "is_coexistence_assistant"
115
+
116
+ IAM_CLOUD_PROVIDER_ENV_VAR_NAME = "IAM_CLOUD_PROVIDER"
117
+ SQL_TRACKER_STORE_SSL_MODE_ENV_VAR_NAME = "SQL_TRACKER_STORE_SSL_MODE"
118
+ SQL_TRACKER_STORE_SSL_ROOT_CERTIFICATE_ENV_VAR_NAME = (
119
+ "SQL_TRACKER_STORE_SSL_ROOT_CERTIFICATE"
120
+ )
File without changes
@@ -0,0 +1,141 @@
1
+ import os
2
+ import threading
3
+ import time
4
+ from typing import Optional
5
+
6
+ import boto3
7
+ import structlog
8
+ from aws_msk_iam_sasl_signer import MSKAuthTokenProvider
9
+ from botocore.exceptions import BotoCoreError
10
+
11
+ from rasa.core.iam_credentials_providers.credentials_provider_protocol import (
12
+ IAMCredentialsProvider,
13
+ IAMCredentialsProviderInput,
14
+ SupportedServiceType,
15
+ TemporaryCredentials,
16
+ )
17
+ from rasa.shared.exceptions import ConnectionException
18
+
19
+ structlogger = structlog.get_logger(__name__)
20
+
21
+
22
+ class AWSRDSIAMCredentialsProvider(IAMCredentialsProvider):
23
+ """Generates temporary credentials for AWS RDS using IAM roles."""
24
+
25
+ def __init__(self, username: str, host: str, port: int) -> None:
26
+ """Initializes the provider."""
27
+ self.username = username
28
+ self.host = host
29
+ self.port = port
30
+
31
+ def get_credentials(self) -> TemporaryCredentials:
32
+ """Generates temporary credentials for AWS RDS."""
33
+ structlogger.debug(
34
+ "rasa.core.aws_rds_iam_credentials_provider.get_credentials",
35
+ event_info="IAM authentication for AWS RDS enabled. "
36
+ "Generating temporary auth token...",
37
+ )
38
+
39
+ try:
40
+ client = boto3.client("rds")
41
+ auth_token = client.generate_db_auth_token(
42
+ DBHostname=self.host,
43
+ Port=self.port,
44
+ DBUsername=self.username,
45
+ )
46
+ structlogger.info(
47
+ "rasa.core.aws_rds_iam_credentials_provider.generated_credentials",
48
+ event_info="Successfully generated temporary auth token for AWS RDS.",
49
+ )
50
+ return TemporaryCredentials(auth_token=auth_token)
51
+ except (BotoCoreError, ValueError) as exc:
52
+ structlogger.error(
53
+ "rasa.core.aws_rds_iam_credentials_provider.error_generating_credentials",
54
+ event_info="Failed to generate temporary auth token for AWS RDS.",
55
+ error=str(exc),
56
+ )
57
+ return TemporaryCredentials(auth_token=None)
58
+
59
+
60
+ class AWSMSKafkaIAMCredentialsProvider(IAMCredentialsProvider):
61
+ """Generates temporary credentials for AWS MSK using IAM roles."""
62
+
63
+ def __init__(self) -> None:
64
+ self.region = os.getenv("AWS_DEFAULT_REGION", os.getenv("AWS_REGION"))
65
+ self._token: Optional[str] = None
66
+ self._expires_at: float = 0
67
+ self.refresh_margin_seconds = 60 # Refresh 60 seconds before expiry
68
+ # ensure thread safety when refreshing token because the
69
+ # kafka client library we use (confluent-kafka) is multithreaded
70
+ self.lock = threading.Lock()
71
+
72
+ @property
73
+ def token(self) -> Optional[str]:
74
+ return self._token
75
+
76
+ @token.setter
77
+ def token(self, value: str) -> None:
78
+ self._token = value
79
+
80
+ @property
81
+ def expires_at(self) -> float:
82
+ return self._expires_at
83
+
84
+ @expires_at.setter
85
+ def expires_at(self, value: float) -> None:
86
+ self._expires_at = value
87
+
88
+ def get_credentials(self) -> TemporaryCredentials:
89
+ """Generates temporary credentials for AWS MSK."""
90
+ with self.lock:
91
+ current_time = time.time() # Current time in seconds
92
+ if (
93
+ not self.token
94
+ or current_time >= self.expires_at - self.refresh_margin_seconds
95
+ ):
96
+ try:
97
+ auth_token, expiry_ms = MSKAuthTokenProvider.generate_auth_token(
98
+ self.region
99
+ )
100
+ structlogger.debug(
101
+ "rasa.core.aws_msk_iam_credentials_provider.get_credentials",
102
+ event_info="Successfully generated AWS IAM token for "
103
+ "Kafka authentication.",
104
+ )
105
+ self.token = auth_token
106
+ self.expires_at = int(expiry_ms) / 1000 # Convert ms to seconds
107
+ return TemporaryCredentials(
108
+ auth_token=auth_token,
109
+ expiration=self.expires_at,
110
+ )
111
+ except Exception as exc:
112
+ raise ConnectionException(
113
+ f"Failed to generate AWS IAM token "
114
+ f"for MSK authentication. Original exception: {exc}"
115
+ ) from exc
116
+ else:
117
+ structlogger.debug(
118
+ "rasa.core.aws_msk_iam_credentials_provider.get_credentials",
119
+ event_info="Using cached AWS IAM token for Kafka authentication.",
120
+ )
121
+ return TemporaryCredentials(
122
+ auth_token=self.token,
123
+ expiration=self.expires_at,
124
+ )
125
+
126
+
127
+ def create_aws_iam_credentials_provider(
128
+ provider_input: "IAMCredentialsProviderInput",
129
+ ) -> Optional["IAMCredentialsProvider"]:
130
+ """Factory function to create an AWS IAM credentials provider."""
131
+ if provider_input.service_name == SupportedServiceType.TRACKER_STORE:
132
+ return AWSRDSIAMCredentialsProvider(
133
+ username=provider_input.username,
134
+ host=provider_input.host,
135
+ port=provider_input.port,
136
+ )
137
+
138
+ if provider_input.service_name == SupportedServiceType.EVENT_BROKER:
139
+ return AWSMSKafkaIAMCredentialsProvider()
140
+
141
+ return None
@@ -0,0 +1,89 @@
1
+ from __future__ import annotations
2
+
3
+ import os
4
+ from enum import Enum
5
+ from typing import Optional, Protocol, runtime_checkable
6
+
7
+ import structlog
8
+ from pydantic import BaseModel
9
+
10
+ from rasa.core.constants import IAM_CLOUD_PROVIDER_ENV_VAR_NAME
11
+
12
+ structlogger = structlog.get_logger(__name__)
13
+
14
+
15
+ class TemporaryCredentials(BaseModel):
16
+ """Dataclass storing temporary credentials."""
17
+
18
+ auth_token: Optional[str] = None
19
+ expiration: Optional[float] = None
20
+ username: Optional[str] = None
21
+ presigned_url: Optional[str] = None
22
+
23
+
24
+ @runtime_checkable
25
+ class IAMCredentialsProvider(Protocol):
26
+ """Interface for generating temporary credentials using IAM roles."""
27
+
28
+ def get_credentials(self) -> TemporaryCredentials:
29
+ """Generates temporary credentials using IAM roles."""
30
+ ...
31
+
32
+
33
+ class IAMCredentialsProviderType(Enum):
34
+ """Enum for supported IAM credentials provider types."""
35
+
36
+ AWS = "aws"
37
+
38
+
39
+ class SupportedServiceType(Enum):
40
+ """Enum for supported services using IAM credentials providers."""
41
+
42
+ TRACKER_STORE = "tracker_store"
43
+ EVENT_BROKER = "event_broker"
44
+ LOCK_STORE = "lock_store"
45
+
46
+
47
+ class IAMCredentialsProviderInput(BaseModel):
48
+ """Input data for creating an IAM credentials provider."""
49
+
50
+ service_name: SupportedServiceType
51
+ username: Optional[str] = None
52
+ host: Optional[str] = None
53
+ port: Optional[int] = None
54
+
55
+
56
+ def create_iam_credentials_provider(
57
+ provider_input: IAMCredentialsProviderInput,
58
+ ) -> Optional[IAMCredentialsProvider]:
59
+ """Factory function to create an IAM credentials provider.
60
+
61
+ Args:
62
+ provider_input: Input data for creating an IAM credentials provider.
63
+
64
+ Returns:
65
+ An instance of the specified IAM credentials provider or
66
+ None if the type is unsupported.
67
+ """
68
+ iam_cloud_provider = os.getenv(IAM_CLOUD_PROVIDER_ENV_VAR_NAME)
69
+
70
+ if iam_cloud_provider is None:
71
+ return None
72
+
73
+ try:
74
+ provider_type = IAMCredentialsProviderType(iam_cloud_provider.lower())
75
+ except ValueError:
76
+ structlogger.warning(
77
+ "rasa.core.iam_credentials_provider.create_iam_credentials_provider.unsupported_provider",
78
+ event_info=f"Unsupported IAM cloud provider: {iam_cloud_provider}",
79
+ )
80
+ return None
81
+
82
+ if provider_type == IAMCredentialsProviderType.AWS:
83
+ from rasa.core.iam_credentials_providers.aws_iam_credentials_providers import (
84
+ create_aws_iam_credentials_provider,
85
+ )
86
+
87
+ return create_aws_iam_credentials_provider(provider_input)
88
+
89
+ return None
rasa/core/lock_store.py CHANGED
@@ -4,7 +4,7 @@ import asyncio
4
4
  import json
5
5
  import os
6
6
  from contextlib import asynccontextmanager
7
- from typing import Any, AsyncGenerator, Dict, Literal, Optional, Text, Union
7
+ from typing import Any, AsyncGenerator, Dict, List, Literal, Optional, Text, Union
8
8
 
9
9
  import structlog
10
10
  from pydantic import (
@@ -12,12 +12,18 @@ from pydantic import (
12
12
  BaseModel,
13
13
  Field,
14
14
  NonNegativeInt,
15
+ ValidationError,
15
16
  model_validator,
16
17
  )
17
18
 
18
19
  import rasa.shared.utils.common
19
20
  from rasa.core.constants import DEFAULT_LOCK_LIFETIME
20
21
  from rasa.core.lock import TicketLock
22
+ from rasa.core.redis_connection_factory import (
23
+ DeploymentMode,
24
+ RedisConfig,
25
+ RedisConnectionFactory,
26
+ )
21
27
  from rasa.shared.exceptions import ConnectionException, RasaException
22
28
  from rasa.shared.utils.io import raise_deprecation_warning
23
29
  from rasa.utils.endpoints import EndpointConfig
@@ -269,6 +275,18 @@ class RedisLockStoreConfig(BaseModel):
269
275
  "will be raised in case Redis doesn't respond "
270
276
  "within `socket_timeout` seconds.",
271
277
  )
278
+ deployment_mode: DeploymentMode = Field(
279
+ default=DeploymentMode.STANDARD,
280
+ description="Redis deployment mode: 'standard', 'cluster', or 'sentinel'",
281
+ )
282
+ endpoints: Optional[List[str]] = Field(
283
+ default=None,
284
+ description="List of endpoints for cluster/sentinel mode in 'host:port' format",
285
+ )
286
+ sentinel_service: Optional[str] = Field(
287
+ default=None,
288
+ description="Sentinel service name",
289
+ )
272
290
 
273
291
  @model_validator(mode="before")
274
292
  @classmethod
@@ -298,9 +316,6 @@ class RedisLockStoreConfig(BaseModel):
298
316
  )
299
317
  return self
300
318
 
301
- def to_strict_redis(self) -> Dict[str, Any]:
302
- return self.model_dump(by_alias=True, exclude={"key_prefix"})
303
-
304
319
 
305
320
  class RedisLockStore(LockStore):
306
321
  """Redis store for ticket locks."""
@@ -314,10 +329,26 @@ class RedisLockStore(LockStore):
314
329
  Args:
315
330
  config: Redis lock store configuration.
316
331
  """
317
- import redis
318
-
319
332
  self.config = config
320
- self.red = redis.StrictRedis(**self.config.to_strict_redis())
333
+ try:
334
+ redis_config = RedisConfig(
335
+ host=str(self.config.host),
336
+ port=self.config.port,
337
+ db=self.config.db,
338
+ username=self.config.username,
339
+ password=self.config.password,
340
+ use_ssl=self.config.use_ssl,
341
+ ssl_keyfile=self.config.ssl_keyfile,
342
+ ssl_certfile=self.config.ssl_certfile,
343
+ ssl_ca_certs=self.config.ssl_ca_certs,
344
+ deployment_mode=self.config.deployment_mode,
345
+ endpoints=self.config.endpoints,
346
+ sentinel_service=self.config.sentinel_service,
347
+ socket_timeout=self.config.socket_timeout,
348
+ )
349
+ self.red = RedisConnectionFactory.create_connection(redis_config)
350
+ except ValidationError as e:
351
+ raise RasaException(f"Invalid Redis configuration: {e}")
321
352
 
322
353
  self.key_prefix = DEFAULT_REDIS_LOCK_STORE_KEY_PREFIX
323
354
  if self.config.key_prefix:
@@ -349,6 +380,9 @@ class RedisLockStore(LockStore):
349
380
  """Retrieves lock (see parent docstring for more information)."""
350
381
  serialised_lock = self.red.get(self.key_prefix + conversation_id)
351
382
  if serialised_lock:
383
+ # Handle bytes to string conversion for JSON parsing
384
+ if isinstance(serialised_lock, bytes):
385
+ serialised_lock = serialised_lock.decode("utf-8")
352
386
  return TicketLock.from_dict(json.loads(serialised_lock))
353
387
 
354
388
  return None
rasa/core/processor.py CHANGED
@@ -72,6 +72,7 @@ from rasa.shared.core.constants import (
72
72
  ACTION_CORRECT_FLOW_SLOT,
73
73
  ACTION_EXTRACT_SLOTS,
74
74
  ACTION_LISTEN_NAME,
75
+ ACTION_METADATA_EXECUTION_TIME,
75
76
  ACTION_SESSION_START_NAME,
76
77
  FOLLOWUP_ACTION,
77
78
  SESSION_START_METADATA_SLOT,
@@ -207,6 +208,7 @@ class MessageProcessor:
207
208
  ) -> Optional[List[Dict[Text, Any]]]:
208
209
  """Handle a single message with this processor."""
209
210
  # preprocess message if necessary
211
+ self.time_turn_start = time.time()
210
212
  tracker = await self.log_message(message, should_save_tracker=False)
211
213
 
212
214
  if self.model_metadata.training_type == TrainingType.NLU:
@@ -1154,6 +1156,7 @@ class MessageProcessor:
1154
1156
  should_predict_another_action = True
1155
1157
 
1156
1158
  tracker = await self.run_command_processor(tracker)
1159
+ self.time_command_processor = time.time()
1157
1160
 
1158
1161
  # action loop. predicts actions until we hit action listen
1159
1162
  while should_predict_another_action and self._should_handle_message(tracker):
@@ -1403,6 +1406,34 @@ class MessageProcessor:
1403
1406
  plugin_manager().hook.after_action_executed(tracker=tracker)
1404
1407
  return self.should_predict_another_action(action.name())
1405
1408
 
1409
+ def _add_metadata_if_action_listen(
1410
+ self, action: Action, prediction: PolicyPrediction
1411
+ ) -> None:
1412
+ """Adds execution times to the ActionExecuted event metadata."""
1413
+ if not hasattr(self, "time_turn_start"):
1414
+ return
1415
+
1416
+ if not hasattr(self, "time_command_processor"):
1417
+ return
1418
+
1419
+ if not action.name() == ACTION_LISTEN_NAME:
1420
+ return
1421
+
1422
+ if prediction.action_metadata is None:
1423
+ prediction.action_metadata = {}
1424
+
1425
+ # calculate execution times
1426
+ execution_time_prediction_loop = (
1427
+ time.time() - self.time_command_processor
1428
+ ) * 1000
1429
+ execution_time_command_processor = (
1430
+ self.time_command_processor - self.time_turn_start
1431
+ ) * 1000
1432
+ prediction.action_metadata[ACTION_METADATA_EXECUTION_TIME] = {
1433
+ "command_processor": execution_time_command_processor,
1434
+ "prediction_loop": execution_time_prediction_loop,
1435
+ }
1436
+
1406
1437
  def _log_action_and_events_on_tracker(
1407
1438
  self,
1408
1439
  tracker: DialogueStateTracker,
@@ -1448,6 +1479,7 @@ class MessageProcessor:
1448
1479
  tracker.update_with_events(prediction.events)
1449
1480
 
1450
1481
  # log the action and its produced events
1482
+ self._add_metadata_if_action_listen(action, prediction)
1451
1483
  tracker.update(
1452
1484
  action.event_for_successful_execution(
1453
1485
  prediction, was_successful, error_message