rasa-pro 3.11.0__py3-none-any.whl → 3.11.0a1__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.
- README.md +396 -17
- rasa/__main__.py +15 -31
- rasa/api.py +1 -5
- rasa/cli/arguments/default_arguments.py +2 -1
- rasa/cli/arguments/shell.py +1 -5
- rasa/cli/arguments/train.py +0 -14
- rasa/cli/e2e_test.py +1 -1
- rasa/cli/evaluate.py +8 -8
- rasa/cli/inspect.py +7 -15
- rasa/cli/interactive.py +0 -1
- rasa/cli/llm_fine_tuning.py +1 -1
- rasa/cli/project_templates/calm/config.yml +7 -5
- rasa/cli/project_templates/calm/endpoints.yml +2 -15
- rasa/cli/project_templates/tutorial/config.yml +5 -8
- rasa/cli/project_templates/tutorial/data/flows.yml +1 -1
- rasa/cli/project_templates/tutorial/data/patterns.yml +0 -5
- rasa/cli/project_templates/tutorial/domain.yml +0 -14
- rasa/cli/project_templates/tutorial/endpoints.yml +0 -5
- rasa/cli/run.py +1 -1
- rasa/cli/scaffold.py +2 -4
- rasa/cli/studio/studio.py +8 -18
- rasa/cli/studio/upload.py +15 -0
- rasa/cli/train.py +0 -3
- rasa/cli/utils.py +1 -6
- rasa/cli/x.py +8 -8
- rasa/constants.py +1 -3
- rasa/core/actions/action.py +33 -75
- rasa/core/actions/e2e_stub_custom_action_executor.py +1 -5
- rasa/core/actions/http_custom_action_executor.py +0 -4
- rasa/core/channels/__init__.py +0 -2
- rasa/core/channels/channel.py +0 -20
- rasa/core/channels/development_inspector.py +3 -10
- rasa/core/channels/inspector/dist/assets/{arc-bc141fb2.js → arc-86942a71.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{c4Diagram-d0fbc5ce-be2db283.js → c4Diagram-d0fbc5ce-b0290676.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{classDiagram-936ed81e-55366915.js → classDiagram-936ed81e-f6405f6e.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{classDiagram-v2-c3cb15f1-bb529518.js → classDiagram-v2-c3cb15f1-ef61ac77.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{createText-62fc7601-b0ec81d6.js → createText-62fc7601-f0411e58.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{edges-f2ad444c-6166330c.js → edges-f2ad444c-7dcc4f3b.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{erDiagram-9d236eb7-5ccc6a8e.js → erDiagram-9d236eb7-e0c092d7.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDb-1972c806-fca3bfe4.js → flowDb-1972c806-fba2e3ce.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDiagram-7ea5b25a-4739080f.js → flowDiagram-7ea5b25a-7a70b71a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-855bc5b3-24a5f41a.js +1 -0
- rasa/core/channels/inspector/dist/assets/{flowchart-elk-definition-abe16c3d-7c1b0e0f.js → flowchart-elk-definition-abe16c3d-00a59b68.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{ganttDiagram-9b5ea136-772fd050.js → ganttDiagram-9b5ea136-293c91fa.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-99d0ae7c-8eae1dc9.js → gitGraphDiagram-99d0ae7c-07b2d68c.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-2c4b9a3b-f55afcdf.js → index-2c4b9a3b-bc959fbd.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-e7cef9de.js → index-3a8a5a28.js} +143 -143
- rasa/core/channels/inspector/dist/assets/{infoDiagram-736b4530-124d4a14.js → infoDiagram-736b4530-4a350f72.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{journeyDiagram-df861f2b-7c4fae44.js → journeyDiagram-df861f2b-af464fb7.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{layout-b9885fb6.js → layout-0071f036.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{line-7c59abb6.js → line-2f73cc83.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{linear-4776f780.js → linear-f014b4cc.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{mindmap-definition-beec6740-2332c46c.js → mindmap-definition-beec6740-d2426fb6.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{pieDiagram-dbbf0591-8fb39303.js → pieDiagram-dbbf0591-776f01a2.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{quadrantDiagram-4d7f4fd6-3c7180a2.js → quadrantDiagram-4d7f4fd6-82e00b57.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{requirementDiagram-6fc4c22a-e910bcb8.js → requirementDiagram-6fc4c22a-ea13c6bb.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sankeyDiagram-8f13d901-ead16c89.js → sankeyDiagram-8f13d901-1feca7e9.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sequenceDiagram-b655622a-29a02a19.js → sequenceDiagram-b655622a-070c61d2.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-59f0c015-042b3137.js → stateDiagram-59f0c015-24f46263.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-v2-2b26beab-2178c0f3.js → stateDiagram-v2-2b26beab-c9056051.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-080da4f6-23ffa4fc.js → styles-080da4f6-08abc34a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-3dcbcfbf-94f59763.js → styles-3dcbcfbf-bc74c25a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-9c745c82-78a6bebc.js → styles-9c745c82-4e5d66de.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{svgDrawCommon-4835440b-eae2a6f6.js → svgDrawCommon-4835440b-849c4517.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{timeline-definition-5b62e21b-5c968d92.js → timeline-definition-5b62e21b-d0fb1598.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{xychartDiagram-2b33534f-fd3db0d5.js → xychartDiagram-2b33534f-04d115e2.js} +1 -1
- rasa/core/channels/inspector/dist/index.html +1 -1
- rasa/core/channels/inspector/src/App.tsx +1 -1
- rasa/core/channels/inspector/src/components/LoadingSpinner.tsx +3 -6
- rasa/core/channels/socketio.py +2 -7
- rasa/core/channels/telegram.py +1 -1
- rasa/core/channels/twilio.py +1 -1
- rasa/core/channels/voice_ready/audiocodes.py +4 -15
- rasa/core/channels/voice_ready/jambonz.py +4 -15
- rasa/core/channels/voice_ready/twilio_voice.py +21 -6
- rasa/core/channels/voice_ready/utils.py +5 -6
- rasa/core/channels/voice_stream/asr/asr_engine.py +1 -19
- rasa/core/channels/voice_stream/asr/asr_event.py +0 -5
- rasa/core/channels/voice_stream/asr/deepgram.py +15 -28
- rasa/core/channels/voice_stream/audio_bytes.py +0 -1
- rasa/core/channels/voice_stream/tts/azure.py +3 -9
- rasa/core/channels/voice_stream/tts/cartesia.py +8 -12
- rasa/core/channels/voice_stream/tts/tts_engine.py +1 -11
- rasa/core/channels/voice_stream/twilio_media_streams.py +19 -28
- rasa/core/channels/voice_stream/util.py +4 -4
- rasa/core/channels/voice_stream/voice_channel.py +42 -222
- rasa/core/featurizers/single_state_featurizer.py +1 -22
- rasa/core/featurizers/tracker_featurizers.py +18 -115
- rasa/core/information_retrieval/qdrant.py +0 -1
- rasa/core/nlg/contextual_response_rephraser.py +25 -44
- rasa/core/persistor.py +34 -191
- rasa/core/policies/enterprise_search_policy.py +60 -119
- rasa/core/policies/flows/flow_executor.py +4 -7
- rasa/core/policies/intentless_policy.py +22 -82
- rasa/core/policies/ted_policy.py +33 -58
- rasa/core/policies/unexpected_intent_policy.py +7 -15
- rasa/core/processor.py +13 -89
- rasa/core/run.py +2 -2
- rasa/core/training/interactive.py +35 -34
- rasa/core/utils.py +22 -58
- rasa/dialogue_understanding/coexistence/llm_based_router.py +12 -39
- rasa/dialogue_understanding/commands/__init__.py +0 -4
- rasa/dialogue_understanding/commands/change_flow_command.py +0 -6
- rasa/dialogue_understanding/commands/utils.py +0 -5
- rasa/dialogue_understanding/generator/constants.py +0 -2
- rasa/dialogue_understanding/generator/flow_retrieval.py +4 -49
- rasa/dialogue_understanding/generator/llm_based_command_generator.py +23 -37
- rasa/dialogue_understanding/generator/multi_step/multi_step_llm_command_generator.py +10 -57
- rasa/dialogue_understanding/generator/nlu_command_adapter.py +1 -19
- rasa/dialogue_understanding/generator/single_step/command_prompt_template.jinja2 +0 -3
- rasa/dialogue_understanding/generator/single_step/single_step_llm_command_generator.py +10 -90
- rasa/dialogue_understanding/patterns/default_flows_for_patterns.yml +0 -53
- rasa/dialogue_understanding/processor/command_processor.py +1 -21
- rasa/e2e_test/assertions.py +16 -133
- rasa/e2e_test/assertions_schema.yml +0 -23
- rasa/e2e_test/e2e_test_case.py +6 -85
- rasa/e2e_test/e2e_test_runner.py +4 -6
- rasa/e2e_test/utils/io.py +1 -3
- rasa/engine/loader.py +0 -12
- rasa/engine/validation.py +11 -541
- rasa/keys +1 -0
- rasa/llm_fine_tuning/notebooks/unsloth_finetuning.ipynb +407 -0
- rasa/model_training.py +7 -29
- rasa/nlu/classifiers/diet_classifier.py +25 -38
- rasa/nlu/classifiers/logistic_regression_classifier.py +9 -22
- rasa/nlu/classifiers/sklearn_intent_classifier.py +16 -37
- rasa/nlu/extractors/crf_entity_extractor.py +50 -93
- rasa/nlu/featurizers/sparse_featurizer/count_vectors_featurizer.py +16 -45
- rasa/nlu/featurizers/sparse_featurizer/lexical_syntactic_featurizer.py +17 -52
- rasa/nlu/featurizers/sparse_featurizer/regex_featurizer.py +3 -5
- rasa/nlu/tokenizers/whitespace_tokenizer.py +14 -3
- rasa/server.py +1 -3
- rasa/shared/constants.py +0 -61
- rasa/shared/core/constants.py +0 -9
- rasa/shared/core/domain.py +5 -8
- rasa/shared/core/flows/flow.py +0 -5
- rasa/shared/core/flows/flows_list.py +1 -5
- rasa/shared/core/flows/flows_yaml_schema.json +0 -10
- rasa/shared/core/flows/validation.py +0 -96
- rasa/shared/core/flows/yaml_flows_io.py +4 -13
- rasa/shared/core/slots.py +0 -5
- rasa/shared/importers/importer.py +2 -19
- rasa/shared/importers/rasa.py +1 -5
- rasa/shared/nlu/training_data/features.py +2 -120
- rasa/shared/nlu/training_data/formats/rasa_yaml.py +3 -18
- rasa/shared/providers/_configs/azure_openai_client_config.py +3 -5
- rasa/shared/providers/_configs/openai_client_config.py +1 -1
- rasa/shared/providers/_configs/self_hosted_llm_client_config.py +0 -1
- rasa/shared/providers/_configs/utils.py +0 -16
- rasa/shared/providers/embedding/_base_litellm_embedding_client.py +29 -18
- rasa/shared/providers/embedding/azure_openai_embedding_client.py +21 -54
- rasa/shared/providers/embedding/default_litellm_embedding_client.py +0 -24
- rasa/shared/providers/llm/_base_litellm_client.py +31 -63
- rasa/shared/providers/llm/azure_openai_llm_client.py +29 -50
- rasa/shared/providers/llm/default_litellm_llm_client.py +0 -24
- rasa/shared/providers/llm/self_hosted_llm_client.py +29 -17
- rasa/shared/providers/mappings.py +0 -19
- rasa/shared/utils/common.py +2 -37
- rasa/shared/utils/io.py +6 -28
- rasa/shared/utils/llm.py +46 -353
- rasa/shared/utils/yaml.py +82 -181
- rasa/studio/auth.py +5 -3
- rasa/studio/config.py +4 -13
- rasa/studio/constants.py +0 -1
- rasa/studio/data_handler.py +4 -13
- rasa/studio/upload.py +80 -175
- rasa/telemetry.py +17 -94
- rasa/tracing/config.py +1 -3
- rasa/tracing/instrumentation/attribute_extractors.py +17 -94
- rasa/tracing/instrumentation/instrumentation.py +0 -121
- rasa/utils/common.py +0 -5
- rasa/utils/endpoints.py +1 -27
- rasa/utils/io.py +81 -7
- rasa/utils/log_utils.py +2 -9
- rasa/utils/tensorflow/model_data.py +193 -2
- rasa/validator.py +4 -110
- rasa/version.py +1 -1
- rasa_pro-3.11.0a1.dist-info/METADATA +576 -0
- {rasa_pro-3.11.0.dist-info → rasa_pro-3.11.0a1.dist-info}/RECORD +182 -216
- rasa/core/actions/action_repeat_bot_messages.py +0 -89
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-855bc5b3-736177bf.js +0 -1
- rasa/core/channels/inspector/src/helpers/audiostream.ts +0 -165
- rasa/core/channels/voice_stream/asr/azure.py +0 -129
- rasa/core/channels/voice_stream/browser_audio.py +0 -107
- rasa/core/channels/voice_stream/call_state.py +0 -23
- rasa/dialogue_understanding/commands/repeat_bot_messages_command.py +0 -60
- rasa/dialogue_understanding/commands/user_silence_command.py +0 -59
- rasa/dialogue_understanding/patterns/repeat.py +0 -37
- rasa/dialogue_understanding/patterns/user_silence.py +0 -37
- rasa/model_manager/__init__.py +0 -0
- rasa/model_manager/config.py +0 -40
- rasa/model_manager/model_api.py +0 -559
- rasa/model_manager/runner_service.py +0 -286
- rasa/model_manager/socket_bridge.py +0 -146
- rasa/model_manager/studio_jwt_auth.py +0 -86
- rasa/model_manager/trainer_service.py +0 -325
- rasa/model_manager/utils.py +0 -87
- rasa/model_manager/warm_rasa_process.py +0 -187
- rasa/model_service.py +0 -112
- rasa/shared/core/flows/utils.py +0 -39
- rasa/shared/providers/_configs/litellm_router_client_config.py +0 -220
- rasa/shared/providers/_configs/model_group_config.py +0 -167
- rasa/shared/providers/_configs/rasa_llm_client_config.py +0 -73
- rasa/shared/providers/_utils.py +0 -79
- rasa/shared/providers/embedding/litellm_router_embedding_client.py +0 -135
- rasa/shared/providers/llm/litellm_router_llm_client.py +0 -182
- rasa/shared/providers/llm/rasa_llm_client.py +0 -112
- rasa/shared/providers/router/__init__.py +0 -0
- rasa/shared/providers/router/_base_litellm_router_client.py +0 -183
- rasa/shared/providers/router/router_client.py +0 -73
- rasa/shared/utils/health_check/__init__.py +0 -0
- rasa/shared/utils/health_check/embeddings_health_check_mixin.py +0 -31
- rasa/shared/utils/health_check/health_check.py +0 -258
- rasa/shared/utils/health_check/llm_health_check_mixin.py +0 -31
- rasa/utils/sanic_error_handler.py +0 -32
- rasa/utils/tensorflow/feature_array.py +0 -366
- rasa_pro-3.11.0.dist-info/METADATA +0 -198
- {rasa_pro-3.11.0.dist-info → rasa_pro-3.11.0a1.dist-info}/NOTICE +0 -0
- {rasa_pro-3.11.0.dist-info → rasa_pro-3.11.0a1.dist-info}/WHEEL +0 -0
- {rasa_pro-3.11.0.dist-info → rasa_pro-3.11.0a1.dist-info}/entry_points.txt +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Z as zt,$ as ot,X as wt,W as Ft,s as Nt,g as Xt,B as Yt,D as St,a as Ht,b as $t,E as Ut,l as Ct,U as qt,i as jt,d as Gt}from"./index-
|
|
1
|
+
import{Z as zt,$ as ot,X as wt,W as Ft,s as Nt,g as Xt,B as Yt,D as St,a as Ht,b as $t,E as Ut,l as Ct,U as qt,i as jt,d as Gt}from"./index-3a8a5a28.js";import{c as Qt}from"./createText-62fc7601-f0411e58.js";import{i as Kt}from"./init-77b53fdd.js";import{o as Zt}from"./ordinal-ba9b4969.js";import{l as ft}from"./linear-f014b4cc.js";import{l as pt}from"./line-2f73cc83.js";import"./array-9f3ba611.js";import"./path-53f90ab3.js";function Jt(e,t,i){e=+e,t=+t,i=(n=arguments.length)<2?(t=e,e=0,1):n<3?1:+i;for(var s=-1,n=Math.max(0,Math.ceil((t-e)/i))|0,o=new Array(n);++s<n;)o[s]=e+s*i;return o}function st(){var e=Zt().unknown(void 0),t=e.domain,i=e.range,s=0,n=1,o,c,f=!1,d=0,R=0,_=.5;delete e.unknown;function A(){var m=t().length,T=n<s,S=T?n:s,P=T?s:n;o=(P-S)/Math.max(1,m-d+R*2),f&&(o=Math.floor(o)),S+=(P-S-o*(m-d))*_,c=o*(1-d),f&&(S=Math.round(S),c=Math.round(c));var p=Jt(m).map(function(C){return S+o*C});return i(T?p.reverse():p)}return e.domain=function(m){return arguments.length?(t(m),A()):t()},e.range=function(m){return arguments.length?([s,n]=m,s=+s,n=+n,A()):[s,n]},e.rangeRound=function(m){return[s,n]=m,s=+s,n=+n,f=!0,A()},e.bandwidth=function(){return c},e.step=function(){return o},e.round=function(m){return arguments.length?(f=!!m,A()):f},e.padding=function(m){return arguments.length?(d=Math.min(1,R=+m),A()):d},e.paddingInner=function(m){return arguments.length?(d=Math.min(1,m),A()):d},e.paddingOuter=function(m){return arguments.length?(R=+m,A()):R},e.align=function(m){return arguments.length?(_=Math.max(0,Math.min(1,m)),A()):_},e.copy=function(){return st(t(),[s,n]).round(f).paddingInner(d).paddingOuter(R).align(_)},Kt.apply(A(),arguments)}var nt=function(){var e=function(V,r,l,u){for(l=l||{},u=V.length;u--;l[V[u]]=r);return l},t=[1,10,12,14,16,18,19,21,23],i=[2,6],s=[1,3],n=[1,5],o=[1,6],c=[1,7],f=[1,5,10,12,14,16,18,19,21,23,34,35,36],d=[1,25],R=[1,26],_=[1,28],A=[1,29],m=[1,30],T=[1,31],S=[1,32],P=[1,33],p=[1,34],C=[1,35],h=[1,36],L=[1,37],z=[1,43],lt=[1,42],ct=[1,47],$=[1,50],w=[1,10,12,14,16,18,19,21,23,34,35,36],Q=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36],E=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36,41,42,43,44,45,46,47,48,49,50],ut=[1,64],K={trace:function(){},yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,commaSeparatedNumbers:25,SQUARE_BRACES_END:26,NUMBER_WITH_DECIMAL:27,COMMA:28,xAxisData:29,bandData:30,ARROW_DELIMITER:31,commaSeparatedTexts:32,yAxisData:33,NEWLINE:34,SEMI:35,EOF:36,alphaNum:37,STR:38,MD_STR:39,alphaNumToken:40,AMP:41,NUM:42,ALPHA:43,PLUS:44,EQUALS:45,MULT:46,DOT:47,BRKT:48,MINUS:49,UNDERSCORE:50,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",27:"NUMBER_WITH_DECIMAL",28:"COMMA",31:"ARROW_DELIMITER",34:"NEWLINE",35:"SEMI",36:"EOF",38:"STR",39:"MD_STR",41:"AMP",42:"NUM",43:"ALPHA",44:"PLUS",45:"EQUALS",46:"MULT",47:"DOT",48:"BRKT",49:"MINUS",50:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[13,1],[13,2],[13,1],[29,1],[29,3],[30,3],[32,3],[32,1],[15,1],[15,2],[15,1],[33,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[37,1],[37,2],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1]],performAction:function(r,l,u,g,b,a,F){var x=a.length-1;switch(b){case 5:g.setOrientation(a[x]);break;case 9:g.setDiagramTitle(a[x].text.trim());break;case 12:g.setLineData({text:"",type:"text"},a[x]);break;case 13:g.setLineData(a[x-1],a[x]);break;case 14:g.setBarData({text:"",type:"text"},a[x]);break;case 15:g.setBarData(a[x-1],a[x]);break;case 16:this.$=a[x].trim(),g.setAccTitle(this.$);break;case 17:case 18:this.$=a[x].trim(),g.setAccDescription(this.$);break;case 19:this.$=a[x-1];break;case 20:this.$=[Number(a[x-2]),...a[x]];break;case 21:this.$=[Number(a[x])];break;case 22:g.setXAxisTitle(a[x]);break;case 23:g.setXAxisTitle(a[x-1]);break;case 24:g.setXAxisTitle({type:"text",text:""});break;case 25:g.setXAxisBand(a[x]);break;case 26:g.setXAxisRangeData(Number(a[x-2]),Number(a[x]));break;case 27:this.$=a[x-1];break;case 28:this.$=[a[x-2],...a[x]];break;case 29:this.$=[a[x]];break;case 30:g.setYAxisTitle(a[x]);break;case 31:g.setYAxisTitle(a[x-1]);break;case 32:g.setYAxisTitle({type:"text",text:""});break;case 33:g.setYAxisRangeData(Number(a[x-2]),Number(a[x]));break;case 37:this.$={text:a[x],type:"text"};break;case 38:this.$={text:a[x],type:"text"};break;case 39:this.$={text:a[x],type:"markdown"};break;case 40:this.$=a[x];break;case 41:this.$=a[x-1]+""+a[x];break}},table:[e(t,i,{3:1,4:2,7:4,5:s,34:n,35:o,36:c}),{1:[3]},e(t,i,{4:2,7:4,3:8,5:s,34:n,35:o,36:c}),e(t,i,{4:2,7:4,6:9,3:10,5:s,8:[1,11],34:n,35:o,36:c}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},e(f,[2,34]),e(f,[2,35]),e(f,[2,36]),{1:[2,1]},e(t,i,{4:2,7:4,3:21,5:s,34:n,35:o,36:c}),{1:[2,3]},e(f,[2,5]),e(t,[2,7],{4:22,34:n,35:o,36:c}),{11:23,37:24,38:d,39:R,40:27,41:_,42:A,43:m,44:T,45:S,46:P,47:p,48:C,49:h,50:L},{11:39,13:38,24:z,27:lt,29:40,30:41,37:24,38:d,39:R,40:27,41:_,42:A,43:m,44:T,45:S,46:P,47:p,48:C,49:h,50:L},{11:45,15:44,27:ct,33:46,37:24,38:d,39:R,40:27,41:_,42:A,43:m,44:T,45:S,46:P,47:p,48:C,49:h,50:L},{11:49,17:48,24:$,37:24,38:d,39:R,40:27,41:_,42:A,43:m,44:T,45:S,46:P,47:p,48:C,49:h,50:L},{11:52,17:51,24:$,37:24,38:d,39:R,40:27,41:_,42:A,43:m,44:T,45:S,46:P,47:p,48:C,49:h,50:L},{20:[1,53]},{22:[1,54]},e(w,[2,18]),{1:[2,2]},e(w,[2,8]),e(w,[2,9]),e(Q,[2,37],{40:55,41:_,42:A,43:m,44:T,45:S,46:P,47:p,48:C,49:h,50:L}),e(Q,[2,38]),e(Q,[2,39]),e(E,[2,40]),e(E,[2,42]),e(E,[2,43]),e(E,[2,44]),e(E,[2,45]),e(E,[2,46]),e(E,[2,47]),e(E,[2,48]),e(E,[2,49]),e(E,[2,50]),e(E,[2,51]),e(w,[2,10]),e(w,[2,22],{30:41,29:56,24:z,27:lt}),e(w,[2,24]),e(w,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:d,39:R,40:27,41:_,42:A,43:m,44:T,45:S,46:P,47:p,48:C,49:h,50:L},e(w,[2,11]),e(w,[2,30],{33:60,27:ct}),e(w,[2,32]),{31:[1,61]},e(w,[2,12]),{17:62,24:$},{25:63,27:ut},e(w,[2,14]),{17:65,24:$},e(w,[2,16]),e(w,[2,17]),e(E,[2,41]),e(w,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},e(w,[2,31]),{27:[1,69]},e(w,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},e(w,[2,15]),e(w,[2,26]),e(w,[2,27]),{11:59,32:72,37:24,38:d,39:R,40:27,41:_,42:A,43:m,44:T,45:S,46:P,47:p,48:C,49:h,50:L},e(w,[2,33]),e(w,[2,19]),{25:73,27:ut},{26:[2,28]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],72:[2,28],73:[2,20]},parseError:function(r,l){if(l.recoverable)this.trace(r);else{var u=new Error(r);throw u.hash=l,u}},parse:function(r){var l=this,u=[0],g=[],b=[null],a=[],F=this.table,x="",U=0,gt=0,Vt=2,xt=1,Bt=a.slice.call(arguments,1),k=Object.create(this.lexer),B={yy:{}};for(var J in this.yy)Object.prototype.hasOwnProperty.call(this.yy,J)&&(B.yy[J]=this.yy[J]);k.setInput(r,B.yy),B.yy.lexer=k,B.yy.parser=this,typeof k.yylloc>"u"&&(k.yylloc={});var tt=k.yylloc;a.push(tt);var Wt=k.options&&k.options.ranges;typeof B.yy.parseError=="function"?this.parseError=B.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Ot(){var I;return I=g.pop()||k.lex()||xt,typeof I!="number"&&(I instanceof Array&&(g=I,I=g.pop()),I=l.symbols_[I]||I),I}for(var D,W,v,it,O={},q,M,dt,j;;){if(W=u[u.length-1],this.defaultActions[W]?v=this.defaultActions[W]:((D===null||typeof D>"u")&&(D=Ot()),v=F[W]&&F[W][D]),typeof v>"u"||!v.length||!v[0]){var et="";j=[];for(q in F[W])this.terminals_[q]&&q>Vt&&j.push("'"+this.terminals_[q]+"'");k.showPosition?et="Parse error on line "+(U+1)+`:
|
|
2
2
|
`+k.showPosition()+`
|
|
3
3
|
Expecting `+j.join(", ")+", got '"+(this.terminals_[D]||D)+"'":et="Parse error on line "+(U+1)+": Unexpected "+(D==xt?"end of input":"'"+(this.terminals_[D]||D)+"'"),this.parseError(et,{text:k.match,token:this.terminals_[D]||D,line:k.yylineno,loc:tt,expected:j})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+W+", token: "+D);switch(v[0]){case 1:u.push(D),b.push(k.yytext),a.push(k.yylloc),u.push(v[1]),D=null,gt=k.yyleng,x=k.yytext,U=k.yylineno,tt=k.yylloc;break;case 2:if(M=this.productions_[v[1]][1],O.$=b[b.length-M],O._$={first_line:a[a.length-(M||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(M||1)].first_column,last_column:a[a.length-1].last_column},Wt&&(O._$.range=[a[a.length-(M||1)].range[0],a[a.length-1].range[1]]),it=this.performAction.apply(O,[x,gt,U,B.yy,v[1],b,a].concat(Bt)),typeof it<"u")return it;M&&(u=u.slice(0,-1*M*2),b=b.slice(0,-1*M),a=a.slice(0,-1*M)),u.push(this.productions_[v[1]][0]),b.push(O.$),a.push(O._$),dt=F[u[u.length-2]][u[u.length-1]],u.push(dt);break;case 3:return!0}}return!0}},It=function(){var V={EOF:1,parseError:function(l,u){if(this.yy.parser)this.yy.parser.parseError(l,u);else throw new Error(l)},setInput:function(r,l){return this.yy=l||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var l=r.match(/(?:\r\n?|\n).*/g);return l?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},unput:function(r){var l=r.length,u=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-l),this.offset-=l;var g=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),u.length-1&&(this.yylineno-=u.length-1);var b=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:u?(u.length===g.length?this.yylloc.first_column:0)+g[g.length-u.length].length-u[0].length:this.yylloc.first_column-l},this.options.ranges&&(this.yylloc.range=[b[0],b[0]+this.yyleng-l]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(r){this.unput(this.match.slice(r))},pastInput:function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var r=this.pastInput(),l=new Array(r.length+1).join("-");return r+this.upcomingInput()+`
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<link rel="icon" href="data:image/x-icon;base64,AAABAAEAICAQAAEABADoAgAAFgAAACgAAAAgAAAAQAAAAAEABAAAAAAAAAIAAOwAAADsAAAAEAAAABAAAABxaUwAwoyZAMOJmADBi5kAwoyZAMKMmQDCjJkAwoyZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAAAAAAAAAAAAAAACV3AAAAAAAAAAAAAAAAAAYXdwAAAAAAAAAAAAAAAANHd3cAAAAAAAEREREREREXd3d3ERAAAAAHd3d3d3d3d3FXd3dwAAAAB3d3d3d3d3dDB3d3cAAAAAd3IiIiIiIiAAIid3AAAAAHdwAAAAAAAAAAAHdwAAAAB3cAAAAAAAAAAAB3cAAAAAd3AAd3AABnd0AAd3AAAAAHdwAHdwADF3QgAHdwAAAAB3cAB3dTMXcSAAB3cAAAAAd3AAd3dxdxMAAAd3AAAAAHdwAHd3d3dGAAAHdwAAAAB3cAB3dHd3dxUAB3cAAAAAd3AAd3A1F3d3AAd3AAAAAHdwAHdwAANXdwAHdwAAAAB3cAB3cAAAAXcAB3cAAAAAd3AAd3d3d3d3AAd3AAAAAHdwAHd3d3d3dwAHdwAAAAB3cAB3d3d3d3cAB3cAAAAAd3AAAAAAAAAAAAd3AAAAAHdwAAAAAAAAAAAHdwAAAAB3cAAAAAAAAAAAB3cAAAAAd3d3d3d3d3d3d3d3AAAAAHd3d3d3d3d3d3d3dwAAAAB3d3d3d3d3d3d3d3cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///5////4f///8H///8B/8AAAD/AAAA/wAAQP8AAcD/H//4/x//+P8ceDj/HHA4/xwAeP8cAPj/HAD4/xwAOP8cQDj/HHg4/xx+OP8cADj/HAA4/xwAOP8f//j/H//4/x//+P8AAAD/AAAA/wAAAP/////////////////////w==" sizes="32x32">
|
|
8
8
|
<title>Rasa inspector</title>
|
|
9
|
-
<script type="module" crossorigin src="./assets/index-
|
|
9
|
+
<script type="module" crossorigin src="./assets/index-3a8a5a28.js"></script>
|
|
10
10
|
<link rel="stylesheet" href="./assets/index-3ee28881.css">
|
|
11
11
|
</head>
|
|
12
12
|
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { Center, Spinner, Text,
|
|
1
|
+
import { Center, Spinner, Text, useColorModeValue } from "@chakra-ui/react";
|
|
2
2
|
import { useOurTheme } from "../theme";
|
|
3
|
-
import {createAudioConnection} from "../helpers/audiostream.ts";
|
|
4
3
|
|
|
5
4
|
export const LoadingSpinner = () => {
|
|
6
5
|
const { rasaSpace } = useOurTheme();
|
|
7
|
-
|
|
8
|
-
const text = isVoice ? "Start a new conversation" : "Waiting for a new conversation"
|
|
6
|
+
|
|
9
7
|
return (
|
|
10
8
|
<Center height={"100vh"} flexDirection="column">
|
|
11
9
|
<Spinner
|
|
@@ -15,8 +13,7 @@ export const LoadingSpinner = () => {
|
|
|
15
13
|
size="lg"
|
|
16
14
|
mb={rasaSpace[1]}
|
|
17
15
|
/>
|
|
18
|
-
<Text fontSize="lg">
|
|
19
|
-
{isVoice ? <Button onClick={createAudioConnection}>Go</Button> : null}
|
|
16
|
+
<Text fontSize="lg">waiting for a new conversation</Text>
|
|
20
17
|
</Center>
|
|
21
18
|
);
|
|
22
19
|
};
|
rasa/core/channels/socketio.py
CHANGED
|
@@ -37,11 +37,7 @@ class SocketBlueprint(Blueprint):
|
|
|
37
37
|
:param options: Options to be used while registering the
|
|
38
38
|
blueprint into the app.
|
|
39
39
|
"""
|
|
40
|
-
|
|
41
|
-
path = self.ctx.socketio_path
|
|
42
|
-
else:
|
|
43
|
-
path = options.get("url_prefix", "/socket.io")
|
|
44
|
-
self.ctx.sio.attach(app, path)
|
|
40
|
+
self.ctx.sio.attach(app, self.ctx.socketio_path)
|
|
45
41
|
super().register(app, options)
|
|
46
42
|
|
|
47
43
|
|
|
@@ -51,7 +47,6 @@ class SocketIOOutput(OutputChannel):
|
|
|
51
47
|
return "socketio"
|
|
52
48
|
|
|
53
49
|
def __init__(self, sio: AsyncServer, bot_message_evt: Text) -> None:
|
|
54
|
-
super().__init__()
|
|
55
50
|
self.sio = sio
|
|
56
51
|
self.bot_message_evt = bot_message_evt
|
|
57
52
|
self.last_event_timestamp = (
|
|
@@ -60,7 +55,7 @@ class SocketIOOutput(OutputChannel):
|
|
|
60
55
|
|
|
61
56
|
def _get_new_events(self) -> List[Dict[Text, Any]]:
|
|
62
57
|
"""Get events that are newer than the last sent event."""
|
|
63
|
-
events = self.tracker_state.get("events", [])
|
|
58
|
+
events = self.tracker_state.get("events", [])
|
|
64
59
|
new_events = [
|
|
65
60
|
event for event in events if event["timestamp"] > self.last_event_timestamp
|
|
66
61
|
]
|
rasa/core/channels/telegram.py
CHANGED
|
@@ -34,7 +34,7 @@ class TelegramOutput(Bot, OutputChannel):
|
|
|
34
34
|
return "telegram"
|
|
35
35
|
|
|
36
36
|
def __init__(self, access_token: Optional[Text]) -> None:
|
|
37
|
-
|
|
37
|
+
super().__init__(access_token)
|
|
38
38
|
|
|
39
39
|
async def send_text_message(
|
|
40
40
|
self, recipient_id: Text, text: Text, **kwargs: Any
|
rasa/core/channels/twilio.py
CHANGED
|
@@ -28,7 +28,7 @@ class TwilioOutput(Client, OutputChannel):
|
|
|
28
28
|
auth_token: Optional[Text],
|
|
29
29
|
twilio_number: Optional[Text],
|
|
30
30
|
) -> None:
|
|
31
|
-
|
|
31
|
+
super().__init__(account_sid, auth_token)
|
|
32
32
|
self.twilio_number = twilio_number
|
|
33
33
|
self.send_retry = 0
|
|
34
34
|
self.max_retry = 5
|
|
@@ -21,7 +21,6 @@ from sanic.exceptions import NotFound, SanicException, ServerError
|
|
|
21
21
|
from sanic.request import Request
|
|
22
22
|
from sanic.response import HTTPResponse
|
|
23
23
|
|
|
24
|
-
from rasa.utils.io import remove_emojis
|
|
25
24
|
|
|
26
25
|
structlogger = structlog.get_logger()
|
|
27
26
|
|
|
@@ -74,7 +73,7 @@ class Conversation:
|
|
|
74
73
|
@staticmethod
|
|
75
74
|
def get_metadata(activity: Dict[Text, Any]) -> Optional[Dict[Text, Any]]:
|
|
76
75
|
"""Get metadata from the activity."""
|
|
77
|
-
return
|
|
76
|
+
return activity.get("parameters")
|
|
78
77
|
|
|
79
78
|
@staticmethod
|
|
80
79
|
def _handle_event(event: Dict[Text, Any]) -> Text:
|
|
@@ -88,16 +87,17 @@ class Conversation:
|
|
|
88
87
|
|
|
89
88
|
if event["name"] == EVENT_START:
|
|
90
89
|
text = f"{INTENT_MESSAGE_PREFIX}{USER_INTENT_SESSION_START}"
|
|
90
|
+
event_params = asdict(map_call_params(event["parameters"]))
|
|
91
91
|
elif event["name"] == EVENT_DTMF:
|
|
92
92
|
text = f"{INTENT_MESSAGE_PREFIX}vaig_event_DTMF"
|
|
93
93
|
event_params = {"value": event["value"]}
|
|
94
|
-
text += json.dumps(event_params)
|
|
95
94
|
else:
|
|
96
95
|
structlogger.warning(
|
|
97
96
|
"audiocodes.handle.event.unknown_event", event_payload=event
|
|
98
97
|
)
|
|
99
98
|
return ""
|
|
100
99
|
|
|
100
|
+
text += json.dumps(event_params)
|
|
101
101
|
return text
|
|
102
102
|
|
|
103
103
|
def is_active_conversation(self, now: datetime, delta: timedelta) -> bool:
|
|
@@ -383,7 +383,7 @@ class AudiocodesInput(InputChannel):
|
|
|
383
383
|
{"conversation": <conversation_id>, "reason": Optional[Text]}.
|
|
384
384
|
"""
|
|
385
385
|
self._get_conversation(request.token, conversation_id)
|
|
386
|
-
reason = {"reason": request.json.get("reason")}
|
|
386
|
+
reason = json.dumps({"reason": request.json.get("reason")})
|
|
387
387
|
await on_new_message(
|
|
388
388
|
UserMessage(
|
|
389
389
|
text=f"{INTENT_MESSAGE_PREFIX}session_end",
|
|
@@ -449,7 +449,6 @@ class AudiocodesOutput(OutputChannel):
|
|
|
449
449
|
self, recipient_id: Text, text: Text, **kwargs: Any
|
|
450
450
|
) -> None:
|
|
451
451
|
"""Send a text message."""
|
|
452
|
-
text = remove_emojis(text)
|
|
453
452
|
await self.add_message({"type": "message", "text": text})
|
|
454
453
|
|
|
455
454
|
async def send_image_url(
|
|
@@ -472,16 +471,6 @@ class AudiocodesOutput(OutputChannel):
|
|
|
472
471
|
"""Indicate that the conversation should be ended."""
|
|
473
472
|
await self.add_message({"type": "event", "name": "hangup"})
|
|
474
473
|
|
|
475
|
-
async def send_text_with_buttons(
|
|
476
|
-
self,
|
|
477
|
-
recipient_id: str,
|
|
478
|
-
text: str,
|
|
479
|
-
buttons: List[Dict[str, Any]],
|
|
480
|
-
**kwargs: Any,
|
|
481
|
-
) -> None:
|
|
482
|
-
"""Uses the concise button output format for voice channels."""
|
|
483
|
-
await self.send_text_with_buttons_concise(recipient_id, text, buttons, **kwargs)
|
|
484
|
-
|
|
485
474
|
|
|
486
475
|
class WebsocketOutput(AudiocodesOutput):
|
|
487
476
|
def __init__(self, ws: Any, conversation_id: Text) -> None:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Any, Awaitable, Callable, Dict,
|
|
1
|
+
from typing import Any, Awaitable, Callable, Dict, Optional, Text
|
|
2
2
|
|
|
3
3
|
import structlog
|
|
4
4
|
from rasa.core.channels.channel import InputChannel, OutputChannel, UserMessage
|
|
@@ -13,8 +13,8 @@ from sanic import Blueprint, response, Websocket # type: ignore[attr-defined]
|
|
|
13
13
|
from sanic.request import Request
|
|
14
14
|
from sanic.response import HTTPResponse
|
|
15
15
|
|
|
16
|
-
from rasa.shared.utils.common import
|
|
17
|
-
|
|
16
|
+
from rasa.shared.utils.common import mark_as_experimental_feature
|
|
17
|
+
|
|
18
18
|
|
|
19
19
|
structlogger = structlog.get_logger()
|
|
20
20
|
|
|
@@ -36,7 +36,7 @@ class JambonzVoiceReadyInput(InputChannel):
|
|
|
36
36
|
|
|
37
37
|
def __init__(self) -> None:
|
|
38
38
|
"""Initializes the JambonzVoiceReadyInput channel."""
|
|
39
|
-
|
|
39
|
+
mark_as_experimental_feature("Jambonz Channel")
|
|
40
40
|
validate_voice_license_scope()
|
|
41
41
|
|
|
42
42
|
def blueprint(
|
|
@@ -87,7 +87,6 @@ class JambonzWebsocketOutput(OutputChannel):
|
|
|
87
87
|
self, recipient_id: Text, text: Text, **kwargs: Any
|
|
88
88
|
) -> None:
|
|
89
89
|
"""Send a text message."""
|
|
90
|
-
text = remove_emojis(text)
|
|
91
90
|
await self.add_message({"type": "message", "text": text})
|
|
92
91
|
|
|
93
92
|
async def send_image_url(
|
|
@@ -109,13 +108,3 @@ class JambonzWebsocketOutput(OutputChannel):
|
|
|
109
108
|
async def hangup(self, recipient_id: Text, **kwargs: Any) -> None:
|
|
110
109
|
"""Indicate that the conversation should be ended."""
|
|
111
110
|
await send_ws_hangup_message(DEFAULT_HANGUP_DELAY_SECONDS, self.ws)
|
|
112
|
-
|
|
113
|
-
async def send_text_with_buttons(
|
|
114
|
-
self,
|
|
115
|
-
recipient_id: str,
|
|
116
|
-
text: str,
|
|
117
|
-
buttons: List[Dict[str, Any]],
|
|
118
|
-
**kwargs: Any,
|
|
119
|
-
) -> None:
|
|
120
|
-
"""Uses the concise button output format for voice channels."""
|
|
121
|
-
await self.send_text_with_buttons_concise(recipient_id, text, buttons, **kwargs)
|
|
@@ -358,23 +358,38 @@ class TwilioVoiceCollectingOutputChannel(CollectingOutputChannel):
|
|
|
358
358
|
"""Name of the output channel."""
|
|
359
359
|
return "twilio_voice"
|
|
360
360
|
|
|
361
|
+
@staticmethod
|
|
362
|
+
def _emoji_warning(text: Text) -> None:
|
|
363
|
+
"""Raises a warning if text contains an emoji."""
|
|
364
|
+
emoji_regex = rasa.utils.io.get_emoji_regex()
|
|
365
|
+
if emoji_regex.findall(text):
|
|
366
|
+
rasa.shared.utils.io.raise_warning(
|
|
367
|
+
"Text contains an emoji in a voice response. "
|
|
368
|
+
"Review responses to provide a voice-friendly alternative."
|
|
369
|
+
)
|
|
370
|
+
|
|
361
371
|
async def send_text_message(
|
|
362
372
|
self, recipient_id: Text, text: Text, **kwargs: Any
|
|
363
373
|
) -> None:
|
|
364
374
|
"""Sends the text message after removing emojis."""
|
|
365
|
-
|
|
375
|
+
self._emoji_warning(text)
|
|
366
376
|
for message_part in text.strip().split("\n\n"):
|
|
367
377
|
await self._persist_message(self._message(recipient_id, text=message_part))
|
|
368
378
|
|
|
369
379
|
async def send_text_with_buttons(
|
|
370
380
|
self,
|
|
371
|
-
recipient_id:
|
|
372
|
-
text:
|
|
373
|
-
buttons: List[Dict[
|
|
381
|
+
recipient_id: Text,
|
|
382
|
+
text: Text,
|
|
383
|
+
buttons: List[Dict[Text, Any]],
|
|
374
384
|
**kwargs: Any,
|
|
375
385
|
) -> None:
|
|
376
|
-
"""
|
|
377
|
-
|
|
386
|
+
"""Convert buttons into a voice representation."""
|
|
387
|
+
self._emoji_warning(text)
|
|
388
|
+
await self._persist_message(self._message(recipient_id, text=text))
|
|
389
|
+
|
|
390
|
+
for b in buttons:
|
|
391
|
+
self._emoji_warning(b["title"])
|
|
392
|
+
await self._persist_message(self._message(recipient_id, text=b["title"]))
|
|
378
393
|
|
|
379
394
|
async def send_image_url(
|
|
380
395
|
self, recipient_id: Text, image: Text, **kwargs: Any
|
|
@@ -2,17 +2,16 @@ import structlog
|
|
|
2
2
|
from dataclasses import dataclass
|
|
3
3
|
from typing import Optional
|
|
4
4
|
|
|
5
|
+
from rasa.utils.licensing import (
|
|
6
|
+
PRODUCT_AREA,
|
|
7
|
+
VOICE_SCOPE,
|
|
8
|
+
validate_license_from_env,
|
|
9
|
+
)
|
|
5
10
|
|
|
6
11
|
structlogger = structlog.get_logger()
|
|
7
12
|
|
|
8
13
|
|
|
9
14
|
def validate_voice_license_scope() -> None:
|
|
10
|
-
from rasa.utils.licensing import (
|
|
11
|
-
PRODUCT_AREA,
|
|
12
|
-
VOICE_SCOPE,
|
|
13
|
-
validate_license_from_env,
|
|
14
|
-
)
|
|
15
|
-
|
|
16
15
|
"""Validate that the correct license scope is present."""
|
|
17
16
|
structlogger.info(
|
|
18
17
|
f"Validating current Rasa Pro license scope which must include "
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
|
-
from typing import
|
|
3
|
-
Dict,
|
|
4
|
-
AsyncIterator,
|
|
5
|
-
Any,
|
|
6
|
-
Generic,
|
|
7
|
-
Optional,
|
|
8
|
-
Tuple,
|
|
9
|
-
Type,
|
|
10
|
-
TypeVar,
|
|
11
|
-
)
|
|
2
|
+
from typing import Dict, AsyncIterator, Any, Generic, Optional, Type, TypeVar
|
|
12
3
|
|
|
13
4
|
from websockets.legacy.client import WebSocketClientProtocol
|
|
14
5
|
|
|
@@ -16,7 +7,6 @@ from rasa.core.channels.voice_stream.asr.asr_event import ASREvent
|
|
|
16
7
|
from rasa.core.channels.voice_stream.audio_bytes import RasaAudioBytes
|
|
17
8
|
from rasa.core.channels.voice_stream.util import MergeableConfig
|
|
18
9
|
from rasa.shared.exceptions import ConnectionException
|
|
19
|
-
from rasa.shared.utils.common import validate_environment
|
|
20
10
|
|
|
21
11
|
T = TypeVar("T", bound="ASREngineConfig")
|
|
22
12
|
E = TypeVar("E", bound="ASREngine")
|
|
@@ -28,17 +18,9 @@ class ASREngineConfig(MergeableConfig):
|
|
|
28
18
|
|
|
29
19
|
|
|
30
20
|
class ASREngine(Generic[T]):
|
|
31
|
-
required_env_vars: Tuple[str, ...] = ()
|
|
32
|
-
required_packages: Tuple[str, ...] = ()
|
|
33
|
-
|
|
34
21
|
def __init__(self, config: Optional[T] = None):
|
|
35
22
|
self.config = self.get_default_config().merge(config)
|
|
36
23
|
self.asr_socket: Optional[WebSocketClientProtocol] = None
|
|
37
|
-
validate_environment(
|
|
38
|
-
self.required_env_vars,
|
|
39
|
-
self.required_packages,
|
|
40
|
-
f"ASR Engine {self.__class__.__name__}",
|
|
41
|
-
)
|
|
42
24
|
|
|
43
25
|
async def connect(self) -> None:
|
|
44
26
|
self.asr_socket = await self.open_websocket_connection()
|
|
@@ -7,13 +7,10 @@ import websockets
|
|
|
7
7
|
from websockets.legacy.client import WebSocketClientProtocol
|
|
8
8
|
|
|
9
9
|
from rasa.core.channels.voice_stream.asr.asr_engine import ASREngine, ASREngineConfig
|
|
10
|
-
from rasa.core.channels.voice_stream.asr.asr_event import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
)
|
|
15
|
-
from rasa.core.channels.voice_stream.audio_bytes import HERTZ, RasaAudioBytes
|
|
16
|
-
from rasa.shared.constants import DEEPGRAM_API_KEY_ENV_VAR
|
|
10
|
+
from rasa.core.channels.voice_stream.asr.asr_event import ASREvent, NewTranscript
|
|
11
|
+
from rasa.core.channels.voice_stream.audio_bytes import RasaAudioBytes
|
|
12
|
+
|
|
13
|
+
DEEPGRAM_API_KEY = "DEEPGRAM_API_KEY"
|
|
17
14
|
|
|
18
15
|
|
|
19
16
|
@dataclass
|
|
@@ -21,21 +18,16 @@ class DeepgramASRConfig(ASREngineConfig):
|
|
|
21
18
|
endpoint: Optional[str] = None
|
|
22
19
|
# number of miliseconds of silence to determine end of speech
|
|
23
20
|
endpointing: Optional[int] = None
|
|
24
|
-
language: Optional[str] = None
|
|
25
|
-
model: Optional[str] = None
|
|
26
|
-
smart_format: Optional[bool] = None
|
|
27
21
|
|
|
28
22
|
|
|
29
23
|
class DeepgramASR(ASREngine[DeepgramASRConfig]):
|
|
30
|
-
required_env_vars = (DEEPGRAM_API_KEY_ENV_VAR,)
|
|
31
|
-
|
|
32
24
|
def __init__(self, config: Optional[DeepgramASRConfig] = None):
|
|
33
25
|
super().__init__(config)
|
|
34
26
|
self.accumulated_transcript = ""
|
|
35
27
|
|
|
36
28
|
async def open_websocket_connection(self) -> WebSocketClientProtocol:
|
|
37
29
|
"""Connect to the ASR system."""
|
|
38
|
-
deepgram_api_key = os.environ
|
|
30
|
+
deepgram_api_key = os.environ.get(DEEPGRAM_API_KEY)
|
|
39
31
|
extra_headers = {"Authorization": f"Token {deepgram_api_key}"}
|
|
40
32
|
api_url = self._get_api_url()
|
|
41
33
|
query_params = self._get_query_params()
|
|
@@ -49,9 +41,8 @@ class DeepgramASR(ASREngine[DeepgramASRConfig]):
|
|
|
49
41
|
|
|
50
42
|
def _get_query_params(self) -> str:
|
|
51
43
|
return (
|
|
52
|
-
f"encoding=mulaw&sample_rate=
|
|
53
|
-
f"&vad_events=true
|
|
54
|
-
f"&model={self.config.model}&smart_format={str(self.config.smart_format).lower()}"
|
|
44
|
+
f"encoding=mulaw&sample_rate=8000&endpointing={self.config.endpointing}"
|
|
45
|
+
f"&vad_events=true"
|
|
55
46
|
)
|
|
56
47
|
|
|
57
48
|
async def signal_audio_done(self) -> None:
|
|
@@ -67,23 +58,19 @@ class DeepgramASR(ASREngine[DeepgramASRConfig]):
|
|
|
67
58
|
def engine_event_to_asr_event(self, e: Any) -> Optional[ASREvent]:
|
|
68
59
|
"""Translate an engine event to a common ASREvent."""
|
|
69
60
|
data = json.loads(e)
|
|
70
|
-
if "is_final"
|
|
61
|
+
if data.get("is_final"):
|
|
71
62
|
transcript = data["channel"]["alternatives"][0]["transcript"]
|
|
72
|
-
if data
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
else:
|
|
79
|
-
self.accumulated_transcript += transcript
|
|
80
|
-
elif transcript:
|
|
81
|
-
return UserIsSpeaking()
|
|
63
|
+
if data.get("speech_final"):
|
|
64
|
+
full_transcript = self.accumulated_transcript + transcript
|
|
65
|
+
self.accumulated_transcript = ""
|
|
66
|
+
return NewTranscript(full_transcript)
|
|
67
|
+
else:
|
|
68
|
+
self.accumulated_transcript += transcript
|
|
82
69
|
return None
|
|
83
70
|
|
|
84
71
|
@staticmethod
|
|
85
72
|
def get_default_config() -> DeepgramASRConfig:
|
|
86
|
-
return DeepgramASRConfig("api.deepgram.com", 400
|
|
73
|
+
return DeepgramASRConfig("api.deepgram.com", 400)
|
|
87
74
|
|
|
88
75
|
@classmethod
|
|
89
76
|
def from_config_dict(cls, config: Dict) -> "DeepgramASR":
|
|
@@ -4,7 +4,7 @@ from dataclasses import dataclass
|
|
|
4
4
|
|
|
5
5
|
import aiohttp
|
|
6
6
|
import structlog
|
|
7
|
-
from aiohttp import ClientConnectorError
|
|
7
|
+
from aiohttp import ClientConnectorError
|
|
8
8
|
|
|
9
9
|
from rasa.core.channels.voice_stream.audio_bytes import RasaAudioBytes
|
|
10
10
|
from rasa.core.channels.voice_stream.tts.tts_engine import (
|
|
@@ -12,7 +12,6 @@ from rasa.core.channels.voice_stream.tts.tts_engine import (
|
|
|
12
12
|
TTSEngineConfig,
|
|
13
13
|
TTSError,
|
|
14
14
|
)
|
|
15
|
-
from rasa.shared.constants import AZURE_SPEECH_API_KEY_ENV_VAR
|
|
16
15
|
from rasa.shared.exceptions import ConnectionException
|
|
17
16
|
|
|
18
17
|
|
|
@@ -26,15 +25,13 @@ class AzureTTSConfig(TTSEngineConfig):
|
|
|
26
25
|
|
|
27
26
|
class AzureTTS(TTSEngine[AzureTTSConfig]):
|
|
28
27
|
session: Optional[aiohttp.ClientSession] = None
|
|
29
|
-
required_env_vars = (AZURE_SPEECH_API_KEY_ENV_VAR,)
|
|
30
28
|
|
|
31
29
|
def __init__(self, config: Optional[AzureTTSConfig] = None):
|
|
32
30
|
super().__init__(config)
|
|
33
|
-
timeout = ClientTimeout(total=self.config.timeout)
|
|
34
31
|
# Have to create this class-shared session lazily at run time otherwise
|
|
35
32
|
# the async event loop doesn't work
|
|
36
33
|
if self.__class__.session is None or self.__class__.session.closed:
|
|
37
|
-
self.__class__.session = aiohttp.ClientSession(
|
|
34
|
+
self.__class__.session = aiohttp.ClientSession()
|
|
38
35
|
|
|
39
36
|
async def synthesize(
|
|
40
37
|
self, text: str, config: Optional[AzureTTSConfig] = None
|
|
@@ -63,12 +60,10 @@ class AzureTTS(TTSEngine[AzureTTSConfig]):
|
|
|
63
60
|
raise TTSError(f"TTS failed: {response.text()}")
|
|
64
61
|
except ClientConnectorError as e:
|
|
65
62
|
raise TTSError(e)
|
|
66
|
-
except TimeoutError as e:
|
|
67
|
-
raise TTSError(e)
|
|
68
63
|
|
|
69
64
|
@staticmethod
|
|
70
65
|
def get_request_headers() -> dict[str, str]:
|
|
71
|
-
azure_speech_api_key = os.environ[
|
|
66
|
+
azure_speech_api_key = os.environ["AZURE_SPEECH_API_KEY"]
|
|
72
67
|
return {
|
|
73
68
|
"Ocp-Apim-Subscription-Key": azure_speech_api_key,
|
|
74
69
|
"Content-Type": "application/ssml+xml",
|
|
@@ -97,7 +92,6 @@ class AzureTTS(TTSEngine[AzureTTSConfig]):
|
|
|
97
92
|
return AzureTTSConfig(
|
|
98
93
|
language="en-US",
|
|
99
94
|
voice="en-US-JennyNeural",
|
|
100
|
-
timeout=10,
|
|
101
95
|
speech_region="germanywestcentral",
|
|
102
96
|
)
|
|
103
97
|
|
|
@@ -3,19 +3,20 @@ from typing import AsyncIterator, Dict, Optional
|
|
|
3
3
|
import os
|
|
4
4
|
import aiohttp
|
|
5
5
|
import structlog
|
|
6
|
-
from aiohttp import ClientConnectorError
|
|
6
|
+
from aiohttp import ClientConnectorError
|
|
7
7
|
|
|
8
8
|
from rasa.core.channels.voice_stream.tts.tts_engine import (
|
|
9
9
|
TTSEngineConfig,
|
|
10
10
|
)
|
|
11
11
|
|
|
12
|
-
from rasa.core.channels.voice_stream.audio_bytes import
|
|
12
|
+
from rasa.core.channels.voice_stream.audio_bytes import RasaAudioBytes
|
|
13
13
|
from rasa.core.channels.voice_stream.tts.tts_engine import TTSEngine, TTSError
|
|
14
|
-
from rasa.shared.constants import CARTESIA_API_KEY_ENV_VAR
|
|
15
14
|
from rasa.shared.exceptions import ConnectionException
|
|
16
15
|
|
|
17
16
|
structlogger = structlog.get_logger()
|
|
18
17
|
|
|
18
|
+
CARTESIA_API_KEY = "CARTESIA_API_KEY"
|
|
19
|
+
|
|
19
20
|
|
|
20
21
|
@dataclass
|
|
21
22
|
class CartesiaTTSConfig(TTSEngineConfig):
|
|
@@ -25,15 +26,13 @@ class CartesiaTTSConfig(TTSEngineConfig):
|
|
|
25
26
|
|
|
26
27
|
class CartesiaTTS(TTSEngine[CartesiaTTSConfig]):
|
|
27
28
|
session: Optional[aiohttp.ClientSession] = None
|
|
28
|
-
required_env_vars = (CARTESIA_API_KEY_ENV_VAR,)
|
|
29
29
|
|
|
30
30
|
def __init__(self, config: Optional[CartesiaTTSConfig] = None):
|
|
31
31
|
super().__init__(config)
|
|
32
|
-
timeout = ClientTimeout(total=self.config.timeout)
|
|
33
32
|
# Have to create this class-shared session lazily at run time otherwise
|
|
34
33
|
# the async event loop doesn't work
|
|
35
34
|
if self.__class__.session is None or self.__class__.session.closed:
|
|
36
|
-
self.__class__.session = aiohttp.ClientSession(
|
|
35
|
+
self.__class__.session = aiohttp.ClientSession()
|
|
37
36
|
|
|
38
37
|
@staticmethod
|
|
39
38
|
def get_tts_endpoint() -> str:
|
|
@@ -56,13 +55,13 @@ class CartesiaTTS(TTSEngine[CartesiaTTSConfig]):
|
|
|
56
55
|
"output_format": {
|
|
57
56
|
"container": "raw",
|
|
58
57
|
"encoding": "pcm_mulaw",
|
|
59
|
-
"sample_rate":
|
|
58
|
+
"sample_rate": 8000,
|
|
60
59
|
},
|
|
61
60
|
}
|
|
62
61
|
|
|
63
62
|
@staticmethod
|
|
64
63
|
def get_request_headers(config: CartesiaTTSConfig) -> dict[str, str]:
|
|
65
|
-
cartesia_api_key = os.environ
|
|
64
|
+
cartesia_api_key = os.environ.get(CARTESIA_API_KEY)
|
|
66
65
|
return {
|
|
67
66
|
"Cartesia-Version": str(config.version),
|
|
68
67
|
"Content-Type": "application/json",
|
|
@@ -89,15 +88,13 @@ class CartesiaTTS(TTSEngine[CartesiaTTSConfig]):
|
|
|
89
88
|
return
|
|
90
89
|
else:
|
|
91
90
|
structlogger.error(
|
|
92
|
-
"
|
|
91
|
+
"azure.synthesize.rest.failed",
|
|
93
92
|
status_code=response.status,
|
|
94
93
|
msg=response.text(),
|
|
95
94
|
)
|
|
96
95
|
raise TTSError(f"TTS failed: {response.text()}")
|
|
97
96
|
except ClientConnectorError as e:
|
|
98
97
|
raise TTSError(e)
|
|
99
|
-
except TimeoutError as e:
|
|
100
|
-
raise TTSError(e)
|
|
101
98
|
|
|
102
99
|
def engine_bytes_to_rasa_audio_bytes(self, chunk: bytes) -> RasaAudioBytes:
|
|
103
100
|
"""Convert the generated tts audio bytes into rasa audio bytes."""
|
|
@@ -108,7 +105,6 @@ class CartesiaTTS(TTSEngine[CartesiaTTSConfig]):
|
|
|
108
105
|
return CartesiaTTSConfig(
|
|
109
106
|
language="en",
|
|
110
107
|
voice="248be419-c632-4f23-adf1-5324ed7dbf1d",
|
|
111
|
-
timeout=10,
|
|
112
108
|
model_id="sonic-english",
|
|
113
109
|
version="2024-06-10",
|
|
114
110
|
)
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
from typing import AsyncIterator, Dict, Generic, Optional,
|
|
1
|
+
from typing import AsyncIterator, Dict, Generic, Optional, Type, TypeVar
|
|
2
2
|
from dataclasses import dataclass
|
|
3
3
|
|
|
4
4
|
from rasa.core.channels.voice_stream.audio_bytes import RasaAudioBytes
|
|
5
5
|
from rasa.core.channels.voice_stream.util import MergeableConfig
|
|
6
6
|
from rasa.shared.exceptions import RasaException
|
|
7
|
-
from rasa.shared.utils.common import validate_environment
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
class TTSError(RasaException):
|
|
@@ -19,20 +18,11 @@ E = TypeVar("E", bound="TTSEngine")
|
|
|
19
18
|
class TTSEngineConfig(MergeableConfig):
|
|
20
19
|
language: Optional[str] = None
|
|
21
20
|
voice: Optional[str] = None
|
|
22
|
-
timeout: Optional[int] = None
|
|
23
21
|
|
|
24
22
|
|
|
25
23
|
class TTSEngine(Generic[T]):
|
|
26
|
-
required_env_vars: Tuple[str, ...] = ()
|
|
27
|
-
required_packages: Tuple[str, ...] = ()
|
|
28
|
-
|
|
29
24
|
def __init__(self, config: Optional[T] = None):
|
|
30
25
|
self.config = self.get_default_config().merge(config)
|
|
31
|
-
validate_environment(
|
|
32
|
-
self.required_env_vars,
|
|
33
|
-
self.required_packages,
|
|
34
|
-
f"TTS Engine {self.__class__.__name__}",
|
|
35
|
-
)
|
|
36
26
|
|
|
37
27
|
async def close_connection(self) -> None:
|
|
38
28
|
"""Cleanup the connection if necessary."""
|