rasa-pro 3.13.1a18__py3-none-any.whl → 3.13.2__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 (259) hide show
  1. rasa/cli/scaffold.py +3 -22
  2. rasa/core/actions/action.py +3 -5
  3. rasa/core/channels/studio_chat.py +10 -34
  4. rasa/core/channels/voice_stream/asr/asr_engine.py +5 -1
  5. rasa/core/channels/voice_stream/asr/deepgram.py +5 -0
  6. rasa/core/channels/voice_stream/audiocodes.py +9 -4
  7. rasa/core/channels/voice_stream/jambonz.py +1 -1
  8. rasa/core/channels/voice_stream/voice_channel.py +7 -0
  9. rasa/core/policies/enterprise_search_policy.py +9 -8
  10. rasa/core/policies/flows/flow_executor.py +1 -8
  11. rasa/dialogue_understanding/commands/correct_slots_command.py +0 -10
  12. rasa/dialogue_understanding/generator/command_generator.py +5 -5
  13. rasa/dialogue_understanding/generator/flow_retrieval.py +9 -10
  14. rasa/dialogue_understanding/processor/command_processor.py +6 -1
  15. rasa/model_manager/model_api.py +3 -2
  16. rasa/model_manager/runner_service.py +1 -1
  17. rasa/model_manager/trainer_service.py +9 -12
  18. rasa/model_manager/utils.py +29 -1
  19. rasa/shared/core/domain.py +15 -62
  20. rasa/shared/core/flows/flow_step.py +1 -7
  21. rasa/shared/core/flows/yaml_flows_io.py +8 -16
  22. rasa/shared/core/slots.py +0 -4
  23. rasa/shared/importers/importer.py +0 -6
  24. rasa/shared/importers/utils.py +1 -77
  25. rasa/studio/upload.py +45 -10
  26. rasa/telemetry.py +1 -2
  27. rasa/utils/io.py +9 -27
  28. rasa/utils/json_utils.py +1 -6
  29. rasa/utils/log_utils.py +1 -5
  30. rasa/utils/plotting.py +1 -1
  31. rasa/validator.py +3 -7
  32. rasa/version.py +1 -1
  33. {rasa_pro-3.13.1a18.dist-info → rasa_pro-3.13.2.dist-info}/METADATA +8 -9
  34. {rasa_pro-3.13.1a18.dist-info → rasa_pro-3.13.2.dist-info}/RECORD +37 -259
  35. rasa/builder/README.md +0 -120
  36. rasa/builder/__init__.py +0 -0
  37. rasa/builder/config.py +0 -79
  38. rasa/builder/create_openai_vector_store.py +0 -228
  39. rasa/builder/exceptions.py +0 -55
  40. rasa/builder/inkeep-rag-response-schema.json +0 -64
  41. rasa/builder/inkeep_document_retrieval.py +0 -212
  42. rasa/builder/llm-helper-schema.json +0 -69
  43. rasa/builder/llm_context.py +0 -81
  44. rasa/builder/llm_helper_prompt.jinja2 +0 -245
  45. rasa/builder/llm_service.py +0 -317
  46. rasa/builder/logging_utils.py +0 -51
  47. rasa/builder/main.py +0 -147
  48. rasa/builder/models.py +0 -225
  49. rasa/builder/project_generator.py +0 -282
  50. rasa/builder/scrape_rasa_docs.py +0 -97
  51. rasa/builder/service.py +0 -742
  52. rasa/builder/skill_to_bot_prompt.jinja2 +0 -164
  53. rasa/builder/training_service.py +0 -132
  54. rasa/builder/validation_service.py +0 -93
  55. rasa/cli/project_templates/finance/actions/__init__.py +0 -0
  56. rasa/cli/project_templates/finance/actions/action_add_payee.py +0 -47
  57. rasa/cli/project_templates/finance/actions/action_ask_account.py +0 -50
  58. rasa/cli/project_templates/finance/actions/action_ask_account_from.py +0 -50
  59. rasa/cli/project_templates/finance/actions/action_ask_card.py +0 -47
  60. rasa/cli/project_templates/finance/actions/action_check_balance.py +0 -40
  61. rasa/cli/project_templates/finance/actions/action_check_card_existence.py +0 -35
  62. rasa/cli/project_templates/finance/actions/action_check_payee_existence.py +0 -40
  63. rasa/cli/project_templates/finance/actions/action_check_sufficient_funds.py +0 -41
  64. rasa/cli/project_templates/finance/actions/action_list_payees.py +0 -45
  65. rasa/cli/project_templates/finance/actions/action_process_immediate_payment.py +0 -18
  66. rasa/cli/project_templates/finance/actions/action_remove_payee.py +0 -49
  67. rasa/cli/project_templates/finance/actions/action_schedule_payment.py +0 -19
  68. rasa/cli/project_templates/finance/actions/action_session_start.py +0 -69
  69. rasa/cli/project_templates/finance/actions/action_update_card_status.py +0 -45
  70. rasa/cli/project_templates/finance/actions/action_validate_payment_date.py +0 -36
  71. rasa/cli/project_templates/finance/actions/database.py +0 -276
  72. rasa/cli/project_templates/finance/config.yml +0 -32
  73. rasa/cli/project_templates/finance/credentials.yml +0 -33
  74. rasa/cli/project_templates/finance/csvs/accounts.csv +0 -8
  75. rasa/cli/project_templates/finance/csvs/advisors.csv +0 -7
  76. rasa/cli/project_templates/finance/csvs/appointments.csv +0 -211
  77. rasa/cli/project_templates/finance/csvs/branches.csv +0 -10
  78. rasa/cli/project_templates/finance/csvs/cards.csv +0 -11
  79. rasa/cli/project_templates/finance/csvs/payees.csv +0 -10
  80. rasa/cli/project_templates/finance/csvs/transactions.csv +0 -71
  81. rasa/cli/project_templates/finance/csvs/users.csv +0 -4
  82. rasa/cli/project_templates/finance/data/flows/add_payee.yml +0 -29
  83. rasa/cli/project_templates/finance/data/flows/block_card.yml +0 -66
  84. rasa/cli/project_templates/finance/data/flows/check_balance.yml +0 -9
  85. rasa/cli/project_templates/finance/data/flows/list_payees.yml +0 -5
  86. rasa/cli/project_templates/finance/data/flows/remove_payee.yml +0 -21
  87. rasa/cli/project_templates/finance/data/flows/select_card.yml +0 -12
  88. rasa/cli/project_templates/finance/data/flows/transfer_money.yml +0 -67
  89. rasa/cli/project_templates/finance/data/flows/welcome.yml +0 -14
  90. rasa/cli/project_templates/finance/data/nlu.yml +0 -29
  91. rasa/cli/project_templates/finance/data/patterns/pattern_chitchat.yml +0 -7
  92. rasa/cli/project_templates/finance/data/patterns/pattern_completed.yml +0 -6
  93. rasa/cli/project_templates/finance/data/patterns/pattern_search.yml +0 -5
  94. rasa/cli/project_templates/finance/data/patterns/pattern_session_start.yml +0 -9
  95. rasa/cli/project_templates/finance/data/source/accounts.json +0 -51
  96. rasa/cli/project_templates/finance/data/source/advisors.json +0 -44
  97. rasa/cli/project_templates/finance/data/source/appointments.json +0 -1474
  98. rasa/cli/project_templates/finance/data/source/branches.json +0 -47
  99. rasa/cli/project_templates/finance/data/source/cards.json +0 -72
  100. rasa/cli/project_templates/finance/data/source/payees.json +0 -74
  101. rasa/cli/project_templates/finance/data/source/transactions.json +0 -492
  102. rasa/cli/project_templates/finance/data/source/users.json +0 -29
  103. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/consequences_of_blocking_card.txt +0 -8
  104. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/reasons_to_block_card.txt +0 -8
  105. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/recovering_from_card_fraud.txt +0 -8
  106. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/tips_for_card_security.txt +0 -8
  107. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/what_to_do_if_card_is_lost.txt +0 -8
  108. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/account_balance_security.txt +0 -7
  109. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/common_balance_inquiries.txt +0 -8
  110. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/methods_to_check_balance.txt +0 -8
  111. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/understanding_balance_updates.txt +0 -8
  112. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/what_to_do_if_balance_is_incorrect.txt +0 -8
  113. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/benefits_of_authorised_payees.txt +0 -8
  114. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/common_issues_with_payees.txt +0 -8
  115. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/general_payee_information.txt +0 -8
  116. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/payee_management_tips.txt +0 -8
  117. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/understanding_payee_types.txt +0 -8
  118. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/common_transfer_errors.txt +0 -8
  119. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/fees_for_transfers.txt +0 -8
  120. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/general_transfer_information.txt +0 -8
  121. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/security_tips_for_transfers.txt +0 -8
  122. rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/transfer_processing_times.txt +0 -8
  123. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part1.txt +0 -50
  124. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part10.txt +0 -50
  125. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part11.txt +0 -48
  126. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part12.txt +0 -50
  127. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part13.txt +0 -50
  128. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part14.txt +0 -47
  129. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part15.txt +0 -50
  130. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part16.txt +0 -50
  131. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part17.txt +0 -47
  132. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part18.txt +0 -50
  133. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part19.txt +0 -50
  134. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part2.txt +0 -50
  135. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part20.txt +0 -47
  136. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part21.txt +0 -50
  137. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part22.txt +0 -50
  138. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part23.txt +0 -47
  139. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part24.txt +0 -50
  140. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part25.txt +0 -50
  141. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part26.txt +0 -47
  142. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part27.txt +0 -50
  143. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part28.txt +0 -50
  144. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part29.txt +0 -47
  145. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part3.txt +0 -47
  146. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part30.txt +0 -50
  147. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part31.txt +0 -50
  148. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part32.txt +0 -47
  149. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part33.txt +0 -50
  150. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part34.txt +0 -50
  151. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part35.txt +0 -47
  152. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part36.txt +0 -50
  153. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part37.txt +0 -50
  154. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part38.txt +0 -47
  155. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part39.txt +0 -50
  156. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part4.txt +0 -50
  157. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part40.txt +0 -50
  158. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part41.txt +0 -47
  159. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part42.txt +0 -50
  160. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part43.txt +0 -50
  161. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part44.txt +0 -47
  162. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part45.txt +0 -50
  163. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part46.txt +0 -50
  164. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part47.txt +0 -47
  165. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part48.txt +0 -50
  166. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part49.txt +0 -50
  167. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part5.txt +0 -50
  168. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part50.txt +0 -47
  169. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part51.txt +0 -50
  170. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part52.txt +0 -50
  171. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part53.txt +0 -47
  172. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part54.txt +0 -50
  173. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part55.txt +0 -50
  174. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part56.txt +0 -47
  175. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part57.txt +0 -50
  176. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part58.txt +0 -50
  177. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part59.txt +0 -47
  178. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part6.txt +0 -47
  179. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part60.txt +0 -50
  180. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part61.txt +0 -50
  181. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part7.txt +0 -50
  182. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part8.txt +0 -50
  183. rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part9.txt +0 -47
  184. rasa/cli/project_templates/finance/domain/add_payee.yml +0 -47
  185. rasa/cli/project_templates/finance/domain/block_card.yml +0 -101
  186. rasa/cli/project_templates/finance/domain/check_balance.yml +0 -9
  187. rasa/cli/project_templates/finance/domain/default_actions.yml +0 -16
  188. rasa/cli/project_templates/finance/domain/default_flows.yml +0 -33
  189. rasa/cli/project_templates/finance/domain/list_payees.yml +0 -4
  190. rasa/cli/project_templates/finance/domain/remove_payee.yml +0 -16
  191. rasa/cli/project_templates/finance/domain/select_card.yml +0 -12
  192. rasa/cli/project_templates/finance/domain/transfer_money.yml +0 -79
  193. rasa/cli/project_templates/finance/endpoints.yml +0 -62
  194. rasa/cli/project_templates/finance/prompts/command-generator.jinja2 +0 -57
  195. rasa/cli/project_templates/finance/prompts/rephraser_demo_personality_prompt.jinja2 +0 -19
  196. rasa/cli/project_templates/finance/tests/conversation_repair/cancellations.yml +0 -12
  197. rasa/cli/project_templates/finance/tests/conversation_repair/cannot_handle.yml +0 -7
  198. rasa/cli/project_templates/finance/tests/conversation_repair/chitchat.yml +0 -7
  199. rasa/cli/project_templates/finance/tests/conversation_repair/clarification.yml +0 -9
  200. rasa/cli/project_templates/finance/tests/conversation_repair/completion.yml +0 -18
  201. rasa/cli/project_templates/finance/tests/conversation_repair/corrections.yml +0 -17
  202. rasa/cli/project_templates/finance/tests/conversation_repair/digressions.yml +0 -32
  203. rasa/cli/project_templates/finance/tests/conversation_repair/human_handoff.yml +0 -21
  204. rasa/cli/project_templates/finance/tests/conversation_repair/skipping_collect_steps.yml +0 -16
  205. rasa/cli/project_templates/finance/tests/demo_scripts/main.yml +0 -16
  206. rasa/cli/project_templates/finance/tests/happy_paths/balance_verification.yml +0 -15
  207. rasa/cli/project_templates/finance/tests/happy_paths/banking_questions.yml +0 -12
  208. rasa/cli/project_templates/finance/tests/happy_paths/card_blocking.yml +0 -52
  209. rasa/cli/project_templates/finance/tests/happy_paths/money_transfer.yml +0 -136
  210. rasa/cli/project_templates/finance/tests/happy_paths/payee_management.yml +0 -27
  211. rasa/cli/project_templates/finance/tests/happy_paths/user_greeted.yml +0 -5
  212. rasa/cli/project_templates/plain/actions/__init__.py +0 -0
  213. rasa/cli/project_templates/plain/config.yml +0 -17
  214. rasa/cli/project_templates/plain/credentials.yml +0 -33
  215. rasa/cli/project_templates/plain/data/patterns/pattern_session_start.yml +0 -7
  216. rasa/cli/project_templates/plain/domain.yml +0 -5
  217. rasa/cli/project_templates/plain/endpoints.yml +0 -58
  218. rasa/cli/project_templates/telco/actions/__init__.py +0 -0
  219. rasa/cli/project_templates/telco/actions/actions_billing.py +0 -197
  220. rasa/cli/project_templates/telco/actions/actions_get_data_from_db.py +0 -43
  221. rasa/cli/project_templates/telco/actions/actions_run_diagnostics.py +0 -23
  222. rasa/cli/project_templates/telco/actions/actions_session_start.py +0 -13
  223. rasa/cli/project_templates/telco/config.yml +0 -25
  224. rasa/cli/project_templates/telco/credentials.yml +0 -33
  225. rasa/cli/project_templates/telco/csvs/billing.csv +0 -10
  226. rasa/cli/project_templates/telco/csvs/customers.csv +0 -5
  227. rasa/cli/project_templates/telco/data/flows/flow_global.yml +0 -5
  228. rasa/cli/project_templates/telco/data/flows/flow_reboot_router.yml +0 -8
  229. rasa/cli/project_templates/telco/data/flows/flow_reset_router.yml +0 -7
  230. rasa/cli/project_templates/telco/data/flows/flow_solve_internet_issue.yml +0 -73
  231. rasa/cli/project_templates/telco/data/flows/flow_undertand_bill.yml +0 -45
  232. rasa/cli/project_templates/telco/data/patterns/pattern_completed.yml +0 -7
  233. rasa/cli/project_templates/telco/data/patterns/pattern_human_handoff.yml +0 -6
  234. rasa/cli/project_templates/telco/data/patterns/pattern_search.yml +0 -7
  235. rasa/cli/project_templates/telco/data/patterns/pattern_session_start.yml +0 -9
  236. rasa/cli/project_templates/telco/docs/reset_vs_rboot_router.txt +0 -1
  237. rasa/cli/project_templates/telco/docs/restart_router.txt +0 -6
  238. rasa/cli/project_templates/telco/docs/run_speed_test.txt +0 -6
  239. rasa/cli/project_templates/telco/domain/domain_global.yml +0 -29
  240. rasa/cli/project_templates/telco/domain/domain_patterns.yml +0 -17
  241. rasa/cli/project_templates/telco/domain/domain_reboot_router.yml +0 -20
  242. rasa/cli/project_templates/telco/domain/domain_reset_router.yml +0 -11
  243. rasa/cli/project_templates/telco/domain/domain_run_speed_test.yml +0 -24
  244. rasa/cli/project_templates/telco/domain/domain_solve_internet_issue.yml +0 -74
  245. rasa/cli/project_templates/telco/domain/domain_undertand_bill.yml +0 -102
  246. rasa/cli/project_templates/telco/endpoints.yml +0 -60
  247. rasa/cli/project_templates/telco/prompts/command-generator.jinja2 +0 -57
  248. rasa/cli/project_templates/telco/tests/e2e_results_failed.yml +0 -62
  249. rasa/cli/project_templates/telco/tests/e2e_results_passed.yml +0 -130
  250. rasa/cli/project_templates/telco/tests/e2e_test_cases/billing_test_cases.yml +0 -68
  251. rasa/cli/project_templates/telco/tests/e2e_test_cases/global_test_cases.yml +0 -13
  252. rasa/cli/project_templates/telco/tests/e2e_test_cases/internet_slow_test_case.yml +0 -47
  253. rasa/cli/project_templates/telco/tests/e2e_test_cases/out_of_scope_test_case.yml +0 -21
  254. rasa/cli/project_templates/telco/tests/e2e_test_cases/patterns_test_cases.yml +0 -15
  255. rasa/shared/importers/static.py +0 -63
  256. rasa/utils/openapi.py +0 -144
  257. {rasa_pro-3.13.1a18.dist-info → rasa_pro-3.13.2.dist-info}/NOTICE +0 -0
  258. {rasa_pro-3.13.1a18.dist-info → rasa_pro-3.13.2.dist-info}/WHEEL +0 -0
  259. {rasa_pro-3.13.1a18.dist-info → rasa_pro-3.13.2.dist-info}/entry_points.txt +0 -0
