rasa-pro 3.14.0.dev20250825__py3-none-any.whl → 3.14.0.dev20250901__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/builder/README.md +120 -0
- rasa/builder/__init__.py +0 -0
- rasa/builder/auth.py +176 -0
- rasa/builder/config.py +91 -0
- rasa/builder/copilot/__init__.py +0 -0
- rasa/builder/copilot/constants.py +28 -0
- rasa/builder/copilot/copilot.py +376 -0
- rasa/builder/copilot/copilot_response_handler.py +522 -0
- rasa/builder/copilot/copilot_templated_message_provider.py +58 -0
- rasa/builder/copilot/exceptions.py +32 -0
- rasa/builder/copilot/models.py +464 -0
- rasa/builder/copilot/prompts/__init__.py +0 -0
- rasa/builder/copilot/prompts/copilot_system_prompt.jinja2 +771 -0
- rasa/builder/copilot/signing.py +305 -0
- rasa/builder/copilot/telemetry.py +200 -0
- rasa/builder/copilot/templated_messages/__init__.py +0 -0
- rasa/builder/copilot/templated_messages/copilot_internal_messages_templates.yml +16 -0
- rasa/builder/copilot/templated_messages/copilot_templated_responses.yml +38 -0
- rasa/builder/document_retrieval/__init__.py +0 -0
- rasa/builder/document_retrieval/constants.py +15 -0
- rasa/builder/document_retrieval/inkeep-rag-response-schema.json +64 -0
- rasa/builder/document_retrieval/inkeep_document_retrieval.py +238 -0
- rasa/builder/document_retrieval/models.py +62 -0
- rasa/builder/download.py +147 -0
- rasa/builder/exceptions.py +91 -0
- rasa/builder/guardrails/__init__.py +1 -0
- rasa/builder/guardrails/constants.py +9 -0
- rasa/builder/guardrails/exceptions.py +4 -0
- rasa/builder/guardrails/lakera.py +206 -0
- rasa/builder/guardrails/models.py +231 -0
- rasa/builder/guardrails/store.py +238 -0
- rasa/builder/guardrails/utils.py +328 -0
- rasa/builder/job_manager.py +87 -0
- rasa/builder/jobs.py +270 -0
- rasa/builder/llm_service.py +246 -0
- rasa/builder/logging_utils.py +265 -0
- rasa/builder/main.py +258 -0
- rasa/builder/models.py +216 -0
- rasa/builder/project_generator.py +462 -0
- rasa/builder/project_info.py +72 -0
- rasa/builder/scrape_rasa_docs.py +97 -0
- rasa/builder/service.py +1335 -0
- rasa/builder/shared/tracker_context.py +212 -0
- rasa/builder/skill_to_bot_prompt.jinja2 +164 -0
- rasa/builder/training_service.py +124 -0
- rasa/builder/validation_service.py +97 -0
- rasa/cli/project_templates/basic/actions/__init__ +0 -0
- rasa/cli/project_templates/basic/actions/action_human_handoff.py +40 -0
- rasa/cli/project_templates/basic/config.yml +27 -0
- rasa/cli/project_templates/basic/credentials.yml +33 -0
- rasa/cli/project_templates/basic/data/data.md +9 -0
- rasa/cli/project_templates/basic/data/general/feedback.yml +21 -0
- rasa/cli/project_templates/basic/data/general/goodbye.yml +6 -0
- rasa/cli/project_templates/basic/data/general/hello.yml +6 -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/show_faqs.yml +6 -0
- rasa/cli/project_templates/basic/data/system/patterns/pattern_cannot_handle.yml +7 -0
- rasa/cli/project_templates/basic/data/system/patterns/pattern_completed.yml +7 -0
- rasa/cli/project_templates/basic/data/system/patterns/pattern_correction.yml +7 -0
- rasa/cli/project_templates/basic/data/system/patterns/pattern_search.yml +8 -0
- rasa/cli/project_templates/basic/data/system/patterns/pattern_session_start.yml +8 -0
- rasa/cli/project_templates/basic/docs/docs.md +5 -0
- rasa/cli/project_templates/basic/docs/template.txt +28 -0
- rasa/cli/project_templates/basic/domain/domain.md +9 -0
- rasa/cli/project_templates/basic/domain/general/feedback.yml +25 -0
- rasa/cli/project_templates/basic/domain/general/goodbye.yml +9 -0
- rasa/cli/project_templates/basic/domain/general/hello.yml +7 -0
- rasa/cli/project_templates/basic/domain/general/help.yml +21 -0
- rasa/cli/project_templates/basic/domain/general/human_handoff.yml +32 -0
- rasa/cli/project_templates/basic/domain/general/show_faqs.yml +14 -0
- rasa/cli/project_templates/basic/domain/system/patterns/pattern_cannot_handle.yml +5 -0
- rasa/cli/project_templates/basic/domain/system/patterns/pattern_session_start.yml +19 -0
- rasa/cli/project_templates/basic/endpoints.yml +63 -0
- rasa/cli/project_templates/basic/prompts/rephraser_demo_personality_prompt.jinja2 +38 -0
- 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/accounts/action_ask_account.py +47 -0
- rasa/cli/project_templates/finance/actions/accounts/action_check_balance.py +40 -0
- rasa/cli/project_templates/finance/actions/action_session_start.py +74 -0
- rasa/cli/project_templates/finance/actions/cards/__init__.py +0 -0
- rasa/cli/project_templates/finance/actions/cards/action_ask_card.py +48 -0
- rasa/cli/project_templates/finance/actions/cards/action_check_card_existence.py +36 -0
- rasa/cli/project_templates/finance/actions/cards/action_update_card_status.py +54 -0
- rasa/cli/project_templates/finance/actions/database.py +277 -0
- rasa/cli/project_templates/finance/actions/transfers/__init__.py +0 -0
- rasa/cli/project_templates/finance/actions/transfers/action_add_payee.py +52 -0
- rasa/cli/project_templates/finance/actions/transfers/action_ask_account_from.py +51 -0
- rasa/cli/project_templates/finance/actions/transfers/action_check_payee_existence.py +40 -0
- rasa/cli/project_templates/finance/actions/transfers/action_check_sufficient_funds.py +40 -0
- rasa/cli/project_templates/finance/actions/transfers/action_list_payees.py +46 -0
- rasa/cli/project_templates/finance/actions/transfers/action_process_immediate_payment.py +18 -0
- rasa/cli/project_templates/finance/actions/transfers/action_remove_payee.py +49 -0
- rasa/cli/project_templates/finance/actions/transfers/action_schedule_payment.py +19 -0
- rasa/cli/project_templates/finance/actions/transfers/action_validate_payment_date.py +36 -0
- rasa/cli/project_templates/finance/config.yml +21 -0
- rasa/cli/project_templates/finance/credentials.yml +32 -0
- rasa/cli/project_templates/finance/csvs/accounts.csv +8 -0
- rasa/cli/project_templates/finance/csvs/advisors.csv +7 -0
- rasa/cli/project_templates/finance/csvs/appointments.csv +211 -0
- rasa/cli/project_templates/finance/csvs/branches.csv +10 -0
- rasa/cli/project_templates/finance/csvs/cards.csv +11 -0
- rasa/cli/project_templates/finance/csvs/payees.csv +11 -0
- rasa/cli/project_templates/finance/csvs/transactions.csv +71 -0
- rasa/cli/project_templates/finance/csvs/users.csv +4 -0
- rasa/cli/project_templates/finance/data/accounts/check_balance.yml +10 -0
- rasa/cli/project_templates/finance/data/cards/block_card.yml +66 -0
- rasa/cli/project_templates/finance/data/cards/select_card.yml +12 -0
- 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/general/help.yml +9 -0
- 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/system/patterns/pattern_chitchat.yml +5 -0
- 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/system/patterns/pattern_session_start.yml +8 -0
- rasa/cli/project_templates/finance/data/system/source/accounts.json +51 -0
- rasa/cli/project_templates/finance/data/system/source/advisors.json +44 -0
- rasa/cli/project_templates/finance/data/system/source/appointments.json +1474 -0
- rasa/cli/project_templates/finance/data/system/source/branches.json +47 -0
- rasa/cli/project_templates/finance/data/system/source/cards.json +72 -0
- rasa/cli/project_templates/finance/data/system/source/payees.json +74 -0
- rasa/cli/project_templates/finance/data/system/source/transactions.json +492 -0
- rasa/cli/project_templates/finance/data/system/source/users.json +29 -0
- rasa/cli/project_templates/finance/data/transfers/add_payee.yml +29 -0
- rasa/cli/project_templates/finance/data/transfers/list_payees.yml +5 -0
- rasa/cli/project_templates/finance/data/transfers/remove_payee.yml +21 -0
- rasa/cli/project_templates/finance/data/transfers/transfer_money.yml +67 -0
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/consequences_of_blocking_card.txt +8 -0
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/reasons_to_block_card.txt +8 -0
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/recovering_from_card_fraud.txt +8 -0
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/tips_for_card_security.txt +8 -0
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/what_to_do_if_card_is_lost.txt +8 -0
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/account_balance_security.txt +7 -0
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/common_balance_inquiries.txt +8 -0
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/methods_to_check_balance.txt +8 -0
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/understanding_balance_updates.txt +8 -0
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/what_to_do_if_balance_is_incorrect.txt +8 -0
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/benefits_of_authorised_payees.txt +8 -0
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/common_issues_with_payees.txt +8 -0
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/general_payee_information.txt +8 -0
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/payee_management_tips.txt +8 -0
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/understanding_payee_types.txt +8 -0
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/common_transfer_errors.txt +8 -0
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/fees_for_transfers.txt +8 -0
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/general_transfer_information.txt +8 -0
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/security_tips_for_transfers.txt +8 -0
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/transfer_processing_times.txt +8 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part1.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part10.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part11.txt +48 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part12.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part13.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part14.txt +47 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part15.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part16.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part17.txt +47 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part18.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part19.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part2.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part20.txt +47 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part21.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part22.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part23.txt +47 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part24.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part25.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part26.txt +47 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part27.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part28.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part29.txt +47 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part3.txt +47 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part30.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part31.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part32.txt +47 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part33.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part34.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part35.txt +47 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part36.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part37.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part38.txt +47 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part39.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part4.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part40.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part41.txt +47 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part42.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part43.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part44.txt +47 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part45.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part46.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part47.txt +47 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part48.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part49.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part5.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part50.txt +47 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part51.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part52.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part53.txt +47 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part54.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part55.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part56.txt +47 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part57.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part58.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part59.txt +47 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part6.txt +47 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part60.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part61.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part7.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part8.txt +50 -0
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part9.txt +47 -0
- rasa/cli/project_templates/finance/domain/accounts/check_balance.yml +11 -0
- rasa/cli/project_templates/finance/domain/cards/block_card.yml +101 -0
- rasa/cli/project_templates/finance/domain/cards/select_card.yml +12 -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/domain/transfers/add_payee.yml +47 -0
- rasa/cli/project_templates/finance/domain/transfers/list_payees.yml +4 -0
- rasa/cli/project_templates/finance/domain/transfers/remove_payee.yml +16 -0
- rasa/cli/project_templates/finance/domain/transfers/transfer_money.yml +79 -0
- rasa/cli/project_templates/finance/endpoints.yml +63 -0
- rasa/cli/project_templates/finance/prompts/rephraser_demo_personality_prompt.jinja2 +19 -0
- rasa/cli/project_templates/telco/actions/__init__.py +0 -0
- rasa/cli/project_templates/telco/actions/billing/__init__.py +0 -0
- rasa/cli/project_templates/telco/actions/billing/actions_billing.py +204 -0
- rasa/cli/project_templates/telco/actions/general/__init__.py +0 -0
- rasa/cli/project_templates/telco/actions/general/action_human_handoff.py +49 -0
- rasa/cli/project_templates/telco/actions/network/__init__.py +0 -0
- rasa/cli/project_templates/telco/actions/network/actions_get_data_from_db.py +48 -0
- rasa/cli/project_templates/telco/actions/network/actions_run_diagnostics.py +28 -0
- rasa/cli/project_templates/telco/actions/network/actions_session_start.py +18 -0
- rasa/cli/project_templates/telco/config.yml +27 -0
- rasa/cli/project_templates/telco/credentials.yml +33 -0
- rasa/cli/project_templates/telco/csvs/billing.csv +19 -0
- rasa/cli/project_templates/telco/csvs/customers.csv +5 -0
- rasa/cli/project_templates/telco/data/billing/flow_understand_bill.yml +45 -0
- rasa/cli/project_templates/telco/data/general/bot_challenge.yml +6 -0
- rasa/cli/project_templates/telco/data/general/feedback.yml +20 -0
- rasa/cli/project_templates/telco/data/general/goodbye.yml +6 -0
- rasa/cli/project_templates/telco/data/general/hello.yml +6 -0
- rasa/cli/project_templates/telco/data/general/human_handoff.yml +16 -0
- rasa/cli/project_templates/telco/data/general/patterns.yml +30 -0
- rasa/cli/project_templates/telco/data/network/flow_reboot_router.yml +8 -0
- rasa/cli/project_templates/telco/data/network/flow_reset_router.yml +7 -0
- rasa/cli/project_templates/telco/data/network/flow_solve_internet_issue.yml +73 -0
- rasa/cli/project_templates/telco/docs/docs.md +5 -0
- rasa/cli/project_templates/telco/docs/network/reset_vs_rboot_router.txt +1 -0
- rasa/cli/project_templates/telco/docs/network/restart_router.txt +6 -0
- rasa/cli/project_templates/telco/docs/network/run_speed_test.txt +6 -0
- rasa/cli/project_templates/telco/domain/billing/domain_undertand_bill.yml +102 -0
- rasa/cli/project_templates/telco/domain/general/bot_challenge.yml +4 -0
- rasa/cli/project_templates/telco/domain/general/feedback.yml +25 -0
- rasa/cli/project_templates/telco/domain/general/goodbye.yml +7 -0
- rasa/cli/project_templates/telco/domain/general/hello.yml +5 -0
- rasa/cli/project_templates/telco/domain/general/human_handoff.yml +29 -0
- rasa/cli/project_templates/telco/domain/general/patterns.yml +33 -0
- rasa/cli/project_templates/telco/domain/network/domain_reboot_router.yml +21 -0
- rasa/cli/project_templates/telco/domain/network/domain_reset_router.yml +12 -0
- rasa/cli/project_templates/telco/domain/network/domain_run_speed_test.yml +25 -0
- rasa/cli/project_templates/telco/domain/network/domain_solve_internet_issue.yml +75 -0
- rasa/cli/project_templates/telco/domain/shared.yml +129 -0
- rasa/cli/project_templates/telco/endpoints.yml +63 -0
- rasa/cli/project_templates/telco/prompts/rephraser_demo_personality_prompt.jinja2 +40 -0
- rasa/cli/project_templates/tutorial/config.yml +2 -1
- rasa/cli/scaffold.py +46 -2
- rasa/core/actions/action.py +0 -1
- rasa/core/channels/inspector/dist/assets/{arc-1ddec37b.js → arc-18042c22.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{blockDiagram-38ab4fdb-18af387c.js → blockDiagram-38ab4fdb-fdd6bcfa.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{c4Diagram-3d4e48cf-250127a3.js → c4Diagram-3d4e48cf-f5ae6786.js} +1 -1
- rasa/core/channels/inspector/dist/assets/channel-b9b536fc.js +1 -0
- rasa/core/channels/inspector/dist/assets/{classDiagram-70f12bd4-c3388b34.js → classDiagram-70f12bd4-81efba3e.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{classDiagram-v2-f2320105-9c893a82.js → classDiagram-v2-f2320105-3b6b6a92.js} +1 -1
- rasa/core/channels/inspector/dist/assets/clone-78d2ddcf.js +1 -0
- rasa/core/channels/inspector/dist/assets/{createText-2e5e7dd3-c111213b.js → createText-2e5e7dd3-31422447.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{edges-e0da2a9e-812a729d.js → edges-e0da2a9e-518a90db.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{erDiagram-9861fffd-fd5051bc.js → erDiagram-9861fffd-a6d3c25a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDb-956e92f1-3287ac02.js → flowDb-956e92f1-e048c2be.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDiagram-66a62f08-692fb0b2.js → flowDiagram-66a62f08-c7474c91.js} +1 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-8b09c060.js +1 -0
- rasa/core/channels/inspector/dist/assets/{flowchart-elk-definition-4a651766-008376f1.js → flowchart-elk-definition-4a651766-cb4d8723.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{ganttDiagram-c361ad54-df330a69.js → ganttDiagram-c361ad54-346636a2.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-72cf32ee-e03676fb.js → gitGraphDiagram-72cf32ee-7c508874.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{graph-46fad2ba.js → graph-14702d8a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-3862675e-a484ac55.js → index-3862675e-f18b534b.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-a003633f.js → index-4d4bdf3a.js} +231 -231
- rasa/core/channels/inspector/dist/assets/{infoDiagram-f8f76790-3f9e6ec2.js → infoDiagram-f8f76790-64154b83.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{journeyDiagram-49397b02-79f72383.js → journeyDiagram-49397b02-833a5f95.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{layout-aad098e5.js → layout-5a3b2123.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{line-219ab7ae.js → line-2272a8c7.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{linear-2cddbe62.js → linear-35bcf273.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{mindmap-definition-fc14e90a-1d41ed99.js → mindmap-definition-fc14e90a-92dcb0e9.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{pieDiagram-8a3498a8-cc496ee8.js → pieDiagram-8a3498a8-94dbc900.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{quadrantDiagram-120e2f19-84d32884.js → quadrantDiagram-120e2f19-8b7a9c33.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{requirementDiagram-deff3bca-c0deb984.js → requirementDiagram-deff3bca-6f7eab81.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sankeyDiagram-04a897e0-b9d7fd62.js → sankeyDiagram-04a897e0-f43e581d.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sequenceDiagram-704730f1-7d517565.js → sequenceDiagram-704730f1-0bcbefc3.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-587899a1-98ef9b27.js → stateDiagram-587899a1-b8a74083.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-v2-d93cdb3a-cee70748.js → stateDiagram-v2-d93cdb3a-2070218f.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-6aaf32cf-3f9d1c96.js → styles-6aaf32cf-f1d54e34.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-9a916d00-67471923.js → styles-9a916d00-980de489.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-c10674c1-bd093fb7.js → styles-c10674c1-3c03abde.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{svgDrawCommon-08f97a94-675794e8.js → svgDrawCommon-08f97a94-46ba068f.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{timeline-definition-85554ec2-0ac67617.js → timeline-definition-85554ec2-901f5e3d.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{xychartDiagram-e933f94c-c018dc37.js → xychartDiagram-e933f94c-acbc628a.js} +1 -1
- rasa/core/channels/inspector/dist/index.html +2 -2
- rasa/core/channels/inspector/index.html +1 -1
- rasa/core/channels/inspector/src/App.tsx +10 -11
- rasa/core/channels/inspector/src/components/DialogueInformation.tsx +12 -3
- rasa/core/channels/studio_chat.py +25 -7
- rasa/core/policies/enterprise_search_policy.py +4 -7
- rasa/core/policies/flows/flow_executor.py +8 -1
- rasa/dialogue_understanding/generator/flow_retrieval.py +10 -9
- rasa/engine/storage/local_model_storage.py +45 -2
- rasa/model_manager/model_api.py +1 -2
- rasa/model_manager/runner_service.py +1 -1
- rasa/model_manager/trainer_service.py +12 -9
- rasa/model_manager/utils.py +1 -29
- rasa/shared/core/domain.py +62 -15
- rasa/shared/core/flows/flow_step.py +7 -1
- rasa/shared/core/flows/steps/call.py +8 -1
- rasa/shared/core/flows/yaml_flows_io.py +16 -8
- rasa/shared/core/slots.py +4 -0
- rasa/shared/importers/importer.py +6 -0
- rasa/shared/importers/utils.py +77 -1
- rasa/studio/upload.py +12 -46
- rasa/telemetry.py +97 -23
- rasa/utils/io.py +27 -9
- rasa/utils/json_utils.py +6 -1
- rasa/utils/log_utils.py +5 -1
- rasa/utils/openapi.py +144 -0
- rasa/validator.py +7 -3
- rasa/version.py +1 -1
- {rasa_pro-3.14.0.dev20250825.dist-info → rasa_pro-3.14.0.dev20250901.dist-info}/METADATA +9 -10
- {rasa_pro-3.14.0.dev20250825.dist-info → rasa_pro-3.14.0.dev20250901.dist-info}/RECORD +347 -73
- rasa/core/channels/inspector/dist/assets/channel-59f6d54b.js +0 -1
- rasa/core/channels/inspector/dist/assets/clone-26177ddb.js +0 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-29c03f5a.js +0 -1
- {rasa_pro-3.14.0.dev20250825.dist-info → rasa_pro-3.14.0.dev20250901.dist-info}/NOTICE +0 -0
- {rasa_pro-3.14.0.dev20250825.dist-info → rasa_pro-3.14.0.dev20250901.dist-info}/WHEEL +0 -0
- {rasa_pro-3.14.0.dev20250825.dist-info → rasa_pro-3.14.0.dev20250901.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import json
|
|
3
|
+
import os
|
|
4
|
+
from contextlib import asynccontextmanager
|
|
5
|
+
from typing import AsyncGenerator, List, Optional
|
|
6
|
+
|
|
7
|
+
import openai
|
|
8
|
+
import structlog
|
|
9
|
+
from openai.types.chat import ChatCompletion
|
|
10
|
+
|
|
11
|
+
from rasa.builder import config
|
|
12
|
+
from rasa.builder.copilot.constants import ROLE_USER
|
|
13
|
+
from rasa.builder.document_retrieval.constants import (
|
|
14
|
+
INKEEP_API_KEY_ENV_VAR,
|
|
15
|
+
INKEEP_DOCUMENT_RETRIEVAL_MODEL,
|
|
16
|
+
INKEEP_RAG_RESPONSE_SCHEMA_PATH,
|
|
17
|
+
)
|
|
18
|
+
from rasa.builder.document_retrieval.models import Document
|
|
19
|
+
from rasa.builder.exceptions import DocumentRetrievalError
|
|
20
|
+
from rasa.shared.utils.io import read_json_file
|
|
21
|
+
|
|
22
|
+
structlogger = structlog.get_logger()
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class InKeepDocumentRetrieval:
|
|
26
|
+
"""Handles the document retrieval from InKeep AI."""
|
|
27
|
+
|
|
28
|
+
def __init__(
|
|
29
|
+
self,
|
|
30
|
+
api_key: Optional[str] = None,
|
|
31
|
+
):
|
|
32
|
+
self._rag_schema = read_json_file(INKEEP_RAG_RESPONSE_SCHEMA_PATH)
|
|
33
|
+
self._api_key = api_key or os.getenv(INKEEP_API_KEY_ENV_VAR)
|
|
34
|
+
|
|
35
|
+
@property
|
|
36
|
+
def api_key(self) -> str:
|
|
37
|
+
"""Resolve the correct API key/token based on proxy usage."""
|
|
38
|
+
using_proxy = bool(config.HELLO_LLM_PROXY_BASE_URL)
|
|
39
|
+
if using_proxy:
|
|
40
|
+
if not config.RASA_PRO_LICENSE:
|
|
41
|
+
raise DocumentRetrievalError(
|
|
42
|
+
"HELLO_LLM_PROXY_BASE_URL is set but RASA_PRO_LICENSE is missing. "
|
|
43
|
+
"Proxy requires a Rasa Pro license token for authentication."
|
|
44
|
+
)
|
|
45
|
+
return config.RASA_PRO_LICENSE
|
|
46
|
+
|
|
47
|
+
if not self._api_key:
|
|
48
|
+
raise DocumentRetrievalError(
|
|
49
|
+
"INKEEP_API_KEY is missing. Provide it via env INKEEP_API_KEY "
|
|
50
|
+
"or pass api_key= to InKeepDocumentRetrieval."
|
|
51
|
+
)
|
|
52
|
+
return self._api_key
|
|
53
|
+
|
|
54
|
+
async def retrieve_documents(
|
|
55
|
+
self, query: str, temperature: float = 0.0, timeout: float = 30.0
|
|
56
|
+
) -> List[Document]:
|
|
57
|
+
"""Retrieve relevant documents using InKeep AI based on the given query.
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
query: The search query
|
|
61
|
+
temperature: Controls randomness in generation (0.0 for deterministic)
|
|
62
|
+
timeout: Timeout for the API call
|
|
63
|
+
|
|
64
|
+
Returns:
|
|
65
|
+
List of Document objects containing retrieved content
|
|
66
|
+
|
|
67
|
+
Raises:
|
|
68
|
+
DocumentRetrievalError: When document retrieval fails due to:
|
|
69
|
+
- Empty response from InKeep AI API
|
|
70
|
+
- OpenAI API errors (authentication, rate limiting, etc.)
|
|
71
|
+
- Request timeout
|
|
72
|
+
- Unexpected errors during API communication
|
|
73
|
+
"""
|
|
74
|
+
try:
|
|
75
|
+
response = await self._call_inkeep_rag_api(
|
|
76
|
+
query=query,
|
|
77
|
+
temperature=temperature,
|
|
78
|
+
timeout=timeout,
|
|
79
|
+
)
|
|
80
|
+
documents = self._parse_documents_from_response(response)
|
|
81
|
+
return documents
|
|
82
|
+
except DocumentRetrievalError as e:
|
|
83
|
+
structlogger.error(
|
|
84
|
+
"inkeep_document_retrieval.retrieve_documents.error",
|
|
85
|
+
event_info="InKeep Document Retrieval: Error",
|
|
86
|
+
query=query,
|
|
87
|
+
error=str(e),
|
|
88
|
+
)
|
|
89
|
+
raise e
|
|
90
|
+
|
|
91
|
+
async def _call_inkeep_rag_api(
|
|
92
|
+
self, query: str, temperature: float, timeout: float
|
|
93
|
+
) -> ChatCompletion:
|
|
94
|
+
"""Call InKeep AI RAG's API endpoint and return the response content.
|
|
95
|
+
|
|
96
|
+
Args:
|
|
97
|
+
query: The search query to send to InKeep
|
|
98
|
+
temperature: Controls randomness in generation (0.0 for deterministic)
|
|
99
|
+
timeout: Timeout for the API call
|
|
100
|
+
|
|
101
|
+
Returns:
|
|
102
|
+
The response content from InKeep AI. The response is made of the retrieved
|
|
103
|
+
documents.
|
|
104
|
+
|
|
105
|
+
Raises:
|
|
106
|
+
LLMGenerationError: If the API call fails or returns invalid response
|
|
107
|
+
"""
|
|
108
|
+
try:
|
|
109
|
+
async with self._get_client() as client:
|
|
110
|
+
response = await client.chat.completions.create(
|
|
111
|
+
model=INKEEP_DOCUMENT_RETRIEVAL_MODEL,
|
|
112
|
+
messages=[{"role": ROLE_USER, "content": query}],
|
|
113
|
+
temperature=temperature,
|
|
114
|
+
timeout=timeout,
|
|
115
|
+
response_format={
|
|
116
|
+
"type": "json_schema",
|
|
117
|
+
"json_schema": self._rag_schema,
|
|
118
|
+
},
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
if not response.choices[0].message.content:
|
|
122
|
+
structlogger.warning(
|
|
123
|
+
"inkeep_document_retrieval.empty_response",
|
|
124
|
+
event_info="InKeep AI returned an empty response. ",
|
|
125
|
+
query=query,
|
|
126
|
+
response_content=response.choices[0].message.content,
|
|
127
|
+
)
|
|
128
|
+
raise DocumentRetrievalError(
|
|
129
|
+
"InKeep Document Retrieval: Empty response"
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
return response
|
|
133
|
+
|
|
134
|
+
except openai.OpenAIError as e:
|
|
135
|
+
structlogger.error(
|
|
136
|
+
"inkeep_document_retrieval.call_inkeep_rag_api.api_error",
|
|
137
|
+
event_info="InKeep Document Retrieval: API error",
|
|
138
|
+
query=query,
|
|
139
|
+
error=e,
|
|
140
|
+
)
|
|
141
|
+
raise DocumentRetrievalError(f"InKeep Document Retrieval: API error: {e}")
|
|
142
|
+
except asyncio.TimeoutError as e:
|
|
143
|
+
structlogger.error(
|
|
144
|
+
"inkeep_document_retrieval.call_inkeep_rag_api.timeout_error",
|
|
145
|
+
event_info="InKeep Document Retrieval: Timeout error",
|
|
146
|
+
query=query,
|
|
147
|
+
error=e,
|
|
148
|
+
)
|
|
149
|
+
raise DocumentRetrievalError(f"InKeep AI request timed out: {e}")
|
|
150
|
+
except Exception as e:
|
|
151
|
+
structlogger.error(
|
|
152
|
+
"inkeep_document_retrieval.call_inkeep_rag_api.error",
|
|
153
|
+
event_info="InKeep Document Retrieval: Error",
|
|
154
|
+
query=query,
|
|
155
|
+
error=e,
|
|
156
|
+
)
|
|
157
|
+
raise DocumentRetrievalError(
|
|
158
|
+
f"InKeep Document Retrieval: Unexpected error: {e}"
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
@asynccontextmanager
|
|
162
|
+
async def _get_client(self) -> AsyncGenerator[openai.AsyncOpenAI, None]:
|
|
163
|
+
"""Get or create client that handles the API calls to InKeep AI."""
|
|
164
|
+
# Ensure trailing slash to match client expectations/tests
|
|
165
|
+
base_url = f"{config.INKEEP_BASE_URL.rstrip('/')}/"
|
|
166
|
+
client = openai.AsyncOpenAI(base_url=base_url, api_key=self.api_key)
|
|
167
|
+
structlogger.debug("inkeep_document_retrieval._get_client", base_url=base_url)
|
|
168
|
+
|
|
169
|
+
try:
|
|
170
|
+
yield client
|
|
171
|
+
except Exception as e:
|
|
172
|
+
structlogger.error(
|
|
173
|
+
"inkeep_document_retrieval.client_error",
|
|
174
|
+
event_info="InKeep Document Retrieval: Client error",
|
|
175
|
+
error=str(e),
|
|
176
|
+
)
|
|
177
|
+
raise
|
|
178
|
+
|
|
179
|
+
def _parse_documents_from_response(
|
|
180
|
+
self, response: ChatCompletion
|
|
181
|
+
) -> List[Document]:
|
|
182
|
+
"""Parse the InKeep AI response into Document objects.
|
|
183
|
+
|
|
184
|
+
Args:
|
|
185
|
+
response: ChatCompletion response from InKeep AI's RAG model.
|
|
186
|
+
|
|
187
|
+
Returns:
|
|
188
|
+
List of Document objects. Empty list is returned if the response is empty
|
|
189
|
+
or if the response is invalid.
|
|
190
|
+
"""
|
|
191
|
+
try:
|
|
192
|
+
content = response.choices[0].message.content
|
|
193
|
+
if not content:
|
|
194
|
+
return []
|
|
195
|
+
|
|
196
|
+
response_data = json.loads(content)
|
|
197
|
+
documents = []
|
|
198
|
+
|
|
199
|
+
for item in response_data.get("content", []):
|
|
200
|
+
try:
|
|
201
|
+
document = Document.from_inkeep_rag_response(item)
|
|
202
|
+
documents.append(document)
|
|
203
|
+
except Exception as e:
|
|
204
|
+
structlogger.warning(
|
|
205
|
+
"inkeep_document_retrieval.invalid_document_skipped",
|
|
206
|
+
event_info=(
|
|
207
|
+
"InKeep Document Retrieval: Invalid document structure "
|
|
208
|
+
"skipped. Returning empty list for this item."
|
|
209
|
+
),
|
|
210
|
+
error=str(e),
|
|
211
|
+
item=item,
|
|
212
|
+
)
|
|
213
|
+
# Continue processing other items, skip this invalid one
|
|
214
|
+
continue
|
|
215
|
+
|
|
216
|
+
return documents
|
|
217
|
+
|
|
218
|
+
except json.JSONDecodeError as e:
|
|
219
|
+
structlogger.warning(
|
|
220
|
+
"inkeep_document_retrieval.parse_documents_from_response"
|
|
221
|
+
".parse_response_failed",
|
|
222
|
+
event_info=(
|
|
223
|
+
"InKeep Document Retrieval: Parse response failed. "
|
|
224
|
+
"Returning empty list.",
|
|
225
|
+
),
|
|
226
|
+
error=str(e),
|
|
227
|
+
)
|
|
228
|
+
return []
|
|
229
|
+
except Exception as e:
|
|
230
|
+
structlogger.error(
|
|
231
|
+
"inkeep_document_retrieval.parse_documents_from_response.error",
|
|
232
|
+
event_info=(
|
|
233
|
+
"InKeep Document Retrieval: Parse response error. "
|
|
234
|
+
"Returning empty list.",
|
|
235
|
+
),
|
|
236
|
+
error=str(e),
|
|
237
|
+
)
|
|
238
|
+
return []
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
from typing import Any, Dict, Optional
|
|
2
|
+
|
|
3
|
+
import structlog
|
|
4
|
+
from pydantic import BaseModel, Field
|
|
5
|
+
|
|
6
|
+
structlogger = structlog.get_logger()
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Document(BaseModel):
|
|
10
|
+
"""Model for document retrieval results."""
|
|
11
|
+
|
|
12
|
+
content: str = Field(...)
|
|
13
|
+
url: Optional[str] = Field(None)
|
|
14
|
+
title: Optional[str] = Field(None)
|
|
15
|
+
metadata: Optional[Dict[str, Any]] = Field(None)
|
|
16
|
+
|
|
17
|
+
@classmethod
|
|
18
|
+
def from_inkeep_rag_response(cls, rag_item: Dict[str, Any]) -> "Document":
|
|
19
|
+
"""Create a Document object from a single InKeep RAG response item.
|
|
20
|
+
|
|
21
|
+
Args:
|
|
22
|
+
rag_item: Single item from InKeep RAG response
|
|
23
|
+
|
|
24
|
+
Returns:
|
|
25
|
+
Document object with extracted content and metadata
|
|
26
|
+
"""
|
|
27
|
+
source = rag_item.get("source", {})
|
|
28
|
+
text_content = cls._extract_text_from_source(source)
|
|
29
|
+
|
|
30
|
+
return cls(
|
|
31
|
+
content=text_content.strip() if text_content else "",
|
|
32
|
+
url=rag_item.get("url"),
|
|
33
|
+
title=rag_item.get("title"),
|
|
34
|
+
metadata={
|
|
35
|
+
"type": rag_item.get("type"),
|
|
36
|
+
"record_type": rag_item.get("record_type"),
|
|
37
|
+
"context": rag_item.get("context"),
|
|
38
|
+
"media_type": source.get("media_type"),
|
|
39
|
+
},
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
@staticmethod
|
|
43
|
+
def _extract_text_from_source(source: Dict[str, Any]) -> str:
|
|
44
|
+
"""Extract text content from InKeep source object.
|
|
45
|
+
|
|
46
|
+
Args:
|
|
47
|
+
source: Source object from InKeep RAG response
|
|
48
|
+
|
|
49
|
+
Returns:
|
|
50
|
+
Extracted text content
|
|
51
|
+
"""
|
|
52
|
+
# Try to extract from content array first
|
|
53
|
+
if "content" in source:
|
|
54
|
+
text_parts = []
|
|
55
|
+
for content_item in source["content"]:
|
|
56
|
+
if content_item.get("type") == "text" and content_item.get("text"):
|
|
57
|
+
text_parts.append(content_item["text"])
|
|
58
|
+
if text_parts:
|
|
59
|
+
return "\n".join(text_parts)
|
|
60
|
+
|
|
61
|
+
# Fallback to source data
|
|
62
|
+
return source.get("data", "")
|
rasa/builder/download.py
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"""Download utilities for bot projects."""
|
|
2
|
+
|
|
3
|
+
import io
|
|
4
|
+
import os
|
|
5
|
+
import sys
|
|
6
|
+
import tarfile
|
|
7
|
+
from textwrap import dedent
|
|
8
|
+
from typing import Dict, Optional
|
|
9
|
+
|
|
10
|
+
import rasa
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _get_env_content() -> str:
|
|
14
|
+
"""Generate .env file content."""
|
|
15
|
+
return f"RASA_PRO_LICENSE={os.getenv('RASA_PRO_LICENSE')}\n"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _get_python_version_content() -> str:
|
|
19
|
+
"""Generate .python-version file content with current Python version."""
|
|
20
|
+
return f"{sys.version_info.major}.{sys.version_info.minor}\n"
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _get_rasa_pro_minor_version() -> str:
|
|
24
|
+
"""Get the minor version of Rasa Pro."""
|
|
25
|
+
return ".".join(rasa.__version__.split(".")[:2])
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _get_pyproject_toml_content(project_id: str) -> str:
|
|
29
|
+
"""Generate pyproject.toml file content."""
|
|
30
|
+
return dedent(
|
|
31
|
+
f"""
|
|
32
|
+
[project]
|
|
33
|
+
name = "{project_id}"
|
|
34
|
+
version = "0.1.0"
|
|
35
|
+
description = "Add your description for your Rasa bot here"
|
|
36
|
+
readme = "README.md"
|
|
37
|
+
dependencies = ["rasa-pro>={_get_rasa_pro_minor_version()}"]
|
|
38
|
+
requires-python = ">={sys.version_info.major}.{sys.version_info.minor}"
|
|
39
|
+
"""
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _get_readme_content() -> str:
|
|
44
|
+
"""Generate README.md file content with basic instructions."""
|
|
45
|
+
return dedent(
|
|
46
|
+
"""
|
|
47
|
+
# Rasa Assistant
|
|
48
|
+
|
|
49
|
+
This is your Rasa assistant project. Below are the basic commands to
|
|
50
|
+
get started.
|
|
51
|
+
|
|
52
|
+
## Prerequisites
|
|
53
|
+
Make sure you have [uv](https://docs.astral.sh/uv/) installed.
|
|
54
|
+
|
|
55
|
+
## Training the Assistant
|
|
56
|
+
|
|
57
|
+
To train your assistant with the current configuration and training data:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
uv run rasa train
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
This will create a model in the `models/` directory.
|
|
64
|
+
|
|
65
|
+
## Testing the Assistant
|
|
66
|
+
|
|
67
|
+
To test your assistant interactively in the command line:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
uv run rasa inspect
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Running the Assistant
|
|
74
|
+
|
|
75
|
+
To start the Rasa server:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
uv run rasa run
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
The server will be available at `http://localhost:5005`.
|
|
82
|
+
|
|
83
|
+
## Project Structure
|
|
84
|
+
|
|
85
|
+
- `config.yml` - Configuration for your NLU pipeline and policies
|
|
86
|
+
- `domain.yml` - Defines intents, entities, slots, responses, and actions
|
|
87
|
+
- `data/` - Flows of your bot
|
|
88
|
+
- `actions/` - Custom action code (if any)
|
|
89
|
+
|
|
90
|
+
## Next Steps
|
|
91
|
+
|
|
92
|
+
1. Customize your domain and flows
|
|
93
|
+
2. Train your model with `rasa train`
|
|
94
|
+
3. Test your assistant with `rasa inspect`
|
|
95
|
+
4. Deploy your assistant with `rasa run`
|
|
96
|
+
|
|
97
|
+
For more information, visit the [Rasa documentation](https://rasa.com/docs/).
|
|
98
|
+
"""
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def _add_file_to_tar(tar: tarfile.TarFile, filename: str, content: str) -> None:
|
|
103
|
+
"""Add a file with the given content to the tar archive.
|
|
104
|
+
|
|
105
|
+
Args:
|
|
106
|
+
tar: The tar file object to add to
|
|
107
|
+
filename: Name of the file in the archive
|
|
108
|
+
content: Content of the file as a string
|
|
109
|
+
"""
|
|
110
|
+
file_data = content.encode("utf-8")
|
|
111
|
+
tarinfo = tarfile.TarInfo(name=filename)
|
|
112
|
+
tarinfo.size = len(file_data)
|
|
113
|
+
tar.addfile(tarinfo, io.BytesIO(file_data))
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def create_bot_project_archive(
|
|
117
|
+
bot_files: Dict[str, Optional[str]], project_id: str
|
|
118
|
+
) -> bytes:
|
|
119
|
+
"""Create a tar.gz archive containing bot files and additional project files.
|
|
120
|
+
|
|
121
|
+
Args:
|
|
122
|
+
bot_files: Dictionary mapping file names to their content
|
|
123
|
+
project_id: Name of the project for the archive filename and pyproject.toml
|
|
124
|
+
|
|
125
|
+
Returns:
|
|
126
|
+
bytes: The tar.gz archive data
|
|
127
|
+
"""
|
|
128
|
+
tar_buffer = io.BytesIO()
|
|
129
|
+
|
|
130
|
+
with tarfile.open(fileobj=tar_buffer, mode="w:gz") as tar:
|
|
131
|
+
# Add bot files to archive
|
|
132
|
+
for filename, content in bot_files.items():
|
|
133
|
+
if content is not None:
|
|
134
|
+
_add_file_to_tar(tar, filename, content)
|
|
135
|
+
|
|
136
|
+
# Add additional project files
|
|
137
|
+
_add_file_to_tar(tar, ".env", _get_env_content())
|
|
138
|
+
_add_file_to_tar(tar, ".python-version", _get_python_version_content())
|
|
139
|
+
_add_file_to_tar(
|
|
140
|
+
tar,
|
|
141
|
+
"pyproject.toml",
|
|
142
|
+
_get_pyproject_toml_content(project_id),
|
|
143
|
+
)
|
|
144
|
+
_add_file_to_tar(tar, "README.md", _get_readme_content())
|
|
145
|
+
|
|
146
|
+
tar_buffer.seek(0)
|
|
147
|
+
return tar_buffer.getvalue()
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"""Custom exceptions for the prompt-to-bot service."""
|
|
2
|
+
|
|
3
|
+
from typing import Any, Dict, List, Optional
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class PromptToBotError(Exception):
|
|
7
|
+
"""Base exception for prompt-to-bot service."""
|
|
8
|
+
|
|
9
|
+
pass
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ValidationError(PromptToBotError):
|
|
13
|
+
"""Raised when Rasa project validation fails."""
|
|
14
|
+
|
|
15
|
+
def __init__(
|
|
16
|
+
self, message: str, validation_logs: Optional[List[Dict[str, Any]]] = None
|
|
17
|
+
):
|
|
18
|
+
super().__init__(message)
|
|
19
|
+
self.validation_logs = validation_logs or []
|
|
20
|
+
|
|
21
|
+
def get_logs(self, log_levels: Optional[List[str]]) -> List[Dict[str, Any]]:
|
|
22
|
+
"""Get logs filtered by given log levels."""
|
|
23
|
+
if len(self.validation_logs) == 0:
|
|
24
|
+
return []
|
|
25
|
+
|
|
26
|
+
error_log_entries: List[Dict[str, Any]] = []
|
|
27
|
+
for log_entry in self.validation_logs:
|
|
28
|
+
if log_levels is not None and log_entry.get("log_level") in log_levels:
|
|
29
|
+
error_log_entries.append(log_entry)
|
|
30
|
+
|
|
31
|
+
return error_log_entries
|
|
32
|
+
|
|
33
|
+
def get_error_message_with_logs(
|
|
34
|
+
self, log_levels: Optional[List[str]] = None
|
|
35
|
+
) -> str:
|
|
36
|
+
"""Get the error message with validation logs for specified log levels.
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
log_levels: List of log levels to include. If None, includes all logs.
|
|
40
|
+
|
|
41
|
+
Returns:
|
|
42
|
+
Error message with validation logs appended.
|
|
43
|
+
"""
|
|
44
|
+
error_message = str(self)
|
|
45
|
+
|
|
46
|
+
# Include all logs when no specific levels are specified
|
|
47
|
+
logs = self.validation_logs if log_levels is None else self.get_logs(log_levels)
|
|
48
|
+
|
|
49
|
+
if logs:
|
|
50
|
+
logs_text = "\n".join([str(log) for log in logs])
|
|
51
|
+
error_message += f"\n\nValidation Logs:\n{logs_text}\n"
|
|
52
|
+
|
|
53
|
+
return error_message
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class TrainingError(PromptToBotError):
|
|
57
|
+
"""Raised when model training fails."""
|
|
58
|
+
|
|
59
|
+
pass
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class LLMGenerationError(PromptToBotError):
|
|
63
|
+
"""Raised when LLM generation fails."""
|
|
64
|
+
|
|
65
|
+
pass
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class DocumentRetrievalError(PromptToBotError):
|
|
69
|
+
"""Raised when document retrieval fails."""
|
|
70
|
+
|
|
71
|
+
pass
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class SchemaValidationError(PromptToBotError):
|
|
75
|
+
"""Raised when schema validation fails."""
|
|
76
|
+
|
|
77
|
+
pass
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class AgentLoadError(PromptToBotError):
|
|
81
|
+
"""Raised when agent loading fails."""
|
|
82
|
+
|
|
83
|
+
pass
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class ProjectGenerationError(PromptToBotError):
|
|
87
|
+
"""Raised when project generation fails after retries."""
|
|
88
|
+
|
|
89
|
+
def __init__(self, message: str, attempts: int):
|
|
90
|
+
super().__init__(f"{message} (failed after {attempts} attempts)")
|
|
91
|
+
self.attempts = attempts
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
from typing import Literal
|
|
2
|
+
|
|
3
|
+
LAKERA_API_KEY_ENV_VAR = "LAKERA_API_KEY"
|
|
4
|
+
LAKERA_GUARD_ENDPOINT = "guard"
|
|
5
|
+
LAKERA_GUARD_RESULTS_ENDPOINT = "guard/results"
|
|
6
|
+
|
|
7
|
+
BLOCK_SCOPE_USER: Literal["user"] = "user"
|
|
8
|
+
BLOCK_SCOPE_PROJECT: Literal["project"] = "project"
|
|
9
|
+
BlockScope = Literal["user", "project"]
|