rasa-pro 3.13.0.dev3__py3-none-any.whl → 3.13.0.dev7__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 (228) hide show
  1. rasa/__main__.py +3 -1
  2. rasa/api.py +4 -0
  3. rasa/cli/arguments/default_arguments.py +13 -1
  4. rasa/cli/arguments/train.py +2 -0
  5. rasa/cli/evaluate.py +1 -1
  6. rasa/cli/export.py +2 -2
  7. rasa/cli/inspect.py +8 -4
  8. rasa/cli/project_templates/default/config.yml +5 -32
  9. rasa/cli/project_templates/{calm → default}/e2e_tests/cancelations/user_cancels_during_a_correction.yml +1 -1
  10. rasa/cli/project_templates/{calm → default}/e2e_tests/cancelations/user_changes_mind_on_a_whim.yml +1 -1
  11. rasa/cli/project_templates/{calm → default}/e2e_tests/corrections/user_corrects_contact_handle.yml +1 -1
  12. rasa/cli/project_templates/{calm → default}/e2e_tests/corrections/user_corrects_contact_name.yml +1 -1
  13. rasa/cli/project_templates/{calm → default}/e2e_tests/happy_paths/user_adds_contact_to_their_list.yml +1 -1
  14. rasa/cli/project_templates/{calm → default}/e2e_tests/happy_paths/user_lists_contacts.yml +1 -1
  15. rasa/cli/project_templates/{calm → default}/e2e_tests/happy_paths/user_removes_contact.yml +1 -1
  16. rasa/cli/project_templates/{calm → default}/e2e_tests/happy_paths/user_removes_contact_from_list.yml +1 -1
  17. rasa/cli/project_templates/default/endpoints.yml +18 -2
  18. rasa/cli/scaffold.py +3 -4
  19. rasa/cli/studio/download.py +1 -1
  20. rasa/cli/studio/upload.py +0 -6
  21. rasa/cli/train.py +1 -0
  22. rasa/constants.py +2 -0
  23. rasa/core/agent.py +2 -2
  24. rasa/core/brokers/kafka.py +4 -0
  25. rasa/core/brokers/pika.py +4 -0
  26. rasa/core/brokers/sql.py +1 -1
  27. rasa/core/channels/channel.py +68 -5
  28. rasa/core/channels/inspector/.eslintrc.cjs +12 -6
  29. rasa/core/channels/inspector/.prettierrc +5 -0
  30. rasa/core/channels/inspector/README.md +10 -4
  31. rasa/core/channels/inspector/dist/assets/{arc-c7691751.js → arc-c4b064fc.js} +1 -1
  32. rasa/core/channels/inspector/dist/assets/{blockDiagram-38ab4fdb-ab99dff7.js → blockDiagram-38ab4fdb-215b5026.js} +1 -1
  33. rasa/core/channels/inspector/dist/assets/{c4Diagram-3d4e48cf-08c35a6b.js → c4Diagram-3d4e48cf-2b54a0a3.js} +1 -1
  34. rasa/core/channels/inspector/dist/assets/channel-3730f5fd.js +1 -0
  35. rasa/core/channels/inspector/dist/assets/{classDiagram-70f12bd4-9e9c71c9.js → classDiagram-70f12bd4-daacea5f.js} +1 -1
  36. rasa/core/channels/inspector/dist/assets/{classDiagram-v2-f2320105-15e7e2bf.js → classDiagram-v2-f2320105-930d4dc2.js} +1 -1
  37. rasa/core/channels/inspector/dist/assets/clone-e847561e.js +1 -0
  38. rasa/core/channels/inspector/dist/assets/{createText-2e5e7dd3-9c105cb1.js → createText-2e5e7dd3-83c206ba.js} +1 -1
  39. rasa/core/channels/inspector/dist/assets/{edges-e0da2a9e-77e89e48.js → edges-e0da2a9e-b0eb01d0.js} +1 -1
  40. rasa/core/channels/inspector/dist/assets/{erDiagram-9861fffd-7a011646.js → erDiagram-9861fffd-17586500.js} +1 -1
  41. rasa/core/channels/inspector/dist/assets/{flowDb-956e92f1-b6f105ac.js → flowDb-956e92f1-be2a1776.js} +1 -1
  42. rasa/core/channels/inspector/dist/assets/{flowDiagram-66a62f08-ce4f18c2.js → flowDiagram-66a62f08-c2120ebd.js} +1 -1
  43. rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-efbbfe00.js +1 -0
  44. rasa/core/channels/inspector/dist/assets/{flowchart-elk-definition-4a651766-cb5f6da4.js → flowchart-elk-definition-4a651766-a6ab5c48.js} +1 -1
  45. rasa/core/channels/inspector/dist/assets/{ganttDiagram-c361ad54-e4d19e28.js → ganttDiagram-c361ad54-ef613457.js} +1 -1
  46. rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-72cf32ee-727b1c33.js → gitGraphDiagram-72cf32ee-d59185b3.js} +1 -1
  47. rasa/core/channels/inspector/dist/assets/{graph-6e2ab9a7.js → graph-0f155405.js} +1 -1
  48. rasa/core/channels/inspector/dist/assets/{index-3862675e-84ec700f.js → index-3862675e-d5f1d1b7.js} +1 -1
  49. rasa/core/channels/inspector/dist/assets/{index-098a1a24.js → index-47737d3a.js} +162 -149
  50. rasa/core/channels/inspector/dist/assets/{infoDiagram-f8f76790-78dda442.js → infoDiagram-f8f76790-b07d141f.js} +1 -1
  51. rasa/core/channels/inspector/dist/assets/{journeyDiagram-49397b02-f1cc6dd1.js → journeyDiagram-49397b02-1936d429.js} +1 -1
  52. rasa/core/channels/inspector/dist/assets/{layout-d98dcd0c.js → layout-dde8d0f3.js} +1 -1
  53. rasa/core/channels/inspector/dist/assets/{line-838e3d82.js → line-0c2c7ee0.js} +1 -1
  54. rasa/core/channels/inspector/dist/assets/{linear-eae72406.js → linear-35dd89a4.js} +1 -1
  55. rasa/core/channels/inspector/dist/assets/{mindmap-definition-fc14e90a-c96fd84b.js → mindmap-definition-fc14e90a-56192851.js} +1 -1
  56. rasa/core/channels/inspector/dist/assets/{pieDiagram-8a3498a8-c936d4e2.js → pieDiagram-8a3498a8-fc21ed78.js} +1 -1
  57. rasa/core/channels/inspector/dist/assets/{quadrantDiagram-120e2f19-b338eb8f.js → quadrantDiagram-120e2f19-25e98518.js} +1 -1
  58. rasa/core/channels/inspector/dist/assets/{requirementDiagram-deff3bca-c6b6c0d5.js → requirementDiagram-deff3bca-546ff1f5.js} +1 -1
  59. rasa/core/channels/inspector/dist/assets/{sankeyDiagram-04a897e0-b9372e19.js → sankeyDiagram-04a897e0-02d8b82d.js} +1 -1
  60. rasa/core/channels/inspector/dist/assets/{sequenceDiagram-704730f1-479e0a3f.js → sequenceDiagram-704730f1-3ca5a92e.js} +1 -1
  61. rasa/core/channels/inspector/dist/assets/{stateDiagram-587899a1-fd26eebc.js → stateDiagram-587899a1-128ea07c.js} +1 -1
  62. rasa/core/channels/inspector/dist/assets/{stateDiagram-v2-d93cdb3a-3233e0ae.js → stateDiagram-v2-d93cdb3a-95f290af.js} +1 -1
  63. rasa/core/channels/inspector/dist/assets/{styles-6aaf32cf-1fdd392b.js → styles-6aaf32cf-4984898a.js} +1 -1
  64. rasa/core/channels/inspector/dist/assets/{styles-9a916d00-6d7bfa1b.js → styles-9a916d00-1bf266ba.js} +1 -1
  65. rasa/core/channels/inspector/dist/assets/{styles-c10674c1-f86aab11.js → styles-c10674c1-60521c63.js} +1 -1
  66. rasa/core/channels/inspector/dist/assets/{svgDrawCommon-08f97a94-e3e49d7a.js → svgDrawCommon-08f97a94-a25b6e12.js} +1 -1
  67. rasa/core/channels/inspector/dist/assets/{timeline-definition-85554ec2-6fe08b4d.js → timeline-definition-85554ec2-0fc086bf.js} +1 -1
  68. rasa/core/channels/inspector/dist/assets/{xychartDiagram-e933f94c-c2e06fd6.js → xychartDiagram-e933f94c-44ee592e.js} +1 -1
  69. rasa/core/channels/inspector/dist/index.html +1 -1
  70. rasa/core/channels/inspector/package.json +3 -1
  71. rasa/core/channels/inspector/src/App.tsx +92 -90
  72. rasa/core/channels/inspector/src/components/Chat.tsx +61 -36
  73. rasa/core/channels/inspector/src/components/DiagramFlow.tsx +40 -43
  74. rasa/core/channels/inspector/src/components/DialogueInformation.tsx +57 -57
  75. rasa/core/channels/inspector/src/components/DialogueStack.tsx +36 -27
  76. rasa/core/channels/inspector/src/components/ExpandIcon.tsx +4 -4
  77. rasa/core/channels/inspector/src/components/FullscreenButton.tsx +7 -7
  78. rasa/core/channels/inspector/src/components/LoadingSpinner.tsx +28 -12
  79. rasa/core/channels/inspector/src/components/NoActiveFlow.tsx +9 -9
  80. rasa/core/channels/inspector/src/components/RasaLogo.tsx +5 -5
  81. rasa/core/channels/inspector/src/components/RecruitmentPanel.tsx +55 -60
  82. rasa/core/channels/inspector/src/components/SaraDiagrams.tsx +5 -5
  83. rasa/core/channels/inspector/src/components/Slots.tsx +22 -22
  84. rasa/core/channels/inspector/src/components/Welcome.tsx +28 -31
  85. rasa/core/channels/inspector/src/helpers/audio/audiostream.ts +245 -0
  86. rasa/core/channels/inspector/src/helpers/audio/microphone-processor.js +12 -0
  87. rasa/core/channels/inspector/src/helpers/audio/playback-processor.js +36 -0
  88. rasa/core/channels/inspector/src/helpers/conversation.ts +16 -0
  89. rasa/core/channels/inspector/src/helpers/formatters.test.ts +181 -181
  90. rasa/core/channels/inspector/src/helpers/formatters.ts +111 -111
  91. rasa/core/channels/inspector/src/helpers/utils.ts +78 -61
  92. rasa/core/channels/inspector/src/main.tsx +8 -8
  93. rasa/core/channels/inspector/src/theme/Button/Button.ts +8 -8
  94. rasa/core/channels/inspector/src/theme/Heading/Heading.ts +7 -7
  95. rasa/core/channels/inspector/src/theme/Input/Input.ts +9 -9
  96. rasa/core/channels/inspector/src/theme/Link/Link.ts +6 -6
  97. rasa/core/channels/inspector/src/theme/Modal/Modal.ts +13 -13
  98. rasa/core/channels/inspector/src/theme/Table/Table.tsx +10 -10
  99. rasa/core/channels/inspector/src/theme/Tooltip/Tooltip.ts +5 -5
  100. rasa/core/channels/inspector/src/theme/base/breakpoints.ts +7 -7
  101. rasa/core/channels/inspector/src/theme/base/colors.ts +64 -64
  102. rasa/core/channels/inspector/src/theme/base/fonts/fontFaces.css +21 -18
  103. rasa/core/channels/inspector/src/theme/base/radii.ts +8 -8
  104. rasa/core/channels/inspector/src/theme/base/shadows.ts +5 -5
  105. rasa/core/channels/inspector/src/theme/base/sizes.ts +5 -5
  106. rasa/core/channels/inspector/src/theme/base/space.ts +12 -12
  107. rasa/core/channels/inspector/src/theme/base/styles.ts +5 -5
  108. rasa/core/channels/inspector/src/theme/base/typography.ts +12 -12
  109. rasa/core/channels/inspector/src/theme/base/zIndices.ts +3 -3
  110. rasa/core/channels/inspector/src/theme/index.ts +38 -38
  111. rasa/core/channels/inspector/src/types.ts +56 -50
  112. rasa/core/channels/inspector/yarn.lock +5 -0
  113. rasa/core/channels/voice_ready/audiocodes.py +75 -32
  114. rasa/core/channels/voice_ready/twilio_voice.py +48 -1
  115. rasa/core/channels/voice_stream/tts/azure.py +11 -2
  116. rasa/core/channels/voice_stream/twilio_media_streams.py +101 -26
  117. rasa/core/channels/voice_stream/voice_channel.py +28 -2
  118. rasa/core/concurrent_lock_store.py +24 -10
  119. rasa/core/evaluation/marker_tracker_loader.py +1 -1
  120. rasa/core/exporter.py +1 -1
  121. rasa/core/lock_store.py +151 -60
  122. rasa/core/nlg/contextual_response_rephraser.py +4 -2
  123. rasa/core/nlg/summarize.py +1 -1
  124. rasa/core/persistor.py +55 -20
  125. rasa/core/policies/enterprise_search_policy.py +7 -4
  126. rasa/core/policies/intentless_policy.py +15 -9
  127. rasa/core/processor.py +2 -2
  128. rasa/core/run.py +7 -2
  129. rasa/core/{auth_retry_tracker_store.py → tracker_stores/auth_retry_tracker_store.py} +5 -1
  130. rasa/core/tracker_stores/dynamo_tracker_store.py +218 -0
  131. rasa/core/tracker_stores/mongo_tracker_store.py +206 -0
  132. rasa/core/tracker_stores/redis_tracker_store.py +219 -0
  133. rasa/core/tracker_stores/sql_tracker_store.py +555 -0
  134. rasa/core/tracker_stores/tracker_store.py +805 -0
  135. rasa/core/utils.py +6 -0
  136. rasa/dialogue_understanding/coexistence/llm_based_router.py +8 -3
  137. rasa/dialogue_understanding/commands/clarify_command.py +2 -2
  138. rasa/dialogue_understanding/commands/knowledge_answer_command.py +2 -2
  139. rasa/dialogue_understanding/generator/constants.py +2 -2
  140. rasa/dialogue_understanding/generator/llm_based_command_generator.py +1 -1
  141. rasa/dialogue_understanding/generator/prompt_templates/command_prompt_v2_gpt_4o_2024_11_20_template.jinja2 +33 -12
  142. rasa/dialogue_understanding/generator/single_step/compact_llm_command_generator.py +2 -2
  143. rasa/dialogue_understanding_test/du_test_case.py +16 -8
  144. rasa/hooks.py +2 -2
  145. rasa/keys +1 -0
  146. rasa/llm_fine_tuning/paraphrasing/conversation_rephraser.py +4 -2
  147. rasa/model_manager/config.py +3 -1
  148. rasa/model_manager/model_api.py +1 -2
  149. rasa/model_manager/runner_service.py +8 -4
  150. rasa/model_manager/trainer_service.py +1 -0
  151. rasa/model_training.py +12 -3
  152. rasa/nlu/extractors/crf_entity_extractor.py +66 -16
  153. rasa/plugin.py +1 -4
  154. rasa/server.py +6 -2
  155. rasa/shared/constants.py +4 -0
  156. rasa/shared/core/domain.py +165 -11
  157. rasa/shared/core/events.py +68 -2
  158. rasa/shared/core/flows/flow.py +155 -131
  159. rasa/shared/core/flows/flow_step.py +19 -3
  160. rasa/shared/core/flows/flow_step_links.py +15 -0
  161. rasa/shared/core/flows/flow_step_sequence.py +6 -0
  162. rasa/shared/core/flows/nlu_trigger.py +13 -0
  163. rasa/shared/core/flows/steps/action.py +7 -4
  164. rasa/shared/core/flows/steps/call.py +11 -4
  165. rasa/shared/core/flows/steps/collect.py +27 -6
  166. rasa/shared/core/flows/steps/internal.py +6 -1
  167. rasa/shared/core/flows/steps/link.py +7 -4
  168. rasa/shared/core/flows/steps/no_operation.py +7 -4
  169. rasa/shared/core/flows/steps/set_slots.py +8 -4
  170. rasa/shared/core/flows/yaml_flows_io.py +106 -5
  171. rasa/shared/importers/importer.py +8 -0
  172. rasa/shared/providers/_configs/azure_openai_client_config.py +4 -0
  173. rasa/shared/providers/_configs/openai_client_config.py +4 -0
  174. rasa/shared/providers/_utils.py +83 -0
  175. rasa/shared/providers/embedding/_base_litellm_embedding_client.py +3 -0
  176. rasa/shared/providers/llm/_base_litellm_client.py +11 -5
  177. rasa/shared/providers/llm/azure_openai_llm_client.py +6 -68
  178. rasa/shared/providers/router/_base_litellm_router_client.py +53 -1
  179. rasa/shared/utils/common.py +42 -0
  180. rasa/studio/download/__init__.py +0 -0
  181. rasa/studio/download/domains.py +49 -0
  182. rasa/studio/download/download.py +439 -0
  183. rasa/studio/download/flows.py +359 -0
  184. rasa/studio/results_logger.py +6 -1
  185. rasa/studio/upload.py +69 -5
  186. rasa/telemetry.py +2 -2
  187. rasa/tracing/config.py +1 -1
  188. rasa/tracing/instrumentation/attribute_extractors.py +1 -1
  189. rasa/tracing/instrumentation/instrumentation.py +1 -1
  190. rasa/utils/common.py +36 -0
  191. rasa/utils/endpoints.py +22 -1
  192. rasa/utils/licensing.py +2 -3
  193. rasa/validator.py +1 -2
  194. rasa/version.py +1 -1
  195. {rasa_pro-3.13.0.dev3.dist-info → rasa_pro-3.13.0.dev7.dist-info}/METADATA +10 -10
  196. {rasa_pro-3.13.0.dev3.dist-info → rasa_pro-3.13.0.dev7.dist-info}/RECORD +213 -210
  197. rasa/cli/project_templates/calm/config.yml +0 -10
  198. rasa/cli/project_templates/calm/credentials.yml +0 -33
  199. rasa/cli/project_templates/calm/endpoints.yml +0 -58
  200. rasa/cli/project_templates/default/actions/actions.py +0 -27
  201. rasa/cli/project_templates/default/data/nlu.yml +0 -91
  202. rasa/cli/project_templates/default/data/rules.yml +0 -13
  203. rasa/cli/project_templates/default/data/stories.yml +0 -30
  204. rasa/cli/project_templates/default/domain.yml +0 -34
  205. rasa/cli/project_templates/default/tests/test_stories.yml +0 -91
  206. rasa/core/channels/inspector/dist/assets/channel-11268142.js +0 -1
  207. rasa/core/channels/inspector/dist/assets/clone-ff7f2ce7.js +0 -1
  208. rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-cba7ae20.js +0 -1
  209. rasa/core/channels/inspector/src/helpers/audiostream.ts +0 -191
  210. rasa/core/tracker_store.py +0 -1792
  211. rasa/studio/download.py +0 -489
  212. /rasa/cli/project_templates/{calm → default}/actions/action_template.py +0 -0
  213. /rasa/cli/project_templates/{calm → default}/actions/add_contact.py +0 -0
  214. /rasa/cli/project_templates/{calm → default}/actions/db.py +0 -0
  215. /rasa/cli/project_templates/{calm → default}/actions/list_contacts.py +0 -0
  216. /rasa/cli/project_templates/{calm → default}/actions/remove_contact.py +0 -0
  217. /rasa/cli/project_templates/{calm → default}/data/flows/add_contact.yml +0 -0
  218. /rasa/cli/project_templates/{calm → default}/data/flows/list_contacts.yml +0 -0
  219. /rasa/cli/project_templates/{calm → default}/data/flows/remove_contact.yml +0 -0
  220. /rasa/cli/project_templates/{calm → default}/db/contacts.json +0 -0
  221. /rasa/cli/project_templates/{calm → default}/domain/add_contact.yml +0 -0
  222. /rasa/cli/project_templates/{calm → default}/domain/list_contacts.yml +0 -0
  223. /rasa/cli/project_templates/{calm → default}/domain/remove_contact.yml +0 -0
  224. /rasa/cli/project_templates/{calm → default}/domain/shared.yml +0 -0
  225. /rasa/{cli/project_templates/calm/actions → core/tracker_stores}/__init__.py +0 -0
  226. {rasa_pro-3.13.0.dev3.dist-info → rasa_pro-3.13.0.dev7.dist-info}/NOTICE +0 -0
  227. {rasa_pro-3.13.0.dev3.dist-info → rasa_pro-3.13.0.dev7.dist-info}/WHEEL +0 -0
  228. {rasa_pro-3.13.0.dev3.dist-info → rasa_pro-3.13.0.dev7.dist-info}/entry_points.txt +0 -0
