rasa-pro 3.8.17__py3-none-any.whl → 3.9.14__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 +5 -5
- rasa/__main__.py +14 -9
- rasa/anonymization/anonymization_pipeline.py +0 -1
- rasa/anonymization/anonymization_rule_executor.py +3 -3
- rasa/anonymization/utils.py +4 -3
- rasa/api.py +2 -2
- rasa/cli/arguments/default_arguments.py +1 -1
- rasa/cli/arguments/run.py +2 -2
- rasa/cli/arguments/test.py +1 -1
- rasa/cli/arguments/train.py +10 -10
- rasa/cli/e2e_test.py +27 -7
- rasa/cli/export.py +0 -1
- rasa/cli/license.py +3 -3
- rasa/cli/project_templates/calm/actions/action_template.py +1 -1
- rasa/cli/project_templates/calm/config.yml +1 -1
- rasa/cli/project_templates/calm/credentials.yml +1 -1
- rasa/cli/project_templates/calm/data/flows/add_contact.yml +1 -1
- rasa/cli/project_templates/calm/data/flows/remove_contact.yml +1 -1
- rasa/cli/project_templates/calm/domain/add_contact.yml +8 -2
- rasa/cli/project_templates/calm/domain/list_contacts.yml +3 -0
- rasa/cli/project_templates/calm/domain/remove_contact.yml +9 -2
- rasa/cli/project_templates/calm/domain/shared.yml +5 -0
- rasa/cli/project_templates/calm/endpoints.yml +4 -4
- rasa/cli/project_templates/default/actions/actions.py +1 -1
- rasa/cli/project_templates/default/config.yml +5 -5
- rasa/cli/project_templates/default/credentials.yml +1 -1
- rasa/cli/project_templates/default/endpoints.yml +4 -4
- rasa/cli/project_templates/default/tests/test_stories.yml +1 -1
- rasa/cli/project_templates/tutorial/config.yml +1 -1
- rasa/cli/project_templates/tutorial/credentials.yml +1 -1
- rasa/cli/project_templates/tutorial/data/patterns.yml +6 -0
- rasa/cli/project_templates/tutorial/domain.yml +4 -0
- rasa/cli/project_templates/tutorial/endpoints.yml +6 -6
- rasa/cli/run.py +0 -1
- rasa/cli/scaffold.py +3 -2
- rasa/cli/studio/download.py +11 -0
- rasa/cli/studio/studio.py +180 -24
- rasa/cli/studio/upload.py +0 -8
- rasa/cli/telemetry.py +18 -6
- rasa/cli/utils.py +21 -10
- rasa/cli/x.py +3 -2
- rasa/core/actions/action.py +90 -315
- rasa/core/actions/action_exceptions.py +24 -0
- rasa/core/actions/constants.py +3 -0
- rasa/core/actions/custom_action_executor.py +188 -0
- rasa/core/actions/forms.py +11 -7
- rasa/core/actions/grpc_custom_action_executor.py +251 -0
- rasa/core/actions/http_custom_action_executor.py +140 -0
- rasa/core/actions/loops.py +3 -0
- rasa/core/actions/two_stage_fallback.py +1 -1
- rasa/core/agent.py +2 -4
- rasa/core/brokers/pika.py +1 -2
- rasa/core/channels/audiocodes.py +1 -1
- rasa/core/channels/botframework.py +0 -1
- rasa/core/channels/callback.py +0 -1
- rasa/core/channels/console.py +6 -8
- rasa/core/channels/development_inspector.py +1 -1
- rasa/core/channels/facebook.py +0 -3
- rasa/core/channels/hangouts.py +0 -6
- rasa/core/channels/inspector/dist/assets/{arc-5623b6dc.js → arc-b6e548fe.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{c4Diagram-d0fbc5ce-685c106a.js → c4Diagram-d0fbc5ce-fa03ac9e.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{classDiagram-936ed81e-8cbed007.js → classDiagram-936ed81e-ee67392a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{classDiagram-v2-c3cb15f1-5889cf12.js → classDiagram-v2-c3cb15f1-9b283fae.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{createText-62fc7601-24c249d7.js → createText-62fc7601-8b6fcc2a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{edges-f2ad444c-7dd06a75.js → edges-f2ad444c-22e77f4f.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{erDiagram-9d236eb7-62c1e54c.js → erDiagram-9d236eb7-60ffc87f.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDb-1972c806-ce49b86f.js → flowDb-1972c806-9dd802e4.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDiagram-7ea5b25a-4067e48f.js → flowDiagram-7ea5b25a-5fa1912f.js} +1 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-855bc5b3-1844e5a5.js +1 -0
- rasa/core/channels/inspector/dist/assets/{flowchart-elk-definition-abe16c3d-59fe4051.js → flowchart-elk-definition-abe16c3d-622a1fd2.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{ganttDiagram-9b5ea136-47e3a43b.js → ganttDiagram-9b5ea136-e285a63a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-99d0ae7c-5a2ac0d9.js → gitGraphDiagram-99d0ae7c-f237bdca.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-2c4b9a3b-dfb8efc4.js → index-2c4b9a3b-4b03d70e.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-268a75c0.js → index-a5d3e69d.js} +4 -4
- rasa/core/channels/inspector/dist/assets/{infoDiagram-736b4530-b0c470f2.js → infoDiagram-736b4530-72a0fa5f.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{journeyDiagram-df861f2b-2edb829a.js → journeyDiagram-df861f2b-82218c41.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{layout-b6873d69.js → layout-78cff630.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{line-1efc5781.js → line-5038b469.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{linear-661e9b94.js → linear-c4fc4098.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{mindmap-definition-beec6740-2d2e727f.js → mindmap-definition-beec6740-c33c8ea6.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{pieDiagram-dbbf0591-9d3ea93d.js → pieDiagram-dbbf0591-a8d03059.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{quadrantDiagram-4d7f4fd6-06a178a2.js → quadrantDiagram-4d7f4fd6-6a0e56b2.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{requirementDiagram-6fc4c22a-0bfedffc.js → requirementDiagram-6fc4c22a-2dc7c7bd.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sankeyDiagram-8f13d901-d76d0a04.js → sankeyDiagram-8f13d901-2360fe39.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sequenceDiagram-b655622a-37bb4341.js → sequenceDiagram-b655622a-41b9f9ad.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-59f0c015-f52f7f57.js → stateDiagram-59f0c015-0aad326f.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-v2-2b26beab-4a986a20.js → stateDiagram-v2-2b26beab-9847d984.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-080da4f6-7dd9ae12.js → styles-080da4f6-564d890e.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-3dcbcfbf-46e1ca14.js → styles-3dcbcfbf-38957613.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-9c745c82-4a97439a.js → styles-9c745c82-f0fc6921.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{svgDrawCommon-4835440b-823917a3.js → svgDrawCommon-4835440b-ef3c5a77.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{timeline-definition-5b62e21b-9ea72896.js → timeline-definition-5b62e21b-bf3e91c1.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{xychartDiagram-2b33534f-b631a8b6.js → xychartDiagram-2b33534f-4d4026c0.js} +1 -1
- rasa/core/channels/inspector/dist/index.html +1 -1
- rasa/core/channels/inspector/src/components/DiagramFlow.tsx +10 -0
- rasa/core/channels/inspector/src/helpers/formatters.test.ts +4 -7
- rasa/core/channels/inspector/src/helpers/formatters.ts +3 -2
- rasa/core/channels/rest.py +36 -21
- rasa/core/channels/rocketchat.py +0 -1
- rasa/core/channels/socketio.py +1 -1
- rasa/core/channels/telegram.py +3 -3
- rasa/core/channels/webexteams.py +0 -1
- rasa/core/concurrent_lock_store.py +1 -1
- rasa/core/evaluation/marker_base.py +1 -3
- rasa/core/evaluation/marker_stats.py +1 -2
- rasa/core/featurizers/single_state_featurizer.py +2 -4
- rasa/core/featurizers/tracker_featurizers.py +0 -7
- rasa/core/information_retrieval/__init__.py +7 -0
- rasa/core/information_retrieval/faiss.py +9 -4
- rasa/core/information_retrieval/information_retrieval.py +64 -7
- rasa/core/information_retrieval/milvus.py +7 -14
- rasa/core/information_retrieval/qdrant.py +8 -15
- rasa/core/lock_store.py +0 -1
- rasa/core/migrate.py +1 -2
- rasa/core/nlg/callback.py +3 -4
- rasa/core/policies/enterprise_search_policy.py +86 -22
- rasa/core/policies/enterprise_search_prompt_template.jinja2 +4 -41
- rasa/core/policies/enterprise_search_prompt_with_citation_template.jinja2 +60 -0
- rasa/core/policies/flows/flow_executor.py +104 -2
- rasa/core/policies/intentless_policy.py +7 -9
- rasa/core/policies/memoization.py +3 -3
- rasa/core/policies/policy.py +18 -9
- rasa/core/policies/rule_policy.py +8 -11
- rasa/core/policies/ted_policy.py +28 -30
- rasa/core/policies/unexpected_intent_policy.py +1 -2
- rasa/core/processor.py +136 -47
- rasa/core/run.py +41 -25
- rasa/core/secrets_manager/endpoints.py +2 -2
- rasa/core/secrets_manager/vault.py +6 -8
- rasa/core/test.py +3 -5
- rasa/core/tracker_store.py +49 -14
- rasa/core/train.py +1 -3
- rasa/core/training/interactive.py +9 -6
- rasa/core/utils.py +5 -10
- rasa/dialogue_understanding/coexistence/intent_based_router.py +11 -4
- rasa/dialogue_understanding/coexistence/llm_based_router.py +2 -3
- rasa/dialogue_understanding/commands/__init__.py +4 -0
- rasa/dialogue_understanding/commands/can_not_handle_command.py +9 -0
- rasa/dialogue_understanding/commands/cancel_flow_command.py +9 -0
- rasa/dialogue_understanding/commands/change_flow_command.py +38 -0
- rasa/dialogue_understanding/commands/chit_chat_answer_command.py +9 -0
- rasa/dialogue_understanding/commands/clarify_command.py +9 -0
- rasa/dialogue_understanding/commands/correct_slots_command.py +9 -0
- rasa/dialogue_understanding/commands/error_command.py +12 -0
- rasa/dialogue_understanding/commands/handle_code_change_command.py +9 -0
- rasa/dialogue_understanding/commands/human_handoff_command.py +9 -0
- rasa/dialogue_understanding/commands/knowledge_answer_command.py +9 -0
- rasa/dialogue_understanding/commands/noop_command.py +9 -0
- rasa/dialogue_understanding/commands/set_slot_command.py +34 -3
- rasa/dialogue_understanding/commands/skip_question_command.py +9 -0
- rasa/dialogue_understanding/commands/start_flow_command.py +9 -0
- rasa/dialogue_understanding/generator/__init__.py +16 -1
- rasa/dialogue_understanding/generator/command_generator.py +92 -6
- rasa/dialogue_understanding/generator/constants.py +18 -0
- rasa/dialogue_understanding/generator/flow_retrieval.py +7 -5
- rasa/dialogue_understanding/generator/llm_based_command_generator.py +467 -0
- rasa/dialogue_understanding/generator/llm_command_generator.py +39 -609
- rasa/dialogue_understanding/generator/multi_step/__init__.py +0 -0
- rasa/dialogue_understanding/generator/multi_step/fill_slots_prompt.jinja2 +62 -0
- rasa/dialogue_understanding/generator/multi_step/handle_flows_prompt.jinja2 +38 -0
- rasa/dialogue_understanding/generator/multi_step/multi_step_llm_command_generator.py +827 -0
- rasa/dialogue_understanding/generator/nlu_command_adapter.py +69 -8
- rasa/dialogue_understanding/generator/single_step/__init__.py +0 -0
- rasa/dialogue_understanding/generator/single_step/single_step_llm_command_generator.py +345 -0
- rasa/dialogue_understanding/patterns/default_flows_for_patterns.yml +44 -39
- rasa/dialogue_understanding/processor/command_processor.py +111 -3
- rasa/e2e_test/constants.py +1 -0
- rasa/e2e_test/e2e_test_case.py +44 -0
- rasa/e2e_test/e2e_test_runner.py +114 -11
- rasa/e2e_test/e2e_test_schema.yml +18 -0
- rasa/engine/caching.py +0 -1
- rasa/engine/graph.py +18 -6
- rasa/engine/recipes/config_files/default_config.yml +3 -3
- rasa/engine/recipes/default_components.py +1 -1
- rasa/engine/recipes/default_recipe.py +4 -5
- rasa/engine/recipes/recipe.py +1 -1
- rasa/engine/runner/dask.py +3 -9
- rasa/engine/storage/local_model_storage.py +0 -2
- rasa/engine/validation.py +179 -145
- rasa/exceptions.py +2 -2
- rasa/graph_components/validators/default_recipe_validator.py +3 -5
- rasa/hooks.py +0 -1
- rasa/model.py +1 -1
- rasa/model_training.py +1 -0
- rasa/nlu/classifiers/diet_classifier.py +8 -14
- rasa/nlu/extractors/crf_entity_extractor.py +4 -4
- rasa/nlu/extractors/duckling_entity_extractor.py +1 -1
- rasa/nlu/featurizers/dense_featurizer/convert_featurizer.py +1 -5
- rasa/nlu/featurizers/dense_featurizer/lm_featurizer.py +0 -4
- rasa/nlu/featurizers/featurizer.py +1 -1
- rasa/nlu/featurizers/sparse_featurizer/count_vectors_featurizer.py +2 -4
- rasa/nlu/featurizers/sparse_featurizer/lexical_syntactic_featurizer.py +9 -12
- rasa/nlu/persistor.py +68 -26
- rasa/nlu/selectors/response_selector.py +7 -10
- rasa/nlu/test.py +0 -3
- rasa/nlu/utils/hugging_face/registry.py +1 -1
- rasa/nlu/utils/spacy_utils.py +1 -3
- rasa/server.py +22 -7
- rasa/shared/constants.py +12 -1
- rasa/shared/core/command_payload_reader.py +109 -0
- rasa/shared/core/constants.py +4 -5
- rasa/shared/core/domain.py +57 -56
- rasa/shared/core/events.py +4 -7
- rasa/shared/core/flows/flow.py +9 -0
- rasa/shared/core/flows/flows_list.py +12 -0
- rasa/shared/core/flows/steps/action.py +7 -2
- rasa/shared/core/generator.py +12 -11
- rasa/shared/core/slot_mappings.py +315 -24
- rasa/shared/core/slots.py +4 -2
- rasa/shared/core/trackers.py +32 -14
- rasa/shared/core/training_data/loading.py +0 -1
- rasa/shared/core/training_data/story_reader/story_reader.py +3 -3
- rasa/shared/core/training_data/story_reader/yaml_story_reader.py +11 -11
- rasa/shared/core/training_data/story_writer/yaml_story_writer.py +5 -3
- rasa/shared/core/training_data/structures.py +1 -1
- rasa/shared/core/training_data/visualization.py +1 -1
- rasa/shared/data.py +58 -1
- rasa/shared/exceptions.py +36 -2
- rasa/shared/importers/importer.py +1 -2
- rasa/shared/importers/rasa.py +0 -1
- rasa/shared/nlu/constants.py +2 -0
- rasa/shared/nlu/training_data/entities_parser.py +1 -2
- rasa/shared/nlu/training_data/formats/dialogflow.py +3 -2
- rasa/shared/nlu/training_data/formats/rasa_yaml.py +3 -5
- rasa/shared/nlu/training_data/formats/readerwriter.py +0 -1
- rasa/shared/nlu/training_data/message.py +13 -0
- rasa/shared/nlu/training_data/training_data.py +0 -2
- rasa/shared/providers/openai/session_handler.py +2 -2
- rasa/shared/utils/constants.py +3 -0
- rasa/shared/utils/io.py +11 -0
- rasa/shared/utils/llm.py +1 -2
- rasa/shared/utils/pykwalify_extensions.py +1 -0
- rasa/shared/utils/schemas/domain.yml +3 -0
- rasa/shared/utils/yaml.py +44 -35
- rasa/studio/auth.py +26 -10
- rasa/studio/constants.py +2 -0
- rasa/studio/data_handler.py +114 -107
- rasa/studio/download.py +160 -27
- rasa/studio/results_logger.py +137 -0
- rasa/studio/train.py +6 -7
- rasa/studio/upload.py +159 -134
- rasa/telemetry.py +188 -34
- rasa/tracing/config.py +18 -3
- rasa/tracing/constants.py +26 -2
- rasa/tracing/instrumentation/attribute_extractors.py +50 -41
- rasa/tracing/instrumentation/instrumentation.py +290 -44
- rasa/tracing/instrumentation/intentless_policy_instrumentation.py +7 -5
- rasa/tracing/instrumentation/metrics.py +109 -21
- rasa/tracing/metric_instrument_provider.py +83 -3
- rasa/utils/cli.py +2 -1
- rasa/utils/common.py +1 -1
- rasa/utils/endpoints.py +1 -2
- rasa/utils/io.py +6 -6
- rasa/utils/licensing.py +246 -31
- rasa/utils/ml_utils.py +1 -1
- rasa/utils/tensorflow/data_generator.py +1 -1
- rasa/utils/tensorflow/environment.py +1 -1
- rasa/utils/tensorflow/model_data.py +9 -11
- rasa/utils/tensorflow/model_data_utils.py +499 -500
- rasa/utils/tensorflow/models.py +5 -6
- rasa/utils/tensorflow/rasa_layers.py +15 -15
- rasa/utils/train_utils.py +1 -1
- rasa/utils/url_tools.py +53 -0
- rasa/validator.py +305 -3
- rasa/version.py +1 -1
- {rasa_pro-3.8.17.dist-info → rasa_pro-3.9.14.dist-info}/METADATA +22 -22
- {rasa_pro-3.8.17.dist-info → rasa_pro-3.9.14.dist-info}/RECORD +271 -253
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-855bc5b3-85583a23.js +0 -1
- /rasa/dialogue_understanding/generator/{command_prompt_template.jinja2 → single_step/command_prompt_template.jinja2} +0 -0
- {rasa_pro-3.8.17.dist-info → rasa_pro-3.9.14.dist-info}/NOTICE +0 -0
- {rasa_pro-3.8.17.dist-info → rasa_pro-3.9.14.dist-info}/WHEEL +0 -0
- {rasa_pro-3.8.17.dist-info → rasa_pro-3.9.14.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-a5d3e69d.js";import{c as Qt}from"./createText-62fc7601-8b6fcc2a.js";import{i as Kt}from"./init-77b53fdd.js";import{o as Zt}from"./ordinal-ba9b4969.js";import{l as ft}from"./linear-c4fc4098.js";import{l as pt}from"./line-5038b469.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-a5d3e69d.js"></script>
|
|
10
10
|
<link rel="stylesheet" href="./assets/index-3ee28881.css">
|
|
11
11
|
</head>
|
|
12
12
|
|
|
@@ -25,6 +25,9 @@ export const DiagramFlow = (props: Props) => {
|
|
|
25
25
|
const config = {
|
|
26
26
|
startOnLoad: true,
|
|
27
27
|
logLevel: 'info',
|
|
28
|
+
flowchart: {
|
|
29
|
+
useMaxWidth: false,
|
|
30
|
+
},
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
useEffect(() => {
|
|
@@ -37,6 +40,13 @@ export const DiagramFlow = (props: Props) => {
|
|
|
37
40
|
// attribute prevents it. We need to remove it each time `text` changes
|
|
38
41
|
mermaidRef.current?.removeAttribute("data-processed");
|
|
39
42
|
mermaid.contentLoaded();
|
|
43
|
+
|
|
44
|
+
setTimeout(() => {
|
|
45
|
+
const active = document.querySelectorAll(".active")[0];
|
|
46
|
+
if (active) {
|
|
47
|
+
active.scrollIntoView({ behavior: "smooth"});
|
|
48
|
+
}
|
|
49
|
+
}, 0);
|
|
40
50
|
}, [text]);
|
|
41
51
|
|
|
42
52
|
useEffect(() => {
|
|
@@ -89,9 +89,6 @@ describe("helpers", () => {
|
|
|
89
89
|
},
|
|
90
90
|
{
|
|
91
91
|
event: "bot",
|
|
92
|
-
metadata: {
|
|
93
|
-
utter_action: "utter_ask_book_restaurant_number_of_people",
|
|
94
|
-
},
|
|
95
92
|
text: "How many people are we talking?",
|
|
96
93
|
},
|
|
97
94
|
{
|
|
@@ -111,11 +108,11 @@ describe("helpers", () => {
|
|
|
111
108
|
expect(result).toEqual(`test_cases:
|
|
112
109
|
- test_case: ${sessionId}
|
|
113
110
|
steps:
|
|
114
|
-
- user: book a restaurant
|
|
111
|
+
- user: "book a restaurant"
|
|
115
112
|
- utter: utter_ask_book_restaurant_name_of_restaurant
|
|
116
|
-
- user: simsim
|
|
117
|
-
-
|
|
118
|
-
- user: 100
|
|
113
|
+
- user: "simsim"
|
|
114
|
+
- bot: "How many people are we talking?"
|
|
115
|
+
- user: "100"
|
|
119
116
|
- utter: utter_ask_book_restaurant_date`);
|
|
120
117
|
});
|
|
121
118
|
});
|
|
@@ -23,13 +23,14 @@ export const formatTestCases = (events: Event[], sessionId: string) => {
|
|
|
23
23
|
|
|
24
24
|
const steps = events
|
|
25
25
|
.map((event) => {
|
|
26
|
+
const escapedText = JSON.stringify(event.text);
|
|
26
27
|
if (event.event === "user") {
|
|
27
|
-
return ` - user: ${
|
|
28
|
+
return ` - user: ${escapedText}`;
|
|
28
29
|
} else if (event.event === "bot") {
|
|
29
30
|
return `${
|
|
30
31
|
event.metadata?.utter_action
|
|
31
32
|
? ` - utter: ${event.metadata.utter_action}`
|
|
32
|
-
: ` -
|
|
33
|
+
: ` - bot: ${escapedText}`
|
|
33
34
|
}`;
|
|
34
35
|
}
|
|
35
36
|
})
|
rasa/core/channels/rest.py
CHANGED
|
@@ -3,12 +3,23 @@ import copy
|
|
|
3
3
|
import inspect
|
|
4
4
|
import json
|
|
5
5
|
import logging
|
|
6
|
+
from functools import partial
|
|
7
|
+
|
|
6
8
|
import structlog
|
|
7
9
|
from asyncio import Queue, CancelledError
|
|
8
10
|
from sanic import Blueprint, response
|
|
9
11
|
from sanic.request import Request
|
|
10
12
|
from sanic.response import HTTPResponse, ResponseStream
|
|
11
|
-
from typing import
|
|
13
|
+
from typing import (
|
|
14
|
+
Text,
|
|
15
|
+
Dict,
|
|
16
|
+
Any,
|
|
17
|
+
Optional,
|
|
18
|
+
Callable,
|
|
19
|
+
Awaitable,
|
|
20
|
+
NoReturn,
|
|
21
|
+
Union,
|
|
22
|
+
)
|
|
12
23
|
|
|
13
24
|
import rasa.utils.endpoints
|
|
14
25
|
from rasa.core.channels.channel import (
|
|
@@ -77,14 +88,15 @@ class RestInput(InputChannel):
|
|
|
77
88
|
"""
|
|
78
89
|
return request.json.get("metadata", None)
|
|
79
90
|
|
|
80
|
-
def stream_response(
|
|
91
|
+
async def stream_response(
|
|
81
92
|
self,
|
|
82
93
|
on_new_message: Callable[[UserMessage], Awaitable[None]],
|
|
83
94
|
text: Text,
|
|
84
95
|
sender_id: Text,
|
|
85
96
|
input_channel: Text,
|
|
86
97
|
metadata: Optional[Dict[Text, Any]],
|
|
87
|
-
|
|
98
|
+
resp: ResponseStream,
|
|
99
|
+
) -> None:
|
|
88
100
|
"""Streams response to the client.
|
|
89
101
|
|
|
90
102
|
If the stream option is enabled, this method will be called to
|
|
@@ -96,27 +108,25 @@ class RestInput(InputChannel):
|
|
|
96
108
|
sender_id: message sender_id
|
|
97
109
|
input_channel: input channel name
|
|
98
110
|
metadata: optional metadata sent with the message
|
|
111
|
+
resp: response stream
|
|
99
112
|
|
|
100
113
|
Returns:
|
|
101
114
|
Sanic stream
|
|
102
115
|
"""
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
self.on_message_wrapper(
|
|
108
|
-
on_new_message, text, q, sender_id, input_channel, metadata
|
|
109
|
-
)
|
|
116
|
+
q: Queue = Queue()
|
|
117
|
+
task = asyncio.ensure_future(
|
|
118
|
+
self.on_message_wrapper(
|
|
119
|
+
on_new_message, text, q, sender_id, input_channel, metadata
|
|
110
120
|
)
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
121
|
+
)
|
|
122
|
+
while True:
|
|
123
|
+
result = await q.get()
|
|
124
|
+
if result == "DONE":
|
|
125
|
+
break
|
|
126
|
+
else:
|
|
127
|
+
await resp.write(json.dumps(result) + "\n")
|
|
118
128
|
|
|
119
|
-
|
|
129
|
+
await task
|
|
120
130
|
|
|
121
131
|
def blueprint(
|
|
122
132
|
self, on_new_message: Callable[[UserMessage], Awaitable[None]]
|
|
@@ -149,9 +159,14 @@ class RestInput(InputChannel):
|
|
|
149
159
|
metadata = self.get_metadata(request)
|
|
150
160
|
|
|
151
161
|
if should_use_stream:
|
|
152
|
-
return
|
|
153
|
-
|
|
154
|
-
|
|
162
|
+
return ResponseStream(
|
|
163
|
+
partial(
|
|
164
|
+
self.stream_response,
|
|
165
|
+
on_new_message,
|
|
166
|
+
text,
|
|
167
|
+
sender_id,
|
|
168
|
+
input_channel,
|
|
169
|
+
metadata,
|
|
155
170
|
),
|
|
156
171
|
content_type="text/event-stream",
|
|
157
172
|
)
|
rasa/core/channels/rocketchat.py
CHANGED
rasa/core/channels/socketio.py
CHANGED
|
@@ -178,7 +178,7 @@ class SocketIOInput(InputChannel):
|
|
|
178
178
|
rasa.shared.utils.io.raise_warning(
|
|
179
179
|
"SocketIO output channel cannot be recreated. "
|
|
180
180
|
"This is expected behavior when using multiple Sanic "
|
|
181
|
-
"workers or multiple Rasa
|
|
181
|
+
"workers or multiple Rasa Pro instances. "
|
|
182
182
|
"Please use a different channel for external events in these "
|
|
183
183
|
"scenarios."
|
|
184
184
|
)
|
rasa/core/channels/telegram.py
CHANGED
|
@@ -97,8 +97,9 @@ class TelegramOutput(Bot, OutputChannel):
|
|
|
97
97
|
reply_markup.add(KeyboardButton(button["title"]))
|
|
98
98
|
else:
|
|
99
99
|
logger.error(
|
|
100
|
-
"Trying to send text with buttons for unknown "
|
|
101
|
-
|
|
100
|
+
"Trying to send text with buttons for unknown button type {}".format(
|
|
101
|
+
button_type
|
|
102
|
+
)
|
|
102
103
|
)
|
|
103
104
|
return
|
|
104
105
|
|
|
@@ -215,7 +216,6 @@ class TelegramInput(InputChannel):
|
|
|
215
216
|
@telegram_webhook.route("/webhook", methods=["GET", "POST"])
|
|
216
217
|
async def message(request: Request) -> Any:
|
|
217
218
|
if request.method == "POST":
|
|
218
|
-
|
|
219
219
|
request_dict = request.json
|
|
220
220
|
if isinstance(request_dict, Text):
|
|
221
221
|
request_dict = json.loads(request_dict)
|
rasa/core/channels/webexteams.py
CHANGED
|
@@ -134,7 +134,7 @@ class ConcurrentRedisLockStore(LockStore):
|
|
|
134
134
|
lock = self.get_or_create_lock(conversation_id)
|
|
135
135
|
lock.remove_expired_tickets()
|
|
136
136
|
ticket_number = self.increment_ticket_number(lock)
|
|
137
|
-
ticket = lock.concurrent_issue_ticket(lock_lifetime, ticket_number) # type: ignore[attr-defined]
|
|
137
|
+
ticket = lock.concurrent_issue_ticket(lock_lifetime, ticket_number) # type: ignore[attr-defined]
|
|
138
138
|
self.save_lock(lock)
|
|
139
139
|
|
|
140
140
|
return ticket
|
|
@@ -48,9 +48,7 @@ class MarkerRegistry:
|
|
|
48
48
|
"""Keeps track of tags that can be used to configure markers."""
|
|
49
49
|
|
|
50
50
|
all_tags: Set[Text] = set() # noqa: RUF012
|
|
51
|
-
condition_tag_to_marker_class: Dict[
|
|
52
|
-
Text, Type[ConditionMarker]
|
|
53
|
-
] = {} # noqa: RUF012
|
|
51
|
+
condition_tag_to_marker_class: Dict[Text, Type[ConditionMarker]] = {} # noqa: RUF012
|
|
54
52
|
operator_tag_to_marker_class: Dict[Text, Type[OperatorMarker]] = {} # noqa: RUF012
|
|
55
53
|
marker_class_to_tag: Dict[Type[Marker], Text] = {} # noqa: RUF012
|
|
56
54
|
negated_tag_to_tag: Dict[Text, Text] = {} # noqa: RUF012
|
|
@@ -12,7 +12,7 @@ from rasa.core.evaluation.marker_base import EventMetaData
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
def compute_statistics(
|
|
15
|
-
values: List[Union[float, int]]
|
|
15
|
+
values: List[Union[float, int]],
|
|
16
16
|
) -> Dict[Text, Union[int, float, np.floating]]:
|
|
17
17
|
"""Computes some statistics over the given numbers."""
|
|
18
18
|
return {
|
|
@@ -138,7 +138,6 @@ class MarkerStatistics:
|
|
|
138
138
|
self.session_identifier.append((sender_id, session_idx))
|
|
139
139
|
|
|
140
140
|
for marker_name, meta_data in meta_data_on_relevant_events_per_marker.items():
|
|
141
|
-
|
|
142
141
|
num_preceding_user_turns = [
|
|
143
142
|
event_meta_data.preceding_user_turns for event_meta_data in meta_data
|
|
144
143
|
]
|
|
@@ -91,6 +91,7 @@ class SingleStateFeaturizer:
|
|
|
91
91
|
domain: An instance of :class:`rasa.shared.core.domain.Domain`.
|
|
92
92
|
bilou_tagging: indicates whether BILOU tagging should be used or not
|
|
93
93
|
"""
|
|
94
|
+
|
|
94
95
|
# store feature states for each attribute in order to create binary features
|
|
95
96
|
def convert_to_dict(feature_states: List[Text]) -> Dict[Text, int]:
|
|
96
97
|
return {
|
|
@@ -116,7 +117,7 @@ class SingleStateFeaturizer:
|
|
|
116
117
|
if attribute in {INTENT, ACTION_NAME}:
|
|
117
118
|
return {sub_state[attribute]: 1} # type: ignore[dict-item]
|
|
118
119
|
elif attribute == ENTITIES:
|
|
119
|
-
return {entity: 1 for entity in sub_state.get(ENTITIES, [])} # type: ignore[misc]
|
|
120
|
+
return {entity: 1 for entity in sub_state.get(ENTITIES, [])} # type: ignore[misc]
|
|
120
121
|
elif attribute == ACTIVE_LOOP:
|
|
121
122
|
return {sub_state["name"]: 1} # type: ignore[dict-item]
|
|
122
123
|
elif attribute == SLOTS:
|
|
@@ -185,14 +186,12 @@ class SingleStateFeaturizer:
|
|
|
185
186
|
precomputations: Optional[MessageContainerForCoreFeaturization],
|
|
186
187
|
sparse: bool = False,
|
|
187
188
|
) -> Dict[Text, List[Features]]:
|
|
188
|
-
|
|
189
189
|
# Remove entities from possible attributes
|
|
190
190
|
attributes = set(
|
|
191
191
|
attribute for attribute in sub_state.keys() if attribute != ENTITIES
|
|
192
192
|
)
|
|
193
193
|
|
|
194
194
|
if precomputations is not None:
|
|
195
|
-
|
|
196
195
|
# Collect features for all those attributes
|
|
197
196
|
attributes_to_features = precomputations.collect_features(
|
|
198
197
|
sub_state, attributes=attributes
|
|
@@ -262,7 +261,6 @@ class SingleStateFeaturizer:
|
|
|
262
261
|
# featurize user only if it is "real" user input,
|
|
263
262
|
# i.e. input from a turn after action_listen
|
|
264
263
|
if state_type == USER and is_prev_action_listen_in_state(state):
|
|
265
|
-
|
|
266
264
|
state_features.update(
|
|
267
265
|
self._extract_state_features(
|
|
268
266
|
sub_state, precomputations=precomputations, sparse=True
|
|
@@ -753,14 +753,12 @@ class MaxHistoryTrackerFeaturizer(TrackerFeaturizer):
|
|
|
753
753
|
disable=rasa.shared.utils.io.is_logging_disabled(),
|
|
754
754
|
)
|
|
755
755
|
for tracker in pbar:
|
|
756
|
-
|
|
757
756
|
for states, label, entities in self._extract_examples(
|
|
758
757
|
tracker,
|
|
759
758
|
domain,
|
|
760
759
|
omit_unset_slots=omit_unset_slots,
|
|
761
760
|
ignore_action_unlikely_intent=ignore_action_unlikely_intent,
|
|
762
761
|
):
|
|
763
|
-
|
|
764
762
|
if self.remove_duplicates:
|
|
765
763
|
hashed = self._hash_example(states, label)
|
|
766
764
|
if hashed in hashed_examples:
|
|
@@ -816,7 +814,6 @@ class MaxHistoryTrackerFeaturizer(TrackerFeaturizer):
|
|
|
816
814
|
entity_data = self._entity_data(event)
|
|
817
815
|
|
|
818
816
|
elif isinstance(event, ActionExecuted):
|
|
819
|
-
|
|
820
817
|
label_index += 1
|
|
821
818
|
|
|
822
819
|
# use only actions which can be predicted at a stories start
|
|
@@ -992,14 +989,12 @@ class IntentMaxHistoryTrackerFeaturizer(MaxHistoryTrackerFeaturizer):
|
|
|
992
989
|
disable=rasa.shared.utils.io.is_logging_disabled(),
|
|
993
990
|
)
|
|
994
991
|
for tracker in pbar:
|
|
995
|
-
|
|
996
992
|
for states, label, entities in self._extract_examples(
|
|
997
993
|
tracker,
|
|
998
994
|
domain,
|
|
999
995
|
omit_unset_slots=omit_unset_slots,
|
|
1000
996
|
ignore_action_unlikely_intent=ignore_action_unlikely_intent,
|
|
1001
997
|
):
|
|
1002
|
-
|
|
1003
998
|
if self.remove_duplicates:
|
|
1004
999
|
hashed = self._hash_example(states, label)
|
|
1005
1000
|
if hashed in hashed_examples:
|
|
@@ -1065,12 +1060,10 @@ class IntentMaxHistoryTrackerFeaturizer(MaxHistoryTrackerFeaturizer):
|
|
|
1065
1060
|
|
|
1066
1061
|
label_index = 0
|
|
1067
1062
|
for event in events:
|
|
1068
|
-
|
|
1069
1063
|
if isinstance(event, ActionExecuted):
|
|
1070
1064
|
label_index += 1
|
|
1071
1065
|
|
|
1072
1066
|
elif isinstance(event, UserUttered):
|
|
1073
|
-
|
|
1074
1067
|
sliced_states = self.slice_state_history(
|
|
1075
1068
|
tracker_states[:label_index], self.max_history
|
|
1076
1069
|
)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from pathlib import Path
|
|
2
|
-
from typing import TYPE_CHECKING, List, Optional, Text
|
|
2
|
+
from typing import TYPE_CHECKING, List, Optional, Text, Any, Dict
|
|
3
3
|
|
|
4
4
|
import structlog
|
|
5
5
|
from langchain.document_loaders import DirectoryLoader, TextLoader
|
|
@@ -7,7 +7,8 @@ from langchain.text_splitter import RecursiveCharacterTextSplitter
|
|
|
7
7
|
from langchain.vectorstores.faiss import FAISS
|
|
8
8
|
from rasa.utils.endpoints import EndpointConfig
|
|
9
9
|
|
|
10
|
-
from rasa.core.information_retrieval
|
|
10
|
+
from rasa.core.information_retrieval import (
|
|
11
|
+
SearchResultList,
|
|
11
12
|
InformationRetrieval,
|
|
12
13
|
InformationRetrievalException,
|
|
13
14
|
)
|
|
@@ -108,9 +109,13 @@ class FAISS_Store(InformationRetrieval):
|
|
|
108
109
|
"""Faiss does not need to connect to a server."""
|
|
109
110
|
pass
|
|
110
111
|
|
|
111
|
-
async def search(
|
|
112
|
+
async def search(
|
|
113
|
+
self, query: Text, tracker_state: Dict[str, Any], threshold: float = 0.0
|
|
114
|
+
) -> SearchResultList:
|
|
112
115
|
logger.debug("information_retrieval.faiss_store.search", query=query)
|
|
113
116
|
try:
|
|
114
|
-
|
|
117
|
+
documents = await self.index.as_retriever().aget_relevant_documents(query)
|
|
115
118
|
except Exception as exc:
|
|
116
119
|
raise InformationRetrievalException from exc
|
|
120
|
+
|
|
121
|
+
return SearchResultList.from_document_list(documents)
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
from
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import TYPE_CHECKING, List, Text, Any, Optional
|
|
4
5
|
|
|
5
6
|
import structlog
|
|
6
7
|
|
|
7
8
|
from rasa.shared.exceptions import RasaException
|
|
8
9
|
from rasa.utils.endpoints import EndpointConfig
|
|
10
|
+
import importlib
|
|
9
11
|
|
|
10
12
|
if TYPE_CHECKING:
|
|
11
13
|
from langchain.schema import Document
|
|
@@ -15,6 +17,40 @@ if TYPE_CHECKING:
|
|
|
15
17
|
logger = structlog.get_logger()
|
|
16
18
|
|
|
17
19
|
|
|
20
|
+
@dataclass
|
|
21
|
+
class SearchResult:
|
|
22
|
+
text: str
|
|
23
|
+
metadata: dict
|
|
24
|
+
score: Optional[float] = None
|
|
25
|
+
|
|
26
|
+
@classmethod
|
|
27
|
+
def from_document(cls, document: Document) -> "SearchResult":
|
|
28
|
+
"""Construct a SearchResult object from Langchain Document object."""
|
|
29
|
+
return cls(text=document.page_content, metadata=document.metadata)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@dataclass
|
|
33
|
+
class SearchResultList:
|
|
34
|
+
results: List[SearchResult]
|
|
35
|
+
metadata: dict
|
|
36
|
+
|
|
37
|
+
@classmethod
|
|
38
|
+
def from_document_list(cls, documents: List["Document"]) -> "SearchResultList":
|
|
39
|
+
"""
|
|
40
|
+
Convert a list of Langchain Documents to a SearchResultList object.
|
|
41
|
+
|
|
42
|
+
Args:
|
|
43
|
+
documents: List of Langchain Documents.
|
|
44
|
+
|
|
45
|
+
Returns:
|
|
46
|
+
SearchResultList object.
|
|
47
|
+
"""
|
|
48
|
+
return cls(
|
|
49
|
+
results=[SearchResult.from_document(doc) for doc in documents],
|
|
50
|
+
metadata={"total_results": len(documents)},
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
|
|
18
54
|
class InformationRetrievalException(RasaException):
|
|
19
55
|
"""Base class for exceptions raised by InformationRetrieval operations."""
|
|
20
56
|
|
|
@@ -28,6 +64,9 @@ class InformationRetrievalException(RasaException):
|
|
|
28
64
|
class InformationRetrieval:
|
|
29
65
|
"""Base class for any InformationRetrieval implementation."""
|
|
30
66
|
|
|
67
|
+
def __init__(self, embeddings: "Embeddings") -> None:
|
|
68
|
+
self.embeddings = embeddings
|
|
69
|
+
|
|
31
70
|
def connect(
|
|
32
71
|
self,
|
|
33
72
|
config: EndpointConfig,
|
|
@@ -40,8 +79,9 @@ class InformationRetrieval:
|
|
|
40
79
|
async def search(
|
|
41
80
|
self,
|
|
42
81
|
query: Text,
|
|
82
|
+
tracker_state: dict[str, Any],
|
|
43
83
|
threshold: float = 0.0,
|
|
44
|
-
) ->
|
|
84
|
+
) -> SearchResultList:
|
|
45
85
|
"""Search for a document in the InformationRetrieval system."""
|
|
46
86
|
raise NotImplementedError(
|
|
47
87
|
"InformationRetrieval must implement the `search` method."
|
|
@@ -65,8 +105,25 @@ def create_from_endpoint_config(
|
|
|
65
105
|
|
|
66
106
|
return Qdrant_Store(embeddings=embeddings)
|
|
67
107
|
else:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
108
|
+
# Import the module dynamically
|
|
109
|
+
try:
|
|
110
|
+
module_name, class_name = config_type.rsplit(".", 1)
|
|
111
|
+
module = importlib.import_module(module_name)
|
|
112
|
+
except ValueError:
|
|
113
|
+
logger.error(
|
|
114
|
+
"information_retrieval.create_from_endpoint_config.invalid_config",
|
|
115
|
+
config_type=config_type,
|
|
116
|
+
)
|
|
117
|
+
raise ValueError(
|
|
118
|
+
f"Invalid configuration for vector store: '{config_type}'. "
|
|
119
|
+
f"Expected a module path and a class name separated by a dot."
|
|
120
|
+
)
|
|
121
|
+
except ModuleNotFoundError:
|
|
122
|
+
logger.error(
|
|
123
|
+
"information_retrieval.create_from_endpoint_config.unknown_type",
|
|
124
|
+
config_type=config_type,
|
|
125
|
+
)
|
|
126
|
+
raise ImportError(f"Cannot retrieve class from path {config_type}.")
|
|
127
|
+
|
|
128
|
+
external_class = getattr(module, class_name)
|
|
129
|
+
return external_class(embeddings=embeddings)
|
|
@@ -1,30 +1,21 @@
|
|
|
1
|
-
from typing import
|
|
1
|
+
from typing import Text, Any, Dict
|
|
2
2
|
|
|
3
3
|
import structlog
|
|
4
4
|
from langchain.vectorstores.milvus import Milvus
|
|
5
5
|
from rasa.utils.endpoints import EndpointConfig
|
|
6
6
|
|
|
7
|
-
from rasa.core.information_retrieval
|
|
7
|
+
from rasa.core.information_retrieval import (
|
|
8
|
+
SearchResultList,
|
|
8
9
|
InformationRetrieval,
|
|
9
10
|
InformationRetrievalException,
|
|
10
11
|
)
|
|
11
12
|
|
|
12
|
-
if TYPE_CHECKING:
|
|
13
|
-
from langchain.schema import Document
|
|
14
|
-
from langchain.schema.embeddings import Embeddings
|
|
15
|
-
|
|
16
13
|
logger = structlog.get_logger()
|
|
17
14
|
|
|
18
15
|
|
|
19
16
|
class Milvus_Store(InformationRetrieval):
|
|
20
17
|
"""Milvus Store implementation."""
|
|
21
18
|
|
|
22
|
-
def __init__(
|
|
23
|
-
self,
|
|
24
|
-
embeddings: "Embeddings",
|
|
25
|
-
):
|
|
26
|
-
self.embeddings = embeddings
|
|
27
|
-
|
|
28
19
|
def connect(self, config: EndpointConfig) -> None:
|
|
29
20
|
"""Connect to the Milvus system."""
|
|
30
21
|
params = config.kwargs
|
|
@@ -39,7 +30,9 @@ class Milvus_Store(InformationRetrieval):
|
|
|
39
30
|
collection_name=str(params.get("collection")),
|
|
40
31
|
)
|
|
41
32
|
|
|
42
|
-
async def search(
|
|
33
|
+
async def search(
|
|
34
|
+
self, query: Text, tracker_state: Dict[str, Any], threshold: float = 0.0
|
|
35
|
+
) -> SearchResultList:
|
|
43
36
|
"""Search for documents in the Milvus store.
|
|
44
37
|
|
|
45
38
|
Args:
|
|
@@ -56,4 +49,4 @@ class Milvus_Store(InformationRetrieval):
|
|
|
56
49
|
raise InformationRetrievalException from exc
|
|
57
50
|
|
|
58
51
|
filtered_hits = [doc for doc, score in hits if score >= threshold]
|
|
59
|
-
return filtered_hits
|
|
52
|
+
return SearchResultList.from_document_list(filtered_hits)
|