rasa-pro 3.12.18.dev1__py3-none-any.whl → 3.13.0a1.dev2__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 +650 -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.dev2.dist-info}/METADATA +12 -14
- {rasa_pro-3.12.18.dev1.dist-info → rasa_pro-3.13.0a1.dev2.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.dev2.dist-info}/NOTICE +0 -0
- {rasa_pro-3.12.18.dev1.dist-info → rasa_pro-3.13.0a1.dev2.dist-info}/WHEEL +0 -0
- {rasa_pro-3.12.18.dev1.dist-info → rasa_pro-3.13.0a1.dev2.dist-info}/entry_points.txt +0 -0
|
@@ -47,8 +47,8 @@ import rasa.shared.utils.io
|
|
|
47
47
|
import rasa.utils.io as io_utils
|
|
48
48
|
from rasa import telemetry
|
|
49
49
|
from rasa.core import run, utils
|
|
50
|
+
from rasa.core.available_endpoints import AvailableEndpoints
|
|
50
51
|
from rasa.core.constants import DEFAULT_SERVER_FORMAT, DEFAULT_SERVER_PORT
|
|
51
|
-
from rasa.core.utils import AvailableEndpoints
|
|
52
52
|
from rasa.shared.constants import (
|
|
53
53
|
DEFAULT_SENDER_ID,
|
|
54
54
|
DOCS_URL_NLU_BASED_POLICIES,
|
rasa/core/utils.py
CHANGED
|
@@ -2,7 +2,7 @@ import logging
|
|
|
2
2
|
import os
|
|
3
3
|
from pathlib import Path
|
|
4
4
|
from socket import SOCK_DGRAM, SOCK_STREAM
|
|
5
|
-
from typing import TYPE_CHECKING, Any, Dict,
|
|
5
|
+
from typing import TYPE_CHECKING, Any, Dict, Optional, Set, Text, Tuple, Union
|
|
6
6
|
|
|
7
7
|
import numpy as np
|
|
8
8
|
import structlog
|
|
@@ -11,6 +11,7 @@ from sanic import Sanic
|
|
|
11
11
|
import rasa.cli.utils as cli_utils
|
|
12
12
|
import rasa.shared.utils.io
|
|
13
13
|
from rasa.constants import DEFAULT_SANIC_WORKERS, ENV_SANIC_WORKERS
|
|
14
|
+
from rasa.core.available_endpoints import AvailableEndpoints
|
|
14
15
|
from rasa.core.constants import (
|
|
15
16
|
ACTIVE_FLOW_METADATA_KEY,
|
|
16
17
|
DOMAIN_GROUND_TRUTH_METADATA_KEY,
|
|
@@ -19,12 +20,12 @@ from rasa.core.constants import (
|
|
|
19
20
|
)
|
|
20
21
|
from rasa.core.lock_store import InMemoryLockStore, LockStore, RedisLockStore
|
|
21
22
|
from rasa.shared.constants import DEFAULT_ENDPOINTS_PATH, TCP_PROTOCOL
|
|
22
|
-
from rasa.shared.core.constants import
|
|
23
|
+
from rasa.shared.core.constants import (
|
|
24
|
+
SlotMappingType,
|
|
25
|
+
)
|
|
23
26
|
from rasa.shared.core.trackers import DialogueStateTracker
|
|
24
27
|
from rasa.utils.endpoints import (
|
|
25
28
|
EndpointConfig,
|
|
26
|
-
read_endpoint_config,
|
|
27
|
-
read_property_config_from_endpoints_file,
|
|
28
29
|
)
|
|
29
30
|
from rasa.utils.io import write_yaml
|
|
30
31
|
|
|
@@ -36,6 +37,25 @@ if TYPE_CHECKING:
|
|
|
36
37
|
structlogger = structlog.get_logger()
|
|
37
38
|
|
|
38
39
|
|
|
40
|
+
def read_endpoints_from_path(
|
|
41
|
+
endpoints_path: Optional[Union[Path, str]] = None,
|
|
42
|
+
) -> AvailableEndpoints:
|
|
43
|
+
"""Get `AvailableEndpoints` object from specified path.
|
|
44
|
+
|
|
45
|
+
Args:
|
|
46
|
+
endpoints_path: Path of the endpoints file to be read. If `None` the
|
|
47
|
+
default path for that file is used (`endpoints.yml`).
|
|
48
|
+
|
|
49
|
+
Returns:
|
|
50
|
+
`AvailableEndpoints` object read from endpoints file.
|
|
51
|
+
|
|
52
|
+
"""
|
|
53
|
+
endpoints_config_path = cli_utils.get_validated_path(
|
|
54
|
+
endpoints_path, "endpoints", DEFAULT_ENDPOINTS_PATH, True
|
|
55
|
+
)
|
|
56
|
+
return AvailableEndpoints.get_instance(endpoints_config_path)
|
|
57
|
+
|
|
58
|
+
|
|
39
59
|
def configure_file_logging(
|
|
40
60
|
logger_obj: logging.Logger,
|
|
41
61
|
log_file: Optional[Text],
|
|
@@ -177,97 +197,6 @@ def is_limit_reached(num_messages: int, limit: Optional[int]) -> bool:
|
|
|
177
197
|
return limit is not None and num_messages >= limit
|
|
178
198
|
|
|
179
199
|
|
|
180
|
-
class AvailableEndpoints:
|
|
181
|
-
"""Collection of configured endpoints."""
|
|
182
|
-
|
|
183
|
-
_instance = None
|
|
184
|
-
|
|
185
|
-
@classmethod
|
|
186
|
-
def read_endpoints(cls, endpoint_file: Text) -> "AvailableEndpoints":
|
|
187
|
-
"""Read the different endpoints from a yaml file."""
|
|
188
|
-
nlg = read_endpoint_config(endpoint_file, endpoint_type="nlg")
|
|
189
|
-
nlu = read_endpoint_config(endpoint_file, endpoint_type="nlu")
|
|
190
|
-
action = read_endpoint_config(endpoint_file, endpoint_type="action_endpoint")
|
|
191
|
-
model = read_endpoint_config(endpoint_file, endpoint_type="models")
|
|
192
|
-
tracker_store = read_endpoint_config(
|
|
193
|
-
endpoint_file, endpoint_type="tracker_store"
|
|
194
|
-
)
|
|
195
|
-
lock_store = read_endpoint_config(endpoint_file, endpoint_type="lock_store")
|
|
196
|
-
event_broker = read_endpoint_config(endpoint_file, endpoint_type="event_broker")
|
|
197
|
-
vector_store = read_endpoint_config(endpoint_file, endpoint_type="vector_store")
|
|
198
|
-
model_groups = read_property_config_from_endpoints_file(
|
|
199
|
-
endpoint_file, property_name="model_groups"
|
|
200
|
-
)
|
|
201
|
-
|
|
202
|
-
return cls(
|
|
203
|
-
nlg,
|
|
204
|
-
nlu,
|
|
205
|
-
action,
|
|
206
|
-
model,
|
|
207
|
-
tracker_store,
|
|
208
|
-
lock_store,
|
|
209
|
-
event_broker,
|
|
210
|
-
vector_store,
|
|
211
|
-
model_groups,
|
|
212
|
-
)
|
|
213
|
-
|
|
214
|
-
def __init__(
|
|
215
|
-
self,
|
|
216
|
-
nlg: Optional[EndpointConfig] = None,
|
|
217
|
-
nlu: Optional[EndpointConfig] = None,
|
|
218
|
-
action: Optional[EndpointConfig] = None,
|
|
219
|
-
model: Optional[EndpointConfig] = None,
|
|
220
|
-
tracker_store: Optional[EndpointConfig] = None,
|
|
221
|
-
lock_store: Optional[EndpointConfig] = None,
|
|
222
|
-
event_broker: Optional[EndpointConfig] = None,
|
|
223
|
-
vector_store: Optional[EndpointConfig] = None,
|
|
224
|
-
model_groups: Optional[List[Dict[str, Any]]] = None,
|
|
225
|
-
) -> None:
|
|
226
|
-
"""Create an `AvailableEndpoints` object."""
|
|
227
|
-
self.model = model
|
|
228
|
-
self.action = action
|
|
229
|
-
self.nlu = nlu
|
|
230
|
-
self.nlg = nlg
|
|
231
|
-
self.tracker_store = tracker_store
|
|
232
|
-
self.lock_store = lock_store
|
|
233
|
-
self.event_broker = event_broker
|
|
234
|
-
self.vector_store = vector_store
|
|
235
|
-
self.model_groups = model_groups
|
|
236
|
-
|
|
237
|
-
@classmethod
|
|
238
|
-
def get_instance(
|
|
239
|
-
cls, endpoint_file: Optional[Text] = DEFAULT_ENDPOINTS_PATH
|
|
240
|
-
) -> "AvailableEndpoints":
|
|
241
|
-
"""Get the singleton instance of AvailableEndpoints."""
|
|
242
|
-
# Ensure that the instance is initialized only once.
|
|
243
|
-
if cls._instance is None:
|
|
244
|
-
cls._instance = cls.read_endpoints(endpoint_file)
|
|
245
|
-
return cls._instance
|
|
246
|
-
|
|
247
|
-
@classmethod
|
|
248
|
-
def reset_instance(cls) -> None:
|
|
249
|
-
cls._instance = None
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
def read_endpoints_from_path(
|
|
253
|
-
endpoints_path: Optional[Union[Path, Text]] = None,
|
|
254
|
-
) -> AvailableEndpoints:
|
|
255
|
-
"""Get `AvailableEndpoints` object from specified path.
|
|
256
|
-
|
|
257
|
-
Args:
|
|
258
|
-
endpoints_path: Path of the endpoints file to be read. If `None` the
|
|
259
|
-
default path for that file is used (`endpoints.yml`).
|
|
260
|
-
|
|
261
|
-
Returns:
|
|
262
|
-
`AvailableEndpoints` object read from endpoints file.
|
|
263
|
-
|
|
264
|
-
"""
|
|
265
|
-
endpoints_config_path = cli_utils.get_validated_path(
|
|
266
|
-
endpoints_path, "endpoints", DEFAULT_ENDPOINTS_PATH, True
|
|
267
|
-
)
|
|
268
|
-
return AvailableEndpoints.get_instance(endpoints_config_path)
|
|
269
|
-
|
|
270
|
-
|
|
271
200
|
def _lock_store_is_multi_worker_compatible(
|
|
272
201
|
lock_store: Union[EndpointConfig, LockStore, None],
|
|
273
202
|
) -> bool:
|
|
@@ -143,7 +143,8 @@ class IntentBasedRouter(GraphComponent):
|
|
|
143
143
|
if route_session_to_calm is None:
|
|
144
144
|
commands = self._generate_command_using_intent(message, flows, tracker)
|
|
145
145
|
structlogger.info(
|
|
146
|
-
"intent_based_router.predicated_commands",
|
|
146
|
+
"intent_based_router.predicated_commands",
|
|
147
|
+
commands=commands, # doesn't contain PII
|
|
147
148
|
)
|
|
148
149
|
return commands
|
|
149
150
|
elif route_session_to_calm is True:
|
|
@@ -15,9 +15,7 @@ from rasa.dialogue_understanding.coexistence.constants import (
|
|
|
15
15
|
)
|
|
16
16
|
from rasa.dialogue_understanding.commands import Command, SetSlotCommand
|
|
17
17
|
from rasa.dialogue_understanding.commands.noop_command import NoopCommand
|
|
18
|
-
from rasa.dialogue_understanding.generator.constants import
|
|
19
|
-
LLM_CONFIG_KEY,
|
|
20
|
-
)
|
|
18
|
+
from rasa.dialogue_understanding.generator.constants import LLM_CONFIG_KEY
|
|
21
19
|
from rasa.engine.graph import ExecutionContext, GraphComponent
|
|
22
20
|
from rasa.engine.recipes.default_recipe import DefaultV1Recipe
|
|
23
21
|
from rasa.engine.storage.resource import Resource
|
|
@@ -28,6 +26,7 @@ from rasa.shared.constants import (
|
|
|
28
26
|
MODEL_CONFIG_KEY,
|
|
29
27
|
OPENAI_PROVIDER,
|
|
30
28
|
PROMPT_CONFIG_KEY,
|
|
29
|
+
PROMPT_TEMPLATE_CONFIG_KEY,
|
|
31
30
|
PROVIDER_CONFIG_KEY,
|
|
32
31
|
ROUTE_TO_CALM_SLOT,
|
|
33
32
|
TEMPERATURE_CONFIG_KEY,
|
|
@@ -46,6 +45,7 @@ from rasa.shared.utils.health_check.llm_health_check_mixin import LLMHealthCheck
|
|
|
46
45
|
from rasa.shared.utils.io import deep_container_fingerprint
|
|
47
46
|
from rasa.shared.utils.llm import (
|
|
48
47
|
DEFAULT_OPENAI_CHAT_MODEL_NAME,
|
|
48
|
+
check_prompt_config_keys_and_warn_if_deprecated,
|
|
49
49
|
get_prompt_template,
|
|
50
50
|
llm_factory,
|
|
51
51
|
resolve_model_client_config,
|
|
@@ -90,7 +90,7 @@ class LLMBasedRouter(LLMHealthCheckMixin, GraphComponent):
|
|
|
90
90
|
def get_default_config() -> Dict[str, Any]:
|
|
91
91
|
"""The component's default config (see parent class for full docstring)."""
|
|
92
92
|
return {
|
|
93
|
-
|
|
93
|
+
PROMPT_TEMPLATE_CONFIG_KEY: None, # TODO: remove in Rasa 4.0.0
|
|
94
94
|
CALM_ENTRY: {STICKY: None},
|
|
95
95
|
NLU_ENTRY: {
|
|
96
96
|
NON_STICKY: "handles chitchat",
|
|
@@ -111,10 +111,13 @@ class LLMBasedRouter(LLMHealthCheckMixin, GraphComponent):
|
|
|
111
111
|
self.config.get(LLM_CONFIG_KEY), LLMBasedRouter.__name__
|
|
112
112
|
)
|
|
113
113
|
|
|
114
|
+
# Warn if the prompt config key is used to set the prompt template
|
|
115
|
+
check_prompt_config_keys_and_warn_if_deprecated(config, "llm_based_router")
|
|
116
|
+
|
|
114
117
|
self.prompt_template = (
|
|
115
118
|
prompt_template
|
|
116
119
|
or get_prompt_template(
|
|
117
|
-
config.get(PROMPT_CONFIG_KEY),
|
|
120
|
+
config.get(PROMPT_TEMPLATE_CONFIG_KEY) or config.get(PROMPT_CONFIG_KEY),
|
|
118
121
|
DEFAULT_COMMAND_PROMPT_TEMPLATE,
|
|
119
122
|
log_source_component=LLMBasedRouter.__name__,
|
|
120
123
|
log_source_method=LOG_COMPONENT_SOURCE_METHOD_INIT,
|
|
@@ -171,6 +174,7 @@ class LLMBasedRouter(LLMHealthCheckMixin, GraphComponent):
|
|
|
171
174
|
**kwargs: Any,
|
|
172
175
|
) -> "LLMBasedRouter":
|
|
173
176
|
"""Loads trained component (see parent class for full docstring)."""
|
|
177
|
+
|
|
174
178
|
# Perform health check on the resolved LLM client config
|
|
175
179
|
llm_config = resolve_model_client_config(config.get(LLM_CONFIG_KEY, {}))
|
|
176
180
|
cls.perform_llm_health_check(
|
|
@@ -326,7 +330,7 @@ class LLMBasedRouter(LLMHealthCheckMixin, GraphComponent):
|
|
|
326
330
|
def fingerprint_addon(cls, config: Dict[str, Any]) -> Optional[str]:
|
|
327
331
|
"""Add a fingerprint of llm based router for the graph."""
|
|
328
332
|
prompt_template = get_prompt_template(
|
|
329
|
-
config.get(PROMPT_CONFIG_KEY),
|
|
333
|
+
config.get(PROMPT_TEMPLATE_CONFIG_KEY) or config.get(PROMPT_CONFIG_KEY),
|
|
330
334
|
DEFAULT_COMMAND_PROMPT_TEMPLATE,
|
|
331
335
|
log_source_component=LLMBasedRouter.__name__,
|
|
332
336
|
log_source_method=LOG_COMPONENT_SOURCE_METHOD_FINGERPRINT_ADDON,
|
|
@@ -81,6 +81,7 @@ class CannotHandleCommand(Command):
|
|
|
81
81
|
mapper = {
|
|
82
82
|
CommandSyntaxVersion.v1: "CannotHandle()",
|
|
83
83
|
CommandSyntaxVersion.v2: "cannot handle",
|
|
84
|
+
CommandSyntaxVersion.v3: "cannot handle",
|
|
84
85
|
}
|
|
85
86
|
return mapper.get(
|
|
86
87
|
CommandSyntaxManager.get_syntax_version(),
|
|
@@ -100,6 +101,7 @@ class CannotHandleCommand(Command):
|
|
|
100
101
|
mapper = {
|
|
101
102
|
CommandSyntaxVersion.v1: r"CannotHandle\(\)",
|
|
102
103
|
CommandSyntaxVersion.v2: r"""^[\s\W\d]*cannot handle['"`]*$""",
|
|
104
|
+
CommandSyntaxVersion.v3: r"""^[\s\W\d]*cannot handle['"`]*$""",
|
|
103
105
|
}
|
|
104
106
|
return mapper.get(
|
|
105
107
|
CommandSyntaxManager.get_syntax_version(),
|
|
@@ -95,7 +95,9 @@ class CancelFlowCommand(Command):
|
|
|
95
95
|
original_stack = original_tracker.stack
|
|
96
96
|
|
|
97
97
|
applied_events: List[Event] = []
|
|
98
|
-
user_frame = top_user_flow_frame(
|
|
98
|
+
user_frame = top_user_flow_frame(
|
|
99
|
+
original_stack, ignore_call_and_link_frames=False
|
|
100
|
+
)
|
|
99
101
|
current_flow = user_frame.flow(all_flows) if user_frame else None
|
|
100
102
|
|
|
101
103
|
if not current_flow:
|
|
@@ -134,6 +136,7 @@ class CancelFlowCommand(Command):
|
|
|
134
136
|
mapper = {
|
|
135
137
|
CommandSyntaxVersion.v1: "CancelFlow()",
|
|
136
138
|
CommandSyntaxVersion.v2: "cancel flow",
|
|
139
|
+
CommandSyntaxVersion.v3: "cancel flow",
|
|
137
140
|
}
|
|
138
141
|
return mapper.get(
|
|
139
142
|
CommandSyntaxManager.get_syntax_version(),
|
|
@@ -150,6 +153,7 @@ class CancelFlowCommand(Command):
|
|
|
150
153
|
mapper = {
|
|
151
154
|
CommandSyntaxVersion.v1: r"CancelFlow\(\)",
|
|
152
155
|
CommandSyntaxVersion.v2: r"""^[\s\W\d]*cancel flow['"`]*$""",
|
|
156
|
+
CommandSyntaxVersion.v3: r"""^[\s\W\d]*cancel flow['"`]*$""",
|
|
153
157
|
}
|
|
154
158
|
return mapper.get(
|
|
155
159
|
CommandSyntaxManager.get_syntax_version(),
|
|
@@ -66,6 +66,7 @@ class ChitChatAnswerCommand(FreeFormAnswerCommand):
|
|
|
66
66
|
mapper = {
|
|
67
67
|
CommandSyntaxVersion.v1: "ChitChat()",
|
|
68
68
|
CommandSyntaxVersion.v2: "offtopic reply",
|
|
69
|
+
CommandSyntaxVersion.v3: "offtopic reply",
|
|
69
70
|
}
|
|
70
71
|
return mapper.get(
|
|
71
72
|
CommandSyntaxManager.get_syntax_version(),
|
|
@@ -82,6 +83,7 @@ class ChitChatAnswerCommand(FreeFormAnswerCommand):
|
|
|
82
83
|
mapper = {
|
|
83
84
|
CommandSyntaxVersion.v1: r"ChitChat\(\)",
|
|
84
85
|
CommandSyntaxVersion.v2: r"""^[\s\W\d]*offtopic reply['"`]*$""",
|
|
86
|
+
CommandSyntaxVersion.v3: r"""^[\s\W\d]*offtopic reply['"`]*$""",
|
|
85
87
|
}
|
|
86
88
|
return mapper.get(
|
|
87
89
|
CommandSyntaxManager.get_syntax_version(),
|
|
@@ -102,6 +102,7 @@ class ClarifyCommand(Command):
|
|
|
102
102
|
mapper = {
|
|
103
103
|
CommandSyntaxVersion.v1: f"Clarify({', '.join(self.options)})",
|
|
104
104
|
CommandSyntaxVersion.v2: f"disambiguate flows {' '.join(self.options)}",
|
|
105
|
+
CommandSyntaxVersion.v3: f"disambiguate flows {' '.join(self.options)}",
|
|
105
106
|
}
|
|
106
107
|
return mapper.get(
|
|
107
108
|
CommandSyntaxManager.get_syntax_version(),
|
|
@@ -121,6 +122,9 @@ class ClarifyCommand(Command):
|
|
|
121
122
|
CommandSyntaxVersion.v2: (
|
|
122
123
|
r"""^[\s\W\d]*disambiguate flows (["'a-zA-Z0-9_, -]*)[\W]*$"""
|
|
123
124
|
),
|
|
125
|
+
CommandSyntaxVersion.v3: (
|
|
126
|
+
r"""^[\s\W\d]*disambiguate flows (["'a-zA-Z0-9_, -]*)[\W]*$"""
|
|
127
|
+
),
|
|
124
128
|
}
|
|
125
129
|
return mapper.get(
|
|
126
130
|
CommandSyntaxManager.get_syntax_version(),
|
|
@@ -274,9 +274,7 @@ class CorrectSlotsCommand(Command):
|
|
|
274
274
|
# we shouldn't end up here as a correction shouldn't be triggered
|
|
275
275
|
# if we are not in any flow. but just in case we do, we
|
|
276
276
|
# just skip the command.
|
|
277
|
-
structlogger.warning(
|
|
278
|
-
"command_executor.correct_slots.no_active_flow", command=self
|
|
279
|
-
)
|
|
277
|
+
structlogger.warning("command_executor.correct_slots.no_active_flow")
|
|
280
278
|
return []
|
|
281
279
|
|
|
282
280
|
structlogger.debug("command_executor.correct_slots", command=self)
|
|
@@ -73,6 +73,7 @@ class HumanHandoffCommand(Command):
|
|
|
73
73
|
mapper = {
|
|
74
74
|
CommandSyntaxVersion.v1: "HumanHandoff()",
|
|
75
75
|
CommandSyntaxVersion.v2: "hand over",
|
|
76
|
+
CommandSyntaxVersion.v3: "hand over",
|
|
76
77
|
}
|
|
77
78
|
return mapper.get(
|
|
78
79
|
CommandSyntaxManager.get_syntax_version(),
|
|
@@ -89,6 +90,7 @@ class HumanHandoffCommand(Command):
|
|
|
89
90
|
mapper = {
|
|
90
91
|
CommandSyntaxVersion.v1: r"HumanHandoff\(\)",
|
|
91
92
|
CommandSyntaxVersion.v2: r"""^[\s\W\d]*hand over['"`]*$""",
|
|
93
|
+
CommandSyntaxVersion.v3: r"""^[\s\W\d]*hand over['"`]*$""",
|
|
92
94
|
}
|
|
93
95
|
return mapper.get(
|
|
94
96
|
CommandSyntaxManager.get_syntax_version(),
|
|
@@ -66,6 +66,7 @@ class KnowledgeAnswerCommand(FreeFormAnswerCommand):
|
|
|
66
66
|
mapper = {
|
|
67
67
|
CommandSyntaxVersion.v1: "SearchAndReply()",
|
|
68
68
|
CommandSyntaxVersion.v2: "provide info",
|
|
69
|
+
CommandSyntaxVersion.v3: "search and reply",
|
|
69
70
|
}
|
|
70
71
|
return mapper.get(
|
|
71
72
|
CommandSyntaxManager.get_syntax_version(),
|
|
@@ -82,6 +83,7 @@ class KnowledgeAnswerCommand(FreeFormAnswerCommand):
|
|
|
82
83
|
mapper = {
|
|
83
84
|
CommandSyntaxVersion.v1: r"SearchAndReply\(\)",
|
|
84
85
|
CommandSyntaxVersion.v2: r"""^[\s\W\d]*provide info['"`]*$""",
|
|
86
|
+
CommandSyntaxVersion.v3: r"""^[\s\W\d]*search and reply['"`]*$""",
|
|
85
87
|
}
|
|
86
88
|
return mapper.get(
|
|
87
89
|
CommandSyntaxManager.get_syntax_version(),
|
|
@@ -67,6 +67,7 @@ class RepeatBotMessagesCommand(Command):
|
|
|
67
67
|
mapper = {
|
|
68
68
|
CommandSyntaxVersion.v1: "RepeatLastBotMessages()",
|
|
69
69
|
CommandSyntaxVersion.v2: "repeat message",
|
|
70
|
+
CommandSyntaxVersion.v3: "repeat message",
|
|
70
71
|
}
|
|
71
72
|
return mapper.get(
|
|
72
73
|
CommandSyntaxManager.get_syntax_version(),
|
|
@@ -83,6 +84,7 @@ class RepeatBotMessagesCommand(Command):
|
|
|
83
84
|
mapper = {
|
|
84
85
|
CommandSyntaxVersion.v1: r"RepeatLastBotMessages\(\)",
|
|
85
86
|
CommandSyntaxVersion.v2: r"""^[\s\W\d]*repeat message['"`]*$""",
|
|
87
|
+
CommandSyntaxVersion.v3: r"""^[\s\W\d]*repeat message['"`]*$""",
|
|
86
88
|
}
|
|
87
89
|
return mapper.get(
|
|
88
90
|
CommandSyntaxManager.get_syntax_version(),
|
|
@@ -13,6 +13,7 @@ from rasa.dialogue_understanding.commands.command_syntax_manager import (
|
|
|
13
13
|
)
|
|
14
14
|
from rasa.dialogue_understanding.commands.utils import (
|
|
15
15
|
clean_extracted_value,
|
|
16
|
+
find_default_flows_collecting_slot,
|
|
16
17
|
get_nullable_slot_value,
|
|
17
18
|
)
|
|
18
19
|
from rasa.dialogue_understanding.patterns.collect_information import (
|
|
@@ -136,6 +137,11 @@ class SetSlotCommand(Command):
|
|
|
136
137
|
):
|
|
137
138
|
# Get the other predicted flows from the most recent message on the tracker.
|
|
138
139
|
predicted_flows = get_flows_predicted_to_start_from_tracker(tracker)
|
|
140
|
+
if not predicted_flows:
|
|
141
|
+
# If no predicted flows, check for default flows collecting the slot.
|
|
142
|
+
predicted_flows = find_default_flows_collecting_slot(
|
|
143
|
+
self.name, all_flows
|
|
144
|
+
)
|
|
139
145
|
use_slot_fill = any(
|
|
140
146
|
step.collect == self.name and not step.ask_before_filling
|
|
141
147
|
for flow in all_flows.underlying_flows
|
|
@@ -170,6 +176,7 @@ class SetSlotCommand(Command):
|
|
|
170
176
|
mapper = {
|
|
171
177
|
CommandSyntaxVersion.v1: f"SetSlot({self.name}, {self.value})",
|
|
172
178
|
CommandSyntaxVersion.v2: f"set slot {self.name} {self.value}",
|
|
179
|
+
CommandSyntaxVersion.v3: f"set slot {self.name} {self.value}",
|
|
173
180
|
}
|
|
174
181
|
return mapper.get(
|
|
175
182
|
CommandSyntaxManager.get_syntax_version(),
|
|
@@ -192,6 +199,9 @@ class SetSlotCommand(Command):
|
|
|
192
199
|
CommandSyntaxVersion.v2: (
|
|
193
200
|
r"""^[\s\W\d]*set slot ['"`]?([a-zA-Z_][a-zA-Z0-9_-]*)['"`]? ['"`]?(.+?)[\W]*$""" # noqa: E501
|
|
194
201
|
),
|
|
202
|
+
CommandSyntaxVersion.v3: (
|
|
203
|
+
r"""^[\s\W\d]*set slot ['"`]?([a-zA-Z_][a-zA-Z0-9_-]*)['"`]? ['"`]?(.+?)[\W]*$""" # noqa: E501
|
|
204
|
+
),
|
|
195
205
|
}
|
|
196
206
|
return mapper.get(
|
|
197
207
|
CommandSyntaxManager.get_syntax_version(),
|
|
@@ -82,6 +82,7 @@ class SkipQuestionCommand(Command):
|
|
|
82
82
|
mapper = {
|
|
83
83
|
CommandSyntaxVersion.v1: "SkipQuestion()",
|
|
84
84
|
CommandSyntaxVersion.v2: "skip question",
|
|
85
|
+
CommandSyntaxVersion.v3: "skip question",
|
|
85
86
|
}
|
|
86
87
|
return mapper.get(
|
|
87
88
|
CommandSyntaxManager.get_syntax_version(),
|
|
@@ -98,6 +99,7 @@ class SkipQuestionCommand(Command):
|
|
|
98
99
|
mapper = {
|
|
99
100
|
CommandSyntaxVersion.v1: r"SkipQuestion\(\)",
|
|
100
101
|
CommandSyntaxVersion.v2: r"""^[\s\W\d]*skip question['"`]*$""",
|
|
102
|
+
CommandSyntaxVersion.v3: r"""^[\s\W\d]*skip question['"`]*$""",
|
|
101
103
|
}
|
|
102
104
|
return mapper.get(
|
|
103
105
|
CommandSyntaxManager.get_syntax_version(),
|
|
@@ -117,6 +117,7 @@ class StartFlowCommand(Command):
|
|
|
117
117
|
mapper = {
|
|
118
118
|
CommandSyntaxVersion.v1: f"StartFlow({self.flow})",
|
|
119
119
|
CommandSyntaxVersion.v2: f"start flow {self.flow}",
|
|
120
|
+
CommandSyntaxVersion.v3: f"start flow {self.flow}",
|
|
120
121
|
}
|
|
121
122
|
return mapper.get(
|
|
122
123
|
CommandSyntaxManager.get_syntax_version(),
|
|
@@ -135,6 +136,9 @@ class StartFlowCommand(Command):
|
|
|
135
136
|
CommandSyntaxVersion.v2: (
|
|
136
137
|
r"""^[\s\W\d]*start flow ['"`]?([a-zA-Z0-9_-]+)['"`]*"""
|
|
137
138
|
),
|
|
139
|
+
CommandSyntaxVersion.v3: (
|
|
140
|
+
r"""^[\s\W\d]*start flow ['"`]?([a-zA-Z0-9_-]+)['"`]*"""
|
|
141
|
+
),
|
|
138
142
|
}
|
|
139
143
|
return mapper.get(
|
|
140
144
|
CommandSyntaxManager.get_syntax_version(),
|
|
@@ -7,18 +7,18 @@ from rasa.dialogue_understanding.patterns.validate_slot import (
|
|
|
7
7
|
)
|
|
8
8
|
from rasa.shared.constants import ACTION_ASK_PREFIX, UTTER_ASK_PREFIX
|
|
9
9
|
from rasa.shared.core.events import Event, SlotSet
|
|
10
|
+
from rasa.shared.core.flows import FlowsList
|
|
10
11
|
from rasa.shared.core.slots import Slot
|
|
11
12
|
from rasa.shared.core.trackers import DialogueStateTracker
|
|
12
13
|
|
|
13
14
|
if TYPE_CHECKING:
|
|
14
15
|
from rasa.dialogue_understanding.commands import StartFlowCommand
|
|
15
|
-
from rasa.shared.core.flows import FlowsList
|
|
16
16
|
|
|
17
17
|
structlogger = structlog.get_logger()
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
def start_flow_by_name(
|
|
21
|
-
flow_name: str, flows:
|
|
21
|
+
flow_name: str, flows: FlowsList
|
|
22
22
|
) -> Optional["StartFlowCommand"]:
|
|
23
23
|
from rasa.dialogue_understanding.commands import StartFlowCommand
|
|
24
24
|
|
|
@@ -126,3 +126,27 @@ def create_validate_frames_from_slot_set_events(
|
|
|
126
126
|
validate_frames.append(frame)
|
|
127
127
|
|
|
128
128
|
return tracker, validate_frames
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def find_default_flows_collecting_slot(
|
|
132
|
+
slot_name: str, all_flows: FlowsList
|
|
133
|
+
) -> List[str]:
|
|
134
|
+
"""Find default flows that have collect steps matching the specified slot name.
|
|
135
|
+
|
|
136
|
+
Args:
|
|
137
|
+
slot_name: The name of the slot to search for.
|
|
138
|
+
all_flows: All flows in the assistant.
|
|
139
|
+
|
|
140
|
+
Returns:
|
|
141
|
+
List of flow IDs for default flows that collect the specified slot
|
|
142
|
+
without asking before filling.
|
|
143
|
+
"""
|
|
144
|
+
return [
|
|
145
|
+
flow.id
|
|
146
|
+
for flow in all_flows.underlying_flows
|
|
147
|
+
if flow.is_rasa_default_flow
|
|
148
|
+
and any(
|
|
149
|
+
step.collect == slot_name and not step.ask_before_filling
|
|
150
|
+
for step in flow.get_collect_steps()
|
|
151
|
+
)
|
|
152
|
+
]
|
|
@@ -8,8 +8,13 @@ from rasa.dialogue_understanding.generator.llm_command_generator import (
|
|
|
8
8
|
from rasa.dialogue_understanding.generator.multi_step.multi_step_llm_command_generator import ( # noqa: E501
|
|
9
9
|
MultiStepLLMCommandGenerator,
|
|
10
10
|
)
|
|
11
|
-
from rasa.dialogue_understanding.generator.single_step.
|
|
11
|
+
from rasa.dialogue_understanding.generator.single_step.compact_llm_command_generator import ( # noqa: E501
|
|
12
12
|
CompactLLMCommandGenerator,
|
|
13
|
+
)
|
|
14
|
+
from rasa.dialogue_understanding.generator.single_step.search_ready_llm_command_generator import ( # noqa: E501
|
|
15
|
+
SearchReadyLLMCommandGenerator,
|
|
16
|
+
)
|
|
17
|
+
from rasa.dialogue_understanding.generator.single_step.single_step_llm_command_generator import ( # noqa: E501
|
|
13
18
|
SingleStepLLMCommandGenerator,
|
|
14
19
|
)
|
|
15
20
|
|
|
@@ -20,4 +25,5 @@ __all__ = [
|
|
|
20
25
|
"MultiStepLLMCommandGenerator",
|
|
21
26
|
"SingleStepLLMCommandGenerator",
|
|
22
27
|
"CompactLLMCommandGenerator",
|
|
28
|
+
"SearchReadyLLMCommandGenerator",
|
|
23
29
|
]
|
|
@@ -321,7 +321,10 @@ class CommandGenerator:
|
|
|
321
321
|
if commands and len(checked_commands) != len(commands):
|
|
322
322
|
structlogger.info(
|
|
323
323
|
"command_generator.check_commands_against_startable_flows.startable_commands",
|
|
324
|
-
commands=
|
|
324
|
+
commands=[
|
|
325
|
+
checked_command.__class__.__name__
|
|
326
|
+
for checked_command in checked_commands
|
|
327
|
+
],
|
|
325
328
|
)
|
|
326
329
|
|
|
327
330
|
return checked_commands
|
|
@@ -357,7 +360,6 @@ class CommandGenerator:
|
|
|
357
360
|
"command_generator.evaluate_message.error",
|
|
358
361
|
event_info="Invalid message",
|
|
359
362
|
errors=[e.as_dict() for e in errors],
|
|
360
|
-
message=message.get(TEXT),
|
|
361
363
|
)
|
|
362
364
|
return errors
|
|
363
365
|
|
|
@@ -81,7 +81,7 @@ def _get_additional_parsing_logic(
|
|
|
81
81
|
|
|
82
82
|
def validate_custom_commands(command_classes: List[Type[PromptCommand]]) -> None:
|
|
83
83
|
clz_not_inheriting_from_command_clz = [
|
|
84
|
-
command_clz
|
|
84
|
+
command_clz.__name__
|
|
85
85
|
for command_clz in command_classes
|
|
86
86
|
if not issubclass(command_clz, Command)
|
|
87
87
|
]
|
|
@@ -99,7 +99,7 @@ def validate_custom_commands(command_classes: List[Type[PromptCommand]]) -> None
|
|
|
99
99
|
sys.exit(1)
|
|
100
100
|
|
|
101
101
|
clz_not_adhering_to_prompt_command_protocol = [
|
|
102
|
-
command_clz
|
|
102
|
+
command_clz.__name__
|
|
103
103
|
for command_clz in command_classes
|
|
104
104
|
if not isinstance(command_clz, PromptCommand)
|
|
105
105
|
]
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
from typing import List
|
|
2
|
+
|
|
3
|
+
import structlog
|
|
4
|
+
|
|
5
|
+
from rasa.dialogue_understanding.commands import (
|
|
6
|
+
Command,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
structlogger = structlog.get_logger()
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class CommandParserValidatorSingleton:
|
|
13
|
+
"""Singleton class to validate the command parser.
|
|
14
|
+
|
|
15
|
+
This class is used to validate the command parser. It keeps track of the number of
|
|
16
|
+
consecutive turns where no commands are parsed by the command parser. If the
|
|
17
|
+
number of consecutive turns exceeds a certain threshold, a warning is logged.
|
|
18
|
+
The prompt can use a DSL syntax that can be incompatible with the command syntax
|
|
19
|
+
used by the command parser. This class helps to detect such incompatibilities.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
MAX_CONSECUTIVE_TURNS_NO_COMMAND_PREDICTED = 5
|
|
23
|
+
_NO_COMMAND_PREDICTED_TURN_COUNTER = 0
|
|
24
|
+
_command_parser_validated = False
|
|
25
|
+
|
|
26
|
+
@classmethod
|
|
27
|
+
def get_no_command_predicted_turn_counter(cls) -> int:
|
|
28
|
+
return cls._NO_COMMAND_PREDICTED_TURN_COUNTER
|
|
29
|
+
|
|
30
|
+
@classmethod
|
|
31
|
+
def should_validate_command_parser(cls) -> bool:
|
|
32
|
+
return not cls._command_parser_validated
|
|
33
|
+
|
|
34
|
+
@classmethod
|
|
35
|
+
def reset_command_parser_validation(cls) -> None:
|
|
36
|
+
cls._NO_COMMAND_PREDICTED_TURN_COUNTER = 0
|
|
37
|
+
cls._command_parser_validated = False
|
|
38
|
+
|
|
39
|
+
@classmethod
|
|
40
|
+
def validate_if_commands_are_parsed_from_llm_response(
|
|
41
|
+
cls, commands: List[Command], llm_response: str
|
|
42
|
+
) -> None:
|
|
43
|
+
if llm_response and not commands:
|
|
44
|
+
cls._NO_COMMAND_PREDICTED_TURN_COUNTER += 1
|
|
45
|
+
else:
|
|
46
|
+
# Reset the counter if commands are generated, and mark
|
|
47
|
+
# the command parser as validated.
|
|
48
|
+
cls._NO_COMMAND_PREDICTED_TURN_COUNTER = 0
|
|
49
|
+
cls._command_parser_validated = True
|
|
50
|
+
return
|
|
51
|
+
|
|
52
|
+
if (
|
|
53
|
+
cls._NO_COMMAND_PREDICTED_TURN_COUNTER
|
|
54
|
+
>= cls.MAX_CONSECUTIVE_TURNS_NO_COMMAND_PREDICTED
|
|
55
|
+
):
|
|
56
|
+
structlogger.warning(
|
|
57
|
+
"llm_command_generator.predict_commands.command_parser_not_working",
|
|
58
|
+
event_info=(
|
|
59
|
+
f"No commands were generated by the command parser for the last "
|
|
60
|
+
f"{cls._NO_COMMAND_PREDICTED_TURN_COUNTER} times. Check if you "
|
|
61
|
+
"are running incompatible prompt and LLM command generator."
|
|
62
|
+
),
|
|
63
|
+
)
|