@@ -4,61 +4,61 @@ import {
4
4
  useTheme,
5
5
  ChakraTheme,
6
6
  type ThemeConfig,
7
- } from "@chakra-ui/react";
8
- import { breakpoints, Breakpoints } from "./base/breakpoints";
9
- import { rasaColors, RasaColors } from "./base/colors";
10
- import { rasaRadii, RasaRadii } from "./base/radii";
11
- import { rasaShadows, RasaShadows } from "./base/shadows";
12
- import { rasaSizes, RasaSizes } from "./base/sizes";
13
- import { rasaSpace, RasaSpace } from "./base/space";
14
- import { rasaZIndices, RasaZIndices } from "./base/zIndices";
15
- import { styles } from "./base/styles";
7
+ } from '@chakra-ui/react'
8
+ import { breakpoints, Breakpoints } from './base/breakpoints'
9
+ import { rasaColors, RasaColors } from './base/colors'
10
+ import { rasaRadii, RasaRadii } from './base/radii'
11
+ import { rasaShadows, RasaShadows } from './base/shadows'
12
+ import { rasaSizes, RasaSizes } from './base/sizes'
13
+ import { rasaSpace, RasaSpace } from './base/space'
14
+ import { rasaZIndices, RasaZIndices } from './base/zIndices'
15
+ import { styles } from './base/styles'
16
16
  import {
17
17
  fonts,
18
18
  rasaFontSizes,
19
19
  rasaFontWeights,
20
20
  RasaFontSizes,
21
21
  RasaFontWeights,
22
- } from "./base/typography";
22
+ } from './base/typography'
23
23
 