@@ -1,63 +0,0 @@
1
- import logging
2
- from typing import Dict, Optional, Text
3
-
4
- from rasa.shared.core.domain import Domain
5
- from rasa.shared.core.flows import FlowsList
6
- from rasa.shared.core.training_data.structures import StoryGraph
7
- from rasa.shared.importers.importer import TrainingDataImporter
8
- from rasa.shared.nlu.training_data.training_data import TrainingData
9
- from rasa.shared.utils.common import cached_method
10
-
11
- logger = logging.getLogger(__name__)
12
-
13
-
14
- class StaticTrainingDataImporter(TrainingDataImporter):
15
- """Static `TrainingFileImporter` implementation."""
16
-
17
- def __init__(
18
- self,
19
- domain: Domain,
20
- stories: Optional[StoryGraph] = None,
21
- flows: Optional[FlowsList] = None,
22
- nlu_data: Optional[TrainingData] = None,
23
- config: Optional[Dict] = None,
24
- ):
25
- self.domain = domain
26
- self.stories = stories or StoryGraph([])
27
- self.flows = flows or FlowsList(underlying_flows=[])
28
- self.nlu_data = nlu_data or TrainingData()
29
- self.config = config or {}
30
-
31
- @cached_method
32
- def get_config(self) -> Dict:
33
- """Retrieves model config (see parent class for full docstring)."""
34
- return self.config
35
-
36
- def get_config_file_for_auto_config(self) -> Optional[Text]:
37
- """Returns config file path for auto-config only if there is a single one."""
38
- return None
39
-
40
- @cached_method
41
- def get_stories(self, exclusion_percentage: Optional[int] = None) -> StoryGraph:
42
- """Retrieves training stories / rules (see parent class for full docstring)."""
43
- return self.stories
44
-
45
- @cached_method
46
- def get_flows(self) -> FlowsList:
47
- """Retrieves training stories / rules (see parent class for full docstring)."""
48
- return self.flows
49
-
50
- @cached_method
51
- def get_conversation_tests(self) -> StoryGraph:
52
- """Retrieves conversation test stories (see parent class for full docstring)."""
53
- return StoryGraph([])
54
-
55
- @cached_method
56
- def get_nlu_data(self, language: Optional[Text] = "en") -> TrainingData:
57
- """Retrieves NLU training data (see parent class for full docstring)."""
58
- return self.nlu_data
59
-
60
- @cached_method
61
- def get_domain(self) -> Domain:
62
- """Retrieves model domain (see parent class for full docstring)."""
63
- return self.domain
rasa/utils/openapi.py DELETED
@@ -1,144 +0,0 @@
1
- from typing import Any, Dict, List, Type
2
-
3
- from pydantic.main import BaseModel
4
- from sanic_openapi import openapi
5
- from sanic_openapi.openapi3.types import Schema
6
-
7
- _SUPPORTED_ATTRIBUTES = frozenset(["format", "enum", "required", "example"])
8
-
9
-
10
- def _to_schema(
11
- definition_stack: List[str], schema_def: Dict[str, Any], definitions: Dict[str, Any]
12
- ) -> Schema:
13
- type = schema_def.get("type")
14
-
15
- if type == "object":
16
- properties_spec = schema_def.get("properties", {})
17
- properties = {}
18
- for key in properties_spec:
19
- properties[key] = _to_schema(
20
- definition_stack=definition_stack,
21
- schema_def=properties_spec[key],
22
- definitions=definitions,
23
- )
24
- schema = openapi.Object(
25
- title=schema_def.get("title"),
26
- description=schema_def.get("description"),
27
- required=schema_def.get("required"),
28
- properties=properties,
29
- )
30
- elif type == "array":
31
- schema = openapi.Array(
32
- description=schema_def.get("description"),
33
- required=schema_def.get("required"),
34
- items=_to_schema(
35
- definition_stack=definition_stack,
36
- schema_def=schema_def.get("items"),
37
- definitions=definitions,
38
- ),
39
- )
40
- elif type is None:
41
- if allof_spec := schema_def.get("allOf"): # Model, Enum
42
- definition = allof_spec[0]["$ref"].split("/")[-1]
43
- definition_data = definitions.get(definition)
44
- if definition_data is None:
45
- schema = openapi.Object(
46
- title=definition, description=schema_def.get("description")
47
- )
48
- else:
49
- schema = (
50
- _to_schema(
51
- definition_stack=definition_stack + [definition],
52
- schema_def={**definition_data},
53
- definitions=definitions,
54
- )
55
- if definition not in definition_stack
56
- else openapi.Object(
57
- title=definition, description=schema_def.get("description")
58
- )
59
- )
60
-
61
- elif anyof_spec := schema_def.get("anyOf"): # Union
62
- anyof = []
63
- for any in anyof_spec:
64
- if any.get("type"):
65
- schema_type_obj = Schema(
66
- **{
67
- "type": any.get("type"),
68
- "description": any.get("description"),
69
- }
70
- )
71
- anyof.append(schema_type_obj)
72
- else:
73
- definition = any["$ref"].split("/")[-1]
74
- if definition not in definition_stack:
75
- definition_data = definitions.get(definition)
76
- if definition_data is not None:
77
- anyof.append(
78
- _to_schema(
79
- definition_stack=definition_stack + [definition],
80
- schema_def=definition_data,
81
- definitions=definitions,
82
- )
83
- )
84
- else:
85
- anyof.append(
86
- openapi.Object(
87
- title=definition,
88
- description=schema_def.get(
89
- "description", definition
90
- ),
91
- properties={},
92
- )
93
- )
94
- else:
95
- anyof.append(
96
- openapi.Object(
97
- title=definition,
98
- description=schema_def.get("description", definition),
99
- properties={},
100
- )
101
- )
102
- schema = Schema(anyOf=anyof)
103
- elif ref := schema_def.get("$ref"): # $ref
104
- definition = ref.split("/")[-1]
105
- definition_data = definitions.get(definition)
106
- if definition_data is not None:
107
- schema = _to_schema(
108
- definition_stack=definition_stack,
109
- schema_def=definition_data,
110
- definitions=definitions,
111
- )
112
- else:
113
- schema = openapi.Object(
114
- title=definition, description=schema_def.get("description")
115
- )
116
- else: # Any type
117
- schema = Schema(
118
- **{"type": "object", "description": schema_def.get("description")}
119
- )
120
-
121
- else:
122
- schema_spec = {
123
- "type": schema_def.get("type"),
124
- "description": schema_def.get("description"),
125
- }
126
- for spec in _SUPPORTED_ATTRIBUTES:
127
- if schema_def.get(spec):
128
- schema_spec[spec] = schema_def.get(spec)
129
- schema = Schema(**schema_spec)
130
-
131
- return schema
132
-
133
-
134
- def model_to_schema(model: Type[BaseModel]) -> Schema:
135
- schema = model.model_json_schema()
136
- # Handle both $defs (newer JSON Schema) and definitions (older JSON Schema)
137
- definitions = schema.get("$defs") or schema.get("definitions") or {}
138
- return _to_schema(
139
- definition_stack=[],
140
- schema_def=dict(
141
- filter(lambda key: key[0] not in ("definitions", "$defs"), schema.items())
142
- ),
143
- definitions=definitions,
144
- )