rasa-pro 3.11.3__py3-none-any.whl → 3.11.3a1.dev1__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.
- rasa/cli/studio/actions.py +48 -0
- rasa/cli/studio/studio.py +2 -0
- rasa/core/actions/direct_custom_actions_executor.py +31 -2
- rasa/core/channels/development_inspector.py +3 -0
- rasa/core/channels/inspector/dist/assets/{arc-632a63ec.js → arc-861ddd57.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{c4Diagram-d0fbc5ce-081e0df4.js → c4Diagram-d0fbc5ce-921f02db.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{classDiagram-936ed81e-3df0afc2.js → classDiagram-936ed81e-b436c4f8.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{classDiagram-v2-c3cb15f1-8c5ed31e.js → classDiagram-v2-c3cb15f1-511a23cb.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{createText-62fc7601-89c73b31.js → createText-62fc7601-ef476ecd.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{edges-f2ad444c-4fc48c3e.js → edges-f2ad444c-f1878e0a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{erDiagram-9d236eb7-907e0440.js → erDiagram-9d236eb7-fac75185.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDb-1972c806-9ec53a3c.js → flowDb-1972c806-201c5bbc.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDiagram-7ea5b25a-41da787a.js → flowDiagram-7ea5b25a-f904ae41.js} +1 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-855bc5b3-b080d6f2.js +1 -0
- rasa/core/channels/inspector/dist/assets/{flowchart-elk-definition-abe16c3d-ce370633.js → flowchart-elk-definition-abe16c3d-1813da66.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{ganttDiagram-9b5ea136-90a36523.js → ganttDiagram-9b5ea136-872af172.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-99d0ae7c-41e1aa3f.js → gitGraphDiagram-99d0ae7c-34a0af5a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-2c4b9a3b-e6f2af62.js → index-2c4b9a3b-42ba3e3d.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-e793d777.js → index-37817b51.js} +3 -3
- rasa/core/channels/inspector/dist/assets/{infoDiagram-736b4530-8ceba4db.js → infoDiagram-736b4530-6b731386.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{journeyDiagram-df861f2b-960d3809.js → journeyDiagram-df861f2b-e8579ac6.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{layout-498807d8.js → layout-89e6403a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{line-eeccc4e2.js → line-dc73d3fc.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{linear-8a078617.js → linear-f5b1d2bc.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{mindmap-definition-beec6740-396d17dd.js → mindmap-definition-beec6740-82cb74fa.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{pieDiagram-dbbf0591-dc9b5e1b.js → pieDiagram-dbbf0591-bdf5f29b.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{quadrantDiagram-4d7f4fd6-a08cba6d.js → quadrantDiagram-4d7f4fd6-c7a0cbe4.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{requirementDiagram-6fc4c22a-87242b9e.js → requirementDiagram-6fc4c22a-7ec5410f.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sankeyDiagram-8f13d901-53f6f391.js → sankeyDiagram-8f13d901-caee5554.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sequenceDiagram-b655622a-715c9c20.js → sequenceDiagram-b655622a-2935f8db.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-59f0c015-2e8fb31f.js → stateDiagram-59f0c015-8f5d9693.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-v2-2b26beab-7e2d2aa0.js → stateDiagram-v2-2b26beab-d565d1de.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-080da4f6-4420cea6.js → styles-080da4f6-75ad421d.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-3dcbcfbf-28676cf4.js → styles-3dcbcfbf-7e764226.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-9c745c82-cef936a6.js → styles-9c745c82-7a4e0e61.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{svgDrawCommon-4835440b-151251e9.js → svgDrawCommon-4835440b-4019d1bf.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{timeline-definition-5b62e21b-0d39bdb2.js → timeline-definition-5b62e21b-01ea12df.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{xychartDiagram-2b33534f-a03fa445.js → xychartDiagram-2b33534f-89407137.js} +1 -1
- rasa/core/channels/inspector/dist/index.html +1 -3
- rasa/core/channels/inspector/index.html +0 -2
- rasa/core/channels/inspector/src/App.tsx +4 -1
- rasa/core/channels/socketio.py +5 -0
- rasa/dialogue_understanding/generator/command_generator.py +126 -5
- rasa/dialogue_understanding/generator/multi_step/multi_step_llm_command_generator.py +28 -1
- rasa/dialogue_understanding/generator/nlu_command_adapter.py +3 -0
- rasa/dialogue_understanding/generator/single_step/single_step_llm_command_generator.py +9 -1
- rasa/dialogue_understanding/utils.py +14 -0
- rasa/dialogue_understanding_test/__init__.py +0 -0
- rasa/dialogue_understanding_test/constants.py +15 -0
- rasa/dialogue_understanding_test/du_test_case.py +118 -0
- rasa/dialogue_understanding_test/du_test_result.py +11 -0
- rasa/e2e_test/e2e_test_case.py +2 -1
- rasa/e2e_test/utils/e2e_yaml_utils.py +1 -1
- rasa/e2e_test/utils/io.py +1 -1
- rasa/e2e_test/utils/validation.py +100 -2
- rasa/engine/recipes/default_recipe.py +63 -49
- rasa/engine/recipes/graph_recipe.py +8 -7
- rasa/model_manager/runner_service.py +1 -0
- rasa/model_manager/socket_bridge.py +29 -7
- rasa/model_training.py +2 -1
- rasa/server.py +1 -37
- rasa/shared/constants.py +17 -6
- rasa/shared/nlu/constants.py +4 -0
- rasa/shared/utils/llm.py +1 -1
- rasa/shared/utils/yaml.py +6 -5
- rasa/studio/actions.py +147 -0
- rasa/studio/upload.py +19 -5
- rasa/telemetry.py +40 -33
- rasa/tracing/instrumentation/attribute_extractors.py +10 -9
- rasa/validator.py +32 -41
- rasa/version.py +1 -1
- {rasa_pro-3.11.3.dist-info → rasa_pro-3.11.3a1.dev1.dist-info}/METADATA +6 -6
- {rasa_pro-3.11.3.dist-info → rasa_pro-3.11.3a1.dev1.dist-info}/RECORD +76 -69
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-855bc5b3-8bea338b.js +0 -1
- {rasa_pro-3.11.3.dist-info → rasa_pro-3.11.3a1.dev1.dist-info}/NOTICE +0 -0
- {rasa_pro-3.11.3.dist-info → rasa_pro-3.11.3a1.dev1.dist-info}/WHEEL +0 -0
- {rasa_pro-3.11.3.dist-info → rasa_pro-3.11.3a1.dev1.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-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)+`:
|
|
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-37817b51.js"></script>
|
|
10
10
|
<link rel="stylesheet" href="./assets/index-3ee28881.css">
|
|
11
11
|
</head>
|
|
12
12
|
|
|
@@ -19,7 +19,6 @@
|
|
|
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";
|
|
23
22
|
const maxHeight = document.documentElement.scrollHeight - 130;
|
|
24
23
|
// 21 and 25 are the rem number we're using for the columns. We add 0.75rem for the padding
|
|
25
24
|
// A potential improvement would be to add a onresize event for both width and height
|
|
@@ -31,7 +30,6 @@
|
|
|
31
30
|
const columnWidth = remReference * parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
32
31
|
|
|
33
32
|
chatDiv.setAttribute("data-websocket-url", websocketUrl);
|
|
34
|
-
chatDiv.setAttribute("data-initial-payload", initialPayload);
|
|
35
33
|
chatDiv.setAttribute("data-close-on-outside-click", false);
|
|
36
34
|
chatDiv.setAttribute("data-height", maxHeight);
|
|
37
35
|
chatDiv.setAttribute("data-width", columnWidth);
|
|
@@ -17,7 +17,6 @@
|
|
|
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";
|
|
21
20
|
const maxHeight = document.documentElement.scrollHeight - 130;
|
|
22
21
|
// 21 and 25 are the rem number we're using for the columns. We add 0.75rem for the padding
|
|
23
22
|
// A potential improvement would be to add a onresize event for both width and height
|
|
@@ -29,7 +28,6 @@
|
|
|
29
28
|
const columnWidth = remReference * parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
30
29
|
|
|
31
30
|
chatDiv.setAttribute("data-websocket-url", websocketUrl);
|
|
32
|
-
chatDiv.setAttribute("data-initial-payload", initialPayload);
|
|
33
31
|
chatDiv.setAttribute("data-close-on-outside-click", false);
|
|
34
32
|
chatDiv.setAttribute("data-height", maxHeight);
|
|
35
33
|
chatDiv.setAttribute("data-width", columnWidth);
|
|
@@ -131,7 +131,6 @@ export function App() {
|
|
|
131
131
|
setStack(updatedStack);
|
|
132
132
|
setFrame(updatedActiveFrame(frame, updatedStack, lastJsonMessage.events));
|
|
133
133
|
setRasaChatSessionId(lastJsonMessage.sender_id);
|
|
134
|
-
fetchStory();
|
|
135
134
|
} else if (
|
|
136
135
|
rasaChatSessionId &&
|
|
137
136
|
lastJsonMessage.sender_id !== rasaChatSessionId
|
|
@@ -141,6 +140,10 @@ export function App() {
|
|
|
141
140
|
}
|
|
142
141
|
}, [lastJsonMessage, rasaChatSessionId]);
|
|
143
142
|
|
|
143
|
+
useEffect(() => {
|
|
144
|
+
fetchStory();
|
|
145
|
+
}, [rasaChatSessionId]);
|
|
146
|
+
|
|
144
147
|
const borderRadiusSx = {
|
|
145
148
|
borderRadius: rasaRadii.normal,
|
|
146
149
|
};
|
rasa/core/channels/socketio.py
CHANGED
|
@@ -212,6 +212,10 @@ class SocketIOInput(InputChannel):
|
|
|
212
212
|
return None
|
|
213
213
|
return SocketIOOutput(self.sio, self.bot_message_evt)
|
|
214
214
|
|
|
215
|
+
async def on_new_tracker_dump(self, sender_id: str, tracker_dump: str):
|
|
216
|
+
if self.sio:
|
|
217
|
+
await self.sio.emit("tracker", tracker_dump, room=sender_id)
|
|
218
|
+
|
|
215
219
|
def blueprint(
|
|
216
220
|
self, on_new_message: Callable[[UserMessage], Awaitable[Any]]
|
|
217
221
|
) -> Blueprint:
|
|
@@ -289,6 +293,7 @@ class SocketIOInput(InputChannel):
|
|
|
289
293
|
metadata = data.get(self.metadata_key, {})
|
|
290
294
|
if isinstance(metadata, Text):
|
|
291
295
|
metadata = json.loads(metadata)
|
|
296
|
+
|
|
292
297
|
message = UserMessage(
|
|
293
298
|
data.get("message", ""),
|
|
294
299
|
output_channel,
|
|
@@ -10,18 +10,25 @@ from rasa.dialogue_understanding.commands import (
|
|
|
10
10
|
ErrorCommand,
|
|
11
11
|
)
|
|
12
12
|
from rasa.dialogue_understanding.commands.set_slot_command import SetSlotExtractor
|
|
13
|
+
from rasa.shared.constants import (
|
|
14
|
+
RASA_PATTERN_INTERNAL_ERROR_USER_INPUT_TOO_LONG,
|
|
15
|
+
RASA_PATTERN_INTERNAL_ERROR_USER_INPUT_EMPTY,
|
|
16
|
+
)
|
|
13
17
|
from rasa.shared.core.constants import SlotMappingType
|
|
14
18
|
from rasa.shared.core.domain import Domain
|
|
15
19
|
from rasa.shared.core.flows import FlowsList
|
|
16
20
|
from rasa.shared.core.slot_mappings import SlotFillingManager
|
|
17
21
|
from rasa.shared.core.trackers import DialogueStateTracker
|
|
22
|
+
from rasa.shared.nlu.constants import (
|
|
23
|
+
COMMANDS,
|
|
24
|
+
TEXT,
|
|
25
|
+
PREDICTED_COMMANDS,
|
|
26
|
+
PROMPTS,
|
|
27
|
+
KEY_USER_PROMPT,
|
|
28
|
+
KEY_SYSTEM_PROMPT,
|
|
29
|
+
)
|
|
18
30
|
from rasa.shared.nlu.training_data.message import Message
|
|
19
|
-
from rasa.shared.nlu.constants import COMMANDS, TEXT
|
|
20
31
|
from rasa.shared.utils.llm import DEFAULT_MAX_USER_INPUT_CHARACTERS
|
|
21
|
-
from rasa.shared.constants import (
|
|
22
|
-
RASA_PATTERN_INTERNAL_ERROR_USER_INPUT_TOO_LONG,
|
|
23
|
-
RASA_PATTERN_INTERNAL_ERROR_USER_INPUT_EMPTY,
|
|
24
|
-
)
|
|
25
32
|
|
|
26
33
|
structlogger = structlog.get_logger()
|
|
27
34
|
|
|
@@ -193,6 +200,7 @@ class CommandGenerator:
|
|
|
193
200
|
flows: The flows to use for command prediction.
|
|
194
201
|
tracker: The tracker containing the conversation history up to now.
|
|
195
202
|
**kwargs: Keyword arguments for forward compatibility.
|
|
203
|
+
|
|
196
204
|
Returns:
|
|
197
205
|
The predicted commands.
|
|
198
206
|
"""
|
|
@@ -341,3 +349,116 @@ class CommandGenerator:
|
|
|
341
349
|
]
|
|
342
350
|
|
|
343
351
|
return filtered_commands
|
|
352
|
+
|
|
353
|
+
@staticmethod
|
|
354
|
+
def _add_commands_to_message_parse_data(
|
|
355
|
+
message: Message, component_name: str, commands: List[Command]
|
|
356
|
+
) -> None:
|
|
357
|
+
"""Add commands to the message parse data.
|
|
358
|
+
|
|
359
|
+
Commands are only added in case the flag 'record_commands_and_prompts' is set.
|
|
360
|
+
Example of predicted commands in the message parse data:
|
|
361
|
+
Message(data={
|
|
362
|
+
PREDICTED_COMMANDS: {
|
|
363
|
+
"MultiStepLLMCommandGenerator": [
|
|
364
|
+
{"command": "set_slot", "name": "slot_name", "value": "slot_value"},
|
|
365
|
+
],
|
|
366
|
+
"NLUCommandAdapter": [
|
|
367
|
+
{"command": "start_flow", "name": "test_flow"},
|
|
368
|
+
]
|
|
369
|
+
}
|
|
370
|
+
})
|
|
371
|
+
"""
|
|
372
|
+
from rasa.dialogue_understanding.utils import record_commands_and_prompts
|
|
373
|
+
|
|
374
|
+
# only set commands if the flag "record_commands_and_prompts" is set to True
|
|
375
|
+
if not record_commands_and_prompts:
|
|
376
|
+
return
|
|
377
|
+
|
|
378
|
+
commands_as_dict = [command.as_dict() for command in commands]
|
|
379
|
+
|
|
380
|
+
if message.get(PREDICTED_COMMANDS) is not None:
|
|
381
|
+
predicted_commands = message.get(PREDICTED_COMMANDS)
|
|
382
|
+
if component_name in predicted_commands:
|
|
383
|
+
predicted_commands[component_name].extend(commands_as_dict)
|
|
384
|
+
else:
|
|
385
|
+
predicted_commands[component_name] = commands_as_dict
|
|
386
|
+
else:
|
|
387
|
+
predicted_commands = {component_name: commands_as_dict}
|
|
388
|
+
|
|
389
|
+
message.set(
|
|
390
|
+
PREDICTED_COMMANDS,
|
|
391
|
+
predicted_commands,
|
|
392
|
+
add_to_output=True,
|
|
393
|
+
)
|
|
394
|
+
|
|
395
|
+
@staticmethod
|
|
396
|
+
def _add_prompt_to_message_parse_data(
|
|
397
|
+
message: Message,
|
|
398
|
+
component_name: str,
|
|
399
|
+
prompt_name: str,
|
|
400
|
+
user_prompt: str,
|
|
401
|
+
system_prompt: Optional[str] = None,
|
|
402
|
+
) -> None:
|
|
403
|
+
"""Add prompt to the message parse data.
|
|
404
|
+
|
|
405
|
+
Prompt is only added in case the flag 'record_commands_and_prompts' is set.
|
|
406
|
+
Example of prompts in the message parse data:
|
|
407
|
+
Message(data={
|
|
408
|
+
PROMPTS: {
|
|
409
|
+
"MultiStepLLMCommandGenerator": [
|
|
410
|
+
(
|
|
411
|
+
"fill_slots_prompt",
|
|
412
|
+
{
|
|
413
|
+
"user_prompt": <prompt content>",
|
|
414
|
+
"system_prompt": <prompt content>"
|
|
415
|
+
}
|
|
416
|
+
),
|
|
417
|
+
(
|
|
418
|
+
"handle_flows_prompt",
|
|
419
|
+
{
|
|
420
|
+
"user_prompt": <prompt content>",
|
|
421
|
+
"system_prompt": <prompt content>"
|
|
422
|
+
}
|
|
423
|
+
),
|
|
424
|
+
],
|
|
425
|
+
"SingleStepLLMCommandGenerator": [
|
|
426
|
+
(
|
|
427
|
+
"prompt_template",
|
|
428
|
+
{
|
|
429
|
+
"user_prompt": <prompt content>",
|
|
430
|
+
"system_prompt": <prompt content>"
|
|
431
|
+
}
|
|
432
|
+
),
|
|
433
|
+
]
|
|
434
|
+
}
|
|
435
|
+
})
|
|
436
|
+
"""
|
|
437
|
+
from rasa.dialogue_understanding.utils import record_commands_and_prompts
|
|
438
|
+
|
|
439
|
+
# only set prompt if the flag "record_commands_and_prompts" is set to True
|
|
440
|
+
if not record_commands_and_prompts:
|
|
441
|
+
return
|
|
442
|
+
|
|
443
|
+
prompt_tuple = (
|
|
444
|
+
prompt_name,
|
|
445
|
+
{
|
|
446
|
+
KEY_USER_PROMPT: user_prompt,
|
|
447
|
+
**({KEY_SYSTEM_PROMPT: system_prompt} if system_prompt else {}),
|
|
448
|
+
},
|
|
449
|
+
)
|
|
450
|
+
|
|
451
|
+
if message.get(PROMPTS) is not None:
|
|
452
|
+
prompts = message.get(PROMPTS)
|
|
453
|
+
if component_name in prompts:
|
|
454
|
+
prompts[component_name].append(prompt_tuple)
|
|
455
|
+
else:
|
|
456
|
+
prompts[component_name] = [prompt_tuple]
|
|
457
|
+
else:
|
|
458
|
+
prompts = {component_name: [prompt_tuple]}
|
|
459
|
+
|
|
460
|
+
message.set(
|
|
461
|
+
PROMPTS,
|
|
462
|
+
prompts,
|
|
463
|
+
add_to_output=True,
|
|
464
|
+
)
|
|
@@ -144,7 +144,6 @@ class MultiStepLLMCommandGenerator(LLMBasedCommandGenerator):
|
|
|
144
144
|
**kwargs: Any,
|
|
145
145
|
) -> "MultiStepLLMCommandGenerator":
|
|
146
146
|
"""Loads trained component (see parent class for full docstring)."""
|
|
147
|
-
|
|
148
147
|
# Perform health check of the LLM client config
|
|
149
148
|
llm_config = resolve_model_client_config(config.get(LLM_CONFIG_KEY, {}))
|
|
150
149
|
cls.perform_llm_health_check(
|
|
@@ -200,6 +199,9 @@ class MultiStepLLMCommandGenerator(LLMBasedCommandGenerator):
|
|
|
200
199
|
message, flows, tracker
|
|
201
200
|
)
|
|
202
201
|
commands = self._clean_up_commands(commands)
|
|
202
|
+
self._add_commands_to_message_parse_data(
|
|
203
|
+
message, MultiStepLLMCommandGenerator.__name__, commands
|
|
204
|
+
)
|
|
203
205
|
except ProviderClientAPIException:
|
|
204
206
|
# if any step resulted in API exception, the command prediction cannot
|
|
205
207
|
# be completed, "predict" the ErrorCommand
|
|
@@ -542,6 +544,15 @@ class MultiStepLLMCommandGenerator(LLMBasedCommandGenerator):
|
|
|
542
544
|
)
|
|
543
545
|
|
|
544
546
|
commands = self.parse_commands(actions, tracker, available_flows)
|
|
547
|
+
|
|
548
|
+
if commands:
|
|
549
|
+
self._add_prompt_to_message_parse_data(
|
|
550
|
+
message,
|
|
551
|
+
MultiStepLLMCommandGenerator.__name__,
|
|
552
|
+
"fill_slots_for_active_flow_prompt",
|
|
553
|
+
prompt,
|
|
554
|
+
)
|
|
555
|
+
|
|
545
556
|
return commands
|
|
546
557
|
|
|
547
558
|
async def _predict_commands_for_handling_flows(
|
|
@@ -585,6 +596,14 @@ class MultiStepLLMCommandGenerator(LLMBasedCommandGenerator):
|
|
|
585
596
|
# filter out flows that are already started and active
|
|
586
597
|
commands = self._filter_redundant_start_flow_commands(tracker, commands)
|
|
587
598
|
|
|
599
|
+
if commands:
|
|
600
|
+
self._add_prompt_to_message_parse_data(
|
|
601
|
+
message,
|
|
602
|
+
MultiStepLLMCommandGenerator.__name__,
|
|
603
|
+
"handle_flows_prompt",
|
|
604
|
+
prompt,
|
|
605
|
+
)
|
|
606
|
+
|
|
588
607
|
return commands
|
|
589
608
|
|
|
590
609
|
@staticmethod
|
|
@@ -674,6 +693,14 @@ class MultiStepLLMCommandGenerator(LLMBasedCommandGenerator):
|
|
|
674
693
|
commands=commands,
|
|
675
694
|
)
|
|
676
695
|
|
|
696
|
+
if commands:
|
|
697
|
+
self._add_prompt_to_message_parse_data(
|
|
698
|
+
message,
|
|
699
|
+
MultiStepLLMCommandGenerator.__name__,
|
|
700
|
+
"fill_slots_for_new_flow_prompt",
|
|
701
|
+
prompt,
|
|
702
|
+
)
|
|
703
|
+
|
|
677
704
|
return commands
|
|
678
705
|
|
|
679
706
|
def _prepare_inputs(
|
|
@@ -137,7 +137,6 @@ class SingleStepLLMCommandGenerator(LLMBasedCommandGenerator):
|
|
|
137
137
|
**kwargs: Any,
|
|
138
138
|
) -> "SingleStepLLMCommandGenerator":
|
|
139
139
|
"""Loads trained component (see parent class for full docstring)."""
|
|
140
|
-
|
|
141
140
|
# Perform health check of the LLM API endpoint
|
|
142
141
|
llm_config = resolve_model_client_config(config.get(LLM_CONFIG_KEY, {}))
|
|
143
142
|
cls.perform_llm_health_check(
|
|
@@ -282,6 +281,15 @@ class SingleStepLLMCommandGenerator(LLMBasedCommandGenerator):
|
|
|
282
281
|
commands = self.parse_commands(action_list, tracker, flows)
|
|
283
282
|
|
|
284
283
|
self._update_message_parse_data_for_fine_tuning(message, commands, flow_prompt)
|
|
284
|
+
self._add_commands_to_message_parse_data(
|
|
285
|
+
message, SingleStepLLMCommandGenerator.__name__, commands
|
|
286
|
+
)
|
|
287
|
+
self._add_prompt_to_message_parse_data(
|
|
288
|
+
message,
|
|
289
|
+
SingleStepLLMCommandGenerator.__name__,
|
|
290
|
+
"command_generator_prompt",
|
|
291
|
+
flow_prompt,
|
|
292
|
+
)
|
|
285
293
|
|
|
286
294
|
return commands
|
|
287
295
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from contextlib import contextmanager
|
|
2
|
+
from typing import Generator
|
|
3
|
+
|
|
4
|
+
record_commands_and_prompts = False
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@contextmanager
|
|
8
|
+
def set_record_commands_and_prompts() -> Generator:
|
|
9
|
+
global record_commands_and_prompts
|
|
10
|
+
record_commands_and_prompts = True
|
|
11
|
+
try:
|
|
12
|
+
yield
|
|
13
|
+
finally:
|
|
14
|
+
record_commands_and_prompts = False
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import rasa.e2e_test.constants as constants
|
|
2
|
+
|
|
3
|
+
KEY_FIXTURES = constants.KEY_FIXTURES
|
|
4
|
+
KEY_METADATA = constants.KEY_METADATA
|
|
5
|
+
KEY_STUB_CUSTOM_ACTIONS = constants.KEY_STUB_CUSTOM_ACTIONS
|
|
6
|
+
KEY_USER_INPUT = constants.KEY_USER_INPUT
|
|
7
|
+
KEY_BOT_INPUT = constants.KEY_BOT_INPUT
|
|
8
|
+
KEY_BOT_UTTERED = constants.KEY_BOT_UTTERED
|
|
9
|
+
KEY_STEPS = constants.KEY_STEPS
|
|
10
|
+
KEY_TEST_CASE = constants.KEY_TEST_CASE
|
|
11
|
+
KEY_TEST_CASES = constants.KEY_TEST_CASES
|
|
12
|
+
KEY_COMMANDS = "commands"
|
|
13
|
+
|
|
14
|
+
ACTOR_USER = "user"
|
|
15
|
+
ACTOR_BOT = "bot"
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
from typing import List, Optional, Dict, Any
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
4
|
+
|
|
5
|
+
from rasa.dialogue_understanding.commands import Command
|
|
6
|
+
from rasa.dialogue_understanding_test.constants import (
|
|
7
|
+
ACTOR_USER,
|
|
8
|
+
KEY_COMMANDS,
|
|
9
|
+
ACTOR_BOT,
|
|
10
|
+
KEY_TEST_CASE,
|
|
11
|
+
KEY_STEPS,
|
|
12
|
+
KEY_FIXTURES,
|
|
13
|
+
KEY_METADATA,
|
|
14
|
+
KEY_USER_INPUT,
|
|
15
|
+
KEY_BOT_INPUT,
|
|
16
|
+
KEY_BOT_UTTERED,
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class DialogueUnderstandingOutput(BaseModel):
|
|
21
|
+
"""Output containing prompts and generated commands by component.
|
|
22
|
+
|
|
23
|
+
Example of commands:
|
|
24
|
+
{
|
|
25
|
+
"MultiStepLLMCommandGenerator": [
|
|
26
|
+
{"command": "set_slot", "name": "slot_name", "value": "slot_value"},
|
|
27
|
+
],
|
|
28
|
+
"NLUCommandAdapter": [
|
|
29
|
+
{"command": "start_flow", "name": "test_flow"},
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
Example of prompts:
|
|
34
|
+
{
|
|
35
|
+
"MultiStepLLMCommandGenerator": [
|
|
36
|
+
(
|
|
37
|
+
"fill_slots_prompt",
|
|
38
|
+
{
|
|
39
|
+
"user_prompt": "<prompt content>",
|
|
40
|
+
"system_prompt": "<prompt content>"
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
(
|
|
44
|
+
"handle_flows_prompt",
|
|
45
|
+
{
|
|
46
|
+
"user_prompt": "<prompt content>",
|
|
47
|
+
"system_prompt": "<prompt content>"
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
],
|
|
51
|
+
}
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
prompts: Dict[str, tuple[str, Dict[str, str]]]
|
|
55
|
+
commands: Dict[str, List[Command]]
|
|
56
|
+
|
|
57
|
+
model_config = ConfigDict(frozen=True)
|
|
58
|
+
|
|
59
|
+
def get_component_data(
|
|
60
|
+
self, component_name: str
|
|
61
|
+
) -> tuple[Optional[tuple[str, Dict[str, str]]], List[Command]]:
|
|
62
|
+
"""Get both the prompts and commands for a specific component."""
|
|
63
|
+
return self.prompts.get(component_name), self.commands.get(component_name, [])
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class DialogueUnderstandingTestStep(BaseModel):
|
|
67
|
+
actor: str
|
|
68
|
+
text: Optional[str] = None
|
|
69
|
+
template: Optional[str] = None
|
|
70
|
+
line: Optional[int] = None
|
|
71
|
+
metadata_name: Optional[str] = None
|
|
72
|
+
commands: Optional[List[Command]] = None
|
|
73
|
+
dialogue_understanding_output: Optional[DialogueUnderstandingOutput] = None
|
|
74
|
+
|
|
75
|
+
def as_dict(self) -> Dict[str, Any]:
|
|
76
|
+
if self.actor == ACTOR_USER:
|
|
77
|
+
if self.commands:
|
|
78
|
+
return {
|
|
79
|
+
KEY_USER_INPUT: self.text,
|
|
80
|
+
# TODO: The command should be converted into our DSL
|
|
81
|
+
KEY_COMMANDS: [command.as_dict() for command in self.commands],
|
|
82
|
+
}
|
|
83
|
+
return {ACTOR_USER: self.text}
|
|
84
|
+
elif self.actor == ACTOR_BOT:
|
|
85
|
+
if self.text is not None:
|
|
86
|
+
return {KEY_BOT_INPUT: self.text}
|
|
87
|
+
elif self.template is not None:
|
|
88
|
+
return {KEY_BOT_UTTERED: self.template}
|
|
89
|
+
|
|
90
|
+
return {}
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
class DialogueUnderstandingTestCase(BaseModel):
|
|
94
|
+
name: str
|
|
95
|
+
steps: list[DialogueUnderstandingTestStep] = Field(min_length=1)
|
|
96
|
+
file: Optional[str] = None
|
|
97
|
+
line: Optional[int] = None
|
|
98
|
+
fixture_names: Optional[List[str]] = None
|
|
99
|
+
metadata_name: Optional[str] = None
|
|
100
|
+
|
|
101
|
+
def full_name(self) -> str:
|
|
102
|
+
return f"{self.file}::{self.name}"
|
|
103
|
+
|
|
104
|
+
def as_dict(self) -> Dict[str, Any]:
|
|
105
|
+
result = {
|
|
106
|
+
KEY_TEST_CASE: self.name,
|
|
107
|
+
KEY_STEPS: [step.as_dict() for step in self.steps],
|
|
108
|
+
}
|
|
109
|
+
if self.fixture_names:
|
|
110
|
+
result[KEY_FIXTURES] = self.fixture_names
|
|
111
|
+
if self.metadata_name:
|
|
112
|
+
result[KEY_METADATA] = self.metadata_name
|
|
113
|
+
return result
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
# Update forward references
|
|
117
|
+
DialogueUnderstandingTestStep.model_rebuild()
|
|
118
|
+
DialogueUnderstandingTestCase.model_rebuild()
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel
|
|
4
|
+
|
|
5
|
+
from rasa.dialogue_understanding_test.du_test_case import DialogueUnderstandingTestCase
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class DialogueUnderstandingTestResult(BaseModel):
|
|
9
|
+
test_case: DialogueUnderstandingTestCase
|
|
10
|
+
passed: bool
|
|
11
|
+
error_line: Optional[int] = None
|
rasa/e2e_test/e2e_test_case.py
CHANGED
|
@@ -5,6 +5,7 @@ from typing import Any, Dict, List, Optional, Text, Union
|
|
|
5
5
|
|
|
6
6
|
import structlog
|
|
7
7
|
|
|
8
|
+
from rasa.dialogue_understanding_test.du_test_case import DialogueUnderstandingTestCase
|
|
8
9
|
from rasa.e2e_test.assertions import Assertion
|
|
9
10
|
from rasa.e2e_test.constants import (
|
|
10
11
|
KEY_ASSERTIONS,
|
|
@@ -551,7 +552,7 @@ class Metadata:
|
|
|
551
552
|
class TestSuite:
|
|
552
553
|
"""Class for representing all top level test suite keys."""
|
|
553
554
|
|
|
554
|
-
test_cases: List[TestCase]
|
|
555
|
+
test_cases: List[Union[TestCase, DialogueUnderstandingTestCase]]
|
|
555
556
|
fixtures: List[Fixture]
|
|
556
557
|
metadata: List[Metadata]
|
|
557
558
|
stub_custom_actions: Dict[Text, StubCustomAction]
|
|
@@ -45,7 +45,7 @@ class E2ETestYAMLWriter:
|
|
|
45
45
|
|
|
46
46
|
yaml_data = ruamel.yaml.safe_load(tests)
|
|
47
47
|
|
|
48
|
-
test_cases_yaml = {KEY_TEST_CASES: yaml_data}
|
|
48
|
+
test_cases_yaml = [{KEY_TEST_CASES: yaml_data}]
|
|
49
49
|
with open(output_file, "w") as outfile:
|
|
50
50
|
yaml = ruamel.yaml.YAML()
|
|
51
51
|
yaml.dump(test_cases_yaml, outfile)
|
rasa/e2e_test/utils/io.py
CHANGED
|
@@ -404,7 +404,7 @@ def read_test_cases(path: str) -> TestSuite:
|
|
|
404
404
|
stub_data=stub_data,
|
|
405
405
|
)
|
|
406
406
|
|
|
407
|
-
validate_test_case(test_case_name, input_test_cases)
|
|
407
|
+
validate_test_case(test_case_name, input_test_cases, fixtures, metadata)
|
|
408
408
|
try:
|
|
409
409
|
if stub_custom_actions:
|
|
410
410
|
ensure_beta_feature_is_enabled(
|