24
24
  // Custom components
25
- import { Button } from "./Button/Button";
26
- import { Heading } from "./Heading/Heading";
27
- import { Input } from "./Input/Input";
28
- import { Link } from "./Link/Link";
29
- import { Table } from "./Table/Table";
30
- import { Modal } from "./Modal/Modal";
31
- import { Tooltip } from "./Tooltip/Tooltip";
25
+ import { Button } from './Button/Button'
26
+ import { Heading } from './Heading/Heading'
27
+ import { Input } from './Input/Input'
28
+ import { Link } from './Link/Link'
29
+ import { Table } from './Table/Table'
30
+ import { Modal } from './Modal/Modal'
31
+ import { Tooltip } from './Tooltip/Tooltip'
32
32
 
33
33
  export interface CustomTheme {
34
34
  // default types
35
- config: ThemeConfig;
36
- semanticTokens: ChakraTheme["semanticTokens"];
37
- direction: ChakraTheme["direction"];
38
- transition: ChakraTheme["transition"];
35
+ config: ThemeConfig
36
+ semanticTokens: ChakraTheme['semanticTokens']
37
+ direction: ChakraTheme['direction']
38
+ transition: ChakraTheme['transition']
39
39
 
40
40
  // we merge & override
41
- styles: ChakraTheme["styles"];
42
- fonts: RasaFontSizes;
43
- breakpoints: Breakpoints;
41
+ styles: ChakraTheme['styles']
42
+ fonts: RasaFontSizes
43
+ breakpoints: Breakpoints
44
44
 
45
45
  // we also merge & override, but use custom color names
46
- colors: RasaColors;
46
+ colors: RasaColors
47
47
 
48
48
  // custom key & types
49
- rasaFontSizes: RasaFontSizes;
50
- rasaFontWeights: RasaFontWeights;
51
- rasaRadii: RasaRadii;
52
- rasaSpace: RasaSpace;
53
- rasaShadows: RasaShadows;
54
- rasaSizes: RasaSizes;
55
- zIndices: ChakraTheme["zIndices"] & RasaZIndices;
49
+ rasaFontSizes: RasaFontSizes
50
+ rasaFontWeights: RasaFontWeights
51
+ rasaRadii: RasaRadii
52
+ rasaSpace: RasaSpace
53
+ rasaShadows: RasaShadows
54
+ rasaSizes: RasaSizes
55
+ zIndices: ChakraTheme['zIndices'] & RasaZIndices
56
56
  }
