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
rasa/engine/validation.py
CHANGED
|
@@ -23,9 +23,10 @@ import structlog
|
|
|
23
23
|
import typing_utils
|
|
24
24
|
|
|
25
25
|
import rasa.utils.common
|
|
26
|
-
from rasa.core import
|
|
26
|
+
from rasa.core.available_endpoints import AvailableEndpoints
|
|
27
|
+
from rasa.core.nlg.contextual_response_rephraser import ContextualResponseRephraser
|
|
28
|
+
from rasa.core.policies.intentless_policy import IntentlessPolicy
|
|
27
29
|
from rasa.core.policies.policy import PolicyPrediction
|
|
28
|
-
from rasa.core.utils import AvailableEndpoints
|
|
29
30
|
from rasa.dialogue_understanding.coexistence.constants import (
|
|
30
31
|
CALM_ENTRY,
|
|
31
32
|
NLU_ENTRY,
|
rasa/hooks.py
CHANGED
|
@@ -1,36 +1,22 @@
|
|
|
1
1
|
import argparse
|
|
2
2
|
import logging
|
|
3
|
-
import os
|
|
4
3
|
from typing import TYPE_CHECKING, List, Optional, Text, Union
|
|
5
4
|
|
|
6
|
-
import litellm
|
|
7
5
|
import pluggy
|
|
8
|
-
import structlog
|
|
9
|
-
|
|
10
|
-
from rasa.shared.providers.constants import (
|
|
11
|
-
LANGFUSE_CALLBACK_NAME,
|
|
12
|
-
LANGFUSE_HOST_ENV_VAR,
|
|
13
|
-
LANGFUSE_PROJECT_ID_ENV_VAR,
|
|
14
|
-
LANGFUSE_PUBLIC_KEY_ENV_VAR,
|
|
15
|
-
LANGFUSE_SECRET_KEY_ENV_VAR,
|
|
16
|
-
RASA_LANGFUSE_INTEGRATION_ENABLED_ENV_VAR,
|
|
17
|
-
)
|
|
18
6
|
|
|
19
7
|
# IMPORTANT: do not import anything from rasa here - use scoped imports
|
|
20
8
|
# this avoids circular imports, as the hooks are used in different places
|
|
21
9
|
# across the codebase.
|
|
22
10
|
|
|
23
11
|
if TYPE_CHECKING:
|
|
24
|
-
from rasa.anonymization.anonymization_pipeline import AnonymizationPipeline
|
|
25
12
|
from rasa.cli import SubParsersAction
|
|
26
13
|
from rasa.core.brokers.broker import EventBroker
|
|
27
|
-
from rasa.core.tracker_store import TrackerStore
|
|
14
|
+
from rasa.core.tracker_stores.tracker_store import TrackerStore
|
|
28
15
|
from rasa.shared.core.domain import Domain
|
|
29
16
|
from rasa.utils.endpoints import EndpointConfig
|
|
30
17
|
|
|
31
18
|
hookimpl = pluggy.HookimplMarker("rasa")
|
|
32
19
|
logger = logging.getLogger(__name__)
|
|
33
|
-
structlogger = structlog.get_logger()
|
|
34
20
|
|
|
35
21
|
|
|
36
22
|
@hookimpl # type: ignore[misc]
|
|
@@ -70,8 +56,6 @@ def configure_commandline(cmdline_arguments: argparse.Namespace) -> Optional[Tex
|
|
|
70
56
|
config.configure_tracing(tracer_provider)
|
|
71
57
|
config.configure_metrics(endpoints_file)
|
|
72
58
|
|
|
73
|
-
_init_langfuse_integration()
|
|
74
|
-
|
|
75
59
|
return endpoints_file
|
|
76
60
|
|
|
77
61
|
|
|
@@ -95,7 +79,7 @@ def create_tracker_store(
|
|
|
95
79
|
domain: "Domain",
|
|
96
80
|
event_broker: Optional["EventBroker"],
|
|
97
81
|
) -> "TrackerStore":
|
|
98
|
-
from rasa.core.auth_retry_tracker_store import AuthRetryTrackerStore
|
|
82
|
+
from rasa.core.tracker_stores.auth_retry_tracker_store import AuthRetryTrackerStore
|
|
99
83
|
from rasa.utils.endpoints import EndpointConfig
|
|
100
84
|
|
|
101
85
|
if isinstance(endpoint_config, EndpointConfig):
|
|
@@ -103,70 +87,3 @@ def create_tracker_store(
|
|
|
103
87
|
endpoint_config=endpoint_config, domain=domain, event_broker=event_broker
|
|
104
88
|
)
|
|
105
89
|
return endpoint_config
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
@hookimpl # type: ignore[misc]
|
|
109
|
-
def init_anonymization_pipeline(endpoints_file: Optional[Text]) -> None:
|
|
110
|
-
"""Hook implementation for initializing the anonymization pipeline."""
|
|
111
|
-
from rasa.anonymization.anonymization_pipeline import load_anonymization_pipeline
|
|
112
|
-
|
|
113
|
-
load_anonymization_pipeline(endpoints_file)
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
@hookimpl # type: ignore[misc]
|
|
117
|
-
def get_anonymization_pipeline() -> Optional["AnonymizationPipeline"]:
|
|
118
|
-
"""Hook implementation for getting the anonymization pipeline."""
|
|
119
|
-
from rasa.anonymization.anonymization_pipeline import AnonymizationPipelineProvider
|
|
120
|
-
|
|
121
|
-
return AnonymizationPipelineProvider().get_anonymization_pipeline()
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
@hookimpl # type: ignore[misc]
|
|
125
|
-
def after_server_stop() -> None:
|
|
126
|
-
"""Hook implementation for stopping the anonymization pipeline."""
|
|
127
|
-
from rasa.anonymization.anonymization_pipeline import AnonymizationPipelineProvider
|
|
128
|
-
|
|
129
|
-
anon_pipeline = AnonymizationPipelineProvider().get_anonymization_pipeline()
|
|
130
|
-
|
|
131
|
-
if anon_pipeline is not None:
|
|
132
|
-
anon_pipeline.stop()
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
def _is_langfuse_integration_enabled() -> bool:
|
|
136
|
-
return (
|
|
137
|
-
os.environ.get(RASA_LANGFUSE_INTEGRATION_ENABLED_ENV_VAR, "false").lower()
|
|
138
|
-
== "true"
|
|
139
|
-
)
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
def _init_langfuse_integration() -> None:
|
|
143
|
-
if not _is_langfuse_integration_enabled():
|
|
144
|
-
structlogger.info(
|
|
145
|
-
"hooks._init_langfuse_integration.disabled",
|
|
146
|
-
event_info="Langfuse integration is disabled.",
|
|
147
|
-
)
|
|
148
|
-
return
|
|
149
|
-
|
|
150
|
-
if (
|
|
151
|
-
not os.environ.get(LANGFUSE_HOST_ENV_VAR)
|
|
152
|
-
or not os.environ.get(LANGFUSE_PROJECT_ID_ENV_VAR)
|
|
153
|
-
or not os.environ.get(LANGFUSE_PUBLIC_KEY_ENV_VAR)
|
|
154
|
-
or not os.environ.get(LANGFUSE_SECRET_KEY_ENV_VAR)
|
|
155
|
-
):
|
|
156
|
-
structlogger.warning(
|
|
157
|
-
"hooks._init_langfuse_integration.missing_langfuse_keys",
|
|
158
|
-
event_info=(
|
|
159
|
-
"Langfuse integration is enabled, but some environment variables "
|
|
160
|
-
"are missing. Please set LANGFUSE_HOST, LANGFUSE_PROJECT_ID, "
|
|
161
|
-
"LANGFUSE_PUBLIC_KEY and LANGFUSE_SECRET_KEY environment "
|
|
162
|
-
"variables to use Langfuse integration."
|
|
163
|
-
),
|
|
164
|
-
)
|
|
165
|
-
return
|
|
166
|
-
|
|
167
|
-
litellm.success_callback = [LANGFUSE_CALLBACK_NAME]
|
|
168
|
-
litellm.failure_callback = [LANGFUSE_CALLBACK_NAME]
|
|
169
|
-
structlogger.info(
|
|
170
|
-
"hooks.langfuse_callbacks_initialized",
|
|
171
|
-
event_info="Langfuse integration initialized.",
|
|
172
|
-
)
|
|
@@ -22,11 +22,7 @@ from rasa.shared.constants import (
|
|
|
22
22
|
from rasa.shared.exceptions import ProviderClientAPIException
|
|
23
23
|
from rasa.shared.providers.mappings import OPENAI_PROVIDER
|
|
24
24
|
from rasa.shared.utils.constants import LOG_COMPONENT_SOURCE_METHOD_INIT
|
|
25
|
-
from rasa.shared.utils.llm import
|
|
26
|
-
USER,
|
|
27
|
-
get_prompt_template,
|
|
28
|
-
llm_factory,
|
|
29
|
-
)
|
|
25
|
+
from rasa.shared.utils.llm import USER, get_prompt_template, llm_factory
|
|
30
26
|
|
|
31
27
|
SEPARATOR = "\n\n"
|
|
32
28
|
BACKUP_SEPARATOR = "\nUSER:"
|
rasa/llm_fine_tuning/utils.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from contextlib import contextmanager
|
|
2
2
|
from datetime import datetime
|
|
3
|
-
from typing import
|
|
3
|
+
from typing import Callable, Generator, List, Union
|
|
4
4
|
|
|
5
5
|
import structlog
|
|
6
6
|
|
|
@@ -24,9 +24,7 @@ def make_mock_invoke_llm(commands: str) -> Callable:
|
|
|
24
24
|
"""
|
|
25
25
|
|
|
26
26
|
async def _mock_invoke_llm(
|
|
27
|
-
self: LLMBasedCommandGenerator,
|
|
28
|
-
prompt: Union[List[dict], List[str], str],
|
|
29
|
-
metadata: Optional[Dict[str, Any]] = None,
|
|
27
|
+
self: LLMBasedCommandGenerator, prompt: Union[List[dict], List[str], str]
|
|
30
28
|
) -> LLMResponse:
|
|
31
29
|
structlogger.debug(
|
|
32
30
|
f"LLM call intercepted, response mocked. "
|
rasa/model_manager/model_api.py
CHANGED
|
@@ -7,12 +7,16 @@ from typing import Any, Callable, Dict, Optional, Union
|
|
|
7
7
|
import dotenv
|
|
8
8
|
import psutil
|
|
9
9
|
import structlog
|
|
10
|
+
from ruamel.yaml import YAMLError
|
|
10
11
|
from sanic import Blueprint, Sanic, response
|
|
11
12
|
from sanic.exceptions import NotFound
|
|
12
13
|
from sanic.request import Request
|
|
13
14
|
from sanic.response import json
|
|
14
15
|
from socketio import AsyncServer
|
|
15
16
|
|
|
17
|
+
import rasa
|
|
18
|
+
from rasa.cli.project_templates.defaults import get_rasa_defaults
|
|
19
|
+
from rasa.cli.scaffold import ProjectTemplateName, scaffold_path
|
|
16
20
|
from rasa.constants import MODEL_ARCHIVE_EXTENSION
|
|
17
21
|
from rasa.exceptions import ModelNotFound
|
|
18
22
|
from rasa.model_manager import config
|
|
@@ -45,6 +49,10 @@ from rasa.model_manager.warm_rasa_process import (
|
|
|
45
49
|
initialize_warm_rasa_process,
|
|
46
50
|
shutdown_warm_rasa_processes,
|
|
47
51
|
)
|
|
52
|
+
from rasa.server import ErrorResponse
|
|
53
|
+
from rasa.shared.exceptions import InvalidConfigException
|
|
54
|
+
from rasa.shared.utils.yaml import dump_obj_as_yaml_to_string
|
|
55
|
+
from rasa.studio.upload import build_calm_import_parts
|
|
48
56
|
|
|
49
57
|
dotenv.load_dotenv()
|
|
50
58
|
|
|
@@ -97,7 +105,7 @@ async def update_status_of_all_bots() -> None:
|
|
|
97
105
|
await update_bot_status(bot)
|
|
98
106
|
|
|
99
107
|
|
|
100
|
-
def base_server_url(request: Request) -> str:
|
|
108
|
+
def base_server_url(request: Optional[Request]) -> str:
|
|
101
109
|
"""Return the base URL of the server."""
|
|
102
110
|
if SERVER_BASE_URL:
|
|
103
111
|
return SERVER_BASE_URL.rstrip("/")
|
|
@@ -476,6 +484,86 @@ def internal_blueprint() -> Blueprint:
|
|
|
476
484
|
except ModelNotFound:
|
|
477
485
|
return response.raw(b"", status=404)
|
|
478
486
|
|
|
487
|
+
@bp.post("/defaults")
|
|
488
|
+
async def get_defaults(request: Request) -> response.HTTPResponse:
|
|
489
|
+
"""Returns the system defaults like prompts, patterns, etc."""
|
|
490
|
+
body = request.json or {}
|
|
491
|
+
config_yaml = body.get("config")
|
|
492
|
+
if config_yaml is None:
|
|
493
|
+
exc = ErrorResponse(
|
|
494
|
+
HTTPStatus.BAD_REQUEST,
|
|
495
|
+
"BadRequest",
|
|
496
|
+
"Missing `config` key in request body.",
|
|
497
|
+
)
|
|
498
|
+
return response.json(exc.error_info, status=exc.status)
|
|
499
|
+
|
|
500
|
+
endpoints_yaml = body.get("endpoints")
|
|
501
|
+
if endpoints_yaml is None:
|
|
502
|
+
exc = ErrorResponse(
|
|
503
|
+
HTTPStatus.BAD_REQUEST,
|
|
504
|
+
"BadRequest",
|
|
505
|
+
"Missing `endpoints` key in request body.",
|
|
506
|
+
)
|
|
507
|
+
return response.json(exc.error_info, status=exc.status)
|
|
508
|
+
|
|
509
|
+
try:
|
|
510
|
+
defaults = get_rasa_defaults(config_yaml, endpoints_yaml)
|
|
511
|
+
except (YAMLError, InvalidConfigException) as e:
|
|
512
|
+
exc = ErrorResponse(
|
|
513
|
+
HTTPStatus.INTERNAL_SERVER_ERROR,
|
|
514
|
+
"InitDataError",
|
|
515
|
+
f"Failed to load defaults. Error: {e!s}",
|
|
516
|
+
)
|
|
517
|
+
return response.json(exc.error_info, status=exc.status)
|
|
518
|
+
return response.json(defaults.model_dump(exclude_none=True))
|
|
519
|
+
|
|
520
|
+
@bp.get("/project_template")
|
|
521
|
+
async def get_project_template(request: Request) -> response.HTTPResponse:
|
|
522
|
+
"""Return initial project template data."""
|
|
523
|
+
template = request.args.get("template", ProjectTemplateName.DEFAULT.value)
|
|
524
|
+
|
|
525
|
+
try:
|
|
526
|
+
template_enum = ProjectTemplateName(template)
|
|
527
|
+
except ValueError:
|
|
528
|
+
valid_templates = ", ".join([t.value for t in ProjectTemplateName])
|
|
529
|
+
exc = ErrorResponse(
|
|
530
|
+
HTTPStatus.BAD_REQUEST,
|
|
531
|
+
"BadRequest",
|
|
532
|
+
f"Unknown template '{template}'. Valid templates: "
|
|
533
|
+
f"{valid_templates}",
|
|
534
|
+
)
|
|
535
|
+
return response.json(exc.error_info, status=exc.status)
|
|
536
|
+
|
|
537
|
+
template_dir = scaffold_path(template_enum)
|
|
538
|
+
if not os.path.isdir(template_dir):
|
|
539
|
+
exc = ErrorResponse(
|
|
540
|
+
HTTPStatus.INTERNAL_SERVER_ERROR,
|
|
541
|
+
"InitDataError",
|
|
542
|
+
f"Template directory '{template_dir}' not found.",
|
|
543
|
+
)
|
|
544
|
+
return response.json(exc.error_info, status=exc.status)
|
|
545
|
+
|
|
546
|
+
assistant_name, parts = build_calm_import_parts(
|
|
547
|
+
data_path=f"{template_dir}/data",
|
|
548
|
+
domain_path=f"{template_dir}/domain",
|
|
549
|
+
config_path=f"{template_dir}/config.yml",
|
|
550
|
+
endpoints_path=f"{template_dir}/endpoints.yml",
|
|
551
|
+
assistant_name=template_enum.value,
|
|
552
|
+
)
|
|
553
|
+
|
|
554
|
+
defaults = get_rasa_defaults(
|
|
555
|
+
config_yaml=dump_obj_as_yaml_to_string(parts.config),
|
|
556
|
+
endpoints_yaml=dump_obj_as_yaml_to_string(parts.endpoints),
|
|
557
|
+
)
|
|
558
|
+
return response.json(
|
|
559
|
+
{
|
|
560
|
+
**parts.model_dump(exclude_none=True),
|
|
561
|
+
"assistantName": assistant_name,
|
|
562
|
+
"defaults": defaults.model_dump(exclude_none=True),
|
|
563
|
+
"version": rasa.__version__,
|
|
564
|
+
}
|
|
565
|
+
)
|
|
566
|
+
|
|
479
567
|
return bp
|
|
480
568
|
|
|
481
569
|
|
|
@@ -483,7 +571,7 @@ def external_blueprint() -> Blueprint:
|
|
|
483
571
|
"""Create a blueprint for the model manager API."""
|
|
484
572
|
from rasa.core.channels.socketio import SocketBlueprint
|
|
485
573
|
|
|
486
|
-
sio = AsyncServer(async_mode="sanic", cors_allowed_origins=
|
|
574
|
+
sio = AsyncServer(async_mode="sanic", cors_allowed_origins=[])
|
|
487
575
|
bp = SocketBlueprint(sio, "", "model_api_external")
|
|
488
576
|
|
|
489
577
|
create_bridge_server(sio, running_bots)
|
|
@@ -131,13 +131,6 @@ async def create_bridge_client(
|
|
|
131
131
|
structlogger.debug("model_runner.bot_message", deployment_id=deployment_id)
|
|
132
132
|
await sio.emit("bot_message", data, room=sid)
|
|
133
133
|
|
|
134
|
-
@client.event # type: ignore[misc]
|
|
135
|
-
async def error(data: Dict[str, Any]) -> None:
|
|
136
|
-
structlogger.debug(
|
|
137
|
-
"model_runner.bot_error", deployment_id=deployment_id, data=data
|
|
138
|
-
)
|
|
139
|
-
await sio.emit("error", data, room=sid)
|
|
140
|
-
|
|
141
134
|
@client.event # type: ignore[misc]
|
|
142
135
|
async def tracker(data: Dict[str, Any]) -> None:
|
|
143
136
|
await sio.emit("tracker", json.loads(data), room=sid)
|
|
@@ -7,7 +7,7 @@ from typing import Any, Dict, Optional
|
|
|
7
7
|
import structlog
|
|
8
8
|
from pydantic import BaseModel, ConfigDict
|
|
9
9
|
|
|
10
|
-
from rasa.constants import MODEL_ARCHIVE_EXTENSION
|
|
10
|
+
from rasa.constants import MODEL_ARCHIVE_EXTENSION, RASA_DIR_NAME
|
|
11
11
|
from rasa.model_manager import config
|
|
12
12
|
from rasa.model_manager.utils import (
|
|
13
13
|
ensure_base_directory_exists,
|
|
@@ -51,6 +51,15 @@ class TrainingSession(BaseModel):
|
|
|
51
51
|
"""Check if the training is running."""
|
|
52
52
|
return self.status == TrainingSessionStatus.RUNNING
|
|
53
53
|
|
|
54
|
+
def has_just_finished(self) -> bool:
|
|
55
|
+
if not self.is_status_indicating_alive():
|
|
56
|
+
# skip if the training is not running
|
|
57
|
+
return False
|
|
58
|
+
if self.process.poll() is None:
|
|
59
|
+
# process is still running
|
|
60
|
+
return False
|
|
61
|
+
return True
|
|
62
|
+
|
|
54
63
|
def model_path(self) -> str:
|
|
55
64
|
"""Return the path to the model."""
|
|
56
65
|
return subpath(models_base_path(), f"{self.model_name}.tar.gz")
|
|
@@ -87,14 +96,8 @@ def terminate_training(training: TrainingSession) -> None:
|
|
|
87
96
|
|
|
88
97
|
|
|
89
98
|
def update_training_status(training: TrainingSession) -> None:
|
|
90
|
-
if
|
|
91
|
-
|
|
92
|
-
return
|
|
93
|
-
if training.process.poll() is None:
|
|
94
|
-
# process is still running
|
|
95
|
-
return
|
|
96
|
-
|
|
97
|
-
complete_training(training)
|
|
99
|
+
if training.has_just_finished():
|
|
100
|
+
complete_training(training)
|
|
98
101
|
|
|
99
102
|
|
|
100
103
|
def complete_training(training: TrainingSession) -> None:
|
|
@@ -171,7 +174,7 @@ def seed_training_directory_with_rasa_cache(
|
|
|
171
174
|
training_base_path=training_base_path,
|
|
172
175
|
)
|
|
173
176
|
# copy the cache to the training directory
|
|
174
|
-
shutil.copytree(src=cache_path, dst=subpath(training_base_path,
|
|
177
|
+
shutil.copytree(src=cache_path, dst=subpath(training_base_path, RASA_DIR_NAME))
|
|
175
178
|
|
|
176
179
|
|
|
177
180
|
def persist_rasa_cache(assistant_id: str, training_base_path: str) -> None:
|
|
@@ -184,12 +187,12 @@ def persist_rasa_cache(assistant_id: str, training_base_path: str) -> None:
|
|
|
184
187
|
cache_path = cache_for_assistant_path(assistant_id)
|
|
185
188
|
|
|
186
189
|
# if the training failed and didn't create a cache, skip this step
|
|
187
|
-
if not os.path.exists(subpath(training_base_path,
|
|
190
|
+
if not os.path.exists(subpath(training_base_path, RASA_DIR_NAME)):
|
|
188
191
|
return
|
|
189
192
|
|
|
190
193
|
# clean up the cache directory first
|
|
191
194
|
shutil.rmtree(cache_path, ignore_errors=True)
|
|
192
|
-
shutil.copytree(src=subpath(training_base_path,
|
|
195
|
+
shutil.copytree(src=subpath(training_base_path, RASA_DIR_NAME), dst=cache_path)
|
|
193
196
|
|
|
194
197
|
|
|
195
198
|
def write_training_data_to_files(
|
rasa/plugin.py
CHANGED
|
@@ -3,7 +3,7 @@ from __future__ import annotations
|
|
|
3
3
|
import argparse
|
|
4
4
|
import functools
|
|
5
5
|
import sys
|
|
6
|
-
from typing import TYPE_CHECKING,
|
|
6
|
+
from typing import TYPE_CHECKING, List, Optional, Text, Union
|
|
7
7
|
|
|
8
8
|
import pluggy
|
|
9
9
|
|
|
@@ -11,7 +11,7 @@ from rasa.cli import SubParsersAction
|
|
|
11
11
|
|
|
12
12
|
if TYPE_CHECKING:
|
|
13
13
|
from rasa.core.brokers.broker import EventBroker
|
|
14
|
-
from rasa.core.tracker_store import TrackerStore
|
|
14
|
+
from rasa.core.tracker_stores.tracker_store import TrackerStore
|
|
15
15
|
from rasa.shared.core.domain import Domain
|
|
16
16
|
from rasa.shared.core.trackers import DialogueStateTracker
|
|
17
17
|
from rasa.utils.endpoints import EndpointConfig
|
|
@@ -32,11 +32,8 @@ def plugin_manager() -> pluggy.PluginManager:
|
|
|
32
32
|
|
|
33
33
|
def init_hooks(manager: pluggy.PluginManager) -> None:
|
|
34
34
|
"""Initialise hooks into rasa."""
|
|
35
|
-
import rasa.utils.licensing
|
|
36
35
|
from rasa import hooks
|
|
37
36
|
|
|
38
|
-
rasa.utils.licensing.validate_license_from_env()
|
|
39
|
-
|
|
40
37
|
manager.register(hooks)
|
|
41
38
|
|
|
42
39
|
|
|
@@ -72,16 +69,6 @@ def create_tracker_store( # type: ignore[empty-body]
|
|
|
72
69
|
"""Hook specification for wrapping with AuthRetryTrackerStore."""
|
|
73
70
|
|
|
74
71
|
|
|
75
|
-
@hookspec(firstresult=True) # type: ignore[misc]
|
|
76
|
-
def init_anonymization_pipeline(endpoints_file: Optional[Text]) -> None:
|
|
77
|
-
"""Hook specification for initialising the anonymization pipeline."""
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
@hookspec(firstresult=True) # type: ignore[misc]
|
|
81
|
-
def get_anonymization_pipeline() -> Optional[Any]:
|
|
82
|
-
"""Hook specification for getting the anonymization pipeline."""
|
|
83
|
-
|
|
84
|
-
|
|
85
72
|
@hookspec # type: ignore[misc]
|
|
86
73
|
def after_server_stop() -> None:
|
|
87
74
|
"""Hook specification for stopping the server.
|
rasa/privacy/__init__.py
ADDED
|
File without changes
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
PRIVACY_CONFIG_SCHEMA = "privacy/privacy_config_schema.json"
|
|
2
|
+
REDACTION_CHAR_KEY = "redaction_char"
|
|
3
|
+
KEEP_LEFT_KEY = "keep_left"
|
|
4
|
+
KEEP_RIGHT_KEY = "keep_right"
|
|
5
|
+
DELETION_KEY = "deletion"
|
|
6
|
+
ANONYMIZATION_KEY = "anonymization"
|
|
7
|
+
TRACKER_STORE_SETTINGS = "tracker_store_settings"
|
|
8
|
+
SLOT_KEY = "slot"
|
|
9
|
+
TEXT_KEY = "text"
|
|
10
|
+
ENTITIES_KEY = "entities"
|
|
11
|
+
VALUE_KEY = "value"
|
|
12
|
+
ENTITY_LABEL_KEY = "label"
|
|
13
|
+
|
|
14
|
+
USER_CHAT_INACTIVITY_IN_MINUTES_ENV_VAR_NAME = "USER_CHAT_INACTIVITY_IN_MINUTES"
|
|
15
|
+
GLINER_MODEL_PATH_ENV_VAR_NAME = "GLINER_MODEL_PATH"
|
|
16
|
+
HUGGINGFACE_CACHE_DIR_ENV_VAR_NAME = "HUGGINGFACE_HUB_CACHE_DIR"
|
|
17
|
+
|
|
18
|
+
DEFAULT_PII_MODEL = "urchade/gliner_multi_pii-v1"
|
|
19
|
+
GLINER_LABELS = [
|
|
20
|
+
"person",
|
|
21
|
+
"organization",
|
|
22
|
+
"company",
|
|
23
|
+
"phone number",
|
|
24
|
+
"address",
|
|
25
|
+
"full address",
|
|
26
|
+
"postcode",
|
|
27
|
+
"zip code",
|
|
28
|
+
"passport number",
|
|
29
|
+
"email",
|
|
30
|
+
"credit card number",
|
|
31
|
+
"social security number",
|
|
32
|
+
"health insurance id number",
|
|
33
|
+
"date of birth",
|
|
34
|
+
"mobile phone number",
|
|
35
|
+
"bank account number",
|
|
36
|
+
"medication",
|
|
37
|
+
"cpf",
|
|
38
|
+
"driver's license number",
|
|
39
|
+
"tax identification number",
|
|
40
|
+
"medical condition",
|
|
41
|
+
"identity card number",
|
|
42
|
+
"national id number",
|
|
43
|
+
"ip address",
|
|
44
|
+
"email address",
|
|
45
|
+
"iban",
|
|
46
|
+
"credit card expiration date",
|
|
47
|
+
"username",
|
|
48
|
+
"health insurance number",
|
|
49
|
+
"registration number",
|
|
50
|
+
"student id number",
|
|
51
|
+
"insurance number",
|
|
52
|
+
"membership number",
|
|
53
|
+
"booking number",
|
|
54
|
+
"landline phone number",
|
|
55
|
+
"blood type",
|
|
56
|
+
"cvv",
|
|
57
|
+
"reservation number",
|
|
58
|
+
"digital signature",
|
|
59
|
+
"social media handle",
|
|
60
|
+
"license plate number",
|
|
61
|
+
"cnpj",
|
|
62
|
+
"postal code",
|
|
63
|
+
"passport_number",
|
|
64
|
+
"serial number",
|
|
65
|
+
"vehicle registration number",
|
|
66
|
+
"fax number",
|
|
67
|
+
"visa number",
|
|
68
|
+
"insurance company",
|
|
69
|
+
"identity document number",
|
|
70
|
+
"transaction number",
|
|
71
|
+
"national health insurance number",
|
|
72
|
+
"cvc",
|
|
73
|
+
"birth certificate number",
|
|
74
|
+
"train ticket number",
|
|
75
|
+
"passport expiration date",
|
|
76
|
+
"social_security_number",
|
|
77
|
+
"personally identifiable information",
|
|
78
|
+
"banking routing number",
|
|
79
|
+
"sort code",
|
|
80
|
+
"routing number",
|
|
81
|
+
"tax number",
|
|
82
|
+
"swift code",
|
|
83
|
+
]
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
from typing import TYPE_CHECKING, List, Optional
|
|
2
|
+
|
|
3
|
+
import structlog
|
|
4
|
+
|
|
5
|
+
from rasa.core.brokers.broker import EventBroker
|
|
6
|
+
from rasa.utils.endpoints import EndpointConfig
|
|
7
|
+
|
|
8
|
+
if TYPE_CHECKING:
|
|
9
|
+
from asyncio import AbstractEventLoop
|
|
10
|
+
|
|
11
|
+
structlogger = structlog.get_logger(__name__)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
async def create_event_brokers(
|
|
15
|
+
event_broker_endpoint: Optional[EndpointConfig],
|
|
16
|
+
event_loop: Optional["AbstractEventLoop"] = None,
|
|
17
|
+
) -> List[EventBroker]:
|
|
18
|
+
"""Create EventBroker objects for each anonymization topic or queue."""
|
|
19
|
+
if event_broker_endpoint is None or event_broker_endpoint.type is None:
|
|
20
|
+
structlogger.debug(
|
|
21
|
+
"rasa.privacy_filtering.create_event_broker.no_event_broker_type",
|
|
22
|
+
)
|
|
23
|
+
return []
|
|
24
|
+
|
|
25
|
+
if event_broker_endpoint.type == "kafka":
|
|
26
|
+
event_collection = event_broker_endpoint.kwargs.get("anonymization_topics", [])
|
|
27
|
+
event_collection_type = "topic"
|
|
28
|
+
elif event_broker_endpoint.type == "pika":
|
|
29
|
+
event_collection = event_broker_endpoint.kwargs.get("anonymization_queues", [])
|
|
30
|
+
event_collection_type = "queues"
|
|
31
|
+
else:
|
|
32
|
+
structlogger.debug(
|
|
33
|
+
"rasa.privacy_filtering.create_event_broker.unsupported_event_broker_type",
|
|
34
|
+
event_broker_type=event_broker_endpoint.type,
|
|
35
|
+
)
|
|
36
|
+
return []
|
|
37
|
+
|
|
38
|
+
if not event_collection:
|
|
39
|
+
structlogger.debug(
|
|
40
|
+
f"rasa.privacy_filtering.create_event_broker.no_anonymization_{event_collection_type}",
|
|
41
|
+
event_collection_type=event_collection_type,
|
|
42
|
+
)
|
|
43
|
+
return []
|
|
44
|
+
|
|
45
|
+
return await _create_event_brokers(
|
|
46
|
+
event_broker_endpoint, event_collection, event_collection_type, event_loop
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
async def _create_event_brokers(
|
|
51
|
+
event_broker_endpoint: EndpointConfig,
|
|
52
|
+
event_collection: List[str],
|
|
53
|
+
event_collection_type: str,
|
|
54
|
+
event_loop: Optional["AbstractEventLoop"] = None,
|
|
55
|
+
) -> List[EventBroker]:
|
|
56
|
+
"""Create event brokers."""
|
|
57
|
+
event_brokers = []
|
|
58
|
+
for item in event_collection:
|
|
59
|
+
event_broker_endpoint.kwargs[event_collection_type] = (
|
|
60
|
+
item if event_collection_type == "topic" else [item]
|
|
61
|
+
)
|
|
62
|
+
structlogger.debug(
|
|
63
|
+
"rasa.privacy_filtering.create_event_broker",
|
|
64
|
+
event_info=f"Setting anonymized event streaming to '{item}'.",
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
event_broker = await EventBroker.create(event_broker_endpoint, event_loop)
|
|
68
|
+
if event_broker is None:
|
|
69
|
+
structlogger.debug(
|
|
70
|
+
"rasa.privacy_filtering.create_event_broker.no_event_broker_created",
|
|
71
|
+
event_info=f"No event broker created for publishing to '{item}'.",
|
|
72
|
+
)
|
|
73
|
+
continue
|
|
74
|
+
|
|
75
|
+
event_brokers.append(event_broker)
|
|
76
|
+
|
|
77
|
+
return event_brokers
|