rasa-pro 3.11.3a1.dev6__py3-none-any.whl → 3.11.4__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 (103) hide show
  1. rasa/core/actions/action.py +7 -18
  2. rasa/core/actions/constants.py +0 -8
  3. rasa/core/actions/direct_custom_actions_executor.py +0 -1
  4. rasa/core/channels/development_inspector.py +0 -3
  5. rasa/core/channels/inspector/dist/assets/{arc-861ddd57.js → arc-632a63ec.js} +1 -1
  6. rasa/core/channels/inspector/dist/assets/{c4Diagram-d0fbc5ce-921f02db.js → c4Diagram-d0fbc5ce-081e0df4.js} +1 -1
  7. rasa/core/channels/inspector/dist/assets/{classDiagram-936ed81e-b436c4f8.js → classDiagram-936ed81e-3df0afc2.js} +1 -1
  8. rasa/core/channels/inspector/dist/assets/{classDiagram-v2-c3cb15f1-511a23cb.js → classDiagram-v2-c3cb15f1-8c5ed31e.js} +1 -1
  9. rasa/core/channels/inspector/dist/assets/{createText-62fc7601-ef476ecd.js → createText-62fc7601-89c73b31.js} +1 -1
  10. rasa/core/channels/inspector/dist/assets/{edges-f2ad444c-f1878e0a.js → edges-f2ad444c-4fc48c3e.js} +1 -1
  11. rasa/core/channels/inspector/dist/assets/{erDiagram-9d236eb7-fac75185.js → erDiagram-9d236eb7-907e0440.js} +1 -1
  12. rasa/core/channels/inspector/dist/assets/{flowDb-1972c806-201c5bbc.js → flowDb-1972c806-9ec53a3c.js} +1 -1
  13. rasa/core/channels/inspector/dist/assets/{flowDiagram-7ea5b25a-f904ae41.js → flowDiagram-7ea5b25a-41da787a.js} +1 -1
  14. rasa/core/channels/inspector/dist/assets/flowDiagram-v2-855bc5b3-8bea338b.js +1 -0
  15. rasa/core/channels/inspector/dist/assets/{flowchart-elk-definition-abe16c3d-1813da66.js → flowchart-elk-definition-abe16c3d-ce370633.js} +1 -1
  16. rasa/core/channels/inspector/dist/assets/{ganttDiagram-9b5ea136-872af172.js → ganttDiagram-9b5ea136-90a36523.js} +1 -1
  17. rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-99d0ae7c-34a0af5a.js → gitGraphDiagram-99d0ae7c-41e1aa3f.js} +1 -1
  18. rasa/core/channels/inspector/dist/assets/{index-2c4b9a3b-42ba3e3d.js → index-2c4b9a3b-e6f2af62.js} +1 -1
  19. rasa/core/channels/inspector/dist/assets/{index-37817b51.js → index-e793d777.js} +3 -3
  20. rasa/core/channels/inspector/dist/assets/{infoDiagram-736b4530-6b731386.js → infoDiagram-736b4530-8ceba4db.js} +1 -1
  21. rasa/core/channels/inspector/dist/assets/{journeyDiagram-df861f2b-e8579ac6.js → journeyDiagram-df861f2b-960d3809.js} +1 -1
  22. rasa/core/channels/inspector/dist/assets/{layout-89e6403a.js → layout-498807d8.js} +1 -1
  23. rasa/core/channels/inspector/dist/assets/{line-dc73d3fc.js → line-eeccc4e2.js} +1 -1
  24. rasa/core/channels/inspector/dist/assets/{linear-f5b1d2bc.js → linear-8a078617.js} +1 -1
  25. rasa/core/channels/inspector/dist/assets/{mindmap-definition-beec6740-82cb74fa.js → mindmap-definition-beec6740-396d17dd.js} +1 -1
  26. rasa/core/channels/inspector/dist/assets/{pieDiagram-dbbf0591-bdf5f29b.js → pieDiagram-dbbf0591-dc9b5e1b.js} +1 -1
  27. rasa/core/channels/inspector/dist/assets/{quadrantDiagram-4d7f4fd6-c7a0cbe4.js → quadrantDiagram-4d7f4fd6-a08cba6d.js} +1 -1
  28. rasa/core/channels/inspector/dist/assets/{requirementDiagram-6fc4c22a-7ec5410f.js → requirementDiagram-6fc4c22a-87242b9e.js} +1 -1
  29. rasa/core/channels/inspector/dist/assets/{sankeyDiagram-8f13d901-caee5554.js → sankeyDiagram-8f13d901-53f6f391.js} +1 -1
  30. rasa/core/channels/inspector/dist/assets/{sequenceDiagram-b655622a-2935f8db.js → sequenceDiagram-b655622a-715c9c20.js} +1 -1
  31. rasa/core/channels/inspector/dist/assets/{stateDiagram-59f0c015-8f5d9693.js → stateDiagram-59f0c015-2e8fb31f.js} +1 -1
  32. rasa/core/channels/inspector/dist/assets/{stateDiagram-v2-2b26beab-d565d1de.js → stateDiagram-v2-2b26beab-7e2d2aa0.js} +1 -1
  33. rasa/core/channels/inspector/dist/assets/{styles-080da4f6-75ad421d.js → styles-080da4f6-4420cea6.js} +1 -1
  34. rasa/core/channels/inspector/dist/assets/{styles-3dcbcfbf-7e764226.js → styles-3dcbcfbf-28676cf4.js} +1 -1
  35. rasa/core/channels/inspector/dist/assets/{styles-9c745c82-7a4e0e61.js → styles-9c745c82-cef936a6.js} +1 -1
  36. rasa/core/channels/inspector/dist/assets/{svgDrawCommon-4835440b-4019d1bf.js → svgDrawCommon-4835440b-151251e9.js} +1 -1
  37. rasa/core/channels/inspector/dist/assets/{timeline-definition-5b62e21b-01ea12df.js → timeline-definition-5b62e21b-0d39bdb2.js} +1 -1
  38. rasa/core/channels/inspector/dist/assets/{xychartDiagram-2b33534f-89407137.js → xychartDiagram-2b33534f-a03fa445.js} +1 -1
  39. rasa/core/channels/inspector/dist/index.html +3 -1
  40. rasa/core/channels/inspector/index.html +2 -0
  41. rasa/core/channels/inspector/src/App.tsx +1 -4
  42. rasa/core/channels/socketio.py +0 -40
  43. rasa/core/nlg/contextual_response_rephraser.py +9 -69
  44. rasa/core/policies/enterprise_search_policy.py +12 -82
  45. rasa/core/policies/flows/flow_executor.py +2 -26
  46. rasa/dialogue_understanding/generator/command_generator.py +5 -136
  47. rasa/dialogue_understanding/generator/llm_based_command_generator.py +5 -5
  48. rasa/dialogue_understanding/generator/llm_command_generator.py +1 -2
  49. rasa/dialogue_understanding/generator/multi_step/multi_step_llm_command_generator.py +4 -50
  50. rasa/dialogue_understanding/generator/nlu_command_adapter.py +0 -3
  51. rasa/dialogue_understanding/generator/single_step/single_step_llm_command_generator.py +3 -16
  52. rasa/dialogue_understanding/patterns/continue_interrupted.py +9 -0
  53. rasa/dialogue_understanding/stack/utils.py +1 -0
  54. rasa/e2e_test/e2e_test_case.py +1 -2
  55. rasa/e2e_test/utils/e2e_yaml_utils.py +1 -1
  56. rasa/e2e_test/utils/io.py +1 -1
  57. rasa/e2e_test/utils/validation.py +2 -100
  58. rasa/engine/recipes/default_recipe.py +49 -63
  59. rasa/engine/recipes/graph_recipe.py +7 -8
  60. rasa/model_manager/runner_service.py +0 -1
  61. rasa/model_manager/socket_bridge.py +2 -8
  62. rasa/model_manager/warm_rasa_process.py +4 -9
  63. rasa/model_training.py +1 -2
  64. rasa/nlu/classifiers/fallback_classifier.py +0 -3
  65. rasa/server.py +37 -1
  66. rasa/shared/constants.py +6 -17
  67. rasa/shared/core/events.py +8 -8
  68. rasa/shared/core/flows/flow.py +4 -4
  69. rasa/shared/core/flows/flow_step.py +15 -10
  70. rasa/shared/core/flows/flow_step_links.py +20 -12
  71. rasa/shared/core/flows/flow_step_sequence.py +5 -3
  72. rasa/shared/core/flows/steps/action.py +3 -2
  73. rasa/shared/core/flows/steps/call.py +3 -3
  74. rasa/shared/core/flows/steps/collect.py +6 -3
  75. rasa/shared/core/flows/steps/continuation.py +3 -1
  76. rasa/shared/core/flows/steps/end.py +3 -1
  77. rasa/shared/core/flows/steps/internal.py +2 -1
  78. rasa/shared/core/flows/steps/link.py +5 -3
  79. rasa/shared/core/flows/steps/no_operation.py +5 -3
  80. rasa/shared/core/flows/steps/set_slots.py +3 -2
  81. rasa/shared/core/flows/steps/start.py +3 -1
  82. rasa/shared/nlu/constants.py +0 -5
  83. rasa/shared/providers/llm/llm_response.py +1 -42
  84. rasa/shared/utils/llm.py +1 -1
  85. rasa/shared/utils/schemas/events.py +1 -1
  86. rasa/shared/utils/yaml.py +5 -6
  87. rasa/studio/upload.py +5 -19
  88. rasa/telemetry.py +33 -40
  89. rasa/tracing/instrumentation/attribute_extractors.py +9 -12
  90. rasa/validator.py +41 -32
  91. rasa/version.py +1 -1
  92. {rasa_pro-3.11.3a1.dev6.dist-info → rasa_pro-3.11.4.dist-info}/METADATA +7 -7
  93. {rasa_pro-3.11.3a1.dev6.dist-info → rasa_pro-3.11.4.dist-info}/RECORD +96 -102
  94. rasa/core/channels/inspector/dist/assets/flowDiagram-v2-855bc5b3-b080d6f2.js +0 -1
  95. rasa/dialogue_understanding/constants.py +0 -1
  96. rasa/dialogue_understanding/utils.py +0 -21
  97. rasa/dialogue_understanding_test/__init__.py +0 -0
  98. rasa/dialogue_understanding_test/constants.py +0 -15
  99. rasa/dialogue_understanding_test/du_test_case.py +0 -118
  100. rasa/dialogue_understanding_test/du_test_result.py +0 -11
  101. {rasa_pro-3.11.3a1.dev6.dist-info → rasa_pro-3.11.4.dist-info}/NOTICE +0 -0
  102. {rasa_pro-3.11.3a1.dev6.dist-info → rasa_pro-3.11.4.dist-info}/WHEEL +0 -0
  103. {rasa_pro-3.11.3a1.dev6.dist-info → rasa_pro-3.11.4.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-37817b51.js";import{c as Qt}from"./createText-62fc7601-ef476ecd.js";import{i as Kt}from"./init-77b53fdd.js";import{o as Zt}from"./ordinal-ba9b4969.js";import{l as ft}from"./linear-f5b1d2bc.js";import{l as pt}from"./line-dc73d3fc.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)+`:
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-e793d777.js";import{c as Qt}from"./createText-62fc7601-89c73b31.js";import{i as Kt}from"./init-77b53fdd.js";import{o as Zt}from"./ordinal-ba9b4969.js";import{l as ft}from"./linear-8a078617.js";import{l as pt}from"./line-eeccc4e2.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-37817b51.js"></script>
9
+ <script type="module" crossorigin src="./assets/index-e793d777.js"></script>
10
10
  <link rel="stylesheet" href="./assets/index-3ee28881.css">
11
11
  </head>
12
12
 
@@ -19,6 +19,7 @@
19
19
  if (window.location.pathname.includes("socketio")) {
20
20
  const chatDiv = document.getElementById("rasa-chat-widget");
21
21
  const websocketUrl = window.location.origin.replace("http", "ws");
22
+ const initialPayload = "/session_start";
22
23
  const maxHeight = document.documentElement.scrollHeight - 130;
23
24
  // 21 and 25 are the rem number we're using for the columns. We add 0.75rem for the padding
24
25
  // A potential improvement would be to add a onresize event for both width and height
@@ -30,6 +31,7 @@
30
31
  const columnWidth = remReference * parseFloat(getComputedStyle(document.documentElement).fontSize);
31
32
 
32
33
  chatDiv.setAttribute("data-websocket-url", websocketUrl);
34
+ chatDiv.setAttribute("data-initial-payload", initialPayload);
33
35
  chatDiv.setAttribute("data-close-on-outside-click", false);
34
36
  chatDiv.setAttribute("data-height", maxHeight);
35
37
  chatDiv.setAttribute("data-width", columnWidth);
@@ -17,6 +17,7 @@
17
17
  if (window.location.pathname.includes("socketio")) {
18
18
  const chatDiv = document.getElementById("rasa-chat-widget");
19
19
  const websocketUrl = window.location.origin.replace("http", "ws");
20
+ const initialPayload = "/session_start";
20
21
  const maxHeight = document.documentElement.scrollHeight - 130;
21
22
  // 21 and 25 are the rem number we're using for the columns. We add 0.75rem for the padding
22
23
  // A potential improvement would be to add a onresize event for both width and height
@@ -28,6 +29,7 @@
28
29
  const columnWidth = remReference * parseFloat(getComputedStyle(document.documentElement).fontSize);
29
30
 
30
31
  chatDiv.setAttribute("data-websocket-url", websocketUrl);
32
+ chatDiv.setAttribute("data-initial-payload", initialPayload);
31
33
  chatDiv.setAttribute("data-close-on-outside-click", false);
32
34
  chatDiv.setAttribute("data-height", maxHeight);
33
35
  chatDiv.setAttribute("data-width", columnWidth);
@@ -131,6 +131,7 @@ export function App() {
131
131
  setStack(updatedStack);
132
132
  setFrame(updatedActiveFrame(frame, updatedStack, lastJsonMessage.events));
133
133
  setRasaChatSessionId(lastJsonMessage.sender_id);
134
+ fetchStory();
134
135
  } else if (
135
136
  rasaChatSessionId &&
136
137
  lastJsonMessage.sender_id !== rasaChatSessionId
@@ -140,10 +141,6 @@ export function App() {
140
141
  }
141
142
  }, [lastJsonMessage, rasaChatSessionId]);
142
143
 
143
- useEffect(() => {
144
- fetchStory();
145
- }, [rasaChatSessionId]);
146
-
147
144
  const borderRadiusSx = {
148
145
  borderRadius: rasaRadii.normal,
149
146
  };
@@ -1,4 +1,3 @@
1
- import asyncio
2
1
  import inspect
3
2
  import logging
4
3
  import uuid
@@ -7,7 +6,6 @@ from typing import Any, Awaitable, Callable, Dict, Iterable, List, Optional, Tex
7
6
 
8
7
  import rasa.core.channels.channel
9
8
  from rasa.core.channels.channel import InputChannel, OutputChannel, UserMessage
10
- from rasa.shared.core.trackers import EventVerbosity
11
9
  import rasa.shared.utils.io
12
10
  from sanic import Blueprint, response, Sanic
13
11
  from sanic.request import Request
@@ -190,8 +188,6 @@ class SocketIOInput(InputChannel):
190
188
  metadata_key: Optional[Text] = "metadata",
191
189
  ):
192
190
  """Creates a ``SocketIOInput`` object."""
193
- from rasa.core.agent import Agent
194
-
195
191
  self.bot_message_evt = bot_message_evt
196
192
  self.session_persistence = session_persistence
197
193
  self.user_message_evt = user_message_evt
@@ -203,8 +199,6 @@ class SocketIOInput(InputChannel):
203
199
  self.jwt_key = jwt_key
204
200
  self.jwt_algorithm = jwt_method
205
201
 
206
- self.agent: Optional[Agent] = None
207
-
208
202
  def get_output_channel(self) -> Optional["OutputChannel"]:
209
203
  """Creates socket.io output channel object."""
210
204
  if self.sio is None:
@@ -218,10 +212,6 @@ class SocketIOInput(InputChannel):
218
212
  return None
219
213
  return SocketIOOutput(self.sio, self.bot_message_evt)
220
214
 
221
- async def on_new_tracker_dump(self, sender_id: str, tracker_dump: str) -> None:
222
- if self.sio:
223
- await self.sio.emit("tracker", tracker_dump, room=sender_id)
224
-
225
215
  def blueprint(
226
216
  self, on_new_message: Callable[[UserMessage], Awaitable[Any]]
227
217
  ) -> Blueprint:
@@ -233,11 +223,6 @@ class SocketIOInput(InputChannel):
233
223
  sio, self.socketio_path, "socketio_webhook", __name__
234
224
  )
235
225
 
236
- @socketio_webhook.listener("after_server_start") # type: ignore[misc]
237
- async def after_server_start(app: Sanic, _: asyncio.AbstractEventLoop) -> None:
238
- """Prints a message after the server has started with inspect URL."""
239
- self.agent = app.ctx.agent
240
-
241
226
  # make sio object static to use in get_output_channel
242
227
  self.sio = sio
243
228
 
@@ -283,30 +268,6 @@ class SocketIOInput(InputChannel):
283
268
  await sio.emit("session_confirm", data["session_id"], room=sid)
284
269
  logger.debug(f"User {sid} connected to socketIO endpoint.")
285
270
 
286
- @sio.on("tracker", namespace=self.namespace)
287
- async def handle_tracker(sid: Text, data: Dict) -> None:
288
- from rasa.shared.core.trackers import DialogueStateTracker
289
-
290
- if self.agent is None:
291
- raise ValueError("Agent is not initialized")
292
-
293
- async with self.agent.lock_store.lock(data["sender_id"]):
294
- tracker = DialogueStateTracker.from_dict(
295
- data["sender_id"], data["events"], self.agent.domain.slots
296
- )
297
-
298
- # will override an existing tracker with the same id!
299
- await self.agent.tracker_store.save(tracker)
300
-
301
- # TODO: rather figure out how to trigger the on_tracker_updated
302
- # of the development inspector channel
303
- state = tracker.current_state(EventVerbosity.AFTER_RESTART)
304
- await sio.emit(
305
- "tracker",
306
- json.dumps(state),
307
- room=sid,
308
- )
309
-
310
271
  @sio.on(self.user_message_evt, namespace=self.namespace)
311
272
  async def handle_message(sid: Text, data: Dict) -> None:
312
273
  output_channel = SocketIOOutput(sio, self.bot_message_evt)
@@ -328,7 +289,6 @@ class SocketIOInput(InputChannel):
328
289
  metadata = data.get(self.metadata_key, {})
329
290
  if isinstance(metadata, Text):
330
291
  metadata = json.loads(metadata)
331
-
332
292
  message = UserMessage(
333
293
  data.get("message", ""),
334
294
  output_channel,
@@ -2,7 +2,6 @@ from typing import Any, Dict, Optional, Text
2
2
 
3
3
  import structlog
4
4
  from jinja2 import Template
5
-
6
5
  from rasa import telemetry
7
6
  from rasa.core.nlg.response import TemplatedNaturalLanguageGenerator
8
7
  from rasa.core.nlg.summarize import summarize_conversation
@@ -19,12 +18,6 @@ from rasa.shared.constants import (
19
18
  from rasa.shared.core.domain import KEY_RESPONSES_TEXT, Domain
20
19
  from rasa.shared.core.events import BotUttered, UserUttered
21
20
  from rasa.shared.core.trackers import DialogueStateTracker
22
- from rasa.shared.nlu.constants import (
23
- PROMPTS,
24
- KEY_USER_PROMPT,
25
- KEY_LLM_RESPONSE_METADATA,
26
- )
27
- from rasa.shared.providers.llm.llm_response import LLMResponse
28
21
  from rasa.shared.utils.health_check.llm_health_check_mixin import LLMHealthCheckMixin
29
22
  from rasa.shared.utils.llm import (
30
23
  DEFAULT_OPENAI_GENERATE_MODEL_NAME,
@@ -131,48 +124,6 @@ class ContextualResponseRephraser(
131
124
  ContextualResponseRephraser.__name__,
132
125
  )
133
126
 
134
- @classmethod
135
- def _add_prompt_and_llm_metadata_to_response(
136
- cls,
137
- response: Dict[str, Any],
138
- prompt_name: str,
139
- user_prompt: str,
140
- llm_response: Optional["LLMResponse"] = None,
141
- ) -> Dict[str, Any]:
142
- """Stores the prompt and LLMResponse metadata to response.
143
-
144
- Args:
145
- response: The response to add the prompt and LLMResponse metadata to.
146
- prompt_name: A name identifying prompt usage.
147
- user_prompt: The user prompt that was sent to the LLM.
148
- llm_response: The response object from the LLM (None if no response).
149
- """
150
- from rasa.dialogue_understanding.utils import record_commands_and_prompts
151
-
152
- if not record_commands_and_prompts:
153
- return response
154
-
155
- prompt_data: Dict[Text, Any] = {
156
- KEY_USER_PROMPT: user_prompt,
157
- }
158
-
159
- if llm_response is not None:
160
- prompt_data[KEY_LLM_RESPONSE_METADATA] = llm_response.to_dict()
161
- else:
162
- prompt_data[KEY_LLM_RESPONSE_METADATA] = None
163
-
164
- prompt_tuple = (prompt_name, prompt_data)
165
-
166
- component_name = cls.__name__
167
- component_prompts = response.get(PROMPTS, {})
168
- if component_name in component_prompts:
169
- component_prompts[component_name].append(prompt_tuple)
170
- else:
171
- component_prompts[component_name] = [prompt_tuple]
172
-
173
- response[PROMPTS] = component_prompts
174
- return response
175
-
176
127
  def _last_message_if_human(self, tracker: DialogueStateTracker) -> Optional[str]:
177
128
  """Returns the latest message from the tracker.
178
129
 
@@ -191,21 +142,20 @@ class ContextualResponseRephraser(
191
142
  return None
192
143
  return None
193
144
 
194
- async def _generate_llm_response(self, prompt: str) -> Optional[LLMResponse]:
195
- """
196
- Use LLM to generate a response, returning an LLMResponse object
197
- containing both the generated text (choices) and metadata.
145
+ async def _generate_llm_response(self, prompt: str) -> Optional[str]:
146
+ """Use LLM to generate a response.
198
147
 
199
148
  Args:
200
- prompt: The prompt to send to the LLM.
149
+ prompt: the prompt to send to the LLM
201
150
 
202
151
  Returns:
203
- An LLMResponse object if successful, otherwise None.
152
+ generated text
204
153
  """
205
154
  llm = llm_factory(self.llm_config, DEFAULT_LLM_CONFIG)
206
155
 
207
156
  try:
208
- return await llm.acompletion(prompt)
157
+ llm_response = await llm.acompletion(prompt)
158
+ return llm_response.choices[0]
209
159
  except Exception as e:
210
160
  # unfortunately, langchain does not wrap LLM exceptions which means
211
161
  # we have to catch all exceptions here
@@ -305,21 +255,11 @@ class ContextualResponseRephraser(
305
255
  or self.llm_property(MODEL_NAME_CONFIG_KEY),
306
256
  llm_model_group_id=self.llm_property(MODEL_GROUP_ID_CONFIG_KEY),
307
257
  )
308
- llm_response = await self._generate_llm_response(prompt)
309
- llm_response = LLMResponse.ensure_llm_response(llm_response)
310
-
311
- response = self._add_prompt_and_llm_metadata_to_response(
312
- response=response,
313
- prompt_name="rephrase_prompt",
314
- user_prompt=prompt,
315
- llm_response=llm_response,
316
- )
317
-
318
- if llm_response is None or not llm_response.choices:
319
- # If the LLM fails to generate a response, return the original response.
258
+ if not (updated_text := await self._generate_llm_response(prompt)):
259
+ # If the LLM fails to generate a response, we
260
+ # return the original response.
320
261
  return response
321
262
 
322
- updated_text = llm_response.choices[0]
323
263
  structlogger.debug(
324
264
  "nlg.rewrite.complete",
325
265
  response_text=response_text,
@@ -2,7 +2,6 @@ import importlib.resources
2
2
  import json
3
3
  import re
4
4
  from typing import TYPE_CHECKING, Any, Dict, List, Optional, Text
5
-
6
5
  import dotenv
7
6
  import structlog
8
7
  from jinja2 import Template
@@ -64,17 +63,11 @@ from rasa.shared.core.events import Event, UserUttered, BotUttered
64
63
  from rasa.shared.core.generator import TrackerWithCachedStates
65
64
  from rasa.shared.core.trackers import DialogueStateTracker, EventVerbosity
66
65
  from rasa.shared.exceptions import RasaException, FileIOException
67
- from rasa.shared.nlu.constants import (
68
- PROMPTS,
69
- KEY_USER_PROMPT,
70
- KEY_LLM_RESPONSE_METADATA,
71
- )
72
66
  from rasa.shared.nlu.training_data.training_data import TrainingData
73
67
  from rasa.shared.providers.embedding._langchain_embedding_client_adapter import (
74
68
  _LangchainEmbeddingClientAdapter,
75
69
  )
76
70
  from rasa.shared.providers.llm.llm_client import LLMClient
77
- from rasa.shared.providers.llm.llm_response import LLMResponse
78
71
  from rasa.shared.utils.cli import print_error_and_exit
79
72
  from rasa.shared.utils.health_check.embeddings_health_check_mixin import (
80
73
  EmbeddingsHealthCheckMixin,
@@ -279,50 +272,6 @@ class EnterpriseSearchPolicy(LLMHealthCheckMixin, EmbeddingsHealthCheckMixin, Po
279
272
  # Wrap the embedding client in the adapter
280
273
  return _LangchainEmbeddingClientAdapter(client)
281
274
 
282
- @classmethod
283
- def _add_prompt_and_llm_response_to_latest_message(
284
- cls,
285
- tracker: DialogueStateTracker,
286
- prompt_name: str,
287
- user_prompt: str,
288
- llm_response: Optional[LLMResponse] = None,
289
- ) -> None:
290
- """Stores the prompt and LLMResponse metadata in the tracker.
291
-
292
- Args:
293
- tracker: The DialogueStateTracker containing the current conversation state.
294
- prompt_name: A name identifying prompt usage.
295
- user_prompt: The user prompt that was sent to the LLM.
296
- llm_response: The response object from the LLM (None if no response).
297
- """
298
- from rasa.dialogue_understanding.utils import record_commands_and_prompts
299
-
300
- if not record_commands_and_prompts:
301
- return
302
-
303
- if not tracker.latest_message:
304
- return
305
-
306
- parse_data = tracker.latest_message.parse_data
307
- if parse_data is not None and PROMPTS not in parse_data:
308
- parse_data[PROMPTS] = {} # type: ignore[literal-required]
309
-
310
- component_name = cls.__name__
311
- component_prompts = parse_data[PROMPTS].get(component_name, []) # type: ignore[literal-required]
312
-
313
- prompt_data: Dict[Text, Any] = {
314
- KEY_USER_PROMPT: user_prompt,
315
- }
316
-
317
- if llm_response is not None:
318
- prompt_data[KEY_LLM_RESPONSE_METADATA] = llm_response.to_dict()
319
- else:
320
- prompt_data[KEY_LLM_RESPONSE_METADATA] = None
321
-
322
- prompt_tuple = (prompt_name, prompt_data)
323
- component_prompts.append(prompt_tuple)
324
- parse_data[PROMPTS][component_name] = component_prompts # type: ignore[literal-required]
325
-
326
275
  def train( # type: ignore[override]
327
276
  self,
328
277
  training_trackers: List[TrackerWithCachedStates],
@@ -549,27 +498,13 @@ class EnterpriseSearchPolicy(LLMHealthCheckMixin, EmbeddingsHealthCheckMixin, Po
549
498
 
550
499
  if self.use_llm:
551
500
  prompt = self._render_prompt(tracker, documents.results)
552
- response = await self._generate_llm_answer(llm, prompt)
553
- llm_response = LLMResponse.ensure_llm_response(response)
554
-
555
- self._add_prompt_and_llm_response_to_latest_message(
556
- tracker=tracker,
557
- prompt_name="enterprise_search_prompt",
558
- user_prompt=prompt,
559
- llm_response=llm_response,
560
- )
561
-
562
- if llm_response is None or not llm_response.choices:
563
- logger.debug(f"{logger_key}.no_llm_response")
564
- response = None
565
- else:
566
- llm_answer = llm_response.choices[0]
501
+ llm_answer = await self._generate_llm_answer(llm, prompt)
567
502
 
568
- if self.citation_enabled:
569
- llm_answer = self.post_process_citations(llm_answer)
503
+ if self.citation_enabled:
504
+ llm_answer = self.post_process_citations(llm_answer)
570
505
 
571
- logger.debug(f"{logger_key}.llm_answer", llm_answer=llm_answer)
572
- response = llm_answer
506
+ logger.debug(f"{logger_key}.llm_answer", llm_answer=llm_answer)
507
+ response = llm_answer
573
508
  else:
574
509
  response = documents.results[0].metadata.get("answer", None)
575
510
  if not response:
@@ -581,6 +516,7 @@ class EnterpriseSearchPolicy(LLMHealthCheckMixin, EmbeddingsHealthCheckMixin, Po
581
516
  "enterprise_search_policy.predict_action_probabilities.no_llm",
582
517
  search_results=documents,
583
518
  )
519
+
584
520
  if response is None:
585
521
  return self._create_prediction_internal_error(domain, tracker)
586
522
 
@@ -645,18 +581,10 @@ class EnterpriseSearchPolicy(LLMHealthCheckMixin, EmbeddingsHealthCheckMixin, Po
645
581
 
646
582
  async def _generate_llm_answer(
647
583
  self, llm: LLMClient, prompt: Text
648
- ) -> Optional[LLMResponse]:
649
- """Fetches an LLM completion for the provided prompt.
650
-
651
- Args:
652
- llm: The LLM client used to get the completion.
653
- prompt: The prompt text to send to the model.
654
-
655
- Returns:
656
- An LLMResponse object, or None if the call fails.
657
- """
584
+ ) -> Optional[Text]:
658
585
  try:
659
- return await llm.acompletion(prompt)
586
+ llm_response = await llm.acompletion(prompt)
587
+ llm_answer = llm_response.choices[0]
660
588
  except Exception as e:
661
589
  # unfortunately, langchain does not wrap LLM exceptions which means
662
590
  # we have to catch all exceptions here
@@ -664,7 +592,9 @@ class EnterpriseSearchPolicy(LLMHealthCheckMixin, EmbeddingsHealthCheckMixin, Po
664
592
  "enterprise_search_policy._generate_llm_answer.llm_error",
665
593
  error=e,
666
594
  )
667
- return None
595
+ llm_answer = None
596
+
597
+ return llm_answer
668
598
 
669
599
  def _create_prediction(
670
600
  self,
@@ -82,7 +82,6 @@ from rasa.shared.core.flows.steps import (
82
82
  NoOperationFlowStep,
83
83
  )
84
84
  from rasa.shared.core.flows.steps.collect import SlotRejection
85
- from rasa.shared.core.flows.steps.constants import START_STEP
86
85
  from rasa.shared.core.slots import Slot
87
86
  from rasa.shared.core.trackers import (
88
87
  DialogueStateTracker,
@@ -317,7 +316,7 @@ def reset_scoped_slots(
317
316
  def _reset_slot(slot_name: Text, dialogue_tracker: DialogueStateTracker) -> None:
318
317
  slot = dialogue_tracker.slots.get(slot_name, None)
319
318
  initial_value = slot.initial_value if slot else None
320
- events.append(SlotSet(slot_name, initial_value, metadata={"reset": True}))
319
+ events.append(SlotSet(slot_name, initial_value))
321
320
 
322
321
  if (
323
322
  isinstance(current_frame, UserFlowStackFrame)
@@ -449,7 +448,6 @@ def advance_flows_until_next_action(
449
448
  tracker,
450
449
  available_actions,
451
450
  flows,
452
- previous_step_id,
453
451
  )
454
452
  new_events = step_result.events
455
453
  if (
@@ -466,9 +464,6 @@ def advance_flows_until_next_action(
466
464
  new_events.insert(
467
465
  idx, FlowCompleted(active_frame.flow_id, previous_step_id)
468
466
  )
469
- attach_stack_metadata_to_events(
470
- next_step.id, current_flow.id, new_events
471
- )
472
467
  tracker.update_stack(step_stack)
473
468
  tracker.update_with_events(new_events)
474
469
 
@@ -572,17 +567,6 @@ def validate_custom_slot_mappings(
572
567
  return True
573
568
 
574
569
 
575
- def attach_stack_metadata_to_events(
576
- step_id: str,
577
- flow_id: str,
578
- events: List[Event],
579
- ) -> None:
580
- """Attach the stack metadata to the events."""
581
- for event in events:
582
- event.metadata[STEP_ID_METADATA_KEY] = step_id
583
- event.metadata[ACTIVE_FLOW_METADATA_KEY] = flow_id
584
-
585
-
586
570
  def run_step(
587
571
  step: FlowStep,
588
572
  flow: Flow,
@@ -590,7 +574,6 @@ def run_step(
590
574
  tracker: DialogueStateTracker,
591
575
  available_actions: List[str],
592
576
  flows: FlowsList,
593
- previous_step_id: str,
594
577
  ) -> FlowStepResult:
595
578
  """Run a single step of a flow.
596
579
 
@@ -608,19 +591,12 @@ def run_step(
608
591
  tracker: The tracker to run the step on.
609
592
  available_actions: The actions that are available in the domain.
610
593
  flows: All flows.
611
- previous_step_id: The ID of the previous step.
612
594
 
613
595
  Returns:
614
596
  A result of running the step describing where to transition to.
615
597
  """
616
598
  initial_events: List[Event] = []
617
- if previous_step_id == START_STEP:
618
- # if the previous step id is the start step, we need to add a flow
619
- # started event to the initial events.
620
- # we can't use the current step to check this, as the current step is the
621
- # first step in the flow -> other steps might link to this flow, so the
622
- # only reliable way to check if we are starting a new flow is checking for
623
- # the START_STEP meta step
599
+ if step == flow.first_step_in_flow():
624
600
  initial_events.append(FlowStarted(flow.id, metadata=stack.current_context()))
625
601
 
626
602
  if isinstance(step, CollectInformationFlowStep):