57
57
 
58
58
  const config: ThemeConfig = {
59
- initialColorMode: "light",
59
+ initialColorMode: 'light',
60
60
  useSystemColorMode: false,
61
- };
61
+ }
62
62
 
63
63
  // Extend theme deep merges with the default Chakra theme.
64
64
  // We try to keep many defaults in tact to support
@@ -93,9 +93,9 @@ export const theme = extendTheme(
93
93
  rasaSizes,
94
94
  zIndices: rasaZIndices,
95
95
  },
96
- withDefaultColorScheme({ colorScheme: "rasaPurple" })
97
- );
96
+ withDefaultColorScheme({ colorScheme: 'rasaPurple' }),
97
+ )
98
98
 
99
99
  export const useOurTheme = () => {
100
- return useTheme<CustomTheme>();
101
- };
100
+ return useTheme<CustomTheme>()
101
+ }
@@ -1,84 +1,90 @@
1
1
  export interface Slot {
2
- name: string;
2
+ name: string
3
3
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
- value: any;
4
+ value: any
5
5
  }
6
6
 
7
7
  export interface Event {
8
- event: "user" | "bot" | "flow_completed" | "flow_started" | "stack" | "restart";
9
- text?: string;
10
- timestamp: string;
11
- update?: string;
12
- parse_data?: { commands: Command[] };
13
- metadata?: { utter_action?: string };
8
+ event:
9
+ | 'user'
10
+ | 'bot'
11
+ | 'flow_completed'
12
+ | 'flow_started'
13
+ | 'stack'
14
+ | 'restart'
15
+ | 'session_ended'
16
+ text?: string
17
+ timestamp: string
18
+ update?: string
19
+ parse_data?: { commands: Command[] }
20
+ metadata?: { utter_action?: string }
14
21
  }
