rasa-pro 3.12.18.dev1__py3-none-any.whl → 3.13.0a1.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/__init__.py +0 -6
- rasa/__main__.py +3 -4
- rasa/api.py +1 -1
- rasa/builder/create_openai_vector_store.py +69 -0
- rasa/builder/llm-helper-schema.json +69 -0
- rasa/builder/prompt_to_bot.py +645 -0
- rasa/builder/scrape_rasa_docs.py +97 -0
- rasa/builder/skill_to_bot_prompt.jinja +158 -0
- rasa/cli/dialogue_understanding_test.py +1 -1
- rasa/cli/e2e_test.py +1 -1
- rasa/cli/evaluate.py +2 -2
- rasa/cli/export.py +3 -3
- rasa/cli/llm_fine_tuning.py +1 -1
- rasa/cli/project_templates/default/config.yml +5 -32
- rasa/cli/project_templates/{calm → default}/e2e_tests/cancelations/user_cancels_during_a_correction.yml +1 -1
- rasa/cli/project_templates/{calm → default}/e2e_tests/cancelations/user_changes_mind_on_a_whim.yml +1 -1
- rasa/cli/project_templates/{calm → default}/e2e_tests/corrections/user_corrects_contact_handle.yml +1 -1
- rasa/cli/project_templates/{calm → default}/e2e_tests/corrections/user_corrects_contact_name.yml +1 -1
- rasa/cli/project_templates/{calm → default}/e2e_tests/happy_paths/user_adds_contact_to_their_list.yml +1 -1
- rasa/cli/project_templates/{calm → default}/e2e_tests/happy_paths/user_lists_contacts.yml +1 -1
- rasa/cli/project_templates/{calm → default}/e2e_tests/happy_paths/user_removes_contact.yml +1 -1
- rasa/cli/project_templates/{calm → default}/e2e_tests/happy_paths/user_removes_contact_from_list.yml +1 -1
- rasa/cli/project_templates/default/endpoints.yml +18 -2
- rasa/cli/project_templates/defaults.py +133 -0
- rasa/cli/run.py +1 -1
- rasa/cli/scaffold.py +2 -3
- rasa/cli/studio/download.py +1 -1
- rasa/cli/studio/link.py +53 -0
- rasa/cli/studio/pull.py +78 -0
- rasa/cli/studio/push.py +78 -0
- rasa/cli/studio/studio.py +12 -0
- rasa/cli/studio/upload.py +5 -3
- rasa/cli/train.py +1 -1
- rasa/cli/utils.py +1 -1
- rasa/cli/x.py +1 -1
- rasa/constants.py +2 -0
- rasa/core/__init__.py +0 -16
- rasa/core/actions/action.py +42 -31
- rasa/core/actions/action_repeat_bot_messages.py +18 -22
- rasa/core/actions/action_run_slot_rejections.py +1 -2
- rasa/core/agent.py +18 -3
- rasa/core/available_endpoints.py +146 -0
- rasa/core/brokers/kafka.py +4 -0
- rasa/core/brokers/pika.py +5 -2
- rasa/core/brokers/sql.py +1 -1
- rasa/core/channels/botframework.py +2 -2
- rasa/core/channels/channel.py +2 -2
- rasa/core/channels/development_inspector.py +1 -1
- rasa/core/channels/facebook.py +1 -4
- rasa/core/channels/hangouts.py +8 -5
- rasa/core/channels/inspector/.eslintrc.cjs +12 -6
- rasa/core/channels/inspector/.prettierrc +5 -0
- rasa/core/channels/inspector/README.md +11 -5
- rasa/core/channels/inspector/dist/assets/{arc-9f75cc3b.js → arc-02053cc1.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{blockDiagram-38ab4fdb-7f34db23.js → blockDiagram-38ab4fdb-008b6289.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{c4Diagram-3d4e48cf-948bab2c.js → c4Diagram-3d4e48cf-fb2597be.js} +1 -1
- rasa/core/channels/inspector/dist/assets/channel-078dada8.js +1 -0
- rasa/core/channels/inspector/dist/assets/{classDiagram-70f12bd4-53b0dd0e.js → classDiagram-70f12bd4-7f847e00.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{classDiagram-v2-f2320105-fdf789e7.js → classDiagram-v2-f2320105-ba1d689b.js} +1 -1
- rasa/core/channels/inspector/dist/assets/clone-5b4516de.js +1 -0
- rasa/core/channels/inspector/dist/assets/{createText-2e5e7dd3-87c4ece5.js → createText-2e5e7dd3-dd8e67c4.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{edges-e0da2a9e-5a8b0749.js → edges-e0da2a9e-10784939.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{erDiagram-9861fffd-66da90e2.js → erDiagram-9861fffd-24947ae6.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDb-956e92f1-10044f05.js → flowDb-956e92f1-a9ced505.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDiagram-66a62f08-f338f66a.js → flowDiagram-66a62f08-afda9c7c.js} +1 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-f9613071.js +1 -0
- rasa/core/channels/inspector/dist/assets/{flowchart-elk-definition-4a651766-b13140aa.js → flowchart-elk-definition-4a651766-6ef530b8.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{ganttDiagram-c361ad54-f2b4a55a.js → ganttDiagram-c361ad54-0c7dd39a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-72cf32ee-dedc298d.js → gitGraphDiagram-72cf32ee-b57239d6.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{graph-4ede11ff.js → graph-9ed57cec.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-3862675e-65549d37.js → index-3862675e-233090de.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-3a23e736.js → index-72184470.js} +123 -123
- rasa/core/channels/inspector/dist/assets/{infoDiagram-f8f76790-65439671.js → infoDiagram-f8f76790-aa116649.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{journeyDiagram-49397b02-56d03d98.js → journeyDiagram-49397b02-e51877cc.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{layout-dd48f7f4.js → layout-3ca3798c.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{line-1569ad2c.js → line-26ee10d3.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{linear-48bf4935.js → linear-aedded32.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{mindmap-definition-fc14e90a-688504c1.js → mindmap-definition-fc14e90a-d8957261.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{pieDiagram-8a3498a8-78b6d7e6.js → pieDiagram-8a3498a8-d771f885.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{quadrantDiagram-120e2f19-048b84b3.js → quadrantDiagram-120e2f19-09fdf50c.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{requirementDiagram-deff3bca-dd67f107.js → requirementDiagram-deff3bca-9f0af02e.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sankeyDiagram-04a897e0-8128436e.js → sankeyDiagram-04a897e0-84415b37.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sequenceDiagram-704730f1-1a0d1461.js → sequenceDiagram-704730f1-8dec4055.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-587899a1-46d388ed.js → stateDiagram-587899a1-c5431d07.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-v2-d93cdb3a-ea42951a.js → stateDiagram-v2-d93cdb3a-274e77d9.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-6aaf32cf-7427ed0c.js → styles-6aaf32cf-e364a1d7.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-9a916d00-ff5e5a16.js → styles-9a916d00-0dae36f6.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-c10674c1-7b3680cf.js → styles-c10674c1-c4641675.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{svgDrawCommon-08f97a94-f860f2ad.js → svgDrawCommon-08f97a94-831fe9a1.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{timeline-definition-85554ec2-2eebf0c8.js → timeline-definition-85554ec2-c3304b3a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{xychartDiagram-e933f94c-5d7f4e96.js → xychartDiagram-e933f94c-da799369.js} +1 -1
- rasa/core/channels/inspector/dist/index.html +1 -1
- rasa/core/channels/inspector/package.json +3 -1
- rasa/core/channels/inspector/src/App.tsx +91 -90
- rasa/core/channels/inspector/src/components/Chat.tsx +45 -41
- rasa/core/channels/inspector/src/components/DiagramFlow.tsx +40 -40
- rasa/core/channels/inspector/src/components/DialogueInformation.tsx +57 -57
- rasa/core/channels/inspector/src/components/DialogueStack.tsx +36 -27
- rasa/core/channels/inspector/src/components/ExpandIcon.tsx +4 -4
- rasa/core/channels/inspector/src/components/FullscreenButton.tsx +7 -7
- rasa/core/channels/inspector/src/components/LoadingSpinner.tsx +28 -12
- rasa/core/channels/inspector/src/components/NoActiveFlow.tsx +9 -9
- rasa/core/channels/inspector/src/components/RasaLogo.tsx +5 -5
- rasa/core/channels/inspector/src/components/RecruitmentPanel.tsx +55 -60
- rasa/core/channels/inspector/src/components/SaraDiagrams.tsx +5 -5
- rasa/core/channels/inspector/src/components/Slots.tsx +22 -22
- rasa/core/channels/inspector/src/components/Welcome.tsx +28 -31
- rasa/core/channels/inspector/src/helpers/audio/audiostream.ts +245 -0
- rasa/core/channels/inspector/src/helpers/audio/microphone-processor.js +12 -0
- rasa/core/channels/inspector/src/helpers/audio/playback-processor.js +36 -0
- rasa/core/channels/inspector/src/helpers/conversation.ts +7 -7
- rasa/core/channels/inspector/src/helpers/formatters.test.ts +181 -181
- rasa/core/channels/inspector/src/helpers/formatters.ts +111 -111
- rasa/core/channels/inspector/src/helpers/utils.ts +78 -61
- rasa/core/channels/inspector/src/main.tsx +8 -8
- rasa/core/channels/inspector/src/theme/Button/Button.ts +8 -8
- rasa/core/channels/inspector/src/theme/Heading/Heading.ts +7 -7
- rasa/core/channels/inspector/src/theme/Input/Input.ts +9 -9
- rasa/core/channels/inspector/src/theme/Link/Link.ts +6 -6
- rasa/core/channels/inspector/src/theme/Modal/Modal.ts +13 -13
- rasa/core/channels/inspector/src/theme/Table/Table.tsx +10 -10
- rasa/core/channels/inspector/src/theme/Tooltip/Tooltip.ts +5 -5
- rasa/core/channels/inspector/src/theme/base/breakpoints.ts +7 -7
- rasa/core/channels/inspector/src/theme/base/colors.ts +64 -64
- rasa/core/channels/inspector/src/theme/base/fonts/fontFaces.css +21 -18
- rasa/core/channels/inspector/src/theme/base/radii.ts +8 -8
- rasa/core/channels/inspector/src/theme/base/shadows.ts +5 -5
- rasa/core/channels/inspector/src/theme/base/sizes.ts +5 -5
- rasa/core/channels/inspector/src/theme/base/space.ts +12 -12
- rasa/core/channels/inspector/src/theme/base/styles.ts +5 -5
- rasa/core/channels/inspector/src/theme/base/typography.ts +12 -12
- rasa/core/channels/inspector/src/theme/base/zIndices.ts +3 -3
- rasa/core/channels/inspector/src/theme/index.ts +38 -38
- rasa/core/channels/inspector/src/types.ts +56 -50
- rasa/core/channels/inspector/yarn.lock +5 -0
- rasa/core/channels/mattermost.py +1 -1
- rasa/core/channels/rasa_chat.py +2 -4
- rasa/core/channels/rest.py +5 -4
- rasa/core/channels/socketio.py +56 -41
- rasa/core/channels/studio_chat.py +337 -71
- rasa/core/channels/vier_cvg.py +1 -2
- rasa/core/channels/voice_ready/audiocodes.py +4 -11
- rasa/core/channels/voice_stream/audiocodes.py +8 -5
- rasa/core/channels/voice_stream/browser_audio.py +1 -1
- rasa/core/channels/voice_stream/genesys.py +2 -2
- rasa/core/channels/voice_stream/tts/__init__.py +8 -0
- rasa/core/channels/voice_stream/twilio_media_streams.py +10 -5
- rasa/core/channels/voice_stream/voice_channel.py +65 -23
- rasa/core/concurrent_lock_store.py +24 -10
- rasa/core/evaluation/marker_tracker_loader.py +1 -1
- rasa/core/exporter.py +1 -1
- rasa/core/http_interpreter.py +3 -7
- rasa/core/information_retrieval/faiss.py +18 -11
- rasa/core/information_retrieval/ingestion/__init__.py +0 -0
- rasa/core/information_retrieval/ingestion/faq_parser.py +158 -0
- rasa/core/jobs.py +2 -1
- rasa/core/lock_store.py +151 -60
- rasa/core/nlg/contextual_response_rephraser.py +17 -7
- rasa/core/nlg/generator.py +5 -22
- rasa/core/nlg/interpolator.py +2 -3
- rasa/core/nlg/response.py +6 -43
- rasa/core/nlg/summarize.py +1 -1
- rasa/core/nlg/translate.py +0 -8
- rasa/core/policies/enterprise_search_policy.py +262 -62
- rasa/core/policies/enterprise_search_prompt_with_relevancy_check_and_citation_template.jinja2 +63 -0
- rasa/core/policies/flow_policy.py +1 -1
- rasa/core/policies/flows/flow_executor.py +96 -17
- rasa/core/policies/intentless_policy.py +57 -20
- rasa/core/processor.py +114 -54
- rasa/core/run.py +33 -11
- rasa/core/tracker_stores/__init__.py +0 -0
- rasa/core/{auth_retry_tracker_store.py → tracker_stores/auth_retry_tracker_store.py} +5 -1
- rasa/core/tracker_stores/dynamo_tracker_store.py +218 -0
- rasa/core/tracker_stores/mongo_tracker_store.py +206 -0
- rasa/core/tracker_stores/redis_tracker_store.py +219 -0
- rasa/core/tracker_stores/sql_tracker_store.py +555 -0
- rasa/core/tracker_stores/tracker_store.py +805 -0
- rasa/core/training/interactive.py +1 -1
- rasa/core/utils.py +24 -95
- rasa/dialogue_understanding/coexistence/intent_based_router.py +2 -1
- rasa/dialogue_understanding/coexistence/llm_based_router.py +10 -6
- rasa/dialogue_understanding/commands/can_not_handle_command.py +2 -0
- rasa/dialogue_understanding/commands/cancel_flow_command.py +5 -1
- rasa/dialogue_understanding/commands/chit_chat_answer_command.py +2 -0
- rasa/dialogue_understanding/commands/clarify_command.py +4 -0
- rasa/dialogue_understanding/commands/command_syntax_manager.py +1 -0
- rasa/dialogue_understanding/commands/correct_slots_command.py +1 -3
- rasa/dialogue_understanding/commands/human_handoff_command.py +2 -0
- rasa/dialogue_understanding/commands/knowledge_answer_command.py +2 -0
- rasa/dialogue_understanding/commands/repeat_bot_messages_command.py +2 -0
- rasa/dialogue_understanding/commands/set_slot_command.py +10 -0
- rasa/dialogue_understanding/commands/skip_question_command.py +2 -0
- rasa/dialogue_understanding/commands/start_flow_command.py +4 -0
- rasa/dialogue_understanding/commands/utils.py +26 -2
- rasa/dialogue_understanding/generator/__init__.py +7 -1
- rasa/dialogue_understanding/generator/command_generator.py +4 -2
- rasa/dialogue_understanding/generator/command_parser.py +2 -2
- rasa/dialogue_understanding/generator/command_parser_validator.py +63 -0
- rasa/dialogue_understanding/generator/llm_based_command_generator.py +5 -17
- rasa/dialogue_understanding/generator/llm_command_generator.py +1 -3
- rasa/dialogue_understanding/generator/multi_step/multi_step_llm_command_generator.py +4 -44
- rasa/dialogue_understanding/generator/nlu_command_adapter.py +2 -2
- rasa/dialogue_understanding/generator/prompt_templates/command_prompt_v3_gpt_4o_2024_11_20_template.jinja2 +78 -0
- rasa/dialogue_understanding/generator/single_step/compact_llm_command_generator.py +26 -474
- rasa/dialogue_understanding/generator/single_step/search_ready_llm_command_generator.py +147 -0
- rasa/dialogue_understanding/generator/single_step/single_step_based_llm_command_generator.py +477 -0
- rasa/dialogue_understanding/generator/single_step/single_step_llm_command_generator.py +11 -64
- rasa/dialogue_understanding/patterns/cancel.py +1 -2
- rasa/dialogue_understanding/patterns/clarify.py +1 -1
- rasa/dialogue_understanding/patterns/correction.py +2 -2
- rasa/dialogue_understanding/patterns/default_flows_for_patterns.yml +37 -25
- rasa/dialogue_understanding/patterns/domain_for_patterns.py +190 -0
- rasa/dialogue_understanding/processor/command_processor.py +6 -7
- rasa/dialogue_understanding/stack/frames/flow_stack_frame.py +17 -4
- rasa/dialogue_understanding/stack/utils.py +3 -1
- rasa/dialogue_understanding/utils.py +68 -12
- rasa/dialogue_understanding_test/command_metric_calculation.py +7 -40
- rasa/dialogue_understanding_test/command_metrics.py +38 -0
- rasa/dialogue_understanding_test/du_test_case.py +58 -25
- rasa/dialogue_understanding_test/du_test_result.py +228 -132
- rasa/dialogue_understanding_test/du_test_runner.py +11 -2
- rasa/dialogue_understanding_test/io.py +35 -8
- rasa/e2e_test/e2e_test_runner.py +1 -1
- rasa/engine/constants.py +1 -1
- rasa/engine/graph.py +2 -2
- rasa/engine/recipes/default_recipe.py +1 -1
- rasa/engine/validation.py +3 -2
- rasa/hooks.py +2 -85
- rasa/llm_fine_tuning/paraphrasing/conversation_rephraser.py +1 -5
- rasa/llm_fine_tuning/utils.py +2 -4
- rasa/model_manager/model_api.py +90 -2
- rasa/model_manager/socket_bridge.py +0 -7
- rasa/model_manager/trainer_service.py +15 -12
- rasa/plugin.py +2 -15
- rasa/privacy/__init__.py +0 -0
- rasa/privacy/constants.py +83 -0
- rasa/privacy/event_broker_utils.py +77 -0
- rasa/privacy/privacy_config.py +281 -0
- rasa/privacy/privacy_config_schema.json +86 -0
- rasa/privacy/privacy_filter.py +340 -0
- rasa/privacy/privacy_manager.py +576 -0
- rasa/server.py +23 -2
- rasa/shared/constants.py +13 -4
- rasa/shared/core/command_payload_reader.py +1 -5
- rasa/shared/core/constants.py +4 -3
- rasa/shared/core/domain.py +172 -11
- rasa/shared/core/events.py +100 -6
- rasa/shared/core/flows/flow.py +35 -8
- rasa/shared/core/flows/flow_step.py +26 -4
- rasa/shared/core/flows/flow_step_links.py +15 -0
- rasa/shared/core/flows/flow_step_sequence.py +6 -0
- rasa/shared/core/flows/flows_yaml_schema.json +3 -0
- rasa/shared/core/flows/nlu_trigger.py +13 -0
- rasa/shared/core/flows/steps/action.py +7 -4
- rasa/shared/core/flows/steps/call.py +11 -4
- rasa/shared/core/flows/steps/collect.py +71 -6
- rasa/shared/core/flows/steps/internal.py +6 -1
- rasa/shared/core/flows/steps/link.py +7 -4
- rasa/shared/core/flows/steps/no_operation.py +7 -4
- rasa/shared/core/flows/steps/set_slots.py +8 -4
- rasa/shared/core/flows/validation.py +16 -3
- rasa/shared/core/flows/yaml_flows_io.py +106 -5
- rasa/shared/core/slots.py +33 -1
- rasa/shared/core/trackers.py +4 -10
- rasa/shared/core/training_data/story_reader/yaml_story_reader.py +1 -4
- rasa/shared/importers/importer.py +14 -0
- rasa/shared/importers/static.py +63 -0
- rasa/shared/providers/constants.py +0 -9
- rasa/shared/providers/llm/_base_litellm_client.py +4 -14
- rasa/shared/providers/llm/default_litellm_llm_client.py +2 -2
- rasa/shared/providers/llm/litellm_router_llm_client.py +7 -17
- rasa/shared/providers/llm/llm_client.py +15 -24
- rasa/shared/providers/llm/self_hosted_llm_client.py +2 -10
- rasa/shared/utils/common.py +43 -1
- rasa/shared/utils/llm.py +155 -3
- rasa/shared/utils/yaml.py +32 -0
- rasa/studio/data_handler.py +3 -3
- rasa/studio/download/__init__.py +0 -0
- rasa/studio/download/domains.py +49 -0
- rasa/studio/download/download.py +416 -0
- rasa/studio/download/flows.py +351 -0
- rasa/studio/link.py +200 -0
- rasa/studio/pull.py +94 -0
- rasa/studio/push.py +131 -0
- rasa/studio/results_logger.py +6 -1
- rasa/studio/upload.py +185 -71
- rasa/telemetry.py +83 -26
- rasa/tracing/config.py +4 -5
- rasa/tracing/constants.py +19 -1
- rasa/tracing/instrumentation/attribute_extractors.py +49 -11
- rasa/tracing/instrumentation/instrumentation.py +54 -3
- rasa/tracing/instrumentation/metrics.py +98 -15
- rasa/tracing/metric_instrument_provider.py +75 -3
- rasa/utils/common.py +37 -27
- rasa/utils/endpoints.py +22 -1
- rasa/utils/licensing.py +2 -3
- rasa/utils/log_utils.py +1 -45
- rasa/validator.py +9 -11
- rasa/version.py +1 -1
- {rasa_pro-3.12.18.dev1.dist-info → rasa_pro-3.13.0a1.dev1.dist-info}/METADATA +12 -14
- {rasa_pro-3.12.18.dev1.dist-info → rasa_pro-3.13.0a1.dev1.dist-info}/RECORD +318 -294
- rasa/anonymization/__init__.py +0 -2
- rasa/anonymization/anonymisation_rule_yaml_reader.py +0 -91
- rasa/anonymization/anonymization_pipeline.py +0 -286
- rasa/anonymization/anonymization_rule_executor.py +0 -266
- rasa/anonymization/anonymization_rule_orchestrator.py +0 -119
- rasa/anonymization/schemas/config.yml +0 -47
- rasa/anonymization/utils.py +0 -118
- rasa/cli/project_templates/calm/config.yml +0 -10
- rasa/cli/project_templates/calm/credentials.yml +0 -33
- rasa/cli/project_templates/calm/endpoints.yml +0 -58
- rasa/cli/project_templates/default/actions/actions.py +0 -27
- rasa/cli/project_templates/default/data/nlu.yml +0 -91
- rasa/cli/project_templates/default/data/rules.yml +0 -13
- rasa/cli/project_templates/default/data/stories.yml +0 -30
- rasa/cli/project_templates/default/domain.yml +0 -34
- rasa/cli/project_templates/default/tests/test_stories.yml +0 -91
- rasa/core/channels/inspector/dist/assets/channel-dfa68278.js +0 -1
- rasa/core/channels/inspector/dist/assets/clone-edb7f119.js +0 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-65e7c670.js +0 -1
- rasa/core/channels/inspector/src/helpers/audiostream.ts +0 -191
- rasa/core/tracker_store.py +0 -1792
- rasa/monkey_patches.py +0 -91
- rasa/studio/download.py +0 -489
- /rasa/{cli/project_templates/calm/actions → builder}/__init__.py +0 -0
- /rasa/cli/project_templates/{calm → default}/actions/action_template.py +0 -0
- /rasa/cli/project_templates/{calm → default}/actions/add_contact.py +0 -0
- /rasa/cli/project_templates/{calm → default}/actions/db.py +0 -0
- /rasa/cli/project_templates/{calm → default}/actions/list_contacts.py +0 -0
- /rasa/cli/project_templates/{calm → default}/actions/remove_contact.py +0 -0
- /rasa/cli/project_templates/{calm → default}/data/flows/add_contact.yml +0 -0
- /rasa/cli/project_templates/{calm → default}/data/flows/list_contacts.yml +0 -0
- /rasa/cli/project_templates/{calm → default}/data/flows/remove_contact.yml +0 -0
- /rasa/cli/project_templates/{calm → default}/db/contacts.json +0 -0
- /rasa/cli/project_templates/{calm → default}/domain/add_contact.yml +0 -0
- /rasa/cli/project_templates/{calm → default}/domain/list_contacts.yml +0 -0
- /rasa/cli/project_templates/{calm → default}/domain/remove_contact.yml +0 -0
- /rasa/cli/project_templates/{calm → default}/domain/shared.yml +0 -0
- {rasa_pro-3.12.18.dev1.dist-info → rasa_pro-3.13.0a1.dev1.dist-info}/NOTICE +0 -0
- {rasa_pro-3.12.18.dev1.dist-info → rasa_pro-3.13.0a1.dev1.dist-info}/WHEEL +0 -0
- {rasa_pro-3.12.18.dev1.dist-info → rasa_pro-3.13.0a1.dev1.dist-info}/entry_points.txt +0 -0
|
@@ -28,6 +28,14 @@ class NLUTrigger:
|
|
|
28
28
|
"""
|
|
29
29
|
return self.intent == intent and confidence >= self.confidence_threshold
|
|
30
30
|
|
|
31
|
+
def __eq__(self, other: object) -> bool:
|
|
32
|
+
if isinstance(other, NLUTrigger):
|
|
33
|
+
return (
|
|
34
|
+
self.intent == other.intent
|
|
35
|
+
and self.confidence_threshold == other.confidence_threshold
|
|
36
|
+
)
|
|
37
|
+
return False
|
|
38
|
+
|
|
31
39
|
|
|
32
40
|
@dataclass
|
|
33
41
|
class NLUTriggers:
|
|
@@ -115,3 +123,8 @@ class NLUTriggers:
|
|
|
115
123
|
trigger_condition.is_triggered(intent, confidence)
|
|
116
124
|
for trigger_condition in self.trigger_conditions
|
|
117
125
|
)
|
|
126
|
+
|
|
127
|
+
def __eq__(self, other: object) -> bool:
|
|
128
|
+
if isinstance(other, NLUTriggers):
|
|
129
|
+
return self.trigger_conditions == other.trigger_conditions
|
|
130
|
+
return False
|
|
@@ -31,15 +31,13 @@ class ActionFlowStep(FlowStep):
|
|
|
31
31
|
**base.__dict__,
|
|
32
32
|
)
|
|
33
33
|
|
|
34
|
-
def as_json(self) -> Dict[Text, Any]:
|
|
34
|
+
def as_json(self) -> Dict[Text, Any]: # type: ignore[override]
|
|
35
35
|
"""Serialize the ActionFlowStep
|
|
36
36
|
|
|
37
37
|
Returns:
|
|
38
38
|
The ActionFlowStep object as serialized data.
|
|
39
39
|
"""
|
|
40
|
-
|
|
41
|
-
data["action"] = self.action
|
|
42
|
-
return data
|
|
40
|
+
return super().as_json(step_properties={"action": self.action})
|
|
43
41
|
|
|
44
42
|
@property
|
|
45
43
|
def default_id_postfix(self) -> str:
|
|
@@ -55,3 +53,8 @@ class ActionFlowStep(FlowStep):
|
|
|
55
53
|
def custom_action(self) -> Optional[str]:
|
|
56
54
|
"""Return all the custom actions used in this step."""
|
|
57
55
|
return self.action if not self.action.startswith(UTTER_PREFIX) else None
|
|
56
|
+
|
|
57
|
+
def __eq__(self, other: object) -> bool:
|
|
58
|
+
if isinstance(other, type(self)):
|
|
59
|
+
return self.action == other.action and super().__eq__(other)
|
|
60
|
+
return False
|
|
@@ -34,15 +34,13 @@ class CallFlowStep(FlowStep):
|
|
|
34
34
|
**base.__dict__,
|
|
35
35
|
)
|
|
36
36
|
|
|
37
|
-
def as_json(self) -> Dict[Text, Any]:
|
|
37
|
+
def as_json(self) -> Dict[Text, Any]: # type: ignore[override]
|
|
38
38
|
"""Returns the flow step as a dictionary.
|
|
39
39
|
|
|
40
40
|
Returns:
|
|
41
41
|
The flow step as a dictionary.
|
|
42
42
|
"""
|
|
43
|
-
|
|
44
|
-
dump["call"] = self.call
|
|
45
|
-
return dump
|
|
43
|
+
return super().as_json(step_properties={"call": self.call})
|
|
46
44
|
|
|
47
45
|
def steps_in_tree(
|
|
48
46
|
self, should_resolve_calls: bool = True
|
|
@@ -62,3 +60,12 @@ class CallFlowStep(FlowStep):
|
|
|
62
60
|
def default_id_postfix(self) -> str:
|
|
63
61
|
"""Returns the default id postfix of the flow step."""
|
|
64
62
|
return f"call_{self.call}"
|
|
63
|
+
|
|
64
|
+
def __eq__(self, other: object) -> bool:
|
|
65
|
+
if isinstance(other, type(self)):
|
|
66
|
+
return (
|
|
67
|
+
self.call == other.call
|
|
68
|
+
and self.called_flow_reference == other.called_flow_reference
|
|
69
|
+
and super().__eq__(other)
|
|
70
|
+
)
|
|
71
|
+
return False
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
from dataclasses import dataclass
|
|
4
|
-
from typing import Any, Dict, List, Set, Text
|
|
4
|
+
from typing import Any, Dict, List, Optional, Set, Text, Union
|
|
5
|
+
|
|
6
|
+
import structlog
|
|
5
7
|
|
|
6
8
|
from rasa.shared.constants import ACTION_ASK_PREFIX, UTTER_ASK_PREFIX
|
|
7
9
|
from rasa.shared.core.flows.flow_step import FlowStep
|
|
8
10
|
from rasa.shared.core.slots import SlotRejection
|
|
11
|
+
from rasa.shared.exceptions import RasaException
|
|
12
|
+
|
|
13
|
+
DEFAULT_ASK_BEFORE_FILLING = False
|
|
14
|
+
DEFAULT_RESET_AFTER_FLOW_ENDS = True
|
|
15
|
+
DEFAULT_FORCE_SLOT_FILLING = False
|
|
16
|
+
|
|
17
|
+
logger = structlog.get_logger(__name__)
|
|
18
|
+
|
|
19
|
+
SilenceTimeoutInstructionType = Union[int, float, Dict[str, Any]]
|
|
9
20
|
|
|
10
21
|
|
|
11
22
|
@dataclass
|
|
@@ -20,12 +31,14 @@ class CollectInformationFlowStep(FlowStep):
|
|
|
20
31
|
"""The action that the assistant uses to ask for the slot."""
|
|
21
32
|
rejections: List[SlotRejection]
|
|
22
33
|
"""how the slot value is validated using predicate evaluation."""
|
|
23
|
-
ask_before_filling: bool =
|
|
34
|
+
ask_before_filling: bool = DEFAULT_ASK_BEFORE_FILLING
|
|
24
35
|
"""Whether to always ask the question even if the slot is already filled."""
|
|
25
|
-
reset_after_flow_ends: bool =
|
|
36
|
+
reset_after_flow_ends: bool = DEFAULT_RESET_AFTER_FLOW_ENDS
|
|
26
37
|
"""Whether to reset the slot value at the end of the flow."""
|
|
27
38
|
force_slot_filling: bool = False
|
|
28
39
|
"""Whether to keep only the SetSlot command for the collected slot."""
|
|
40
|
+
silence_timeout: Optional[float] = None
|
|
41
|
+
"""The silence timeout for the collect information step."""
|
|
29
42
|
|
|
30
43
|
@classmethod
|
|
31
44
|
def from_json(
|
|
@@ -40,10 +53,15 @@ class CollectInformationFlowStep(FlowStep):
|
|
|
40
53
|
Returns:
|
|
41
54
|
A CollectInformationFlowStep object
|
|
42
55
|
"""
|
|
56
|
+
|
|
57
|
+
silence_timeout = cls._deserialise_silence_timeout(
|
|
58
|
+
data.get("silence_timeout", None)
|
|
59
|
+
)
|
|
60
|
+
|
|
43
61
|
base = super().from_json(flow_id, data)
|
|
44
62
|
return CollectInformationFlowStep(
|
|
45
63
|
collect=data["collect"],
|
|
46
|
-
utter=data.get("utter",
|
|
64
|
+
utter=data.get("utter", cls._default_utter(data["collect"])),
|
|
47
65
|
# as of now it is not possible to define a different name for the
|
|
48
66
|
# action, always use the default name 'action_ask_<slot_name>'
|
|
49
67
|
collect_action=f"{ACTION_ASK_PREFIX}{data['collect']}",
|
|
@@ -54,10 +72,40 @@ class CollectInformationFlowStep(FlowStep):
|
|
|
54
72
|
for rejection in data.get("rejections", [])
|
|
55
73
|
],
|
|
56
74
|
force_slot_filling=data.get("force_slot_filling", False),
|
|
75
|
+
silence_timeout=silence_timeout,
|
|
57
76
|
**base.__dict__,
|
|
58
77
|
)
|
|
59
78
|
|
|
60
|
-
|
|
79
|
+
@staticmethod
|
|
80
|
+
def _deserialise_silence_timeout(
|
|
81
|
+
silence_timeout_json: Optional[SilenceTimeoutInstructionType],
|
|
82
|
+
) -> Optional[float]:
|
|
83
|
+
"""Deserialize silence timeout from JSON."""
|
|
84
|
+
if not silence_timeout_json:
|
|
85
|
+
return None
|
|
86
|
+
|
|
87
|
+
if not isinstance(silence_timeout_json, (int, float)):
|
|
88
|
+
raise RasaException(
|
|
89
|
+
f"Invalid silence timeout value: {silence_timeout_json}. "
|
|
90
|
+
"If defined at collect step, silence timeout must be a number."
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
silence_timeout = silence_timeout_json
|
|
94
|
+
|
|
95
|
+
if silence_timeout and silence_timeout < 0:
|
|
96
|
+
raise RasaException(
|
|
97
|
+
f"Invalid silence timeout value: {silence_timeout}. "
|
|
98
|
+
"Silence timeout must be a non-negative number."
|
|
99
|
+
)
|
|
100
|
+
return silence_timeout
|
|
101
|
+
|
|
102
|
+
@staticmethod
|
|
103
|
+
def _default_utter(collect: str) -> str:
|
|
104
|
+
return f"{UTTER_ASK_PREFIX}{collect}"
|
|
105
|
+
|
|
106
|
+
def as_json(
|
|
107
|
+
self, step_properties: Optional[Dict[Text, Any]] = None
|
|
108
|
+
) -> Dict[str, Any]:
|
|
61
109
|
"""Serialize the CollectInformationFlowStep object.
|
|
62
110
|
|
|
63
111
|
Returns:
|
|
@@ -70,8 +118,10 @@ class CollectInformationFlowStep(FlowStep):
|
|
|
70
118
|
data["reset_after_flow_ends"] = self.reset_after_flow_ends
|
|
71
119
|
data["rejections"] = [rejection.as_dict() for rejection in self.rejections]
|
|
72
120
|
data["force_slot_filling"] = self.force_slot_filling
|
|
121
|
+
if self.silence_timeout:
|
|
122
|
+
data["silence_timeout"] = self.silence_timeout
|
|
73
123
|
|
|
74
|
-
return data
|
|
124
|
+
return super().as_json(step_properties=data)
|
|
75
125
|
|
|
76
126
|
@property
|
|
77
127
|
def default_id_postfix(self) -> str:
|
|
@@ -82,3 +132,18 @@ class CollectInformationFlowStep(FlowStep):
|
|
|
82
132
|
def utterances(self) -> Set[str]:
|
|
83
133
|
"""Return all the utterances used in this step."""
|
|
84
134
|
return {self.utter} | {r.utter for r in self.rejections}
|
|
135
|
+
|
|
136
|
+
def __eq__(self, other: object) -> bool:
|
|
137
|
+
if isinstance(other, type(self)):
|
|
138
|
+
return (
|
|
139
|
+
self.collect == other.collect
|
|
140
|
+
and self.utter == other.utter
|
|
141
|
+
and self.collect_action == other.collect_action
|
|
142
|
+
and self.rejections == other.rejections
|
|
143
|
+
and self.ask_before_filling == other.ask_before_filling
|
|
144
|
+
and self.reset_after_flow_ends == other.reset_after_flow_ends
|
|
145
|
+
and self.force_slot_filling == other.force_slot_filling
|
|
146
|
+
and self.silence_timeout == other.silence_timeout
|
|
147
|
+
and super().__eq__(other)
|
|
148
|
+
)
|
|
149
|
+
return False
|
|
@@ -28,7 +28,7 @@ class InternalFlowStep(FlowStep):
|
|
|
28
28
|
"or de-serialized."
|
|
29
29
|
)
|
|
30
30
|
|
|
31
|
-
def as_json(self) -> Dict[Text, Any]:
|
|
31
|
+
def as_json(self) -> Dict[Text, Any]: # type: ignore[override]
|
|
32
32
|
"""Serialize the InternalFlowStep object
|
|
33
33
|
|
|
34
34
|
Returns:
|
|
@@ -43,3 +43,8 @@ class InternalFlowStep(FlowStep):
|
|
|
43
43
|
def default_id_postfix(self) -> str:
|
|
44
44
|
"""Returns the default id postfix of the flow step."""
|
|
45
45
|
raise ValueError("Internal flow steps do not need a default id")
|
|
46
|
+
|
|
47
|
+
def __eq__(self, other: object) -> bool:
|
|
48
|
+
if isinstance(other, type(self)):
|
|
49
|
+
return super().__eq__(other)
|
|
50
|
+
return False
|
|
@@ -37,17 +37,20 @@ class LinkFlowStep(FlowStep):
|
|
|
37
37
|
**base.__dict__,
|
|
38
38
|
)
|
|
39
39
|
|
|
40
|
-
def as_json(self) -> Dict[Text, Any]:
|
|
40
|
+
def as_json(self) -> Dict[Text, Any]: # type: ignore[override]
|
|
41
41
|
"""Serialize the LinkFlowStep object
|
|
42
42
|
|
|
43
43
|
Returns:
|
|
44
44
|
the LinkFlowStep object as serialized data.
|
|
45
45
|
"""
|
|
46
|
-
|
|
47
|
-
data["link"] = self.link
|
|
48
|
-
return data
|
|
46
|
+
return super().as_json(step_properties={"link": self.link})
|
|
49
47
|
|
|
50
48
|
@property
|
|
51
49
|
def default_id_postfix(self) -> str:
|
|
52
50
|
"""Returns the default id postfix of the flow step."""
|
|
53
51
|
return f"link_{self.link}"
|
|
52
|
+
|
|
53
|
+
def __eq__(self, other: object) -> bool:
|
|
54
|
+
if isinstance(other, type(self)):
|
|
55
|
+
return self.link == other.link and super().__eq__(other)
|
|
56
|
+
return False
|
|
@@ -34,17 +34,20 @@ class NoOperationFlowStep(FlowStep):
|
|
|
34
34
|
**base.__dict__,
|
|
35
35
|
)
|
|
36
36
|
|
|
37
|
-
def as_json(self) -> Dict[Text, Any]:
|
|
37
|
+
def as_json(self) -> Dict[Text, Any]: # type: ignore[override]
|
|
38
38
|
"""Serialize the NoOperationFlowStep object
|
|
39
39
|
|
|
40
40
|
Returns:
|
|
41
41
|
the NoOperationFlowStep object as serialized data.
|
|
42
42
|
"""
|
|
43
|
-
|
|
44
|
-
data["noop"] = self.noop
|
|
45
|
-
return data
|
|
43
|
+
return super().as_json(step_properties={"noop": self.noop})
|
|
46
44
|
|
|
47
45
|
@property
|
|
48
46
|
def default_id_postfix(self) -> str:
|
|
49
47
|
"""Returns the default id postfix of the flow step."""
|
|
50
48
|
return "noop"
|
|
49
|
+
|
|
50
|
+
def __eq__(self, other: object) -> bool:
|
|
51
|
+
if isinstance(other, type(self)):
|
|
52
|
+
return self.noop == other.noop and super().__eq__(other)
|
|
53
|
+
return False
|
|
@@ -35,17 +35,21 @@ class SetSlotsFlowStep(FlowStep):
|
|
|
35
35
|
**base.__dict__,
|
|
36
36
|
)
|
|
37
37
|
|
|
38
|
-
def as_json(self) -> Dict[Text, Any]:
|
|
38
|
+
def as_json(self) -> Dict[Text, Any]: # type: ignore[override]
|
|
39
39
|
"""Serialize the SetSlotsFlowStep object
|
|
40
40
|
|
|
41
41
|
Returns:
|
|
42
42
|
the SetSlotsFlowStep object as serialized data
|
|
43
43
|
"""
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return data
|
|
44
|
+
set_slots = [{slot["key"]: slot["value"]} for slot in self.slots]
|
|
45
|
+
return super().as_json(step_properties={"set_slots": set_slots})
|
|
47
46
|
|
|
48
47
|
@property
|
|
49
48
|
def default_id_postfix(self) -> str:
|
|
50
49
|
"""Returns the default id postfix of the flow step."""
|
|
51
50
|
return "set_slots"
|
|
51
|
+
|
|
52
|
+
def __eq__(self, other: object) -> bool:
|
|
53
|
+
if isinstance(other, type(self)):
|
|
54
|
+
return self.slots == other.slots and super().__eq__(other)
|
|
55
|
+
return False
|
|
@@ -8,6 +8,7 @@ from typing import List, Optional, Set, Text
|
|
|
8
8
|
|
|
9
9
|
from rasa.shared.constants import (
|
|
10
10
|
RASA_DEFAULT_FLOW_PATTERN_PREFIX,
|
|
11
|
+
RASA_PATTERN_CHITCHAT,
|
|
11
12
|
RASA_PATTERN_HUMAN_HANDOFF,
|
|
12
13
|
RASA_PATTERN_INTERNAL_ERROR,
|
|
13
14
|
)
|
|
@@ -186,8 +187,10 @@ class ReferenceToPatternException(RasaException):
|
|
|
186
187
|
return message + "Patterns can not be used as a target for a call step."
|
|
187
188
|
else:
|
|
188
189
|
return message + (
|
|
189
|
-
"
|
|
190
|
-
"
|
|
190
|
+
"Patterns cannot be used as a target in link steps, except for "
|
|
191
|
+
"'pattern_human_handoff', which may be linked from both user-defined "
|
|
192
|
+
"flows and other patterns. 'pattern_chitchat' may only be linked "
|
|
193
|
+
"from other patterns."
|
|
191
194
|
)
|
|
192
195
|
|
|
193
196
|
|
|
@@ -597,7 +600,13 @@ def validate_patterns_are_not_called_or_linked(flows: "FlowsList") -> None:
|
|
|
597
600
|
if (
|
|
598
601
|
isinstance(step, LinkFlowStep)
|
|
599
602
|
and step.link.startswith(RASA_DEFAULT_FLOW_PATTERN_PREFIX)
|
|
603
|
+
# Allow linking to human-handoff from both patterns
|
|
604
|
+
# and user-defined flows
|
|
600
605
|
and step.link != RASA_PATTERN_HUMAN_HANDOFF
|
|
606
|
+
# Allow linking to 'pattern_chitchat' only from other patterns
|
|
607
|
+
and not (
|
|
608
|
+
flow.is_rasa_default_flow and step.link == RASA_PATTERN_CHITCHAT
|
|
609
|
+
)
|
|
601
610
|
):
|
|
602
611
|
raise ReferenceToPatternException(
|
|
603
612
|
step.link, flow.id, step.id, call_step=False
|
|
@@ -617,7 +626,8 @@ def validate_patterns_are_not_calling_or_linking_other_flows(
|
|
|
617
626
|
"""Validates that patterns do not contain call or link steps.
|
|
618
627
|
|
|
619
628
|
Link steps to user flows are allowed for all patterns but 'pattern_internal_error'.
|
|
620
|
-
Link steps to other patterns, except for 'pattern_human_handoff'
|
|
629
|
+
Link steps to other patterns, except for 'pattern_human_handoff' and
|
|
630
|
+
'pattern_chitchat' are forbidden.
|
|
621
631
|
"""
|
|
622
632
|
for flow in flows.underlying_flows:
|
|
623
633
|
if not flow.is_rasa_default_flow:
|
|
@@ -627,6 +637,9 @@ def validate_patterns_are_not_calling_or_linking_other_flows(
|
|
|
627
637
|
if step.link == RASA_PATTERN_HUMAN_HANDOFF:
|
|
628
638
|
# links to 'pattern_human_handoff' are allowed
|
|
629
639
|
continue
|
|
640
|
+
if step.link == RASA_PATTERN_CHITCHAT:
|
|
641
|
+
# links to 'pattern_chitchat' are allowed
|
|
642
|
+
continue
|
|
630
643
|
if step.link.startswith(RASA_DEFAULT_FLOW_PATTERN_PREFIX):
|
|
631
644
|
# all other patterns are allowed to link to user flows, but not
|
|
632
645
|
# to other patterns
|
|
@@ -8,8 +8,15 @@ from ruamel import yaml as yaml
|
|
|
8
8
|
import rasa.shared
|
|
9
9
|
import rasa.shared.data
|
|
10
10
|
import rasa.shared.utils.io
|
|
11
|
-
from rasa.shared.core.flows.flow import Flow
|
|
11
|
+
from rasa.shared.core.flows.flow import DEFAULT_RUN_PATTERN_COMPLETED, Flow
|
|
12
|
+
from rasa.shared.core.flows.flow_step import FlowStep
|
|
12
13
|
from rasa.shared.core.flows.flows_list import FlowsList
|
|
14
|
+
from rasa.shared.core.flows.steps import CollectInformationFlowStep
|
|
15
|
+
from rasa.shared.core.flows.steps.collect import (
|
|
16
|
+
DEFAULT_ASK_BEFORE_FILLING,
|
|
17
|
+
DEFAULT_FORCE_SLOT_FILLING,
|
|
18
|
+
DEFAULT_RESET_AFTER_FLOW_ENDS,
|
|
19
|
+
)
|
|
13
20
|
from rasa.shared.exceptions import RasaException, YamlException
|
|
14
21
|
from rasa.shared.utils.yaml import (
|
|
15
22
|
dump_obj_as_yaml_to_string,
|
|
@@ -242,31 +249,43 @@ class YamlFlowsWriter:
|
|
|
242
249
|
"""Class that writes flows information in YAML format."""
|
|
243
250
|
|
|
244
251
|
@staticmethod
|
|
245
|
-
def dumps(
|
|
252
|
+
def dumps(
|
|
253
|
+
flows: List[Flow],
|
|
254
|
+
should_clean_json: bool = False,
|
|
255
|
+
) -> Text:
|
|
246
256
|
"""Dump `Flow`s to YAML.
|
|
247
257
|
|
|
248
258
|
Args:
|
|
249
259
|
flows: The `Flow`s to dump.
|
|
260
|
+
should_clean_json: Flag whether to clean the flow JSON.
|
|
250
261
|
|
|
251
262
|
Returns:
|
|
252
263
|
The dumped YAML.
|
|
253
264
|
"""
|
|
254
265
|
dump = {}
|
|
255
266
|
for flow in flows:
|
|
256
|
-
dumped_flow = flow
|
|
267
|
+
dumped_flow = get_flow_as_json(flow, should_clean_json)
|
|
257
268
|
del dumped_flow["id"]
|
|
258
269
|
dump[flow.id] = dumped_flow
|
|
259
270
|
return dump_obj_as_yaml_to_string({KEY_FLOWS: dump})
|
|
260
271
|
|
|
261
272
|
@staticmethod
|
|
262
|
-
def dump(
|
|
273
|
+
def dump(
|
|
274
|
+
flows: List[Flow],
|
|
275
|
+
filename: Union[Text, Path],
|
|
276
|
+
should_clean_json: bool = False,
|
|
277
|
+
) -> None:
|
|
263
278
|
"""Dump `Flow`s to YAML file.
|
|
264
279
|
|
|
265
280
|
Args:
|
|
266
281
|
flows: The `Flow`s to dump.
|
|
267
282
|
filename: The path to the file to write to.
|
|
283
|
+
should_clean_json: Flag whether to clean the flow JSON.
|
|
268
284
|
"""
|
|
269
|
-
rasa.shared.utils.io.write_text_file(
|
|
285
|
+
rasa.shared.utils.io.write_text_file(
|
|
286
|
+
YamlFlowsWriter.dumps(flows, should_clean_json),
|
|
287
|
+
filename,
|
|
288
|
+
)
|
|
270
289
|
|
|
271
290
|
|
|
272
291
|
def is_flows_file(file_path: Union[Text, Path]) -> bool:
|
|
@@ -403,3 +422,85 @@ def process_yaml_content(yaml_content: Dict[str, Any]) -> Dict[str, Any]:
|
|
|
403
422
|
)
|
|
404
423
|
|
|
405
424
|
return yaml_content
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
def get_flow_as_json(flow: Flow, should_clean_json: bool = False) -> Dict[str, Any]:
|
|
428
|
+
"""
|
|
429
|
+
Clean the Flow JSON by removing default values and empty fields.
|
|
430
|
+
|
|
431
|
+
Args:
|
|
432
|
+
flow: The Flow object to clean.
|
|
433
|
+
should_clean_json: Flag indicating whether to clean the JSON.
|
|
434
|
+
|
|
435
|
+
Returns:
|
|
436
|
+
The cleaned Flow JSON as a dictionary.
|
|
437
|
+
"""
|
|
438
|
+
step_id_to_default_id = {}
|
|
439
|
+
flow_data = flow.as_json()
|
|
440
|
+
if not should_clean_json:
|
|
441
|
+
return flow_data
|
|
442
|
+
|
|
443
|
+
def gather_step_ids(step: FlowStep) -> None:
|
|
444
|
+
"""Create a map of step IDs to their default IDs."""
|
|
445
|
+
step_id_to_default_id[step.id] = step.default_id
|
|
446
|
+
for link in step.next.links:
|
|
447
|
+
for child in link.child_steps():
|
|
448
|
+
gather_step_ids(child)
|
|
449
|
+
|
|
450
|
+
def clean_flow_data(data: Dict[str, Any]) -> None:
|
|
451
|
+
"""Remove or omit flow-level fields if they match defaults."""
|
|
452
|
+
for top_level_step in flow.step_sequence.steps:
|
|
453
|
+
gather_step_ids(top_level_step)
|
|
454
|
+
|
|
455
|
+
if data.get("run_pattern_completed") == DEFAULT_RUN_PATTERN_COMPLETED:
|
|
456
|
+
data.pop("run_pattern_completed", None)
|
|
457
|
+
|
|
458
|
+
if not data.get("persisted_slots"):
|
|
459
|
+
data.pop("persisted_slots", None)
|
|
460
|
+
|
|
461
|
+
_remove_keys_recursively(data, ["metadata"])
|
|
462
|
+
|
|
463
|
+
data.pop("file_path", None)
|
|
464
|
+
|
|
465
|
+
steps = data.get("steps", [])
|
|
466
|
+
for i, current_step in enumerate(steps):
|
|
467
|
+
# Look ahead to the next step if we should remove the 'next' field
|
|
468
|
+
next_step_data = steps[i + 1] if i + 1 < len(steps) else None
|
|
469
|
+
clean_step(current_step, next_step_data)
|
|
470
|
+
|
|
471
|
+
def clean_step(current_step: Dict[str, Any], next_step: Dict[str, Any]) -> None:
|
|
472
|
+
"""Remove default fields from a step."""
|
|
473
|
+
# Remove 'next' if it exactly matches the next step's default ID
|
|
474
|
+
if next_step:
|
|
475
|
+
next_id = next_step.get("id")
|
|
476
|
+
default_id = step_id_to_default_id.get(next_id)
|
|
477
|
+
if next_id and current_step.get("next") == default_id:
|
|
478
|
+
current_step.pop("next", None)
|
|
479
|
+
|
|
480
|
+
# Remove 'id' if it equals its own default
|
|
481
|
+
step_id = current_step.get("id")
|
|
482
|
+
if step_id and step_id == step_id_to_default_id.get(step_id):
|
|
483
|
+
current_step.pop("id", None)
|
|
484
|
+
|
|
485
|
+
if "collect" in current_step:
|
|
486
|
+
clean_collect_step(current_step)
|
|
487
|
+
|
|
488
|
+
def clean_collect_step(step_data: Dict[str, Any]) -> None:
|
|
489
|
+
"""Remove default fields from a collect step."""
|
|
490
|
+
slot_name = step_data["collect"]
|
|
491
|
+
default_utter = CollectInformationFlowStep._default_utter(slot_name)
|
|
492
|
+
|
|
493
|
+
if step_data.get("utter") == default_utter:
|
|
494
|
+
step_data.pop("utter", None)
|
|
495
|
+
if step_data.get("ask_before_filling") is DEFAULT_ASK_BEFORE_FILLING:
|
|
496
|
+
step_data.pop("ask_before_filling", None)
|
|
497
|
+
if step_data.get("reset_after_flow_ends") is DEFAULT_RESET_AFTER_FLOW_ENDS:
|
|
498
|
+
step_data.pop("reset_after_flow_ends", None)
|
|
499
|
+
if step_data.get("force_slot_filling") is DEFAULT_FORCE_SLOT_FILLING:
|
|
500
|
+
step_data.pop("force_slot_filling", None)
|
|
501
|
+
if not step_data.get("rejections"):
|
|
502
|
+
step_data.pop("rejections", None)
|
|
503
|
+
|
|
504
|
+
clean_flow_data(flow_data)
|
|
505
|
+
|
|
506
|
+
return flow_data
|
rasa/shared/core/slots.py
CHANGED
|
@@ -273,10 +273,14 @@ class Slot(ABC):
|
|
|
273
273
|
try:
|
|
274
274
|
return rasa.shared.utils.common.class_from_module_path(type_name)
|
|
275
275
|
except (ImportError, AttributeError):
|
|
276
|
+
known_types = [
|
|
277
|
+
cls.type_name for cls in rasa.shared.utils.common.all_subclasses(Slot)
|
|
278
|
+
]
|
|
276
279
|
raise InvalidSlotTypeException(
|
|
277
280
|
f"Failed to find slot type, '{type_name}' is neither a known type nor "
|
|
278
281
|
f"user-defined. If you are creating your own slot type, make "
|
|
279
282
|
f"sure its module path is correct. "
|
|
283
|
+
f"Known types: {', '.join(known_types)} "
|
|
280
284
|
f"You can find all build in types at {DOCS_URL_SLOTS}"
|
|
281
285
|
)
|
|
282
286
|
|
|
@@ -311,6 +315,34 @@ class Slot(ABC):
|
|
|
311
315
|
"""Indicates if the slot requires validation."""
|
|
312
316
|
return True if self.validation else False
|
|
313
317
|
|
|
318
|
+
def to_dict(
|
|
319
|
+
self,
|
|
320
|
+
*,
|
|
321
|
+
include_private: bool = False,
|
|
322
|
+
) -> Dict[str, Any]:
|
|
323
|
+
"""Return a dictionary with attributes of this slot instance.
|
|
324
|
+
|
|
325
|
+
Args:
|
|
326
|
+
include_private: If `True`, private attributes are included.
|
|
327
|
+
|
|
328
|
+
Returns:
|
|
329
|
+
A plain `dict` that can be JSON-serialised.
|
|
330
|
+
"""
|
|
331
|
+
result: Dict[str, Any] = {}
|
|
332
|
+
|
|
333
|
+
for attr, value in vars(self).items():
|
|
334
|
+
if not include_private and attr.startswith("_"):
|
|
335
|
+
continue
|
|
336
|
+
|
|
337
|
+
if attr == "mappings":
|
|
338
|
+
result[attr] = [mapping.as_dict() for mapping in value]
|
|
339
|
+
continue
|
|
340
|
+
|
|
341
|
+
result[attr] = value
|
|
342
|
+
|
|
343
|
+
result.setdefault("type", self.type_name)
|
|
344
|
+
return result
|
|
345
|
+
|
|
314
346
|
|
|
315
347
|
class FloatSlot(Slot):
|
|
316
348
|
"""A slot storing a float value."""
|
|
@@ -787,7 +819,7 @@ class StrictCategoricalSlot(CategoricalSlot):
|
|
|
787
819
|
def coerce_value(self, value: Any) -> Any:
|
|
788
820
|
"""Coerce the value to one of the allowed ones or raise an error if invalid."""
|
|
789
821
|
if value is None:
|
|
790
|
-
return
|
|
822
|
+
return value
|
|
791
823
|
|
|
792
824
|
for allowed_value in self.values:
|
|
793
825
|
# Allowed values are always stored as strings, so we can use casefold().
|
rasa/shared/core/trackers.py
CHANGED
|
@@ -1123,16 +1123,10 @@ class DialogueStateTracker:
|
|
|
1123
1123
|
f"Please update the slot configuration accordingly."
|
|
1124
1124
|
)
|
|
1125
1125
|
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
language_code=language_code,
|
|
1131
|
-
is_default=is_default,
|
|
1132
|
-
)
|
|
1133
|
-
supported_languages.append(language)
|
|
1134
|
-
|
|
1135
|
-
return supported_languages
|
|
1126
|
+
return [
|
|
1127
|
+
Language.from_language_code(language_code)
|
|
1128
|
+
for language_code in language_slot.values
|
|
1129
|
+
]
|
|
1136
1130
|
|
|
1137
1131
|
@property
|
|
1138
1132
|
def current_language(self) -> Optional[Language]:
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import copy
|
|
2
1
|
import functools
|
|
3
2
|
import json
|
|
4
3
|
import logging
|
|
@@ -648,9 +647,7 @@ class YAMLStoryReader(StoryReader):
|
|
|
648
647
|
# message text did start with the special prefix -- however, a user might
|
|
649
648
|
# just have decided to start their text this way.
|
|
650
649
|
if not match:
|
|
651
|
-
structlogger.warning(
|
|
652
|
-
"message.parsing.failed", user_text=copy.deepcopy(user_text)
|
|
653
|
-
)
|
|
650
|
+
structlogger.warning("message.parsing.failed")
|
|
654
651
|
return message
|
|
655
652
|
|
|
656
653
|
# Extract attributes from the match - and validate it via the domain.
|
|
@@ -18,6 +18,7 @@ import importlib_resources
|
|
|
18
18
|
|
|
19
19
|
import rasa.shared.constants
|
|
20
20
|
import rasa.shared.core.constants
|
|
21
|
+
import rasa.shared.data
|
|
21
22
|
import rasa.shared.utils.common
|
|
22
23
|
import rasa.shared.utils.io
|
|
23
24
|
from rasa.shared.constants import CONFIG_ADDITIONAL_LANGUAGES_KEY, CONFIG_LANGUAGE_KEY
|
|
@@ -206,6 +207,12 @@ class TrainingDataImporter(ABC):
|
|
|
206
207
|
)
|
|
207
208
|
]
|
|
208
209
|
|
|
210
|
+
return TrainingDataImporter.wrap_in_builtins(importers)
|
|
211
|
+
|
|
212
|
+
@staticmethod
|
|
213
|
+
def wrap_in_builtins(
|
|
214
|
+
importers: List["TrainingDataImporter"],
|
|
215
|
+
) -> "TrainingDataImporter":
|
|
209
216
|
return LanguageImporter(
|
|
210
217
|
E2EImporter(
|
|
211
218
|
FlowSyncImporter(ResponsesSyncImporter(CombinedDataImporter(importers)))
|
|
@@ -279,6 +286,13 @@ class TrainingDataImporter(ABC):
|
|
|
279
286
|
"""
|
|
280
287
|
raise NotImplementedError
|
|
281
288
|
|
|
289
|
+
@staticmethod
|
|
290
|
+
def get_domain_files(
|
|
291
|
+
data_paths: Optional[Union[List[Text], Text]] = None,
|
|
292
|
+
) -> List[Text]:
|
|
293
|
+
"""Returns the domain file path (see parent class for full docstring)."""
|
|
294
|
+
return rasa.shared.data.get_data_files(data_paths, Domain.is_domain_file)
|
|
295
|
+
|
|
282
296
|
|
|
283
297
|
class NluDataImporter(TrainingDataImporter):
|
|
284
298
|
"""Importer that skips any Core-related file reading."""
|