rasa-pro 3.12.22__py3-none-any.whl → 3.13.0__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/__main__.py +3 -4
- rasa/api.py +1 -1
- rasa/cli/dialogue_understanding_test.py +1 -1
- rasa/cli/e2e_test.py +1 -8
- rasa/cli/evaluate.py +2 -2
- rasa/cli/export.py +5 -3
- rasa/cli/inspect.py +7 -0
- 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/project_templates/tutorial/config.yml +1 -1
- rasa/cli/project_templates/tutorial/endpoints.yml +1 -1
- rasa/cli/run.py +1 -1
- rasa/cli/scaffold.py +2 -3
- rasa/cli/shell.py +6 -1
- rasa/cli/studio/download.py +0 -22
- rasa/cli/studio/link.py +36 -0
- rasa/cli/studio/pull.py +79 -0
- rasa/cli/studio/push.py +78 -0
- rasa/cli/studio/studio.py +12 -0
- rasa/cli/studio/train.py +1 -5
- rasa/cli/studio/upload.py +6 -4
- rasa/cli/train.py +5 -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 +43 -29
- rasa/core/actions/action_repeat_bot_messages.py +18 -22
- rasa/core/actions/action_run_slot_rejections.py +1 -2
- rasa/core/agent.py +24 -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/__init__.py +3 -0
- 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-371401b1.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{blockDiagram-38ab4fdb-7f34db23.js → blockDiagram-38ab4fdb-3f126156.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{c4Diagram-3d4e48cf-948bab2c.js → c4Diagram-3d4e48cf-12f22eb7.js} +1 -1
- rasa/core/channels/inspector/dist/assets/channel-f1efda17.js +1 -0
- rasa/core/channels/inspector/dist/assets/{classDiagram-70f12bd4-53b0dd0e.js → classDiagram-70f12bd4-03b1d386.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{classDiagram-v2-f2320105-fdf789e7.js → classDiagram-v2-f2320105-84f69d63.js} +1 -1
- rasa/core/channels/inspector/dist/assets/clone-fdf164e2.js +1 -0
- rasa/core/channels/inspector/dist/assets/{createText-2e5e7dd3-87c4ece5.js → createText-2e5e7dd3-ca47fd38.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{edges-e0da2a9e-5a8b0749.js → edges-e0da2a9e-f837ca8a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{erDiagram-9861fffd-66da90e2.js → erDiagram-9861fffd-8717ac54.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDb-956e92f1-10044f05.js → flowDb-956e92f1-94f38b83.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDiagram-66a62f08-f338f66a.js → flowDiagram-66a62f08-b616f9fb.js} +1 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-7d7a1629.js +1 -0
- rasa/core/channels/inspector/dist/assets/{flowchart-elk-definition-4a651766-b13140aa.js → flowchart-elk-definition-4a651766-f5d24bb8.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{ganttDiagram-c361ad54-f2b4a55a.js → ganttDiagram-c361ad54-b43ba8d9.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-72cf32ee-dedc298d.js → gitGraphDiagram-72cf32ee-c3aafaa5.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{graph-4ede11ff.js → graph-0d0a2c10.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-3862675e-65549d37.js → index-3862675e-58ea0305.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-3a23e736.js → index-cce6f8a1.js} +123 -123
- rasa/core/channels/inspector/dist/assets/{infoDiagram-f8f76790-65439671.js → infoDiagram-f8f76790-b8f60461.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{journeyDiagram-49397b02-56d03d98.js → journeyDiagram-49397b02-95be5545.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{layout-dd48f7f4.js → layout-da885b9b.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{line-1569ad2c.js → line-f1c817d3.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{linear-48bf4935.js → linear-d42801e6.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{mindmap-definition-fc14e90a-688504c1.js → mindmap-definition-fc14e90a-a38923a6.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{pieDiagram-8a3498a8-78b6d7e6.js → pieDiagram-8a3498a8-ca6e71e9.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{quadrantDiagram-120e2f19-048b84b3.js → quadrantDiagram-120e2f19-b290dae9.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{requirementDiagram-deff3bca-dd67f107.js → requirementDiagram-deff3bca-03f02ceb.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sankeyDiagram-04a897e0-8128436e.js → sankeyDiagram-04a897e0-c49eee40.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sequenceDiagram-704730f1-1a0d1461.js → sequenceDiagram-704730f1-b2cd6a3d.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-587899a1-46d388ed.js → stateDiagram-587899a1-e53a2028.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-v2-d93cdb3a-ea42951a.js → stateDiagram-v2-d93cdb3a-e1982a03.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-6aaf32cf-7427ed0c.js → styles-6aaf32cf-d0226ca5.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-9a916d00-ff5e5a16.js → styles-9a916d00-0e21dc00.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-c10674c1-7b3680cf.js → styles-c10674c1-9588494e.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{svgDrawCommon-08f97a94-f860f2ad.js → svgDrawCommon-08f97a94-be478d4f.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{timeline-definition-85554ec2-2eebf0c8.js → timeline-definition-85554ec2-74631749.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{xychartDiagram-e933f94c-5d7f4e96.js → xychartDiagram-e933f94c-a043552f.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 +329 -68
- rasa/core/channels/vier_cvg.py +1 -2
- rasa/core/channels/voice_ready/audiocodes.py +4 -11
- rasa/core/channels/voice_ready/jambonz.py +5 -6
- rasa/core/channels/voice_ready/twilio_voice.py +13 -12
- rasa/core/channels/voice_ready/utils.py +22 -0
- rasa/core/channels/voice_stream/audiocodes.py +13 -16
- rasa/core/channels/voice_stream/browser_audio.py +1 -1
- rasa/core/channels/voice_stream/genesys.py +37 -18
- rasa/core/channels/voice_stream/jambonz.py +232 -0
- rasa/core/channels/voice_stream/tts/__init__.py +8 -0
- rasa/core/channels/voice_stream/twilio_media_streams.py +15 -12
- rasa/core/channels/voice_stream/voice_channel.py +71 -27
- rasa/core/concurrent_lock_store.py +24 -10
- rasa/core/evaluation/marker_tracker_loader.py +1 -1
- rasa/core/exporter.py +37 -1
- rasa/core/http_interpreter.py +3 -7
- rasa/core/information_retrieval/faiss.py +18 -11
- 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 +305 -189
- rasa/core/policies/enterprise_search_policy_config.py +241 -0
- rasa/core/policies/enterprise_search_prompt_with_relevancy_check_and_citation_template.jinja2 +67 -0
- rasa/core/policies/flow_policy.py +1 -1
- rasa/core/policies/flows/flow_executor.py +102 -17
- rasa/core/policies/intentless_policy.py +56 -17
- rasa/core/processor.py +70 -49
- 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} +66 -1
- rasa/core/tracker_stores/dynamo_tracker_store.py +256 -0
- rasa/core/tracker_stores/mongo_tracker_store.py +223 -0
- rasa/core/tracker_stores/redis_tracker_store.py +252 -0
- rasa/core/tracker_stores/sql_tracker_store.py +582 -0
- rasa/core/tracker_stores/tracker_store.py +839 -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 +13 -11
- rasa/dialogue_understanding/commands/can_not_handle_command.py +2 -0
- rasa/dialogue_understanding/commands/cancel_flow_command.py +3 -1
- rasa/dialogue_understanding/commands/chit_chat_answer_command.py +2 -0
- rasa/dialogue_understanding/commands/clarify_command.py +6 -2
- rasa/dialogue_understanding/commands/command_syntax_manager.py +1 -0
- rasa/dialogue_understanding/commands/correct_slots_command.py +5 -6
- rasa/dialogue_understanding/commands/error_command.py +1 -1
- rasa/dialogue_understanding/commands/human_handoff_command.py +3 -3
- 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 +8 -4
- rasa/dialogue_understanding/commands/skip_question_command.py +3 -3
- rasa/dialogue_understanding/commands/start_flow_command.py +7 -3
- 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 +1 -2
- rasa/dialogue_understanding/generator/multi_step/multi_step_llm_command_generator.py +3 -2
- rasa/dialogue_understanding/generator/nlu_command_adapter.py +2 -2
- rasa/dialogue_understanding/generator/prompt_templates/command_prompt_template.jinja2 +0 -2
- rasa/dialogue_understanding/generator/prompt_templates/command_prompt_v2_claude_3_5_sonnet_20240620_template.jinja2 +1 -0
- rasa/dialogue_understanding/generator/prompt_templates/command_prompt_v2_gpt_4o_2024_11_20_template.jinja2 +1 -0
- rasa/dialogue_understanding/generator/prompt_templates/command_prompt_v3_claude_3_5_sonnet_20240620_template.jinja2 +79 -0
- rasa/dialogue_understanding/generator/prompt_templates/command_prompt_v3_gpt_4o_2024_11_20_template.jinja2 +79 -0
- rasa/dialogue_understanding/generator/single_step/compact_llm_command_generator.py +26 -461
- 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 +461 -0
- rasa/dialogue_understanding/generator/single_step/single_step_llm_command_generator.py +20 -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 +42 -27
- rasa/dialogue_understanding/patterns/domain_for_patterns.py +190 -0
- rasa/dialogue_understanding/processor/command_processor.py +6 -7
- 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/du_test_schema.yml +3 -3
- rasa/dialogue_understanding_test/io.py +35 -8
- rasa/e2e_test/constants.py +1 -1
- rasa/e2e_test/e2e_test_runner.py +1 -1
- rasa/e2e_test/e2e_test_schema.yml +3 -3
- 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 -30
- rasa/llm_fine_tuning/paraphrasing/conversation_rephraser.py +2 -6
- rasa/model_manager/model_api.py +89 -1
- rasa/model_manager/runner_service.py +20 -4
- rasa/model_manager/socket_bridge.py +0 -7
- rasa/model_manager/trainer_service.py +10 -4
- 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 +393 -0
- rasa/privacy/privacy_manager.py +594 -0
- rasa/server.py +23 -2
- rasa/shared/constants.py +17 -0
- 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 +30 -5
- rasa/shared/core/flows/flow_step.py +19 -3
- 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 +25 -5
- rasa/shared/core/flows/yaml_flows_io.py +106 -5
- rasa/shared/core/slots.py +29 -1
- rasa/shared/core/trackers.py +21 -10
- rasa/shared/core/training_data/story_reader/yaml_story_reader.py +1 -4
- rasa/shared/importers/importer.py +8 -0
- rasa/shared/providers/_configs/azure_openai_client_config.py +2 -2
- rasa/shared/providers/_configs/default_litellm_client_config.py +1 -1
- rasa/shared/providers/_configs/huggingface_local_embedding_client_config.py +1 -1
- rasa/shared/providers/_configs/openai_client_config.py +1 -1
- rasa/shared/providers/_configs/rasa_llm_client_config.py +1 -1
- rasa/shared/providers/_configs/self_hosted_llm_client_config.py +1 -1
- rasa/shared/providers/_configs/utils.py +0 -99
- rasa/shared/providers/llm/default_litellm_llm_client.py +2 -2
- rasa/shared/utils/common.py +43 -1
- rasa/shared/utils/configs.py +110 -0
- rasa/shared/utils/constants.py +0 -3
- rasa/shared/utils/llm.py +245 -8
- rasa/shared/utils/pykwalify_extensions.py +0 -9
- rasa/shared/utils/yaml.py +32 -0
- rasa/studio/constants.py +1 -0
- rasa/studio/data_handler.py +33 -12
- rasa/studio/download.py +117 -435
- rasa/studio/link.py +211 -0
- rasa/studio/prompts.py +221 -0
- rasa/studio/pull/__init__.py +0 -0
- rasa/studio/pull/data.py +222 -0
- rasa/studio/pull/domains.py +60 -0
- rasa/studio/pull/pull.py +239 -0
- rasa/studio/push.py +138 -0
- rasa/studio/results_logger.py +6 -1
- rasa/studio/train.py +1 -1
- rasa/studio/upload.py +243 -72
- rasa/studio/utils.py +33 -0
- rasa/telemetry.py +83 -26
- rasa/tracing/config.py +4 -5
- rasa/tracing/constants.py +19 -1
- rasa/tracing/instrumentation/attribute_extractors.py +68 -16
- 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 +43 -22
- rasa/utils/endpoints.py +22 -1
- rasa/utils/licensing.py +2 -3
- rasa/utils/log_utils.py +1 -45
- rasa/validator.py +2 -8
- rasa/version.py +1 -1
- {rasa_pro-3.12.22.dist-info → rasa_pro-3.13.0.dist-info}/METADATA +11 -12
- {rasa_pro-3.12.22.dist-info → rasa_pro-3.13.0.dist-info}/RECORD +333 -309
- 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/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/{cli/project_templates/calm/actions → core/information_retrieval/ingestion}/__init__.py +0 -0
- {rasa_pro-3.12.22.dist-info → rasa_pro-3.13.0.dist-info}/NOTICE +0 -0
- {rasa_pro-3.12.22.dist-info → rasa_pro-3.13.0.dist-info}/WHEEL +0 -0
- {rasa_pro-3.12.22.dist-info → rasa_pro-3.13.0.dist-info}/entry_points.txt +0 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import json
|
|
2
|
-
import logging
|
|
3
2
|
import time
|
|
4
3
|
from collections import deque
|
|
5
4
|
from typing import Deque, Optional, Text
|
|
6
5
|
|
|
6
|
+
import structlog
|
|
7
|
+
|
|
7
8
|
from rasa.core.lock import Ticket, TicketLock
|
|
8
9
|
from rasa.core.lock_store import (
|
|
9
10
|
DEFAULT_SOCKET_TIMEOUT_IN_SECONDS,
|
|
@@ -19,7 +20,7 @@ DEFAULT_PORT = 6379
|
|
|
19
20
|
|
|
20
21
|
DEFAULT_HOSTNAME = "localhost"
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
structlogger = structlog.getLogger(__name__)
|
|
23
24
|
|
|
24
25
|
LAST_ISSUED_TICKET_NUMBER_SUFFIX = "last_issued_ticket_number"
|
|
25
26
|
|
|
@@ -105,7 +106,10 @@ class ConcurrentRedisLockStore(LockStore):
|
|
|
105
106
|
|
|
106
107
|
self.key_prefix = DEFAULT_CONCURRENT_REDIS_LOCK_STORE_KEY_PREFIX
|
|
107
108
|
if key_prefix:
|
|
108
|
-
|
|
109
|
+
structlogger.debug(
|
|
110
|
+
"concurrent_redis_lock_store._set_key_prefix.non_default_key_prefix",
|
|
111
|
+
event_info=f"Setting non-default redis key prefix: '{key_prefix}'.",
|
|
112
|
+
)
|
|
109
113
|
self._set_key_prefix(key_prefix)
|
|
110
114
|
|
|
111
115
|
super().__init__()
|
|
@@ -116,9 +120,13 @@ class ConcurrentRedisLockStore(LockStore):
|
|
|
116
120
|
key_prefix + ":" + DEFAULT_CONCURRENT_REDIS_LOCK_STORE_KEY_PREFIX
|
|
117
121
|
)
|
|
118
122
|
else:
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
123
|
+
structlogger.warning(
|
|
124
|
+
"concurrent_redis_lock_store._set_key_prefix.default_instead_of_invalid_key_prefix",
|
|
125
|
+
event_info=(
|
|
126
|
+
f"Omitting provided non-alphanumeric "
|
|
127
|
+
f"redis key prefix: '{key_prefix}'. "
|
|
128
|
+
f"Using default '{self.key_prefix}' instead."
|
|
129
|
+
),
|
|
122
130
|
)
|
|
123
131
|
|
|
124
132
|
def issue_ticket(
|
|
@@ -129,7 +137,10 @@ class ConcurrentRedisLockStore(LockStore):
|
|
|
129
137
|
It's configured with `lock_lifetime` and associated with `conversation_id`.
|
|
130
138
|
Creates a new lock if none is found.
|
|
131
139
|
"""
|
|
132
|
-
|
|
140
|
+
structlogger.debug(
|
|
141
|
+
"concurrent_redis_lock_store.issue_ticket",
|
|
142
|
+
event_info=f"Issuing ticket for conversation '{conversation_id}'.",
|
|
143
|
+
)
|
|
133
144
|
try:
|
|
134
145
|
lock = self.get_or_create_lock(conversation_id)
|
|
135
146
|
lock.remove_expired_tickets()
|
|
@@ -164,9 +175,12 @@ class ConcurrentRedisLockStore(LockStore):
|
|
|
164
175
|
redis_keys = self.red.keys(pattern)
|
|
165
176
|
|
|
166
177
|
if not redis_keys:
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
178
|
+
structlogger.debug(
|
|
179
|
+
"concurrent_redis_lock_store.delete_lock_key_not_found",
|
|
180
|
+
event_info=(
|
|
181
|
+
f"The lock store does not contain any key-value "
|
|
182
|
+
f"items for conversation '{conversation_id}'."
|
|
183
|
+
),
|
|
170
184
|
)
|
|
171
185
|
return None
|
|
172
186
|
|
|
@@ -2,7 +2,7 @@ import random
|
|
|
2
2
|
from typing import Any, AsyncIterator, Iterable, List, Optional, Text
|
|
3
3
|
|
|
4
4
|
import rasa.shared.utils.io
|
|
5
|
-
from rasa.core.tracker_store import TrackerStore
|
|
5
|
+
from rasa.core.tracker_stores.tracker_store import TrackerStore
|
|
6
6
|
from rasa.shared.core.trackers import DialogueStateTracker
|
|
7
7
|
from rasa.shared.exceptions import RasaException
|
|
8
8
|
|
rasa/core/exporter.py
CHANGED
|
@@ -10,12 +10,17 @@ import rasa.shared.utils.io
|
|
|
10
10
|
from rasa.core.brokers.broker import EventBroker
|
|
11
11
|
from rasa.core.brokers.pika import PikaEventBroker
|
|
12
12
|
from rasa.core.constants import RASA_EXPORT_PROCESS_ID_HEADER_NAME
|
|
13
|
-
from rasa.core.tracker_store import TrackerStore
|
|
13
|
+
from rasa.core.tracker_stores.tracker_store import TrackerStore
|
|
14
14
|
from rasa.exceptions import (
|
|
15
15
|
NoConversationsInTrackerStoreError,
|
|
16
16
|
NoEventsToMigrateError,
|
|
17
17
|
PublishingError,
|
|
18
18
|
)
|
|
19
|
+
from rasa.shared.core.events import (
|
|
20
|
+
BotUttered,
|
|
21
|
+
SlotSet,
|
|
22
|
+
UserUttered,
|
|
23
|
+
)
|
|
19
24
|
from rasa.shared.core.trackers import EventVerbosity
|
|
20
25
|
|
|
21
26
|
logger = logging.getLogger(__name__)
|
|
@@ -43,6 +48,7 @@ class Exporter:
|
|
|
43
48
|
tracker_store: TrackerStore,
|
|
44
49
|
event_broker: EventBroker,
|
|
45
50
|
endpoints_path: Text,
|
|
51
|
+
is_pii_enabled: bool = False,
|
|
46
52
|
requested_conversation_ids: Optional[Text] = None,
|
|
47
53
|
minimum_timestamp: Optional[float] = None,
|
|
48
54
|
maximum_timestamp: Optional[float] = None,
|
|
@@ -52,6 +58,7 @@ class Exporter:
|
|
|
52
58
|
self.tracker_store = tracker_store
|
|
53
59
|
|
|
54
60
|
self.event_broker = event_broker
|
|
61
|
+
self.is_pii_enabled = is_pii_enabled
|
|
55
62
|
self.requested_conversation_ids = requested_conversation_ids
|
|
56
63
|
self.minimum_timestamp = minimum_timestamp
|
|
57
64
|
self.maximum_timestamp = maximum_timestamp
|
|
@@ -72,10 +79,12 @@ class Exporter:
|
|
|
72
79
|
current_timestamp = None
|
|
73
80
|
|
|
74
81
|
headers = self._get_message_headers()
|
|
82
|
+
warned_sender_ids: Set[Text] = set()
|
|
75
83
|
|
|
76
84
|
async for event in self._fetch_events_within_time_range():
|
|
77
85
|
# noinspection PyBroadException
|
|
78
86
|
try:
|
|
87
|
+
self._check_anonymization_status(event, warned_sender_ids)
|
|
79
88
|
self._publish_with_message_headers(event, headers)
|
|
80
89
|
published_events += 1
|
|
81
90
|
current_timestamp = event["timestamp"]
|
|
@@ -282,3 +291,30 @@ class Exporter:
|
|
|
282
291
|
events_with_conversation_id.append(event)
|
|
283
292
|
|
|
284
293
|
return events_with_conversation_id
|
|
294
|
+
|
|
295
|
+
def _check_anonymization_status(
|
|
296
|
+
self, event: Dict[Text, Any], warned_sender_ids: Set[Text]
|
|
297
|
+
) -> None:
|
|
298
|
+
"""Check if the tracker store contains unanonymized events.
|
|
299
|
+
|
|
300
|
+
If it does, print a warning that these events will be published as is.
|
|
301
|
+
|
|
302
|
+
Args:
|
|
303
|
+
event: The event to check for anonymization status
|
|
304
|
+
warned_sender_ids: Set of sender IDs that have already been warned about
|
|
305
|
+
"""
|
|
306
|
+
sender_id = event["sender_id"]
|
|
307
|
+
if (
|
|
308
|
+
self.is_pii_enabled
|
|
309
|
+
and sender_id not in warned_sender_ids
|
|
310
|
+
and event["event"]
|
|
311
|
+
in (UserUttered.type_name, BotUttered.type_name, SlotSet.type_name)
|
|
312
|
+
and not event.get("anonymized_at", None)
|
|
313
|
+
):
|
|
314
|
+
rasa.shared.utils.cli.print_warning(
|
|
315
|
+
f"Retrieved un-anonymized event for sender_id {sender_id}. "
|
|
316
|
+
f"All events after this timestamp {event['timestamp']} "
|
|
317
|
+
"are not anonymized for this tracker. Proceeding with "
|
|
318
|
+
"publishing plaintext values for all events following this.",
|
|
319
|
+
)
|
|
320
|
+
warned_sender_ids.add(sender_id)
|
rasa/core/http_interpreter.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import copy
|
|
2
1
|
import logging
|
|
3
2
|
from typing import Any, Dict, Optional, Text
|
|
4
3
|
|
|
@@ -49,7 +48,6 @@ class RasaNLUHttpInterpreter:
|
|
|
49
48
|
if not self.endpoint_config or self.endpoint_config.url is None:
|
|
50
49
|
structlogger.error(
|
|
51
50
|
"http.parse.text",
|
|
52
|
-
text=copy.deepcopy(text),
|
|
53
51
|
event_info="No rasa NLU server specified!",
|
|
54
52
|
)
|
|
55
53
|
return None
|
|
@@ -71,18 +69,16 @@ class RasaNLUHttpInterpreter:
|
|
|
71
69
|
if resp.status == 200:
|
|
72
70
|
return await resp.json()
|
|
73
71
|
else:
|
|
74
|
-
response_text = await resp.text()
|
|
75
72
|
structlogger.error(
|
|
76
73
|
"http.parse.text.failure",
|
|
77
|
-
|
|
78
|
-
response_text=copy.deepcopy(response_text),
|
|
74
|
+
event_info="Failed to parse text",
|
|
79
75
|
)
|
|
80
76
|
return None
|
|
81
|
-
except Exception: # skipcq: PYL-W0703
|
|
77
|
+
except Exception as e: # skipcq: PYL-W0703
|
|
82
78
|
# need to catch all possible exceptions when doing http requests
|
|
83
79
|
# (timeouts, value errors, parser errors, ...)
|
|
84
80
|
structlogger.exception(
|
|
85
81
|
"http.parse.text.exception",
|
|
86
|
-
text
|
|
82
|
+
event_info=f"Exception occurred while parsing text. Error: {e}",
|
|
87
83
|
)
|
|
88
84
|
return None
|
|
@@ -12,6 +12,7 @@ from rasa.core.information_retrieval import (
|
|
|
12
12
|
InformationRetrievalException,
|
|
13
13
|
SearchResultList,
|
|
14
14
|
)
|
|
15
|
+
from rasa.core.information_retrieval.ingestion.faq_parser import _format_faq_documents
|
|
15
16
|
from rasa.utils.endpoints import EndpointConfig
|
|
16
17
|
from rasa.utils.ml_utils import persist_faiss_vector_store
|
|
17
18
|
|
|
@@ -31,10 +32,12 @@ class FAISS_Store(InformationRetrieval):
|
|
|
31
32
|
index_path: str,
|
|
32
33
|
docs_folder: Optional[str],
|
|
33
34
|
create_index: Optional[bool] = False,
|
|
35
|
+
parse_as_faq_pairs: Optional[bool] = False,
|
|
34
36
|
):
|
|
35
37
|
"""Initializes the FAISS Store."""
|
|
36
38
|
self.chunk_size = 1000
|
|
37
39
|
self.chunk_overlap = 20
|
|
40
|
+
self.parse_as_faq_pairs = parse_as_faq_pairs
|
|
38
41
|
|
|
39
42
|
path = Path(index_path) / "documents_faiss"
|
|
40
43
|
if create_index:
|
|
@@ -86,21 +89,25 @@ class FAISS_Store(InformationRetrieval):
|
|
|
86
89
|
if not docs_folder:
|
|
87
90
|
raise ValueError("parameter `docs_folder` needs to be specified")
|
|
88
91
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
documents = self.load_documents(docs_folder)
|
|
93
|
+
|
|
94
|
+
if not self.parse_as_faq_pairs:
|
|
95
|
+
splitter = RecursiveCharacterTextSplitter(
|
|
96
|
+
chunk_size=self.chunk_size,
|
|
97
|
+
chunk_overlap=self.chunk_overlap,
|
|
98
|
+
length_function=len,
|
|
99
|
+
)
|
|
100
|
+
parsed_documents = splitter.split_documents(documents)
|
|
101
|
+
else:
|
|
102
|
+
parsed_documents = _format_faq_documents(documents)
|
|
96
103
|
|
|
97
104
|
logger.info(
|
|
98
105
|
"information_retrieval.faiss_store._create_document_index",
|
|
99
|
-
len_chunks=len(
|
|
106
|
+
len_chunks=len(parsed_documents),
|
|
100
107
|
)
|
|
101
|
-
if
|
|
102
|
-
texts = [
|
|
103
|
-
metadatas = [
|
|
108
|
+
if parsed_documents:
|
|
109
|
+
texts = [document.page_content for document in parsed_documents]
|
|
110
|
+
metadatas = [document.metadata for document in parsed_documents]
|
|
104
111
|
return FAISS.from_texts(texts, embedding, metadatas=metadatas, ids=None)
|
|
105
112
|
else:
|
|
106
113
|
raise ValueError(f"No documents found at '{docs_folder}'.")
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"""Utilities for parsing FAQ-style documents (Q/A pairs) used in extractive search."""
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
from collections import defaultdict
|
|
5
|
+
from typing import TYPE_CHECKING, List
|
|
6
|
+
|
|
7
|
+
import structlog
|
|
8
|
+
|
|
9
|
+
from rasa.shared.constants import (
|
|
10
|
+
DOCUMENT_TYPE_FAQ,
|
|
11
|
+
FAQ_DOCUMENT_ENTRY_SEPARATOR,
|
|
12
|
+
FAQ_DOCUMENT_LINE_SEPARATOR,
|
|
13
|
+
FAQ_DOCUMENT_METADATA_ANSWER,
|
|
14
|
+
FAQ_DOCUMENT_METADATA_TITLE,
|
|
15
|
+
FAQ_DOCUMENT_METADATA_TYPE,
|
|
16
|
+
FAQ_INPUT_DATA_ANSWER_LINE_PREFIX,
|
|
17
|
+
FAQ_INPUT_DATA_QUESTION_LINE_PREFIX,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
if TYPE_CHECKING:
|
|
21
|
+
from langchain.schema import Document
|
|
22
|
+
|
|
23
|
+
_FAQ_PAIR_PATTERN = re.compile(
|
|
24
|
+
rf"{re.escape(FAQ_INPUT_DATA_QUESTION_LINE_PREFIX)}\s*"
|
|
25
|
+
rf"(?P<question>.*?)\s*{FAQ_DOCUMENT_LINE_SEPARATOR}\s*"
|
|
26
|
+
rf"{re.escape(FAQ_INPUT_DATA_ANSWER_LINE_PREFIX)}\s*"
|
|
27
|
+
rf"(?P<answer>.*)",
|
|
28
|
+
re.DOTALL,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
structlogger = structlog.get_logger()
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _format_faq_documents(documents: List["Document"]) -> List["Document"]:
|
|
36
|
+
"""Splits each loaded file into individual FAQs.
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
documents: Documents representing whole files containing FAQs.
|
|
40
|
+
|
|
41
|
+
Returns:
|
|
42
|
+
List of Document objects, each containing a separate FAQ.
|
|
43
|
+
|
|
44
|
+
Examples:
|
|
45
|
+
An example of a file containing FAQs:
|
|
46
|
+
|
|
47
|
+
Q: Who is Finley?
|
|
48
|
+
A: Finley is your smart assistant for the FinX App. You can add him to your
|
|
49
|
+
favorite messenger and tell him what you need help with.
|
|
50
|
+
|
|
51
|
+
Q: How does Finley work?
|
|
52
|
+
A: Finley is powered by the latest chatbot technology leveraging a unique
|
|
53
|
+
interplay of large language models and secure logic.
|
|
54
|
+
|
|
55
|
+
More details in documentation: https://rasa.com/docs/reference/config/policies/extractive-search/
|
|
56
|
+
"""
|
|
57
|
+
structured_faqs = []
|
|
58
|
+
from langchain.schema import Document
|
|
59
|
+
|
|
60
|
+
for document in documents:
|
|
61
|
+
chunks = document.page_content.strip().split(FAQ_DOCUMENT_ENTRY_SEPARATOR)
|
|
62
|
+
|
|
63
|
+
for chunk in chunks:
|
|
64
|
+
match = _FAQ_PAIR_PATTERN.match(chunk.strip())
|
|
65
|
+
|
|
66
|
+
if not match:
|
|
67
|
+
structlogger.warning(
|
|
68
|
+
"faq_parser.format_faq_documents.invalid_chunk_skipped",
|
|
69
|
+
event_info=(
|
|
70
|
+
"Chunk does not match expected QA format. "
|
|
71
|
+
"Please refer to the documentation: "
|
|
72
|
+
"https://rasa.com/docs/reference/config/"
|
|
73
|
+
"policies/extractive-search/"
|
|
74
|
+
),
|
|
75
|
+
chunk_preview=chunk[:100],
|
|
76
|
+
)
|
|
77
|
+
continue
|
|
78
|
+
|
|
79
|
+
question = match.group("question").strip()
|
|
80
|
+
answer = match.group("answer").strip()
|
|
81
|
+
title = _sanitize_title(question)
|
|
82
|
+
|
|
83
|
+
formatted_document = Document(
|
|
84
|
+
page_content=question,
|
|
85
|
+
metadata={
|
|
86
|
+
FAQ_DOCUMENT_METADATA_TITLE: title,
|
|
87
|
+
FAQ_DOCUMENT_METADATA_TYPE: DOCUMENT_TYPE_FAQ,
|
|
88
|
+
FAQ_DOCUMENT_METADATA_ANSWER: answer,
|
|
89
|
+
},
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
structured_faqs.append(formatted_document)
|
|
93
|
+
|
|
94
|
+
structlogger.debug(
|
|
95
|
+
"faq_parser.format_faq_documents.parsed_chunk",
|
|
96
|
+
event_info="Parsed chunk.",
|
|
97
|
+
title=title,
|
|
98
|
+
question=question,
|
|
99
|
+
answer=answer,
|
|
100
|
+
parsed_chunk_preview=chunk[:100],
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
structlogger.debug(
|
|
104
|
+
"faq_parser.format_faq_documents.parsed_chunks",
|
|
105
|
+
event_info=(
|
|
106
|
+
f"Retrieved {len(structured_faqs)} FAQ pair(s)"
|
|
107
|
+
f"from {len(documents)} document(s)."
|
|
108
|
+
),
|
|
109
|
+
num_structured_faqs=len(structured_faqs),
|
|
110
|
+
num_documents=len(documents),
|
|
111
|
+
)
|
|
112
|
+
_check_and_parsed_faq_documents_for_duplicates(structured_faqs)
|
|
113
|
+
return structured_faqs
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def _sanitize_title(title: str) -> str:
|
|
117
|
+
title = title.lower()
|
|
118
|
+
# Remove all whitespaces with "_"
|
|
119
|
+
title = re.sub(r"\s+", "_", title)
|
|
120
|
+
# Remove all non alpha-numeric characters
|
|
121
|
+
title = re.sub(r"[^\w]", "", title)
|
|
122
|
+
# Collapse multiple "_"
|
|
123
|
+
title = re.sub(r"_+", "_", title)
|
|
124
|
+
# Clean up edges
|
|
125
|
+
return title.strip("_")
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def _check_and_parsed_faq_documents_for_duplicates(documents: List["Document"]) -> None:
|
|
129
|
+
seen_qa_pairs = set()
|
|
130
|
+
seen_questions: defaultdict = defaultdict(list)
|
|
131
|
+
|
|
132
|
+
for doc in documents:
|
|
133
|
+
question = doc.page_content.strip()
|
|
134
|
+
answer = doc.metadata.get(FAQ_DOCUMENT_METADATA_ANSWER, "").strip()
|
|
135
|
+
|
|
136
|
+
if not question or not answer:
|
|
137
|
+
continue
|
|
138
|
+
|
|
139
|
+
if (question, answer) in seen_qa_pairs:
|
|
140
|
+
structlogger.warning(
|
|
141
|
+
"faq_parser.duplicate_qa_pair_found",
|
|
142
|
+
event_info="Duplicate QA pair found.",
|
|
143
|
+
question=question,
|
|
144
|
+
answer_preview=answer,
|
|
145
|
+
)
|
|
146
|
+
continue
|
|
147
|
+
|
|
148
|
+
if question in seen_questions and seen_questions[question] != answer:
|
|
149
|
+
structlogger.warning(
|
|
150
|
+
"faq_parser.inconsistent_answer",
|
|
151
|
+
event_info="Duplicate question with different answer found.",
|
|
152
|
+
question=question,
|
|
153
|
+
previous_answers=seen_questions[question],
|
|
154
|
+
new_answer=answer,
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
seen_qa_pairs.add((question, answer))
|
|
158
|
+
seen_questions[question].append(answer)
|
rasa/core/jobs.py
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import asyncio
|
|
2
2
|
import logging
|
|
3
|
+
from typing import Optional
|
|
3
4
|
|
|
4
5
|
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
|
5
6
|
from pytz import UnknownTimeZoneError, utc
|
|
6
7
|
|
|
7
8
|
import rasa.shared.utils.io
|
|
8
9
|
|
|
9
|
-
__scheduler = None
|
|
10
|
+
__scheduler: Optional[AsyncIOScheduler] = None
|
|
10
11
|
|
|
11
12
|
logger = logging.getLogger(__name__)
|
|
12
13
|
|