15
22
 
16
23
  export interface Command {
17
- command: string;
18
- flow?: string;
19
- name?: string;
20
- value?: string;
24
+ command: string
25
+ flow?: string
26
+ name?: string
27
+ value?: string
21
28
  }
22
29
 
23
30
  export interface SelectedStack {
24
- stack: Stack;
25
- activatedSteps: string[];
26
- isUserSelected: boolean;
31
+ stack: Stack
32
+ activatedSteps: string[]
33
+ isUserSelected: boolean
27
34
  }
28
35
 
29
36
  export interface Stack {
30
- frame_id: string;
31
- flow_id: string;
32
- step_id: string;
33
- collect?: string;
34
- utter?: string;
35
- ended: boolean;
37
+ frame_id: string
38
+ flow_id: string
39
+ step_id: string
40
+ collect?: string
41
+ utter?: string
42
+ ended: boolean
36
43
  }
37
44
 
38
45
  export interface Tracker {
39
- sender_id: string;
40
- slots: { [key: string]: unknown };
41
- events: Event[];
42
- stack: Stack[];
46
+ sender_id: string
47
+ slots: { [key: string]: unknown }
48
+ events: Event[]
49
+ stack: Stack[]
43
50
  }
44
51
 
45
-
46
52
  export interface Flow {
47
- id: string;
48
- description: string;
49
- name: string;
50
- steps: Step[];
53
+ id: string
54
+ description: string
55
+ name: string
56
+ steps: Step[]
51
57
  }
