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
|
@@ -11,7 +11,7 @@ responses:
|
|
|
11
11
|
template: jinja
|
|
12
12
|
|
|
13
13
|
utter_can_do_something_else:
|
|
14
|
-
- text: "What else I
|
|
14
|
+
- text: "What else can I help you with?"
|
|
15
15
|
metadata:
|
|
16
16
|
rephrase: True
|
|
17
17
|
|
|
@@ -55,7 +55,7 @@ responses:
|
|
|
55
55
|
template: jinja
|
|
56
56
|
|
|
57
57
|
utter_free_chitchat_response:
|
|
58
|
-
- text:
|
|
58
|
+
- text: placeholder_this_utterance_needs_the_rephraser
|
|
59
59
|
metadata:
|
|
60
60
|
rephrase: True
|
|
61
61
|
rephrase_prompt: |
|
|
@@ -100,11 +100,11 @@ slots:
|
|
|
100
100
|
confirm_correction:
|
|
101
101
|
type: bool
|
|
102
102
|
mappings:
|
|
103
|
-
- type:
|
|
103
|
+
- type: from_llm
|
|
104
104
|
|
|
105
105
|
flows:
|
|
106
106
|
pattern_cancel_flow:
|
|
107
|
-
description:
|
|
107
|
+
description: Conversation repair flow that starts when a flow is cancelled
|
|
108
108
|
name: pattern_cancel_flow
|
|
109
109
|
steps:
|
|
110
110
|
- action: action_cancel_flow
|
|
@@ -112,72 +112,77 @@ flows:
|
|
|
112
112
|
|
|
113
113
|
pattern_cannot_handle:
|
|
114
114
|
description: |
|
|
115
|
-
|
|
115
|
+
Conversation repair flow for addressing failed command generation scenarios
|
|
116
116
|
name: pattern cannot handle
|
|
117
117
|
steps:
|
|
118
118
|
- noop: true
|
|
119
119
|
next:
|
|
120
120
|
# chitchat fallback
|
|
121
|
-
- if: "'{{context.reason}}'
|
|
121
|
+
- if: "'{{context.reason}}' = 'cannot_handle_chitchat'"
|
|
122
122
|
then:
|
|
123
123
|
- action: utter_cannot_handle
|
|
124
124
|
next: "END"
|
|
125
|
+
# fallback for things that are not supported
|
|
126
|
+
- if: "'{{context.reason}}' = 'cannot_handle_not_supported'"
|
|
127
|
+
then:
|
|
128
|
+
- action: utter_cannot_handle
|
|
129
|
+
next: END
|
|
125
130
|
# default
|
|
126
131
|
- else:
|
|
127
132
|
- action: utter_ask_rephrase
|
|
128
|
-
next:
|
|
133
|
+
next: END
|
|
129
134
|
|
|
130
135
|
pattern_chitchat:
|
|
131
|
-
description:
|
|
136
|
+
description: Conversation repair flow for off-topic interactions that won't disrupt the main conversation
|
|
132
137
|
name: pattern chitchat
|
|
133
138
|
steps:
|
|
134
139
|
- action: action_trigger_chitchat
|
|
135
140
|
|
|
136
141
|
pattern_clarification:
|
|
137
|
-
description:
|
|
142
|
+
description: Conversation repair flow for handling ambiguous requests that could match multiple flows
|
|
138
143
|
name: pattern clarification
|
|
139
144
|
steps:
|
|
140
145
|
- action: action_clarify_flows
|
|
141
146
|
- action: utter_clarification_options_rasa
|
|
142
147
|
|
|
143
148
|
pattern_code_change:
|
|
144
|
-
description: flow
|
|
149
|
+
description: Conversation repair flow for cleaning the stack after an assistant update
|
|
145
150
|
name: pattern code change
|
|
146
151
|
steps:
|
|
147
152
|
- action: utter_inform_code_change
|
|
148
153
|
- action: action_clean_stack
|
|
149
154
|
|
|
150
155
|
pattern_collect_information:
|
|
151
|
-
description:
|
|
156
|
+
description: Flow for collecting information from users
|
|
152
157
|
name: pattern collect information
|
|
153
158
|
steps:
|
|
154
|
-
- id:
|
|
159
|
+
- id: start
|
|
155
160
|
action: action_run_slot_rejections
|
|
156
161
|
- action: validate_{{context.collect}}
|
|
157
162
|
next:
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
- id:
|
|
163
|
+
- if: "slots.{{context.collect}} is not null"
|
|
164
|
+
then: END
|
|
165
|
+
- else: ask_collect
|
|
166
|
+
- id: ask_collect
|
|
162
167
|
action: "{{context.utter}}"
|
|
163
168
|
- action: "{{context.collect_action}}"
|
|
164
169
|
- action: action_listen
|
|
165
|
-
next:
|
|
170
|
+
next: start
|
|
166
171
|
|
|
167
172
|
pattern_completed:
|
|
168
|
-
description:
|
|
173
|
+
description: Flow that asks if the user needs more help after completing their initiated use cases
|
|
169
174
|
name: pattern completed
|
|
170
175
|
steps:
|
|
171
176
|
- action: utter_can_do_something_else
|
|
172
177
|
|
|
173
178
|
pattern_continue_interrupted:
|
|
174
|
-
description:
|
|
179
|
+
description: Conversation repair flow for managing when users switch between different flows
|
|
175
180
|
name: pattern continue interrupted
|
|
176
181
|
steps:
|
|
177
182
|
- action: utter_flow_continue_interrupted
|
|
178
183
|
|
|
179
184
|
pattern_correction:
|
|
180
|
-
description:
|
|
185
|
+
description: Conversation repair flow for managing user input changes or error corrections
|
|
181
186
|
name: pattern correction
|
|
182
187
|
steps:
|
|
183
188
|
- action: action_correct_flow_slot
|
|
@@ -185,36 +190,36 @@ flows:
|
|
|
185
190
|
- if: not context.is_reset_only
|
|
186
191
|
then:
|
|
187
192
|
- action: utter_corrected_previous_input
|
|
188
|
-
next:
|
|
189
|
-
- else:
|
|
193
|
+
next: END
|
|
194
|
+
- else: END
|
|
190
195
|
|
|
191
196
|
pattern_human_handoff:
|
|
192
|
-
description: human
|
|
197
|
+
description: Conversation repair flow for switching users to a human agent if their request can't be handled
|
|
193
198
|
name: pattern human handoff
|
|
194
199
|
steps:
|
|
195
200
|
- action: utter_human_handoff_not_available
|
|
196
201
|
|
|
197
202
|
pattern_internal_error:
|
|
198
|
-
description: internal
|
|
203
|
+
description: Conversation repair flow for informing users about internal errors
|
|
199
204
|
name: pattern internal error
|
|
200
205
|
steps:
|
|
201
206
|
- noop: true
|
|
202
207
|
next:
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
208
|
+
- if: "'{{context.error_type}}' = 'rasa_internal_error_user_input_too_long'"
|
|
209
|
+
then:
|
|
210
|
+
- action: utter_user_input_too_long_error_rasa
|
|
211
|
+
next: END
|
|
212
|
+
- if: "'{{context.error_type}}' = 'rasa_internal_error_user_input_empty'"
|
|
213
|
+
then:
|
|
214
|
+
- action: utter_user_input_empty_error_rasa
|
|
215
|
+
next: END
|
|
216
|
+
- else:
|
|
217
|
+
- action: utter_internal_error_rasa
|
|
218
|
+
next: END
|
|
214
219
|
|
|
215
220
|
|
|
216
221
|
pattern_restart:
|
|
217
|
-
description:
|
|
222
|
+
description: Flow for restarting the conversation
|
|
218
223
|
name: pattern restart
|
|
219
224
|
nlu_trigger:
|
|
220
225
|
- intent: restart
|
|
@@ -222,14 +227,14 @@ flows:
|
|
|
222
227
|
- action: action_restart
|
|
223
228
|
|
|
224
229
|
pattern_search:
|
|
225
|
-
description:
|
|
230
|
+
description: Flow for handling knowledge-based questions
|
|
226
231
|
name: pattern search
|
|
227
232
|
steps:
|
|
228
233
|
- action: utter_no_knowledge_base
|
|
229
234
|
# - action: action_trigger_search to use doc search policy if present
|
|
230
235
|
|
|
231
236
|
pattern_session_start:
|
|
232
|
-
description:
|
|
237
|
+
description: Flow for starting the conversation
|
|
233
238
|
name: pattern session start
|
|
234
239
|
nlu_trigger:
|
|
235
240
|
- intent: session_start
|
|
@@ -237,7 +242,7 @@ flows:
|
|
|
237
242
|
- action: action_session_start
|
|
238
243
|
|
|
239
244
|
pattern_skip_question:
|
|
240
|
-
description: flow
|
|
245
|
+
description: Conversation repair flow for managing user intents to skip questions (steps)
|
|
241
246
|
name: pattern skip question
|
|
242
247
|
steps:
|
|
243
248
|
- action: utter_skip_question_answer
|
|
@@ -16,6 +16,7 @@ from rasa.dialogue_understanding.commands import (
|
|
|
16
16
|
from rasa.dialogue_understanding.commands.handle_code_change_command import (
|
|
17
17
|
HandleCodeChangeCommand,
|
|
18
18
|
)
|
|
19
|
+
from rasa.dialogue_understanding.commands.set_slot_command import SetSlotExtractor
|
|
19
20
|
from rasa.dialogue_understanding.patterns.chitchat import FLOW_PATTERN_CHITCHAT
|
|
20
21
|
from rasa.dialogue_understanding.patterns.collect_information import (
|
|
21
22
|
CollectInformationPatternFlowStackFrame,
|
|
@@ -36,16 +37,23 @@ from rasa.shared.constants import (
|
|
|
36
37
|
ROUTE_TO_CALM_SLOT,
|
|
37
38
|
RASA_PATTERN_CANNOT_HANDLE_CHITCHAT,
|
|
38
39
|
)
|
|
39
|
-
from rasa.shared.core.constants import ACTION_TRIGGER_CHITCHAT
|
|
40
|
+
from rasa.shared.core.constants import ACTION_TRIGGER_CHITCHAT, SlotMappingType
|
|
40
41
|
from rasa.shared.core.constants import FLOW_HASHES_SLOT
|
|
41
42
|
from rasa.shared.core.events import Event, SlotSet
|
|
42
43
|
from rasa.shared.core.flows import FlowsList
|
|
43
44
|
from rasa.shared.core.flows.steps.collect import CollectInformationFlowStep
|
|
45
|
+
from rasa.shared.core.slots import Slot
|
|
44
46
|
from rasa.shared.core.trackers import DialogueStateTracker
|
|
45
47
|
from rasa.shared.nlu.constants import COMMANDS
|
|
46
48
|
|
|
47
49
|
structlogger = structlog.get_logger()
|
|
48
50
|
|
|
51
|
+
CANNOT_HANDLE_REASON = (
|
|
52
|
+
"A command generator attempted to set a slot "
|
|
53
|
+
"with a value extracted by an extractor "
|
|
54
|
+
"that is incompatible with the slot mapping type."
|
|
55
|
+
)
|
|
56
|
+
|
|
49
57
|
|
|
50
58
|
def contains_command(commands: List[Command], typ: Type[Command]) -> bool:
|
|
51
59
|
"""Check if a list of commands contains a command of a given type.
|
|
@@ -118,7 +126,7 @@ def validate_state_of_commands(commands: List[Command]) -> None:
|
|
|
118
126
|
]
|
|
119
127
|
if free_form_answer_commands != commands[: len(free_form_answer_commands)]:
|
|
120
128
|
structlogger.error(
|
|
121
|
-
"command_processor.validate_state_of_commands.free_form_answer_commands_not_at_beginning",
|
|
129
|
+
"command_processor.validate_state_of_commands.free_form_answer_commands_not_at_beginning",
|
|
122
130
|
commands=commands,
|
|
123
131
|
)
|
|
124
132
|
raise ValueError(
|
|
@@ -341,7 +349,6 @@ def clean_up_commands(
|
|
|
341
349
|
clean_commands: List[Command] = []
|
|
342
350
|
|
|
343
351
|
for command in commands:
|
|
344
|
-
|
|
345
352
|
if isinstance(command, SetSlotCommand):
|
|
346
353
|
clean_commands = clean_up_slot_command(
|
|
347
354
|
clean_commands, command, tracker, all_flows, slots_so_far
|
|
@@ -355,6 +362,19 @@ def clean_up_commands(
|
|
|
355
362
|
".skip_command_flow_already_cancelled",
|
|
356
363
|
command=command,
|
|
357
364
|
)
|
|
365
|
+
|
|
366
|
+
# if there is a cannot handle command after the previous step,
|
|
367
|
+
# we don't want to add another one
|
|
368
|
+
elif isinstance(command, CannotHandleCommand) and contains_command(
|
|
369
|
+
clean_commands, CannotHandleCommand
|
|
370
|
+
):
|
|
371
|
+
structlogger.debug(
|
|
372
|
+
"command_processor"
|
|
373
|
+
".clean_up_commands"
|
|
374
|
+
".skip_command_already_has_cannot_handle",
|
|
375
|
+
command=command,
|
|
376
|
+
)
|
|
377
|
+
|
|
358
378
|
elif isinstance(command, StartFlowCommand) and command.flow == active_flow:
|
|
359
379
|
# drop a start flow command if the starting flow is equal to the currently
|
|
360
380
|
# active flow
|
|
@@ -388,6 +408,13 @@ def clean_up_commands(
|
|
|
388
408
|
else:
|
|
389
409
|
clean_commands.append(command)
|
|
390
410
|
|
|
411
|
+
# when coexistence is enabled, by default there will be a SetSlotCommand
|
|
412
|
+
# for the ROUTE_TO_CALM_SLOT slot.
|
|
413
|
+
if tracker.has_coexistence_routing_slot and len(clean_commands) > 2:
|
|
414
|
+
clean_commands = filter_cannot_handle_command_for_skipped_slots(clean_commands)
|
|
415
|
+
elif not tracker.has_coexistence_routing_slot and len(clean_commands) > 1:
|
|
416
|
+
clean_commands = filter_cannot_handle_command_for_skipped_slots(clean_commands)
|
|
417
|
+
|
|
391
418
|
structlogger.debug(
|
|
392
419
|
"command_processor.clean_up_commands.final_commands",
|
|
393
420
|
command=clean_commands,
|
|
@@ -461,6 +488,21 @@ def clean_up_slot_command(
|
|
|
461
488
|
|
|
462
489
|
resulting_commands = commands_so_far[:]
|
|
463
490
|
if command.name in slots_so_far and command.name != ROUTE_TO_CALM_SLOT:
|
|
491
|
+
slot = tracker.slots.get(command.name)
|
|
492
|
+
if slot is None:
|
|
493
|
+
structlogger.debug(
|
|
494
|
+
"command_processor.clean_up_slot_command.skip_command_slot_not_in_domain",
|
|
495
|
+
command=command,
|
|
496
|
+
)
|
|
497
|
+
return resulting_commands
|
|
498
|
+
|
|
499
|
+
if not should_slot_be_set(slot, command):
|
|
500
|
+
cannot_handle = CannotHandleCommand(reason=CANNOT_HANDLE_REASON)
|
|
501
|
+
if cannot_handle not in resulting_commands:
|
|
502
|
+
resulting_commands.append(cannot_handle)
|
|
503
|
+
|
|
504
|
+
return resulting_commands
|
|
505
|
+
|
|
464
506
|
current_collect_info = get_current_collect_step(stack, all_flows)
|
|
465
507
|
|
|
466
508
|
if current_collect_info and current_collect_info.collect == command.name:
|
|
@@ -576,3 +618,69 @@ def clean_up_chitchat_command(
|
|
|
576
618
|
)
|
|
577
619
|
|
|
578
620
|
return resulting_commands
|
|
621
|
+
|
|
622
|
+
|
|
623
|
+
def should_slot_be_set(slot: Slot, command: SetSlotCommand) -> bool:
|
|
624
|
+
"""Check if a slot should be set by a command."""
|
|
625
|
+
if command.extractor == SetSlotExtractor.COMMAND_PAYLOAD_READER.value:
|
|
626
|
+
# if the command is issued by the command payload reader, it means the slot
|
|
627
|
+
# was set deterministically via a response button. In this case,
|
|
628
|
+
# we can always set it
|
|
629
|
+
return True
|
|
630
|
+
|
|
631
|
+
slot_mappings = slot.mappings
|
|
632
|
+
|
|
633
|
+
if not slot_mappings:
|
|
634
|
+
slot_mappings = [{"type": SlotMappingType.FROM_LLM.value}]
|
|
635
|
+
|
|
636
|
+
for mapping in slot_mappings:
|
|
637
|
+
mapping_type = SlotMappingType(
|
|
638
|
+
mapping.get("type", SlotMappingType.FROM_LLM.value)
|
|
639
|
+
)
|
|
640
|
+
|
|
641
|
+
should_be_set_by_llm = (
|
|
642
|
+
command.extractor == SetSlotExtractor.LLM.value
|
|
643
|
+
and mapping_type == SlotMappingType.FROM_LLM
|
|
644
|
+
)
|
|
645
|
+
should_be_set_by_nlu = (
|
|
646
|
+
command.extractor == SetSlotExtractor.NLU.value
|
|
647
|
+
and mapping_type.is_predefined_type()
|
|
648
|
+
)
|
|
649
|
+
|
|
650
|
+
if should_be_set_by_llm or should_be_set_by_nlu:
|
|
651
|
+
# if the extractor matches the mapping type, we can continue
|
|
652
|
+
# setting the slot
|
|
653
|
+
break
|
|
654
|
+
|
|
655
|
+
structlogger.debug(
|
|
656
|
+
"command_processor.clean_up_slot_command.skip_command.extractor_"
|
|
657
|
+
"does_not_match_slot_mapping",
|
|
658
|
+
extractor=command.extractor,
|
|
659
|
+
slot_name=slot.name,
|
|
660
|
+
mapping_type=mapping_type.value,
|
|
661
|
+
)
|
|
662
|
+
return False
|
|
663
|
+
|
|
664
|
+
return True
|
|
665
|
+
|
|
666
|
+
|
|
667
|
+
def filter_cannot_handle_command_for_skipped_slots(
|
|
668
|
+
clean_commands: List[Command],
|
|
669
|
+
) -> List[Command]:
|
|
670
|
+
"""Filter out a 'cannot handle' command for skipped slots.
|
|
671
|
+
|
|
672
|
+
This is used to filter out a 'cannot handle' command for skipped slots
|
|
673
|
+
in case other commands are present.
|
|
674
|
+
|
|
675
|
+
Returns:
|
|
676
|
+
The filtered commands.
|
|
677
|
+
"""
|
|
678
|
+
return [
|
|
679
|
+
command
|
|
680
|
+
for command in clean_commands
|
|
681
|
+
if not (
|
|
682
|
+
isinstance(command, CannotHandleCommand)
|
|
683
|
+
and command.reason
|
|
684
|
+
and CANNOT_HANDLE_REASON == command.reason
|
|
685
|
+
)
|
|
686
|
+
]
|
rasa/e2e_test/constants.py
CHANGED
rasa/e2e_test/e2e_test_case.py
CHANGED
|
@@ -8,6 +8,7 @@ from rasa.e2e_test.constants import (
|
|
|
8
8
|
KEY_BOT_INPUT,
|
|
9
9
|
KEY_BOT_UTTERED,
|
|
10
10
|
KEY_FIXTURES,
|
|
11
|
+
KEY_METADATA,
|
|
11
12
|
KEY_SLOT_NOT_SET,
|
|
12
13
|
KEY_SLOT_SET,
|
|
13
14
|
KEY_STEPS,
|
|
@@ -63,6 +64,7 @@ class TestStep:
|
|
|
63
64
|
slot_was_not_set: bool = False
|
|
64
65
|
_slot_instance: Optional[Union[Text, Dict[Text, Any]]] = None
|
|
65
66
|
_underlying: Optional[Dict[Text, Any]] = None
|
|
67
|
+
metadata_name: Optional[Text] = None
|
|
66
68
|
|
|
67
69
|
@staticmethod
|
|
68
70
|
def from_dict(test_step_dict: Dict[Text, Any]) -> "TestStep":
|
|
@@ -71,6 +73,8 @@ class TestStep:
|
|
|
71
73
|
Example:
|
|
72
74
|
>>> TestStep.from_dict({"user": "hello"})
|
|
73
75
|
TestStep(text="hello", actor="user")
|
|
76
|
+
>>> TestStep.from_dict({"user": "hello", metadata: "some_metadata"})
|
|
77
|
+
TestStep(text="hello", actor="user", metadata_name="some_metadata")
|
|
74
78
|
>>> TestStep.from_dict({"bot": "hello world"})
|
|
75
79
|
TestStep(text="hello world", actor="bot")
|
|
76
80
|
|
|
@@ -94,6 +98,7 @@ class TestStep:
|
|
|
94
98
|
slot_was_not_set=bool(test_step_dict.get(KEY_SLOT_NOT_SET)),
|
|
95
99
|
_slot_instance=slot_instance,
|
|
96
100
|
_underlying=test_step_dict,
|
|
101
|
+
metadata_name=test_step_dict.get(KEY_METADATA, ""),
|
|
97
102
|
)
|
|
98
103
|
|
|
99
104
|
@staticmethod
|
|
@@ -269,6 +274,7 @@ class TestCase:
|
|
|
269
274
|
file: Optional[Text] = None
|
|
270
275
|
line: Optional[int] = None
|
|
271
276
|
fixture_names: Optional[List[Text]] = None
|
|
277
|
+
metadata_name: Optional[Text] = None
|
|
272
278
|
|
|
273
279
|
@staticmethod
|
|
274
280
|
def from_dict(
|
|
@@ -311,6 +317,7 @@ class TestCase:
|
|
|
311
317
|
if hasattr(input_test_case, "lc")
|
|
312
318
|
else None,
|
|
313
319
|
fixture_names=input_test_case.get(KEY_FIXTURES),
|
|
320
|
+
metadata_name=input_test_case.get(KEY_METADATA),
|
|
314
321
|
)
|
|
315
322
|
|
|
316
323
|
def file_with_line(self) -> Text:
|
|
@@ -320,3 +327,40 @@ class TestCase:
|
|
|
320
327
|
|
|
321
328
|
line = str(self.line) if self.line is not None else ""
|
|
322
329
|
return f"{self.file}:{line}"
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
@dataclass(frozen=True)
|
|
333
|
+
class Metadata:
|
|
334
|
+
"""Class for storing an input metadata."""
|
|
335
|
+
|
|
336
|
+
name: Text
|
|
337
|
+
metadata: Dict[Text, Any]
|
|
338
|
+
|
|
339
|
+
@staticmethod
|
|
340
|
+
def from_dict(metadata_dict: Dict[Text, Any]) -> "Metadata":
|
|
341
|
+
"""Creates a metadata from a dictionary.
|
|
342
|
+
|
|
343
|
+
Example:
|
|
344
|
+
>>> Metadata.from_dict({"some_metadata": {"room": "test_room"}})
|
|
345
|
+
Metadata(name="some_metadata", metadata={"room": "test_room"})
|
|
346
|
+
|
|
347
|
+
Args:
|
|
348
|
+
metadata_dict: Dictionary containing the metadata.
|
|
349
|
+
"""
|
|
350
|
+
return Metadata(
|
|
351
|
+
name=next(iter(metadata_dict.keys())),
|
|
352
|
+
metadata={
|
|
353
|
+
metadata_name: metadata_value
|
|
354
|
+
for metadata in metadata_dict.values()
|
|
355
|
+
for metadata_name, metadata_value in metadata.items()
|
|
356
|
+
},
|
|
357
|
+
)
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
@dataclass(frozen=True)
|
|
361
|
+
class TestSuite:
|
|
362
|
+
"""Class for representing all top level test suite keys."""
|
|
363
|
+
|
|
364
|
+
test_cases: List[TestCase]
|
|
365
|
+
fixtures: List[Fixture]
|
|
366
|
+
metadata: List[Metadata]
|