rasa-pro 3.13.1a18__py3-none-any.whl → 3.13.1a20__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 +8 -0
- rasa/builder/auth.py +71 -0
- rasa/builder/config.py +16 -0
- rasa/builder/copilot/constants.py +15 -0
- rasa/builder/copilot/copilot.py +342 -0
- rasa/builder/copilot/copilot_response_handler.py +471 -0
- rasa/builder/copilot/exceptions.py +20 -0
- rasa/builder/copilot/models.py +344 -0
- rasa/builder/copilot/prompts/copilot_system_prompt.jinja2 +495 -0
- rasa/builder/copilot/telemetry.py +195 -0
- rasa/builder/document_retrieval/__init__.py +0 -0
- rasa/builder/document_retrieval/constants.py +16 -0
- rasa/builder/{inkeep_document_retrieval.py → document_retrieval/inkeep_document_retrieval.py} +53 -44
- rasa/builder/document_retrieval/models.py +62 -0
- rasa/builder/download.py +140 -0
- rasa/builder/guardrails/__init__.py +1 -0
- rasa/builder/guardrails/constants.py +4 -0
- rasa/builder/guardrails/exceptions.py +4 -0
- rasa/builder/guardrails/lakera.py +188 -0
- rasa/builder/guardrails/models.py +199 -0
- rasa/builder/guardrails/utils.py +305 -0
- rasa/builder/job_manager.py +87 -0
- rasa/builder/jobs.py +232 -0
- rasa/builder/llm_service.py +89 -173
- rasa/builder/logging_utils.py +162 -4
- rasa/builder/main.py +29 -16
- rasa/builder/models.py +93 -121
- rasa/builder/project_generator.py +91 -7
- rasa/builder/scrape_rasa_docs.py +1 -1
- rasa/builder/service.py +650 -452
- rasa/builder/shared/tracker_context.py +212 -0
- rasa/builder/validation_service.py +4 -4
- rasa/cli/data.py +8 -3
- rasa/cli/project_templates/basic/actions/action_api.py +15 -0
- rasa/cli/project_templates/basic/actions/action_human_handoff.py +44 -0
- rasa/cli/project_templates/basic/config.yml +23 -0
- rasa/cli/project_templates/{plain → basic}/credentials.yml +8 -7
- rasa/cli/project_templates/basic/data/general/feedback.yml +20 -0
- rasa/cli/project_templates/basic/data/general/goodbye.yml +6 -0
- rasa/cli/project_templates/basic/data/general/hello.yml +7 -0
- rasa/cli/project_templates/basic/data/general/help.yml +6 -0
- rasa/cli/project_templates/basic/data/general/human_handoff.yml +16 -0
- rasa/cli/project_templates/basic/data/general/welcome.yml +9 -0
- rasa/cli/project_templates/{finance/data/patterns → basic/data/system}/pattern_completed.yml +2 -1
- rasa/cli/project_templates/basic/data/system/pattern_correction.yml +7 -0
- rasa/cli/project_templates/basic/data/system/pattern_search.yml +8 -0
- rasa/cli/project_templates/basic/data/system/pattern_session_start.yml +8 -0
- rasa/cli/project_templates/basic/docs/rasa_assistant_qa.txt +65 -0
- rasa/cli/project_templates/basic/docs/template.txt +7 -0
- rasa/cli/project_templates/basic/domain/general/assistant_details.yml +12 -0
- rasa/cli/project_templates/basic/domain/general/bot_identity.yml +5 -0
- rasa/cli/project_templates/basic/domain/general/cannot_handle.yml +5 -0
- rasa/cli/project_templates/basic/domain/general/feedback.yml +28 -0
- rasa/cli/project_templates/basic/domain/general/goodbye.yml +7 -0
- rasa/cli/project_templates/basic/domain/general/help.yml +5 -0
- rasa/cli/project_templates/basic/domain/general/human_handoff_domain.yml +35 -0
- rasa/cli/project_templates/{finance/domain/default_actions.yml → basic/domain/general/utils.yml} +0 -3
- rasa/cli/project_templates/basic/domain/general/welcome.yml +7 -0
- rasa/cli/project_templates/{plain → basic}/endpoints.yml +42 -27
- rasa/cli/project_templates/basic/prompts/rephraser_demo_personality_prompt.jinja2 +19 -0
- rasa/cli/project_templates/defaults.py +25 -3
- rasa/cli/project_templates/finance/actions/__init__.py +46 -0
- rasa/cli/project_templates/finance/actions/accounts/__init__.py +0 -0
- rasa/cli/project_templates/finance/actions/{action_ask_account.py → accounts/action_ask_account.py} +6 -9
- rasa/cli/project_templates/finance/actions/{action_check_balance.py → accounts/action_check_balance.py} +4 -4
- rasa/cli/project_templates/finance/actions/action_session_start.py +11 -6
- rasa/cli/project_templates/finance/actions/cards/__init__.py +0 -0
- rasa/cli/project_templates/finance/actions/{action_ask_card.py → cards/action_ask_card.py} +4 -3
- rasa/cli/project_templates/finance/actions/{action_check_card_existence.py → cards/action_check_card_existence.py} +4 -3
- rasa/cli/project_templates/finance/actions/{action_update_card_status.py → cards/action_update_card_status.py} +18 -9
- rasa/cli/project_templates/finance/actions/database.py +1 -0
- rasa/cli/project_templates/finance/actions/transfers/__init__.py +0 -0
- rasa/cli/project_templates/finance/actions/{action_add_payee.py → transfers/action_add_payee.py} +8 -3
- rasa/cli/project_templates/finance/actions/{action_ask_account_from.py → transfers/action_ask_account_from.py} +5 -4
- rasa/cli/project_templates/finance/actions/{action_check_payee_existence.py → transfers/action_check_payee_existence.py} +3 -3
- rasa/cli/project_templates/finance/actions/{action_check_sufficient_funds.py → transfers/action_check_sufficient_funds.py} +3 -4
- rasa/cli/project_templates/finance/actions/{action_list_payees.py → transfers/action_list_payees.py} +4 -3
- rasa/cli/project_templates/finance/actions/{action_remove_payee.py → transfers/action_remove_payee.py} +4 -4
- rasa/cli/project_templates/finance/config.yml +8 -19
- rasa/cli/project_templates/finance/credentials.yml +6 -7
- rasa/cli/project_templates/finance/csvs/cards.csv +10 -10
- rasa/cli/project_templates/finance/csvs/payees.csv +10 -9
- rasa/cli/project_templates/finance/data/{flows → accounts}/check_balance.yml +2 -1
- rasa/cli/project_templates/finance/data/general/bot_identity.yml +6 -0
- rasa/cli/project_templates/finance/data/general/feedback.yml +20 -0
- rasa/cli/project_templates/finance/data/general/goodbye.yml +6 -0
- rasa/cli/project_templates/finance/data/general/hello.yml +7 -0
- rasa/cli/project_templates/finance/data/{flows/welcome.yml → general/help.yml} +2 -7
- rasa/cli/project_templates/finance/data/general/human_handoff.yml +16 -0
- rasa/cli/project_templates/finance/data/general/welcome.yml +9 -0
- rasa/cli/project_templates/finance/data/{patterns → system/patterns}/pattern_chitchat.yml +0 -2
- rasa/cli/project_templates/finance/data/system/patterns/pattern_completed.yml +7 -0
- rasa/cli/project_templates/finance/data/system/patterns/pattern_correction.yml +7 -0
- rasa/cli/project_templates/finance/data/system/patterns/pattern_search.yml +8 -0
- rasa/cli/project_templates/finance/data/{patterns → system/patterns}/pattern_session_start.yml +0 -1
- rasa/cli/project_templates/finance/domain/{check_balance.yml → accounts/check_balance.yml} +2 -0
- rasa/cli/project_templates/finance/domain/general/assistant_details.yml +12 -0
- rasa/cli/project_templates/finance/domain/general/bot_identity.yml +5 -0
- rasa/cli/project_templates/finance/domain/general/cannot_handle.yml +5 -0
- rasa/cli/project_templates/finance/domain/general/defaults.yml +24 -0
- rasa/cli/project_templates/finance/domain/general/feedback.yml +28 -0
- rasa/cli/project_templates/finance/domain/general/goodbye.yml +7 -0
- rasa/cli/project_templates/finance/domain/general/help.yml +5 -0
- rasa/cli/project_templates/finance/domain/general/human_handoff.yml +30 -0
- rasa/cli/project_templates/finance/domain/general/utils.yml +13 -0
- rasa/cli/project_templates/finance/domain/general/welcome.yml +8 -0
- rasa/cli/project_templates/finance/endpoints.yml +1 -0
- rasa/cli/project_templates/finance/prompts/rephraser_demo_personality_prompt.jinja2 +3 -3
- rasa/cli/project_templates/telco/actions/actions_billing.py +24 -17
- rasa/cli/project_templates/telco/actions/actions_get_data_from_db.py +6 -1
- rasa/cli/project_templates/telco/actions/actions_run_diagnostics.py +6 -1
- rasa/cli/project_templates/telco/actions/actions_session_start.py +6 -1
- rasa/cli/project_templates/tutorial/config.yml +2 -1
- rasa/cli/scaffold.py +27 -2
- rasa/cli/train.py +8 -0
- rasa/cli/utils.py +31 -15
- rasa/core/actions/action.py +28 -41
- rasa/core/actions/action_run_slot_rejections.py +1 -1
- rasa/core/channels/development_inspector.py +47 -14
- rasa/core/channels/inspector/dist/assets/{arc-371401b1.js → arc-1ddec37b.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{blockDiagram-38ab4fdb-3f126156.js → blockDiagram-38ab4fdb-18af387c.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{c4Diagram-3d4e48cf-12f22eb7.js → c4Diagram-3d4e48cf-250127a3.js} +1 -1
- rasa/core/channels/inspector/dist/assets/channel-59f6d54b.js +1 -0
- rasa/core/channels/inspector/dist/assets/{classDiagram-70f12bd4-03b1d386.js → classDiagram-70f12bd4-c3388b34.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{classDiagram-v2-f2320105-84f69d63.js → classDiagram-v2-f2320105-9c893a82.js} +1 -1
- rasa/core/channels/inspector/dist/assets/clone-26177ddb.js +1 -0
- rasa/core/channels/inspector/dist/assets/{createText-2e5e7dd3-ca47fd38.js → createText-2e5e7dd3-c111213b.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{edges-e0da2a9e-f837ca8a.js → edges-e0da2a9e-812a729d.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{erDiagram-9861fffd-8717ac54.js → erDiagram-9861fffd-fd5051bc.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDb-956e92f1-94f38b83.js → flowDb-956e92f1-3287ac02.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDiagram-66a62f08-b616f9fb.js → flowDiagram-66a62f08-692fb0b2.js} +1 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-29c03f5a.js +1 -0
- rasa/core/channels/inspector/dist/assets/{flowchart-elk-definition-4a651766-f5d24bb8.js → flowchart-elk-definition-4a651766-008376f1.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{ganttDiagram-c361ad54-b43ba8d9.js → ganttDiagram-c361ad54-df330a69.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-72cf32ee-c3aafaa5.js → gitGraphDiagram-72cf32ee-e03676fb.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{graph-0d0a2c10.js → graph-46fad2ba.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-3862675e-58ea0305.js → index-3862675e-a484ac55.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-cce6f8a1.js → index-a003633f.js} +179 -179
- rasa/core/channels/inspector/dist/assets/{infoDiagram-f8f76790-b8f60461.js → infoDiagram-f8f76790-3f9e6ec2.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{journeyDiagram-49397b02-95be5545.js → journeyDiagram-49397b02-79f72383.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{layout-da885b9b.js → layout-aad098e5.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{line-f1c817d3.js → line-219ab7ae.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{linear-d42801e6.js → linear-2cddbe62.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{mindmap-definition-fc14e90a-a38923a6.js → mindmap-definition-fc14e90a-1d41ed99.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{pieDiagram-8a3498a8-ca6e71e9.js → pieDiagram-8a3498a8-cc496ee8.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{quadrantDiagram-120e2f19-b290dae9.js → quadrantDiagram-120e2f19-84d32884.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{requirementDiagram-deff3bca-03f02ceb.js → requirementDiagram-deff3bca-c0deb984.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sankeyDiagram-04a897e0-c49eee40.js → sankeyDiagram-04a897e0-b9d7fd62.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sequenceDiagram-704730f1-b2cd6a3d.js → sequenceDiagram-704730f1-7d517565.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-587899a1-e53a2028.js → stateDiagram-587899a1-98ef9b27.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-v2-d93cdb3a-e1982a03.js → stateDiagram-v2-d93cdb3a-cee70748.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-6aaf32cf-d0226ca5.js → styles-6aaf32cf-3f9d1c96.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-9a916d00-0e21dc00.js → styles-9a916d00-67471923.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-c10674c1-9588494e.js → styles-c10674c1-bd093fb7.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{svgDrawCommon-08f97a94-be478d4f.js → svgDrawCommon-08f97a94-675794e8.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{timeline-definition-85554ec2-74631749.js → timeline-definition-85554ec2-0ac67617.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{xychartDiagram-e933f94c-a043552f.js → xychartDiagram-e933f94c-c018dc37.js} +1 -1
- rasa/core/channels/inspector/dist/index.html +2 -2
- rasa/core/channels/inspector/index.html +1 -1
- rasa/core/channels/inspector/package.json +4 -3
- rasa/core/channels/inspector/src/App.tsx +53 -7
- rasa/core/channels/inspector/src/components/Chat.tsx +3 -2
- rasa/core/channels/inspector/src/components/DiagramFlow.tsx +1 -1
- rasa/core/channels/inspector/src/components/LatencyDisplay.tsx +268 -0
- rasa/core/channels/inspector/src/components/LoadingSpinner.tsx +6 -2
- rasa/core/channels/inspector/src/helpers/audio/audiostream.ts +8 -3
- rasa/core/channels/inspector/src/types.ts +8 -0
- rasa/core/channels/inspector/yarn.lock +12 -12
- rasa/core/channels/studio_chat.py +119 -34
- rasa/core/channels/voice_ready/twilio_voice.py +1 -1
- rasa/core/channels/voice_stream/asr/asr_engine.py +5 -1
- rasa/core/channels/voice_stream/asr/deepgram.py +5 -0
- rasa/core/channels/voice_stream/audiocodes.py +16 -8
- rasa/core/channels/voice_stream/browser_audio.py +39 -4
- rasa/core/channels/voice_stream/call_state.py +13 -2
- rasa/core/channels/voice_stream/genesys.py +16 -13
- rasa/core/channels/voice_stream/jambonz.py +14 -12
- rasa/core/channels/voice_stream/twilio_media_streams.py +14 -13
- rasa/core/channels/voice_stream/util.py +11 -1
- rasa/core/channels/voice_stream/voice_channel.py +108 -29
- rasa/core/nlg/callback.py +1 -1
- rasa/core/nlg/contextual_response_rephraser.py +19 -9
- rasa/core/nlg/generator.py +21 -5
- rasa/core/nlg/response.py +43 -6
- rasa/core/nlg/translate.py +8 -0
- rasa/core/policies/enterprise_search_policy.py +16 -21
- rasa/dialogue_understanding/commands/correct_slots_command.py +38 -10
- rasa/dialogue_understanding/generator/command_generator.py +5 -5
- rasa/dialogue_understanding/generator/command_parser.py +9 -13
- rasa/dialogue_understanding/processor/command_processor.py +149 -55
- rasa/dialogue_understanding/stack/utils.py +13 -3
- rasa/dialogue_understanding_test/du_test_schema.yml +3 -3
- rasa/dialogue_understanding_test/validation.py +9 -10
- rasa/e2e_test/e2e_config.py +18 -11
- rasa/e2e_test/e2e_test_schema.yml +3 -3
- rasa/e2e_test/utils/validation.py +17 -19
- rasa/engine/validation.py +86 -91
- rasa/exceptions.py +26 -1
- rasa/model_manager/model_api.py +2 -2
- rasa/model_manager/socket_bridge.py +8 -2
- rasa/shared/providers/_configs/default_litellm_client_config.py +3 -7
- rasa/shared/utils/cli.py +2 -0
- rasa/shared/utils/common.py +2 -1
- rasa/shared/utils/health_check/health_check.py +10 -14
- rasa/studio/upload.py +6 -2
- rasa/studio/utils.py +33 -22
- rasa/telemetry.py +95 -22
- rasa/utils/licensing.py +21 -10
- rasa/utils/log_utils.py +1 -1
- rasa/utils/tensorflow/transformer.py +3 -3
- rasa/validator.py +7 -5
- rasa/version.py +1 -1
- {rasa_pro-3.13.1a18.dist-info → rasa_pro-3.13.1a20.dist-info}/METADATA +7 -7
- {rasa_pro-3.13.1a18.dist-info → rasa_pro-3.13.1a20.dist-info}/RECORD +242 -203
- rasa/builder/create_openai_vector_store.py +0 -228
- rasa/builder/llm-helper-schema.json +0 -69
- rasa/builder/llm_context.py +0 -81
- rasa/builder/llm_helper_prompt.jinja2 +0 -245
- rasa/cli/project_templates/finance/data/nlu.yml +0 -29
- rasa/cli/project_templates/finance/data/patterns/pattern_search.yml +0 -5
- rasa/cli/project_templates/finance/domain/default_flows.yml +0 -33
- rasa/cli/project_templates/finance/prompts/command-generator.jinja2 +0 -57
- rasa/cli/project_templates/finance/tests/conversation_repair/cancellations.yml +0 -12
- rasa/cli/project_templates/finance/tests/conversation_repair/cannot_handle.yml +0 -7
- rasa/cli/project_templates/finance/tests/conversation_repair/chitchat.yml +0 -7
- rasa/cli/project_templates/finance/tests/conversation_repair/clarification.yml +0 -9
- rasa/cli/project_templates/finance/tests/conversation_repair/completion.yml +0 -18
- rasa/cli/project_templates/finance/tests/conversation_repair/corrections.yml +0 -17
- rasa/cli/project_templates/finance/tests/conversation_repair/digressions.yml +0 -32
- rasa/cli/project_templates/finance/tests/conversation_repair/human_handoff.yml +0 -21
- rasa/cli/project_templates/finance/tests/conversation_repair/skipping_collect_steps.yml +0 -16
- rasa/cli/project_templates/finance/tests/demo_scripts/main.yml +0 -16
- rasa/cli/project_templates/finance/tests/happy_paths/balance_verification.yml +0 -15
- rasa/cli/project_templates/finance/tests/happy_paths/banking_questions.yml +0 -12
- rasa/cli/project_templates/finance/tests/happy_paths/card_blocking.yml +0 -52
- rasa/cli/project_templates/finance/tests/happy_paths/money_transfer.yml +0 -136
- rasa/cli/project_templates/finance/tests/happy_paths/payee_management.yml +0 -27
- rasa/cli/project_templates/finance/tests/happy_paths/user_greeted.yml +0 -5
- rasa/cli/project_templates/plain/config.yml +0 -17
- rasa/cli/project_templates/plain/data/patterns/pattern_session_start.yml +0 -7
- rasa/cli/project_templates/plain/domain.yml +0 -5
- rasa/core/channels/inspector/dist/assets/channel-f1efda17.js +0 -1
- rasa/core/channels/inspector/dist/assets/clone-fdf164e2.js +0 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-7d7a1629.js +0 -1
- rasa/shared/importers/static.py +0 -63
- /rasa/{cli/project_templates/plain/actions → builder/copilot}/__init__.py +0 -0
- /rasa/builder/{inkeep-rag-response-schema.json → document_retrieval/inkeep-rag-response-schema.json} +0 -0
- /rasa/cli/project_templates/finance/actions/{action_process_immediate_payment.py → transfers/action_process_immediate_payment.py} +0 -0
- /rasa/cli/project_templates/finance/actions/{action_schedule_payment.py → transfers/action_schedule_payment.py} +0 -0
- /rasa/cli/project_templates/finance/actions/{action_validate_payment_date.py → transfers/action_validate_payment_date.py} +0 -0
- /rasa/cli/project_templates/finance/data/{flows → cards}/block_card.yml +0 -0
- /rasa/cli/project_templates/finance/data/{flows → cards}/select_card.yml +0 -0
- /rasa/cli/project_templates/finance/data/{source → system/source}/accounts.json +0 -0
- /rasa/cli/project_templates/finance/data/{source → system/source}/advisors.json +0 -0
- /rasa/cli/project_templates/finance/data/{source → system/source}/appointments.json +0 -0
- /rasa/cli/project_templates/finance/data/{source → system/source}/branches.json +0 -0
- /rasa/cli/project_templates/finance/data/{source → system/source}/cards.json +0 -0
- /rasa/cli/project_templates/finance/data/{source → system/source}/payees.json +0 -0
- /rasa/cli/project_templates/finance/data/{source → system/source}/transactions.json +0 -0
- /rasa/cli/project_templates/finance/data/{source → system/source}/users.json +0 -0
- /rasa/cli/project_templates/finance/data/{flows → transfers}/add_payee.yml +0 -0
- /rasa/cli/project_templates/finance/data/{flows → transfers}/list_payees.yml +0 -0
- /rasa/cli/project_templates/finance/data/{flows → transfers}/remove_payee.yml +0 -0
- /rasa/cli/project_templates/finance/data/{flows → transfers}/transfer_money.yml +0 -0
- /rasa/cli/project_templates/finance/domain/{block_card.yml → cards/block_card.yml} +0 -0
- /rasa/cli/project_templates/finance/domain/{select_card.yml → cards/select_card.yml} +0 -0
- /rasa/cli/project_templates/finance/domain/{add_payee.yml → transfers/add_payee.yml} +0 -0
- /rasa/cli/project_templates/finance/domain/{list_payees.yml → transfers/list_payees.yml} +0 -0
- /rasa/cli/project_templates/finance/domain/{remove_payee.yml → transfers/remove_payee.yml} +0 -0
- /rasa/cli/project_templates/finance/domain/{transfer_money.yml → transfers/transfer_money.yml} +0 -0
- {rasa_pro-3.13.1a18.dist-info → rasa_pro-3.13.1a20.dist-info}/NOTICE +0 -0
- {rasa_pro-3.13.1a18.dist-info → rasa_pro-3.13.1a20.dist-info}/WHEEL +0 -0
- {rasa_pro-3.13.1a18.dist-info → rasa_pro-3.13.1a20.dist-info}/entry_points.txt +0 -0
rasa/exceptions.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
|
-
from typing import Text
|
|
2
|
+
from typing import Any, Dict, Text
|
|
3
3
|
|
|
4
4
|
from packaging import version
|
|
5
5
|
|
|
@@ -51,6 +51,31 @@ class MissingDependencyException(RasaException):
|
|
|
51
51
|
"""Raised if a python package dependency is needed, but not installed."""
|
|
52
52
|
|
|
53
53
|
|
|
54
|
+
class DetailedRasaException(RasaException):
|
|
55
|
+
"""Base class for exceptions that carry an error code and extra context."""
|
|
56
|
+
|
|
57
|
+
def __init__(self, *, code: str, event_info: str, **ctx: Any) -> None:
|
|
58
|
+
super().__init__(event_info)
|
|
59
|
+
self.code: str = code
|
|
60
|
+
self.info: str = event_info
|
|
61
|
+
self.ctx: Dict[str, Any] = ctx
|
|
62
|
+
|
|
63
|
+
def __str__(self) -> str:
|
|
64
|
+
return self.info
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class HealthCheckError(DetailedRasaException):
|
|
68
|
+
"""Raised when an error occurs during health checks."""
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
class EnterpriseSearchPolicyError(DetailedRasaException):
|
|
72
|
+
"""Raised when an error occurs in EnterpriseSearchPolicy."""
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class ValidationError(DetailedRasaException):
|
|
76
|
+
"""Raised when an error occurs during validation."""
|
|
77
|
+
|
|
78
|
+
|
|
54
79
|
@dataclass
|
|
55
80
|
class PublishingError(RasaException):
|
|
56
81
|
"""Raised when publishing of an event fails.
|
rasa/model_manager/model_api.py
CHANGED
|
@@ -104,7 +104,7 @@ async def update_status_of_all_bots() -> None:
|
|
|
104
104
|
await update_bot_status(bot)
|
|
105
105
|
|
|
106
106
|
|
|
107
|
-
def base_server_url(request:
|
|
107
|
+
def base_server_url(request: Request) -> str:
|
|
108
108
|
"""Return the base URL of the server."""
|
|
109
109
|
if SERVER_BASE_URL:
|
|
110
110
|
return SERVER_BASE_URL.rstrip("/")
|
|
@@ -570,7 +570,7 @@ def external_blueprint() -> Blueprint:
|
|
|
570
570
|
"""Create a blueprint for the model manager API."""
|
|
571
571
|
from rasa.core.channels.socketio import SocketBlueprint
|
|
572
572
|
|
|
573
|
-
sio = AsyncServer(async_mode="sanic", cors_allowed_origins=
|
|
573
|
+
sio = AsyncServer(async_mode="sanic", cors_allowed_origins="*")
|
|
574
574
|
bp = SocketBlueprint(sio, "", "model_api_external")
|
|
575
575
|
|
|
576
576
|
create_bridge_server(sio, running_bots)
|
|
@@ -2,8 +2,7 @@ import json
|
|
|
2
2
|
from typing import Any, Dict, Optional
|
|
3
3
|
|
|
4
4
|
import structlog
|
|
5
|
-
from socketio import AsyncServer
|
|
6
|
-
from socketio.asyncio_client import AsyncClient
|
|
5
|
+
from socketio import AsyncClient, AsyncServer # type: ignore[attr-defined]
|
|
7
6
|
from socketio.exceptions import ConnectionRefusedError
|
|
8
7
|
|
|
9
8
|
from rasa.model_manager.runner_service import BotSession
|
|
@@ -131,6 +130,13 @@ async def create_bridge_client(
|
|
|
131
130
|
structlogger.debug("model_runner.bot_message", deployment_id=deployment_id)
|
|
132
131
|
await sio.emit("bot_message", data, room=sid)
|
|
133
132
|
|
|
133
|
+
@client.event # type: ignore[misc]
|
|
134
|
+
async def error(data: Dict[str, Any]) -> None:
|
|
135
|
+
structlogger.debug(
|
|
136
|
+
"model_runner.bot_error", deployment_id=deployment_id, data=data
|
|
137
|
+
)
|
|
138
|
+
await sio.emit("error", data, room=sid)
|
|
139
|
+
|
|
134
140
|
@client.event # type: ignore[misc]
|
|
135
141
|
async def tracker(data: Dict[str, Any]) -> None:
|
|
136
142
|
await sio.emit("tracker", json.loads(data), room=sid)
|
|
@@ -5,7 +5,7 @@ from typing import Any, Dict
|
|
|
5
5
|
|
|
6
6
|
import structlog
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
from rasa.exceptions import ValidationError
|
|
9
9
|
from rasa.shared.constants import (
|
|
10
10
|
MODEL_CONFIG_KEY,
|
|
11
11
|
MODEL_NAME_CONFIG_KEY,
|
|
@@ -124,9 +124,5 @@ class DefaultLiteLLMClientConfig:
|
|
|
124
124
|
f"Unsupported parameter - {MODEL_NAME_CONFIG_KEY} is set. Please use "
|
|
125
125
|
f"{MODEL_CONFIG_KEY} instead."
|
|
126
126
|
)
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
event_info=event_info,
|
|
130
|
-
config=config,
|
|
131
|
-
)
|
|
132
|
-
rasa.shared.utils.cli.print_error_and_exit(event_info)
|
|
127
|
+
error_code = "default_litellm_client_config.unsupported_parameter_in_config"
|
|
128
|
+
raise ValidationError(code=error_code, event_info=event_info, config=config)
|
rasa/shared/utils/cli.py
CHANGED
|
@@ -65,6 +65,8 @@ def print_error(*args: Any) -> None:
|
|
|
65
65
|
|
|
66
66
|
def print_error_and_exit(message: Text, exit_code: int = 1) -> NoReturn:
|
|
67
67
|
"""Print an error message and exit the application.
|
|
68
|
+
This function is intended only for the CLI module; library code
|
|
69
|
+
should raise an appropriate exception instead
|
|
68
70
|
|
|
69
71
|
Args:
|
|
70
72
|
message: The error message to be printed.
|
rasa/shared/utils/common.py
CHANGED
|
@@ -373,7 +373,8 @@ def validate_environment(
|
|
|
373
373
|
importlib.import_module(p)
|
|
374
374
|
except ImportError:
|
|
375
375
|
raise MissingDependencyException(
|
|
376
|
-
f"Missing
|
|
376
|
+
f"Missing dependency for {component_name}: {p}. "
|
|
377
|
+
f"Please ensure the correct package is installed."
|
|
377
378
|
)
|
|
378
379
|
|
|
379
380
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import os
|
|
2
|
-
import sys
|
|
3
2
|
from typing import Any, Dict, Optional
|
|
4
3
|
|
|
4
|
+
from rasa.exceptions import HealthCheckError
|
|
5
5
|
from rasa.shared.constants import (
|
|
6
6
|
LLM_API_HEALTH_CHECK_DEFAULT_VALUE,
|
|
7
7
|
LLM_API_HEALTH_CHECK_ENV_VAR,
|
|
@@ -23,8 +23,8 @@ def try_instantiate_llm_client(
|
|
|
23
23
|
try:
|
|
24
24
|
return llm_factory(custom_llm_config, default_llm_config)
|
|
25
25
|
except (ProviderClientValidationError, ValueError) as e:
|
|
26
|
-
|
|
27
|
-
f"{log_source_function}.llm_instantiation_failed",
|
|
26
|
+
raise HealthCheckError(
|
|
27
|
+
code=f"{log_source_function}.llm_instantiation_failed",
|
|
28
28
|
event_info=(
|
|
29
29
|
f"Unable to create the LLM client for component - "
|
|
30
30
|
f"{log_source_component}. "
|
|
@@ -33,7 +33,6 @@ def try_instantiate_llm_client(
|
|
|
33
33
|
),
|
|
34
34
|
error=e,
|
|
35
35
|
)
|
|
36
|
-
sys.exit(1)
|
|
37
36
|
|
|
38
37
|
|
|
39
38
|
def try_instantiate_embedder(
|
|
@@ -46,8 +45,8 @@ def try_instantiate_embedder(
|
|
|
46
45
|
try:
|
|
47
46
|
return embedder_factory(custom_embeddings_config, default_embeddings_config)
|
|
48
47
|
except (ProviderClientValidationError, ValueError) as e:
|
|
49
|
-
|
|
50
|
-
f"{log_source_function}.embedder_instantiation_failed",
|
|
48
|
+
raise HealthCheckError(
|
|
49
|
+
code=f"{log_source_function}.embedder_instantiation_failed",
|
|
51
50
|
event_info=(
|
|
52
51
|
f"Unable to create the Embedding client for component - "
|
|
53
52
|
f"{log_source_component}. Please make sure you specified the required "
|
|
@@ -55,7 +54,6 @@ def try_instantiate_embedder(
|
|
|
55
54
|
),
|
|
56
55
|
error=e,
|
|
57
56
|
)
|
|
58
|
-
sys.exit(1)
|
|
59
57
|
|
|
60
58
|
|
|
61
59
|
def perform_llm_health_check(
|
|
@@ -200,16 +198,15 @@ def send_test_llm_api_request(
|
|
|
200
198
|
try:
|
|
201
199
|
llm_client.completion("hello")
|
|
202
200
|
except Exception as e:
|
|
203
|
-
|
|
204
|
-
f"{log_source_function}.send_test_llm_api_request_failed",
|
|
201
|
+
raise HealthCheckError(
|
|
202
|
+
code=f"{log_source_function}.send_test_llm_api_request_failed",
|
|
205
203
|
event_info=(
|
|
206
204
|
f"Test call to the LLM API failed for component - "
|
|
207
|
-
f"{log_source_component}."
|
|
205
|
+
f"{log_source_component}."
|
|
208
206
|
),
|
|
209
207
|
config=llm_client.config,
|
|
210
208
|
error=e,
|
|
211
209
|
)
|
|
212
|
-
sys.exit(1)
|
|
213
210
|
|
|
214
211
|
|
|
215
212
|
def send_test_embeddings_api_request(
|
|
@@ -231,8 +228,8 @@ def send_test_embeddings_api_request(
|
|
|
231
228
|
try:
|
|
232
229
|
embedder.embed(["hello"])
|
|
233
230
|
except Exception as e:
|
|
234
|
-
|
|
235
|
-
f"{log_source_function}.send_test_llm_api_request_failed",
|
|
231
|
+
raise HealthCheckError(
|
|
232
|
+
code=f"{log_source_function}.send_test_llm_api_request_failed",
|
|
236
233
|
event_info=(
|
|
237
234
|
f"Test call to the Embeddings API failed for component - "
|
|
238
235
|
f"{log_source_component}."
|
|
@@ -240,7 +237,6 @@ def send_test_embeddings_api_request(
|
|
|
240
237
|
config=embedder.config,
|
|
241
238
|
error=e,
|
|
242
239
|
)
|
|
243
|
-
sys.exit(1)
|
|
244
240
|
|
|
245
241
|
|
|
246
242
|
def is_api_health_check_enabled() -> bool:
|
rasa/studio/upload.py
CHANGED
|
@@ -108,9 +108,10 @@ def run_validation(args: argparse.Namespace) -> None:
|
|
|
108
108
|
"""
|
|
109
109
|
from rasa.validator import Validator
|
|
110
110
|
|
|
111
|
+
training_data_paths = args.data if isinstance(args.data, list) else [args.data]
|
|
111
112
|
training_data_importer = TrainingDataImporter.load_from_dict(
|
|
112
113
|
domain_path=args.domain,
|
|
113
|
-
training_data_paths=
|
|
114
|
+
training_data_paths=training_data_paths,
|
|
114
115
|
config_path=args.config,
|
|
115
116
|
expand_env_vars=False,
|
|
116
117
|
)
|
|
@@ -238,9 +239,11 @@ def build_calm_import_parts(
|
|
|
238
239
|
Returns:
|
|
239
240
|
The assistant name and the parts to be uploaded
|
|
240
241
|
"""
|
|
242
|
+
training_data_paths = data_path if isinstance(data_path, list) else [str(data_path)]
|
|
241
243
|
importer = TrainingDataImporter.load_from_dict(
|
|
242
244
|
domain_path=domain_path,
|
|
243
245
|
config_path=config_path,
|
|
246
|
+
training_data_paths=training_data_paths,
|
|
244
247
|
expand_env_vars=False,
|
|
245
248
|
)
|
|
246
249
|
|
|
@@ -314,9 +317,10 @@ def upload_nlu_assistant(
|
|
|
314
317
|
"rasa.studio.upload.nlu_data_read",
|
|
315
318
|
event_info="Found DM1 assistant data, parsing...",
|
|
316
319
|
)
|
|
320
|
+
training_data_paths = args.data if isinstance(args.data, list) else [args.data]
|
|
317
321
|
importer = TrainingDataImporter.load_from_dict(
|
|
318
322
|
domain_path=args.domain,
|
|
319
|
-
training_data_paths=
|
|
323
|
+
training_data_paths=training_data_paths,
|
|
320
324
|
config_path=args.config,
|
|
321
325
|
expand_env_vars=False,
|
|
322
326
|
)
|
rasa/studio/utils.py
CHANGED
|
@@ -1,33 +1,44 @@
|
|
|
1
1
|
import argparse
|
|
2
2
|
from pathlib import Path
|
|
3
|
+
from typing import List
|
|
3
4
|
|
|
4
5
|
import rasa.shared.utils.cli
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
from rasa.studio.constants import DOMAIN_FILENAME
|
|
6
|
+
|
|
7
|
+
DOMAIN_FILENAME = "domain.yml"
|
|
8
|
+
DEFAULT_CONFIG_PATH = "config.yml"
|
|
9
|
+
DEFAULT_ENDPOINTS_PATH = "endpoints.yml"
|
|
10
|
+
DEFAULT_DATA_PATH = "data"
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
def validate_argument_paths(args: argparse.Namespace) -> None:
|
|
14
|
-
"""
|
|
14
|
+
"""Validate every path passed via CLI arguments.
|
|
15
15
|
|
|
16
16
|
Args:
|
|
17
|
-
args:
|
|
17
|
+
args: CLI arguments containing paths to validate.
|
|
18
|
+
|
|
19
|
+
Raises:
|
|
20
|
+
rasa.shared.utils.cli.PrintErrorAndExit: If any path does not exist.
|
|
18
21
|
"""
|
|
22
|
+
invalid_paths: List[str] = []
|
|
23
|
+
|
|
24
|
+
def collect_invalid_paths(arg_name: str, default: str) -> None:
|
|
25
|
+
value = getattr(args, arg_name, None)
|
|
26
|
+
path_values = value if isinstance(value, list) else [value]
|
|
27
|
+
for path_value in path_values:
|
|
28
|
+
if not path_value or path_value == default:
|
|
29
|
+
continue
|
|
30
|
+
|
|
31
|
+
if not Path(path_value).resolve().exists():
|
|
32
|
+
invalid_paths.append(f"{arg_name}: '{path_value}'")
|
|
33
|
+
|
|
34
|
+
collect_invalid_paths("domain", DOMAIN_FILENAME)
|
|
35
|
+
collect_invalid_paths("config", DEFAULT_CONFIG_PATH)
|
|
36
|
+
collect_invalid_paths("endpoints", DEFAULT_ENDPOINTS_PATH)
|
|
37
|
+
collect_invalid_paths("data", DEFAULT_DATA_PATH)
|
|
19
38
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
f"{arg_name.capitalize()} file or directory "
|
|
27
|
-
f"'{path_value}' does not exist."
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
validate_path("domain", DOMAIN_FILENAME)
|
|
31
|
-
validate_path("config", DEFAULT_CONFIG_PATH)
|
|
32
|
-
validate_path("endpoints", DEFAULT_ENDPOINTS_PATH)
|
|
33
|
-
validate_path("data", DEFAULT_DATA_PATH)
|
|
39
|
+
if invalid_paths:
|
|
40
|
+
message = (
|
|
41
|
+
"The following files or directories do not exist:\n - "
|
|
42
|
+
+ "\n - ".join(invalid_paths)
|
|
43
|
+
)
|
|
44
|
+
rasa.shared.utils.cli.print_error_and_exit(message)
|
rasa/telemetry.py
CHANGED
|
@@ -3,7 +3,6 @@ import contextlib
|
|
|
3
3
|
import hashlib
|
|
4
4
|
import inspect
|
|
5
5
|
import json
|
|
6
|
-
import logging
|
|
7
6
|
import multiprocessing
|
|
8
7
|
import os
|
|
9
8
|
import platform
|
|
@@ -70,7 +69,7 @@ if typing.TYPE_CHECKING:
|
|
|
70
69
|
from rasa.shared.importers.importer import TrainingDataImporter
|
|
71
70
|
from rasa.shared.nlu.training_data.training_data import TrainingData
|
|
72
71
|
|
|
73
|
-
|
|
72
|
+
structlogger = structlog.get_logger()
|
|
74
73
|
|
|
75
74
|
SEGMENT_TRACK_ENDPOINT = "https://api.segment.io/v1/track"
|
|
76
75
|
SEGMENT_IDENTIFY_ENDPOINT = "https://api.segment.io/v1/identify"
|
|
@@ -197,6 +196,10 @@ TELEMETRY_E2E_TEST_CONVERSION_EVENT = "E2E Test Conversion Completed"
|
|
|
197
196
|
E2E_TEST_CONVERSION_FILE_TYPE = "file_type"
|
|
198
197
|
E2E_TEST_CONVERSION_TEST_CASE_COUNT = "test_case_count"
|
|
199
198
|
|
|
199
|
+
# Copilot telemetry
|
|
200
|
+
TELEMETRY_COPILOT_USER_MESSAGE_EVENT = "copilot_user_message"
|
|
201
|
+
TELEMETRY_COPILOT_BOT_MESSAGE_EVENT = "copilot_bot_message"
|
|
202
|
+
|
|
200
203
|
|
|
201
204
|
def print_telemetry_reporting_info() -> None:
|
|
202
205
|
"""Print telemetry information to std out."""
|
|
@@ -255,7 +258,11 @@ def _is_telemetry_enabled_in_configuration() -> bool:
|
|
|
255
258
|
|
|
256
259
|
return stored_config[CONFIG_TELEMETRY_ENABLED]
|
|
257
260
|
except ValueError as e:
|
|
258
|
-
|
|
261
|
+
structlogger.debug(
|
|
262
|
+
"telemetry.is_telemetry_enabled_in_configuration.error",
|
|
263
|
+
error=str(e),
|
|
264
|
+
event_info="Could not read telemetry settings from configuration file",
|
|
265
|
+
)
|
|
259
266
|
|
|
260
267
|
# seems like there is no config, we'll create one and enable telemetry
|
|
261
268
|
success = _write_default_telemetry_configuration()
|
|
@@ -272,7 +279,10 @@ def is_telemetry_enabled() -> bool:
|
|
|
272
279
|
from rasa.utils import licensing
|
|
273
280
|
|
|
274
281
|
if licensing.is_champion_server_license():
|
|
275
|
-
|
|
282
|
+
structlogger.debug(
|
|
283
|
+
"telemetry.enabled.developer_license",
|
|
284
|
+
event_info="Telemetry is enabled for developer licenses.",
|
|
285
|
+
)
|
|
276
286
|
return True
|
|
277
287
|
|
|
278
288
|
telemetry_environ = os.environ.get(TELEMETRY_ENABLED_ENVIRONMENT_VARIABLE)
|
|
@@ -308,9 +318,13 @@ def initialize_telemetry() -> bool:
|
|
|
308
318
|
|
|
309
319
|
return telemetry_environ.lower() == "true"
|
|
310
320
|
except Exception as e: # skipcq:PYL-W0703
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
321
|
+
structlogger.exception(
|
|
322
|
+
"telemetry.initialize_telemetry.error",
|
|
323
|
+
error=str(e),
|
|
324
|
+
event_info=(
|
|
325
|
+
"Failed to initialize telemetry reporting. "
|
|
326
|
+
"Telemetry reporting will be disabled."
|
|
327
|
+
),
|
|
314
328
|
)
|
|
315
329
|
return False
|
|
316
330
|
|
|
@@ -481,7 +495,10 @@ def print_telemetry_payload(payload: Dict[Text, Any]) -> None:
|
|
|
481
495
|
payload: payload to be delivered to segment.
|
|
482
496
|
"""
|
|
483
497
|
payload_json = json.dumps(payload, indent=2)
|
|
484
|
-
|
|
498
|
+
structlogger.debug(
|
|
499
|
+
"telemetry.print_telemetry_payload.debug",
|
|
500
|
+
event_info=f"Telemetry payload: {payload_json}",
|
|
501
|
+
)
|
|
485
502
|
|
|
486
503
|
|
|
487
504
|
def _get_telemetry_write_key() -> Optional[Text]:
|
|
@@ -535,10 +552,24 @@ def _send_request(url: Text, payload: Dict[Text, Any]) -> None:
|
|
|
535
552
|
if not write_key:
|
|
536
553
|
# If RASA_TELEMETRY_WRITE_KEY is empty or `None`, telemetry has not
|
|
537
554
|
# been enabled for this build (e.g. because it is running from source)
|
|
538
|
-
|
|
555
|
+
structlogger.debug(
|
|
556
|
+
"telemetry.send_request.no_telemetry_key",
|
|
557
|
+
event_info="Skipping request to external service: telemetry key not set.",
|
|
558
|
+
)
|
|
539
559
|
return
|
|
540
560
|
|
|
541
|
-
|
|
561
|
+
send_segment_request(url, payload, write_key)
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
def send_segment_request(url: Text, payload: Dict[Text, Any], write_key: Text) -> None:
|
|
565
|
+
"""Send a request to the Segment API.
|
|
566
|
+
|
|
567
|
+
Args:
|
|
568
|
+
url: URL of the Segment API endpoint
|
|
569
|
+
payload: payload to send to the Segment API
|
|
570
|
+
write_key: write key for the Segment API
|
|
571
|
+
"""
|
|
572
|
+
headers = segment_request_header(write_key)
|
|
542
573
|
|
|
543
574
|
resp = requests.post(
|
|
544
575
|
url=url,
|
|
@@ -548,15 +579,22 @@ def _send_request(url: Text, payload: Dict[Text, Any]) -> None:
|
|
|
548
579
|
)
|
|
549
580
|
# handle different failure cases
|
|
550
581
|
if resp.status_code != 200:
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
582
|
+
structlogger.debug(
|
|
583
|
+
"telemetry.send_segment_request.error_response",
|
|
584
|
+
event_info=(
|
|
585
|
+
f"Segment telemetry request returned a {resp.status_code} "
|
|
586
|
+
f"response. Body: {resp.text}"
|
|
587
|
+
),
|
|
554
588
|
)
|
|
555
589
|
else:
|
|
556
590
|
data = resp.json()
|
|
557
591
|
if not data.get("success"):
|
|
558
|
-
|
|
559
|
-
|
|
592
|
+
structlogger.debug(
|
|
593
|
+
"telemetry.send_segment_request.failure",
|
|
594
|
+
event_info=(
|
|
595
|
+
f"Segment telemetry request returned a failure. "
|
|
596
|
+
f"Response: {data}"
|
|
597
|
+
),
|
|
560
598
|
)
|
|
561
599
|
|
|
562
600
|
|
|
@@ -609,6 +647,15 @@ def with_default_context_fields(
|
|
|
609
647
|
return {**_default_context_fields(), **context}
|
|
610
648
|
|
|
611
649
|
|
|
650
|
+
def get_deployment_stack() -> Text:
|
|
651
|
+
"""Return the deployment stack.
|
|
652
|
+
|
|
653
|
+
Returns:
|
|
654
|
+
The deployment stack.
|
|
655
|
+
"""
|
|
656
|
+
return os.environ.get("DEPLOYMENT_STACK", "")
|
|
657
|
+
|
|
658
|
+
|
|
612
659
|
def _default_context_fields() -> Dict[Text, Any]:
|
|
613
660
|
"""Return a dictionary that contains the default context values.
|
|
614
661
|
|
|
@@ -632,6 +679,7 @@ def _default_context_fields() -> Dict[Text, Any]:
|
|
|
632
679
|
"cpu": multiprocessing.cpu_count(),
|
|
633
680
|
"docker": _is_docker(),
|
|
634
681
|
"license_hash": get_license_hash(),
|
|
682
|
+
"deployment_stack": get_deployment_stack(),
|
|
635
683
|
"company": property_of_active_license(
|
|
636
684
|
lambda active_license: active_license.company
|
|
637
685
|
),
|
|
@@ -663,7 +711,10 @@ def _track(
|
|
|
663
711
|
telemetry_id = get_telemetry_id()
|
|
664
712
|
|
|
665
713
|
if not telemetry_id:
|
|
666
|
-
|
|
714
|
+
structlogger.debug(
|
|
715
|
+
"telemetry.track.no_id_found",
|
|
716
|
+
event_info="Will not report telemetry events as no ID was found.",
|
|
717
|
+
)
|
|
667
718
|
return
|
|
668
719
|
|
|
669
720
|
if not properties:
|
|
@@ -681,7 +732,11 @@ def _track(
|
|
|
681
732
|
with_default_context_fields(context),
|
|
682
733
|
)
|
|
683
734
|
except Exception as e: # skipcq:PYL-W0703
|
|
684
|
-
|
|
735
|
+
structlogger.debug(
|
|
736
|
+
"telemetry.track.error",
|
|
737
|
+
error=str(e),
|
|
738
|
+
event_info="Skipping telemetry reporting",
|
|
739
|
+
)
|
|
685
740
|
|
|
686
741
|
|
|
687
742
|
def _identify(
|
|
@@ -702,7 +757,10 @@ def _identify(
|
|
|
702
757
|
telemetry_id = get_telemetry_id()
|
|
703
758
|
|
|
704
759
|
if not telemetry_id:
|
|
705
|
-
|
|
760
|
+
structlogger.debug(
|
|
761
|
+
"telemetry.identify.no_id_found",
|
|
762
|
+
event_info="Will not report telemetry events as no ID was found.",
|
|
763
|
+
)
|
|
706
764
|
return
|
|
707
765
|
|
|
708
766
|
if not traits:
|
|
@@ -710,7 +768,11 @@ def _identify(
|
|
|
710
768
|
|
|
711
769
|
_send_traits(telemetry_id, traits, with_default_context_fields(context))
|
|
712
770
|
except Exception as e:
|
|
713
|
-
|
|
771
|
+
structlogger.debug(
|
|
772
|
+
"telemetry.identify.error",
|
|
773
|
+
error=str(e),
|
|
774
|
+
event_info="Skipping telemetry reporting",
|
|
775
|
+
)
|
|
714
776
|
|
|
715
777
|
|
|
716
778
|
def _send_traits(
|
|
@@ -868,13 +930,16 @@ def strip_sensitive_data_from_sentry_event(
|
|
|
868
930
|
|
|
869
931
|
|
|
870
932
|
@ensure_telemetry_enabled
|
|
871
|
-
def initialize_error_reporting() -> None:
|
|
933
|
+
def initialize_error_reporting(private_mode: bool = True) -> None:
|
|
872
934
|
"""Sets up automated error reporting.
|
|
873
935
|
|
|
874
936
|
Exceptions are reported to sentry. We avoid sending any metadata (local
|
|
875
937
|
variables, paths, ...) to make sure we don't compromise any data. Only the
|
|
876
938
|
exception and its stacktrace is logged and only if the exception origins
|
|
877
939
|
from the `rasa` package.
|
|
940
|
+
|
|
941
|
+
Args:
|
|
942
|
+
private_mode: If True, try to send as little data as possible.
|
|
878
943
|
"""
|
|
879
944
|
import sentry_sdk
|
|
880
945
|
from sentry_sdk import configure_scope
|
|
@@ -892,11 +957,18 @@ def initialize_error_reporting() -> None:
|
|
|
892
957
|
|
|
893
958
|
telemetry_id = get_telemetry_id()
|
|
894
959
|
|
|
960
|
+
# in hello rasa we use a different project, so we need to be able
|
|
961
|
+
# to set the whole url. since we can't change the behavior of sentry in pro
|
|
962
|
+
# we have two kinds of keys, full urls and jsut the key within the fixed rasa
|
|
963
|
+
# pro project.
|
|
964
|
+
if not key.startswith("https://"):
|
|
965
|
+
key = f"https://{key}.ingest.sentry.io/2801673"
|
|
966
|
+
|
|
895
967
|
# this is a very defensive configuration, avoiding as many integrations as
|
|
896
968
|
# possible. it also submits very little data (exception with error message
|
|
897
969
|
# and line numbers).
|
|
898
970
|
sentry_sdk.init(
|
|
899
|
-
|
|
971
|
+
key,
|
|
900
972
|
before_send=before_send,
|
|
901
973
|
integrations=[
|
|
902
974
|
ExcepthookIntegration(),
|
|
@@ -916,7 +988,7 @@ def initialize_error_reporting() -> None:
|
|
|
916
988
|
OSError,
|
|
917
989
|
],
|
|
918
990
|
in_app_include=["rasa"], # only submit errors in this package
|
|
919
|
-
include_local_variables=
|
|
991
|
+
include_local_variables=not private_mode,
|
|
920
992
|
release=f"rasa-{rasa.__version__}",
|
|
921
993
|
default_integrations=False,
|
|
922
994
|
environment="development" if in_continuous_integration() else "production",
|
|
@@ -937,6 +1009,7 @@ def initialize_error_reporting() -> None:
|
|
|
937
1009
|
# os is a nested dict, hence we report it separately
|
|
938
1010
|
scope.set_context("Operating System", default_context.pop("os"))
|
|
939
1011
|
scope.set_context("Environment", default_context)
|
|
1012
|
+
structlogger.debug("telemetry.sentry.initialized")
|
|
940
1013
|
|
|
941
1014
|
|
|
942
1015
|
@contextlib.contextmanager
|
rasa/utils/licensing.py
CHANGED
|
@@ -20,7 +20,8 @@ from rasa.shared.utils.cli import print_error_and_exit
|
|
|
20
20
|
if typing.TYPE_CHECKING:
|
|
21
21
|
from rasa.core.tracker_stores.tracker_store import TrackerStore
|
|
22
22
|
|
|
23
|
-
LICENSE_ENV_VAR = "
|
|
23
|
+
LICENSE_ENV_VAR = "RASA_LICENSE"
|
|
24
|
+
LICENSE_ENV_VAR_LEGACY = "RASA_PRO_LICENSE"
|
|
24
25
|
ALGORITHM = "RS256"
|
|
25
26
|
# deepcode ignore HardcodedKey: This is a public key - not a security issue.
|
|
26
27
|
PUBLIC_KEY = """-----BEGIN PUBLIC KEY-----
|
|
@@ -265,12 +266,22 @@ class License:
|
|
|
265
266
|
|
|
266
267
|
def retrieve_license_from_env() -> Text:
|
|
267
268
|
"""Return the license found in the env var."""
|
|
269
|
+
# Check environment variables first
|
|
270
|
+
license_value = os.environ.get(LICENSE_ENV_VAR) or os.environ.get(
|
|
271
|
+
LICENSE_ENV_VAR_LEGACY
|
|
272
|
+
)
|
|
273
|
+
if license_value:
|
|
274
|
+
return license_value
|
|
275
|
+
|
|
276
|
+
# Fall back to .env file
|
|
268
277
|
stored_env_values = dotenv_values(".env")
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
278
|
+
license_value = stored_env_values.get(LICENSE_ENV_VAR) or stored_env_values.get(
|
|
279
|
+
LICENSE_ENV_VAR_LEGACY
|
|
280
|
+
)
|
|
281
|
+
if license_value:
|
|
282
|
+
return license_value
|
|
283
|
+
|
|
284
|
+
raise LicenseNotFoundException()
|
|
274
285
|
|
|
275
286
|
|
|
276
287
|
def is_license_expiring_soon(license: License) -> bool:
|
|
@@ -297,15 +308,15 @@ def validate_license_from_env(product_area: Text = PRODUCT_AREA) -> None:
|
|
|
297
308
|
except LicenseNotFoundException:
|
|
298
309
|
structlogger.error("license.not_found.error")
|
|
299
310
|
raise SystemExit(
|
|
300
|
-
f"A Rasa
|
|
301
|
-
f"Please set the
|
|
311
|
+
f"A Rasa license is required. "
|
|
312
|
+
f"Please set the environment variable "
|
|
302
313
|
f"`{LICENSE_ENV_VAR}` to a valid license string. "
|
|
303
314
|
)
|
|
304
315
|
except LicenseValidationException as e:
|
|
305
316
|
structlogger.error("license.validation.error", error=e)
|
|
306
317
|
raise SystemExit(
|
|
307
|
-
f"Failed to validate Rasa
|
|
308
|
-
f"which was read from
|
|
318
|
+
f"Failed to validate Rasa license "
|
|
319
|
+
f"which was read from environment variable `{LICENSE_ENV_VAR}`. "
|
|
309
320
|
f"Please ensure `{LICENSE_ENV_VAR}` is set to a valid license string. "
|
|
310
321
|
)
|
|
311
322
|
|
rasa/utils/log_utils.py
CHANGED
|
@@ -37,7 +37,7 @@ class HumanConsoleRenderer(ConsoleRenderer):
|
|
|
37
37
|
def configure_structlog(
|
|
38
38
|
log_level: Optional[int] = None,
|
|
39
39
|
include_time: bool = False,
|
|
40
|
-
additional_processors: Optional[List[structlog.
|
|
40
|
+
additional_processors: Optional[List[structlog.typing.Processor]] = None,
|
|
41
41
|
) -> None:
|
|
42
42
|
"""Configure logging of the server."""
|
|
43
43
|
if log_level is None: # Log level NOTSET is 0 so we use `is None` here
|
|
@@ -7,7 +7,7 @@ import tensorflow as tf
|
|
|
7
7
|
from keras.src.utils.control_flow_util import smart_cond
|
|
8
8
|
from tensorflow.keras import backend as K
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
from rasa.utils.tensorflow.exceptions import TFLayerConfigException
|
|
11
11
|
from rasa.utils.tensorflow.layers import RandomlyConnectedDense
|
|
12
12
|
|
|
13
13
|
|
|
@@ -48,8 +48,8 @@ class MultiHeadAttention(tf.keras.layers.Layer):
|
|
|
48
48
|
super().__init__()
|
|
49
49
|
|
|
50
50
|
if units % num_heads != 0:
|
|
51
|
-
|
|
52
|
-
f"
|
|
51
|
+
raise TFLayerConfigException(
|
|
52
|
+
f"The given transformer size {units} should be a "
|
|
53
53
|
f"multiple of the number of attention heads {num_heads}."
|
|
54
54
|
)
|
|
55
55
|
|