52
58
 
53
59
  interface NextStepThen {
54
- action: string;
55
- id: string;
56
- next: string;
57
- set_slots: unknown[];
60
+ action: string
61
+ id: string
62
+ next: string
63
+ set_slots: unknown[]
58
64
  }
59
65
 
60
66
  interface NextStepIf {
61
- if: string;
62
- then: NextStepThen[];
67
+ if: string
68
+ then: NextStepThen[]
63
69
  }
64
70
 
65
71
  interface NextStepElse {
66
- if: string;
67
- then: NextStepThen[];
68
- else: string;
72
+ if: string
73
+ then: NextStepThen[]
74
+ else: string
69
75
  }
70
76
 
71
- export type NextStep = NextStepIf | NextStepElse;
77
+ export type NextStep = NextStepIf | NextStepElse
72
78
 
73
79
  interface Step {
74
- ask_before_filling: boolean;
75
- collect: string;
76
- action: string;
77
- link: string;
78
- description: string;
79
- id: string;
80
- next: string | NextStep[];
81
- reset_after_flow_ends: boolean;
82
- utter: string;
83
- set_slots?: unknown;
80
+ ask_before_filling: boolean
81
+ collect: string
82
+ action: string
83
+ link: string
84
+ description: string
85
+ id: string
86
+ next: string | NextStep[]
87
+ reset_after_flow_ends: boolean
88
+ utter: string
89
+ set_slots?: unknown
84
90
  }
@@ -5280,6 +5280,11 @@ prelude-ls@^1.2.1:
5280
5280
  resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396"
5281
5281
  integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==
5282
5282
 
5283
+ prettier@^3.5.3:
5284
+ version "3.5.3"
5285
+ resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.5.3.tgz#4fc2ce0d657e7a02e602549f053b239cb7dfe1b5"
5286
+ integrity sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw==
5287
+
5283
5288
  pretty-format@^27.0.2:
5284
5289
  version "27.5.1"
5285
5290
  resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-27.5.1.tgz#2181879fdea51a7a5851fb39d920faa63f01d88e"
@@ -6,7 +6,18 @@ import uuid
6
6
  from collections import defaultdict
7
7
  from dataclasses import asdict
8
8
  from datetime import datetime, timedelta, timezone
9
- from typing import Any, Awaitable, Callable, Dict, List, Optional, Set, Text, Union
9
+ from typing import (
10
+ Any,
11
+ Awaitable,
12
+ Callable,
13
+ Dict,
14
+ List,
15
+ Optional,
16
+ Set,
17
+ Text,
18
+ Tuple,
19
+ Union,
20
+ )
10
21
 
11
22
  import structlog
12
23
  from jsonschema import ValidationError, validate
@@ -76,32 +87,45 @@ class Conversation:
76
87
 
77
88
  @staticmethod
78
89
  def get_metadata(activity: Dict[Text, Any]) -> Optional[Dict[Text, Any]]:
79
- """Get metadata from the activity."""
80
- return asdict(map_call_params(activity["parameters"]))
90
+ """Get metadata from the activity.
91
+
92
+ ONLY used for activities NOT for events (see _handle_event)."""
93
+ return activity.get("parameters")
81
94
 
82
95
  @staticmethod
83
- def _handle_event(event: Dict[Text, Any]) -> Text:
84
- """Handle start and DTMF event and return the corresponding text."""
96
+ def _handle_event(event: Dict[Text, Any]) -> Tuple[Text, Dict[Text, Any]]:
97
+ """Handle events and return a tuple of text and metadata.
98
+
99
+ Args:
100
+ event: The event to handle.
101
+
102
+ Returns:
103
+ Tuple of text and metadata.
104
+ text is either /session_start or /vaig_event_<event_name>
105
+ metadata is a dictionary with the event parameters.
106
+ """
85
107
  structlogger.debug("audiocodes.handle.event", event_payload=event)
86
108
  if "name" not in event:
87
109
  structlogger.warning(
88
110
  "audiocodes.handle.event.no_name_key", event_payload=event
89
111
  )
90
- return ""
112
+ return "", {}
91
113
 
92
114
  if event["name"] == EVENT_START:
93
115
  text = f"{INTENT_MESSAGE_PREFIX}{USER_INTENT_SESSION_START}"
116
+ metadata = asdict(map_call_params(event.get("parameters", {})))
94
117
  elif event["name"] == EVENT_DTMF:
95
118
  text = f"{INTENT_MESSAGE_PREFIX}vaig_event_DTMF"
96
- event_params = {"value": event["value"]}
97
- text += json.dumps(event_params)
119
+ metadata = {"value": event["value"]}
98
120
  else:
99
- structlogger.warning(
100
- "audiocodes.handle.event.unknown_event", event_payload=event
101
- )
102
- return ""
121
+ # handle other events described by Audiocodes
122
+ # https://techdocs.audiocodes.com/voice-ai-connect/#VAIG_Combined/inactivity-detection.htm?TocPath=Bot%2520integration%257CReceiving%2520notifications%257C_____3
123
+ text = f"{INTENT_MESSAGE_PREFIX}vaig_event_{event['name']}"
124
+ metadata = {**event.get("parameters", {})}
125
+ if "value" in event:
126
+ metadata["value"] = event["value"]
103
127
 
104
- return text
128
+ return text, metadata
105
129
 
106
130
  def is_active_conversation(self, now: datetime, delta: timedelta) -> bool:
107
131
  """Check if the conversation is active."""
@@ -136,21 +160,29 @@ class Conversation:
136
160
  structlogger.warning(
137
161
  "audiocodes.handle.activities.duplicate_activity",
138
162
  activity_id=activity[ACTIVITY_ID_KEY],
163
+ event_info=(
164
+ "Audiocodes might send duplicate activities if the bot has not "
165
+ "responded to the previous one or responded too late. Please "
166
+ "consider enabling the `use_websocket` option to use"
167
+ " Audiocodes Asynchronous API."
168
+ ),
139
169
  )
140
170
  continue
141
171
  self.activity_ids.append(activity[ACTIVITY_ID_KEY])
142
172
  if activity["type"] == ACTIVITY_MESSAGE:
143
173
  text = activity["text"]
174
+ metadata = self.get_metadata(activity)
144
175
  elif activity["type"] == ACTIVITY_EVENT:
145
- text = self._handle_event(activity)
176
+ text, metadata = self._handle_event(activity)
146
177
  else:
147
178
  structlogger.warning(
148
179
  "audiocodes.handle.activities.unknown_activity_type",
149
180
  activity=activity,
150
181
  )
182
+ continue
183
+
151
184
  if not text:
152
185
  continue
153
- metadata = self.get_metadata(activity)
154
186
  user_msg = UserMessage(
155
187
  text=text,
156
188
  input_channel=input_channel_name,
@@ -389,30 +421,41 @@ class AudiocodesInput(InputChannel):
389
421
  "audiocodes.on_activities.no_conversation", request=request.json
390
422
  )
391
423
  return response.json({})
392
- elif conversation.ws:
424
+
425
+ if self.use_websocket:
426
+ # send an empty response for this request
427
+ # activities are processed in the background
428
+ # chat response is sent via the websocket
393
429
  ac_output: Union[WebsocketOutput, AudiocodesOutput] = WebsocketOutput(
394
430
  conversation.ws, conversation_id
395
431
  )
396
- response_json = {}
397
- else:
398
- # handle non websocket case where messages get returned in json
399
- ac_output = AudiocodesOutput()
400
- response_json = {
432
+ self._create_task(
433
+ conversation_id,
434
+ conversation.handle_activities(
435
+ request.json,
436
+ input_channel_name=self.name(),
437
+ output_channel=ac_output,
438
+ on_new_message=on_new_message,
439
+ ),
440
+ )
441
+ return response.json({})
442
+
443
+ # without websockets, this becomes a blocking call
444
+ # and the response is sent back to the Audiocodes server
445
+ # after the activities are processed
446
+ ac_output = AudiocodesOutput()
447
+ await conversation.handle_activities(
448
+ request.json,
449
+ input_channel_name=self.name(),
450
+ output_channel=ac_output,
451
+ on_new_message=on_new_message,
452
+ )
453
+ return response.json(
454
+ {
401
455
  "conversation": conversation_id,
402
456
  "activities": ac_output.messages,
403
457
  }
404
-
405
- # start a background task to handle activities
406
- self._create_task(
407
- conversation_id,
408
- conversation.handle_activities(
409
- request.json,
410
- input_channel_name=self.name(),
411
- output_channel=ac_output,
412
- on_new_message=on_new_message,
413
- ),
414
458
  )
415
- return response.json(response_json)
416
459
 
417
460
  @ac_webhook.route(
418
461
  "/conversation/<conversation_id>/disconnect", methods=["POST"]
@@ -13,14 +13,19 @@ from rasa.core.channels.channel import (
13
13
  CollectingOutputChannel,
14
14
  InputChannel,
15
15
  UserMessage,
16
+ create_auth_requested_response_provider,
17
+ requires_basic_auth,
16
18
  )
17
19
  from rasa.core.channels.voice_ready.utils import CallParameters
18
20
  from rasa.shared.core.events import BotUttered
19
- from rasa.shared.exceptions import InvalidConfigException
21
+ from rasa.shared.exceptions import InvalidConfigException, RasaException
20
22
 
21
23
  logger = structlog.get_logger(__name__)
22
24
 
23
25
 
26
+ TWILIO_VOICE_PATH = "webhooks/twilio_voice/webhook"
27
+
28
+
24
29
  def map_call_params(form: RequestParameters) -> CallParameters:
25
30
  """Map the Audiocodes parameters to the CallParameters dataclass."""
26
31
  return CallParameters(
@@ -120,6 +125,14 @@ class TwilioVoiceInput(InputChannel):
120
125
  """Load custom configurations."""
121
126
  credentials = credentials or {}
122
127
 
128
+ username = credentials.get("username")
129
+ password = credentials.get("password")
130
+ if (username is None) != (password is None):
131
+ raise RasaException(
132
+ "In TwilioVoice channel, either both username and password "
133
+ "or neither should be provided. "
134
+ )
135
+
123
136
  return cls(
124
137
  credentials.get(
125
138
  "reprompt_fallback_phrase",
@@ -129,6 +142,8 @@ class TwilioVoiceInput(InputChannel):
129
142
  credentials.get("speech_timeout", "5"),
130
143
  credentials.get("speech_model", "default"),
131
144
  credentials.get("enhanced", "false"),
145
+ username=username,
146
+ password=password,
132
147
  )
133
148
 
134
149
  def __init__(
@@ -138,6 +153,8 @@ class TwilioVoiceInput(InputChannel):
138
153
  speech_timeout: Text = "5",
139
154
  speech_model: Text = "default",
140
155
  enhanced: Text = "false",
156
+ username: Optional[Text] = None,
157
+ password: Optional[Text] = None,
141
158
  ) -> None:
142
159
  """Creates a connection to Twilio voice.
143
160
 
@@ -153,6 +170,8 @@ class TwilioVoiceInput(InputChannel):
153
170
  self.speech_timeout = speech_timeout
154
171
  self.speech_model = speech_model
155
172
  self.enhanced = enhanced
173
+ self.username = username
174
+ self.password = password
156
175
 
157
176
  self._validate_configuration()
158
177
 
@@ -161,6 +180,9 @@ class TwilioVoiceInput(InputChannel):
161
180
  if self.assistant_voice not in self.SUPPORTED_VOICES:
162
181
  self._raise_invalid_voice_exception()
163
182
 
183
+ if (self.username is None) != (self.password is None):
184
+ self._raise_invalid_credentials_exception()
185
+
164
186
  try:
165
187
  int(self.speech_timeout)
166
188
  except ValueError:
@@ -246,6 +268,13 @@ class TwilioVoiceInput(InputChannel):
246
268
  return response.json({"status": "ok"})
247
269
 
248
270
  @twilio_voice_webhook.route("/webhook", methods=["POST"])
271
+ @requires_basic_auth(
272
+ username=self.username,
273
+ password=self.password,
274
+ auth_request_provider=create_auth_requested_response_provider(
275
+ TWILIO_VOICE_PATH
276
+ ),
277
+ )
249
278
  async def receive(request: Request) -> HTTPResponse:
250
279
  sender_id = request.form.get("From")
251
280
  text = request.form.get("SpeechResult")
@@ -310,6 +339,11 @@ class TwilioVoiceInput(InputChannel):
310
339
  twilio_response = self._build_twilio_voice_response(
311
340
  [{"text": last_response_text}]
312
341
  )
342
+
343
+ logger.debug(
344
+ "twilio_voice.webhook.twilio_response",
345
+ twilio_response=str(twilio_response),
346
+ )
313
347
  return response.text(str(twilio_response), content_type="text/xml")
314
348
 
315
349
  return twilio_voice_webhook
@@ -329,6 +363,13 @@ class TwilioVoiceInput(InputChannel):
329
363
  enhanced=self.enhanced,
330
364
  )
331
365
 
366
+ if not messages:
367
+ # In case bot has a greet message disabled
368
+ # or if the bot is not configured to send an initial message
369
+ # we need to send a voice response with speech settings
370
+ voice_response.append(gather)
371
+ return voice_response
372
+
332
373
  # Add pauses between messages.
333
374
  # Add a listener to the last message to listen for user response.
334
375
  for i, message in enumerate(messages):
@@ -347,6 +388,12 @@ class TwilioVoiceInput(InputChannel):
347
388
 
348
389
  return voice_response
349
390
 
391
+ def _raise_invalid_credentials_exception(self) -> None:
392
+ raise InvalidConfigException(
393
+ "In TwilioVoice channel, either both username and password "
394
+ "or neither should be provided. "
395
+ )
396
+
350
397
 
351
398
  class TwilioVoiceCollectingOutputChannel(CollectingOutputChannel):
352
399
  """Output channel that collects send messages in a list.
@@ -54,13 +54,22 @@ class AzureTTS(TTSEngine[AzureTTSConfig]):
54
54
  async for data in response.content.iter_chunked(1024):
55
55
  yield self.engine_bytes_to_rasa_audio_bytes(data)
56
56
  return
57
+ elif response.status == 401:
58
+ structlogger.error(
59
+ "azure.synthesize.rest.authentication_failed",
60
+ status_code=response.status,
61
+ )
62
+ raise TTSError(
63
+ f"Authentication failed. Please check your API key: {response.status}" # noqa: E501
64
+ )
57
65
  else:
66
+ response_text = await response.text()
58
67
  structlogger.error(
59
68
  "azure.synthesize.rest.failed",
60
69
  status_code=response.status,
61
- msg=response.text(),
70
+ msg=response_text,
62
71
  )
63
- raise TTSError(f"TTS failed: {response.text()}")
72
+ raise TTSError(f"TTS failed: {response_text}")
64
73
  except ClientConnectorError as e:
65
74
  raise TTSError(e)
66
75
  except TimeoutError as e: