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
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
version: "3.1"
|
|
2
|
+
actions:
|
|
3
|
+
- "action_human_handoff"
|
|
4
|
+
|
|
5
|
+
intents:
|
|
6
|
+
- human_handoff
|
|
7
|
+
- speak_to_agent
|
|
8
|
+
- talk_to_human
|
|
9
|
+
- escalate
|
|
10
|
+
|
|
11
|
+
slots:
|
|
12
|
+
confirm_human_handoff:
|
|
13
|
+
type: "categorical"
|
|
14
|
+
mappings:
|
|
15
|
+
- type: "from_llm"
|
|
16
|
+
values:
|
|
17
|
+
- "Yes"
|
|
18
|
+
- "No"
|
|
19
|
+
|
|
20
|
+
responses:
|
|
21
|
+
utter_ask_confirm_human_handoff:
|
|
22
|
+
- text: "Do you want to be connected to a human agent?"
|
|
23
|
+
buttons:
|
|
24
|
+
- payload: "/SetSlots(confirm_human_handoff=Yes)"
|
|
25
|
+
title: "Yes"
|
|
26
|
+
- payload: "/SetSlots(confirm_human_handoff=No)"
|
|
27
|
+
title: "No"
|
|
28
|
+
|
|
29
|
+
utter_transferring_to_human:
|
|
30
|
+
- text: "You will be transfered to a human agent in a few moments."
|
|
31
|
+
|
|
32
|
+
utter_human_handoff_cancelled:
|
|
33
|
+
- text: "Ok, I understand you don't want to be connected to a human agent. Is there something else I can help you with?"
|
|
34
|
+
metadata:
|
|
35
|
+
rephrase: True
|
|
@@ -1,22 +1,55 @@
|
|
|
1
|
-
# This file contains the different endpoints your bot can use.
|
|
1
|
+
# This file contains the different endpoints your bot can use.
|
|
2
|
+
|
|
3
|
+
# Server which runs your custom actions.
|
|
4
|
+
# https://rasa.com/docs/rasa-pro/concepts/custom-actions
|
|
5
|
+
action_endpoint:
|
|
6
|
+
actions_module: "actions"
|
|
7
|
+
|
|
8
|
+
# Allow rephrasing of responses using a Rasa-hosted model
|
|
9
|
+
nlg:
|
|
10
|
+
type: rephrase
|
|
11
|
+
llm:
|
|
12
|
+
model_group: openai-gpt-4o
|
|
13
|
+
prompt_template: ./prompts/rephraser_demo_personality_prompt.jinja2
|
|
14
|
+
rephrase_all: False
|
|
15
|
+
summarize_history: False
|
|
16
|
+
|
|
17
|
+
# Model Groups - Integrate with different LLM providers
|
|
18
|
+
# https://rasa.com/docs/reference/config/components/llm-configuration/#model-groups
|
|
19
|
+
# https://platform.openai.com/docs/models
|
|
20
|
+
model_groups:
|
|
21
|
+
- id: openai-gpt-4o
|
|
22
|
+
models:
|
|
23
|
+
- provider: openai
|
|
24
|
+
model: gpt-4o-2024-11-20
|
|
25
|
+
timeout: 7
|
|
26
|
+
temperature: 0.0
|
|
27
|
+
top_p: 0.0
|
|
28
|
+
- id: gpt-3.5-turbo-openai-model
|
|
29
|
+
models:
|
|
30
|
+
- provider: openai
|
|
31
|
+
model: gpt-3.5-turbo
|
|
32
|
+
temperature: 0.3
|
|
33
|
+
# - id: rasa_command_generation_model
|
|
34
|
+
# models:
|
|
35
|
+
# - provider: rasa
|
|
36
|
+
# model: rasa/cmd_gen_codellama_13b_calm_demo
|
|
37
|
+
# api_base: "https://tutorial-llm.rasa.ai"
|
|
38
|
+
# - id: openai_embeddings
|
|
39
|
+
# models:
|
|
40
|
+
# - provider: openai
|
|
41
|
+
# model: text-embedding-ada-002
|
|
42
|
+
|
|
2
43
|
|
|
3
44
|
# Server where the models are pulled from.
|
|
4
45
|
# https://rasa.com/docs/rasa-pro/production/model-storage#fetching-models-from-a-server
|
|
5
|
-
|
|
6
46
|
#models:
|
|
7
47
|
# url: http://my-server.com/models/default_core@latest
|
|
8
48
|
# wait_time_between_pulls: 10 # [optional](default: 100)
|
|
9
49
|
|
|
10
|
-
# Server which runs your custom actions.
|
|
11
|
-
# https://rasa.com/docs/rasa-pro/concepts/custom-actions
|
|
12
|
-
|
|
13
|
-
action_endpoint:
|
|
14
|
-
actions_module: "actions"
|
|
15
|
-
|
|
16
50
|
# Tracker store which is used to store the conversations.
|
|
17
51
|
# By default the conversations are stored in memory.
|
|
18
52
|
# https://rasa.com/docs/rasa-pro/production/tracker-stores
|
|
19
|
-
|
|
20
53
|
#tracker_store:
|
|
21
54
|
# type: redis
|
|
22
55
|
# url: <host of the redis instance, e.g. localhost>
|
|
@@ -24,7 +57,6 @@ action_endpoint:
|
|
|
24
57
|
# db: <number of your database within redis, e.g. 0>
|
|
25
58
|
# password: <password used for authentication>
|
|
26
59
|
# use_ssl: <whether or not the communication is encrypted, default false>
|
|
27
|
-
|
|
28
60
|
#tracker_store:
|
|
29
61
|
# type: mongod
|
|
30
62
|
# url: <url to your mongo instance, e.g. mongodb://localhost:27017>
|
|
@@ -34,25 +66,8 @@ action_endpoint:
|
|
|
34
66
|
|
|
35
67
|
# Event broker which all conversation events should be streamed to.
|
|
36
68
|
# https://rasa.com/docs/rasa-pro/production/event-brokers
|
|
37
|
-
|
|
38
69
|
#event_broker:
|
|
39
70
|
# url: localhost
|
|
40
71
|
# username: username
|
|
41
72
|
# password: password
|
|
42
73
|
# queue: queue
|
|
43
|
-
|
|
44
|
-
# The lines below activate contextual rephrasing, using the default OpenAI language model.
|
|
45
|
-
# Ensure the OPENAI_API_KEY is set to prevent any missing API key errors.
|
|
46
|
-
# For more details, refer to the documentation:
|
|
47
|
-
# https://rasa.com/docs/rasa-pro/concepts/contextual-response-rephraser
|
|
48
|
-
# To enable the rephraser, remove the comment symbols in the lines below.
|
|
49
|
-
#nlg:
|
|
50
|
-
# type: rephrase
|
|
51
|
-
|
|
52
|
-
model_groups:
|
|
53
|
-
- id: openai-gpt-4o
|
|
54
|
-
models:
|
|
55
|
-
- provider: openai
|
|
56
|
-
model: gpt-4o-2024-11-20
|
|
57
|
-
request_timeout: 7
|
|
58
|
-
max_tokens: 256
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
The following is a conversation with an AI assistant.
|
|
2
|
+
The assistant is professional, calm, and highly attentive to detail.
|
|
3
|
+
Its main priorities are efficiency, speed, and accuracy when handling user requests.
|
|
4
|
+
|
|
5
|
+
Please rephrase the suggested AI response, staying close to the original meaning while
|
|
6
|
+
ensuring the assistant's tone remains formal yet empathetic, friendly, and reassuring.
|
|
7
|
+
It should convey patience, even with vague or repetitive questions, and be clear,
|
|
8
|
+
informative, and slightly humorous where appropriate.
|
|
9
|
+
|
|
10
|
+
Write your responses in English
|
|
11
|
+
|
|
12
|
+
Context / previous conversation with the user:
|
|
13
|
+
{{history}}
|
|
14
|
+
|
|
15
|
+
{{current_input}}
|
|
16
|
+
|
|
17
|
+
Suggested AI Response: {{suggested_response}}
|
|
18
|
+
|
|
19
|
+
Rephrased AI Response:
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import os
|
|
3
4
|
import tempfile
|
|
4
5
|
from typing import Any, Dict, List, Optional, Text
|
|
5
6
|
|
|
@@ -78,14 +79,35 @@ def _get_domain_from_importer(config: Dict[Text, Any]) -> Domain:
|
|
|
78
79
|
Returns:
|
|
79
80
|
A Domain object .
|
|
80
81
|
"""
|
|
81
|
-
with
|
|
82
|
-
|
|
82
|
+
# We create the file with delete=False so that it can be re-opened on
|
|
83
|
+
# Windows. If delete=True, the file is opened with the _O_TEMPORARY flag
|
|
84
|
+
# which blocks any second open() call.
|
|
85
|
+
tmp = tempfile.NamedTemporaryFile("w+", suffix=".yml", delete=False)
|
|
86
|
+
|
|
87
|
+
try:
|
|
88
|
+
path = tmp.name
|
|
89
|
+
|
|
90
|
+
# write_yaml() re-opens the same path. On Windows an already-open
|
|
91
|
+
# handle keeps the file locked for further opens, so we close
|
|
92
|
+
# the first handle before we call write_yaml().
|
|
93
|
+
tmp.close()
|
|
94
|
+
write_yaml(config, path)
|
|
95
|
+
|
|
83
96
|
importer = TrainingDataImporter.load_from_config(
|
|
84
97
|
domain_path=FlowSyncImporter.default_pattern_path(),
|
|
85
|
-
config_path=
|
|
98
|
+
config_path=path,
|
|
86
99
|
)
|
|
87
100
|
return importer.get_domain()
|
|
88
101
|
|
|
102
|
+
finally:
|
|
103
|
+
# Because we passed delete=False above, Python will not clean the file
|
|
104
|
+
# To avoid leaving garbage in the temp directory after the tests run,
|
|
105
|
+
# we remove it explicitly.
|
|
106
|
+
try:
|
|
107
|
+
os.remove(path)
|
|
108
|
+
except FileNotFoundError:
|
|
109
|
+
pass
|
|
110
|
+
|
|
89
111
|
|
|
90
112
|
def get_pattern_defaults(config: Dict[Text, Any]) -> PatternDefaults:
|
|
91
113
|
"""Get the default flows, responses and slots for patterns.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Account actions
|
|
2
|
+
from actions.accounts.action_ask_account import ActionAskAccount
|
|
3
|
+
from actions.accounts.action_check_balance import ActionCheckBalance
|
|
4
|
+
|
|
5
|
+
# General actions
|
|
6
|
+
from actions.action_session_start import ActionSessionStart
|
|
7
|
+
|
|
8
|
+
# Card actions
|
|
9
|
+
from actions.cards.action_ask_card import ActionAskCard
|
|
10
|
+
from actions.cards.action_check_card_existence import ActionCheckCardExistence
|
|
11
|
+
from actions.cards.action_update_card_status import ActionUpdateCardStatus
|
|
12
|
+
|
|
13
|
+
# Transfer actions
|
|
14
|
+
from actions.transfers.action_add_payee import ActionAddPayee
|
|
15
|
+
from actions.transfers.action_ask_account_from import ActionAskAccountFrom
|
|
16
|
+
from actions.transfers.action_check_payee_existence import ActionCheckPayeeExistence
|
|
17
|
+
from actions.transfers.action_check_sufficient_funds import ActionCheckSufficientFunds
|
|
18
|
+
from actions.transfers.action_list_payees import ActionListPayees
|
|
19
|
+
from actions.transfers.action_process_immediate_payment import (
|
|
20
|
+
ActionProcessImmediatePayment,
|
|
21
|
+
)
|
|
22
|
+
from actions.transfers.action_remove_payee import ActionRemovePayee
|
|
23
|
+
from actions.transfers.action_schedule_payment import ActionSchedulePayment
|
|
24
|
+
from actions.transfers.action_validate_payment_date import ActionValidatePaymentDate
|
|
25
|
+
|
|
26
|
+
__all__ = [
|
|
27
|
+
# General actions
|
|
28
|
+
"ActionSessionStart",
|
|
29
|
+
# Account actions
|
|
30
|
+
"ActionAskAccount",
|
|
31
|
+
"ActionCheckBalance",
|
|
32
|
+
# Card actions
|
|
33
|
+
"ActionAskCard",
|
|
34
|
+
"ActionCheckCardExistence",
|
|
35
|
+
"ActionUpdateCardStatus",
|
|
36
|
+
# Transfer actions
|
|
37
|
+
"ActionAddPayee",
|
|
38
|
+
"ActionAskAccountFrom",
|
|
39
|
+
"ActionCheckPayeeExistence",
|
|
40
|
+
"ActionCheckSufficientFunds",
|
|
41
|
+
"ActionListPayees",
|
|
42
|
+
"ActionProcessImmediatePayment",
|
|
43
|
+
"ActionRemovePayee",
|
|
44
|
+
"ActionSchedulePayment",
|
|
45
|
+
"ActionValidatePaymentDate",
|
|
46
|
+
]
|
|
File without changes
|
rasa/cli/project_templates/finance/actions/{action_ask_account.py → accounts/action_ask_account.py}
RENAMED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
from typing import Any, Dict, List, Text
|
|
2
2
|
|
|
3
3
|
from rasa_sdk import Action, Tracker
|
|
4
|
-
from rasa_sdk.events import SlotSet
|
|
5
4
|
from rasa_sdk.executor import CollectingDispatcher
|
|
6
5
|
|
|
7
6
|
from actions.database import Database
|
|
@@ -17,18 +16,19 @@ class ActionAskAccount(Action):
|
|
|
17
16
|
tracker: Tracker,
|
|
18
17
|
domain: Dict[Text, Any],
|
|
19
18
|
) -> List[Dict[Text, Any]]:
|
|
20
|
-
|
|
19
|
+
name = tracker.get_slot("name")
|
|
21
20
|
|
|
22
21
|
db = Database()
|
|
23
22
|
|
|
24
23
|
# Get user information
|
|
25
|
-
user = db.get_user_by_name(
|
|
24
|
+
user = db.get_user_by_name(name)
|
|
26
25
|
if not user:
|
|
27
26
|
dispatcher.utter_message(text="User not found.")
|
|
28
27
|
return []
|
|
29
28
|
|
|
30
29
|
# Get all accounts for the user
|
|
31
|
-
|
|
30
|
+
user_id = int(user["id"])
|
|
31
|
+
accounts = db.get_accounts_by_user(user_id)
|
|
32
32
|
|
|
33
33
|
if not accounts:
|
|
34
34
|
dispatcher.utter_message(text="No accounts found for this user.")
|
|
@@ -36,15 +36,12 @@ class ActionAskAccount(Action):
|
|
|
36
36
|
|
|
37
37
|
buttons = [
|
|
38
38
|
{
|
|
39
|
-
"content_type": "text",
|
|
40
39
|
"title": f"{account['number']} ({account['type'].title()})",
|
|
41
|
-
"payload":
|
|
40
|
+
"payload": account["number"],
|
|
42
41
|
}
|
|
43
42
|
for account in accounts
|
|
44
43
|
]
|
|
45
44
|
message = "Which account would you like the balance for?"
|
|
46
45
|
dispatcher.utter_message(text=message, buttons=buttons)
|
|
47
46
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return [SlotSet("account", selected_account)]
|
|
47
|
+
return []
|
|
@@ -16,25 +16,25 @@ class ActionCheckBalance(Action):
|
|
|
16
16
|
tracker: Tracker,
|
|
17
17
|
domain: Dict[Text, Any],
|
|
18
18
|
) -> List[Dict[Text, Any]]:
|
|
19
|
-
|
|
19
|
+
name = tracker.get_slot("name")
|
|
20
20
|
account_number = tracker.get_slot("account")
|
|
21
21
|
|
|
22
22
|
db = Database()
|
|
23
23
|
|
|
24
24
|
# Get user information
|
|
25
|
-
user = db.get_user_by_name(
|
|
25
|
+
user = db.get_user_by_name(name)
|
|
26
26
|
if not user:
|
|
27
27
|
dispatcher.utter_message(text="User not found.")
|
|
28
28
|
return []
|
|
29
29
|
|
|
30
30
|
# Get account information
|
|
31
|
-
account = db.get_account_by_user_and_number(user["id"], account_number)
|
|
31
|
+
account = db.get_account_by_user_and_number(int(user["id"]), account_number)
|
|
32
32
|
if not account:
|
|
33
33
|
dispatcher.utter_message(text="Account not found.")
|
|
34
34
|
return []
|
|
35
35
|
|
|
36
36
|
current_balance = float(account["balance"])
|
|
37
37
|
|
|
38
|
-
message = f"The balance is: ${current_balance}"
|
|
38
|
+
message = f"The balance on that account is: ${current_balance}"
|
|
39
39
|
dispatcher.utter_message(text=message)
|
|
40
40
|
return []
|
|
@@ -3,6 +3,7 @@ from typing import Any, Dict, List, Text
|
|
|
3
3
|
|
|
4
4
|
from rasa_sdk import Action, Tracker
|
|
5
5
|
from rasa_sdk.events import ActionExecuted, SlotSet
|
|
6
|
+
from rasa_sdk.executor import CollectingDispatcher
|
|
6
7
|
|
|
7
8
|
from actions.database import Database
|
|
8
9
|
|
|
@@ -15,15 +16,16 @@ class ActionSessionStart(Action):
|
|
|
15
16
|
current_date = datetime.now().strftime("%d/%m/%Y")
|
|
16
17
|
return [SlotSet("current_date", current_date)]
|
|
17
18
|
|
|
18
|
-
def set_user_profile(self,
|
|
19
|
+
def set_user_profile(self, name: str) -> List[Dict[Text, Any]]:
|
|
19
20
|
db = Database()
|
|
20
21
|
|
|
21
22
|
# Get user information
|
|
22
|
-
user = db.get_user_by_name(
|
|
23
|
+
user = db.get_user_by_name(name)
|
|
23
24
|
|
|
24
25
|
if user:
|
|
25
26
|
return [
|
|
26
|
-
SlotSet("
|
|
27
|
+
SlotSet("name", user["name"]),
|
|
28
|
+
SlotSet("username", user["username"]),
|
|
27
29
|
SlotSet("segment", user["segment"]),
|
|
28
30
|
SlotSet("email_address", user["email"]),
|
|
29
31
|
SlotSet("physical_address", user["address"]),
|
|
@@ -32,7 +34,10 @@ class ActionSessionStart(Action):
|
|
|
32
34
|
return []
|
|
33
35
|
|
|
34
36
|
def run(
|
|
35
|
-
self,
|
|
37
|
+
self,
|
|
38
|
+
dispatcher: CollectingDispatcher,
|
|
39
|
+
tracker: Tracker,
|
|
40
|
+
domain: Dict[Text, Any],
|
|
36
41
|
) -> List[Dict[Text, Any]]:
|
|
37
42
|
current_date_events = self.set_current_date()
|
|
38
43
|
|
|
@@ -53,10 +58,10 @@ class ActionSessionStart(Action):
|
|
|
53
58
|
# and Business
|
|
54
59
|
#
|
|
55
60
|
# Intructions: Just toggle the comments of the following 2 lines.
|
|
56
|
-
|
|
61
|
+
name = "John Smith"
|
|
57
62
|
# username = random.choice(["John Smith", "Mary Brown", "Dan Young"])
|
|
58
63
|
|
|
59
|
-
user_profile_events = self.set_user_profile(
|
|
64
|
+
user_profile_events = self.set_user_profile(name)
|
|
60
65
|
|
|
61
66
|
events = (
|
|
62
67
|
current_date_events
|
|
File without changes
|
|
@@ -16,18 +16,19 @@ class ActionAskCard(Action):
|
|
|
16
16
|
tracker: Tracker,
|
|
17
17
|
domain: Dict[Text, Any],
|
|
18
18
|
) -> List[Dict[Text, Any]]:
|
|
19
|
-
|
|
19
|
+
name = tracker.get_slot("name")
|
|
20
20
|
|
|
21
21
|
db = Database()
|
|
22
22
|
|
|
23
23
|
# Get user information
|
|
24
|
-
user = db.get_user_by_name(
|
|
24
|
+
user = db.get_user_by_name(name)
|
|
25
25
|
if not user:
|
|
26
26
|
dispatcher.utter_message(text="User not found.")
|
|
27
27
|
return []
|
|
28
28
|
|
|
29
29
|
# Get all cards for the user
|
|
30
|
-
|
|
30
|
+
user_id = int(user["id"])
|
|
31
|
+
cards = db.get_cards_by_user(user_id)
|
|
31
32
|
|
|
32
33
|
if not cards:
|
|
33
34
|
dispatcher.utter_message(text="No cards found for this user.")
|
|
@@ -14,19 +14,20 @@ class ActionCheckCardExistence(Action):
|
|
|
14
14
|
def run(
|
|
15
15
|
self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[str, Any]
|
|
16
16
|
) -> List[Dict[Text, Any]]:
|
|
17
|
-
|
|
17
|
+
name = tracker.get_slot("name")
|
|
18
18
|
card_number = tracker.get_slot("card_number")
|
|
19
19
|
|
|
20
20
|
db = Database()
|
|
21
21
|
|
|
22
22
|
# Get user information
|
|
23
|
-
user = db.get_user_by_name(
|
|
23
|
+
user = db.get_user_by_name(name)
|
|
24
24
|
if not user:
|
|
25
25
|
dispatcher.utter_message(text="User not found.")
|
|
26
26
|
return []
|
|
27
27
|
|
|
28
28
|
# Get all cards for the user
|
|
29
|
-
|
|
29
|
+
user_id = int(user["id"])
|
|
30
|
+
cards = db.get_cards_by_user(user_id)
|
|
30
31
|
card_numbers = [card["number"] for card in cards]
|
|
31
32
|
|
|
32
33
|
if card_number in card_numbers:
|
|
@@ -14,32 +14,41 @@ class ActionUpdateCardStatus(Action):
|
|
|
14
14
|
def run(
|
|
15
15
|
self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[str, Any]
|
|
16
16
|
) -> List[Dict[Text, Any]]:
|
|
17
|
-
|
|
18
|
-
card_number = tracker.get_slot("
|
|
17
|
+
name = tracker.get_slot("name")
|
|
18
|
+
card_number = tracker.get_slot("card")
|
|
19
19
|
new_status = "inactive"
|
|
20
20
|
|
|
21
21
|
db = Database()
|
|
22
22
|
|
|
23
23
|
# Get user information
|
|
24
|
-
user = db.get_user_by_name(
|
|
24
|
+
user = db.get_user_by_name(name)
|
|
25
25
|
if not user:
|
|
26
26
|
dispatcher.utter_message(text="User not found.")
|
|
27
27
|
return []
|
|
28
28
|
|
|
29
29
|
# Get card information to verify it belongs to the user
|
|
30
30
|
card = db.get_card_by_number(card_number)
|
|
31
|
-
if not card
|
|
32
|
-
dispatcher.utter_message(text="
|
|
31
|
+
if not card:
|
|
32
|
+
dispatcher.utter_message(text="I can't find the card within your account.")
|
|
33
|
+
return []
|
|
34
|
+
|
|
35
|
+
# Check if card belongs to the user
|
|
36
|
+
try:
|
|
37
|
+
if int(card["user_id"]) != int(user["id"]):
|
|
38
|
+
dispatcher.utter_message(
|
|
39
|
+
text="That card is not associated with your account."
|
|
40
|
+
)
|
|
41
|
+
return []
|
|
42
|
+
except (ValueError, TypeError, KeyError):
|
|
43
|
+
dispatcher.utter_message(text="Error verifying card ownership.")
|
|
33
44
|
return []
|
|
34
45
|
|
|
35
46
|
# Update card status
|
|
36
47
|
success = db.update_card_status(card_number, new_status)
|
|
37
48
|
|
|
38
49
|
if success:
|
|
39
|
-
dispatcher.utter_message(text=f"Card status updated to {new_status}.")
|
|
40
50
|
return [SlotSet("card_status", new_status)]
|
|
41
51
|
else:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
)
|
|
52
|
+
# Log the error but don't show technical error to user
|
|
53
|
+
print(f"Error: Failed to update card status for card {card_number}")
|
|
45
54
|
return []
|
|
File without changes
|
rasa/cli/project_templates/finance/actions/{action_add_payee.py → transfers/action_add_payee.py}
RENAMED
|
@@ -17,7 +17,7 @@ class ActionAddPayee(Action):
|
|
|
17
17
|
tracker: Tracker,
|
|
18
18
|
domain: Dict[Text, Any],
|
|
19
19
|
) -> List[Dict[Text, Any]]:
|
|
20
|
-
|
|
20
|
+
name = tracker.get_slot("name")
|
|
21
21
|
payee_name = tracker.get_slot("payee_name")
|
|
22
22
|
account_number = tracker.get_slot("account_number")
|
|
23
23
|
sort_code = tracker.get_slot("sort_code")
|
|
@@ -27,14 +27,19 @@ class ActionAddPayee(Action):
|
|
|
27
27
|
db = Database()
|
|
28
28
|
|
|
29
29
|
# Get user information
|
|
30
|
-
user = db.get_user_by_name(
|
|
30
|
+
user = db.get_user_by_name(name)
|
|
31
31
|
if not user:
|
|
32
32
|
dispatcher.utter_message(text="User not found.")
|
|
33
33
|
return []
|
|
34
34
|
|
|
35
35
|
# Add the payee
|
|
36
36
|
success = db.add_payee(
|
|
37
|
-
user["id"],
|
|
37
|
+
int(user["id"]),
|
|
38
|
+
payee_name,
|
|
39
|
+
sort_code,
|
|
40
|
+
account_number,
|
|
41
|
+
payee_type,
|
|
42
|
+
reference,
|
|
38
43
|
)
|
|
39
44
|
|
|
40
45
|
if success:
|
|
@@ -16,19 +16,20 @@ class ActionAskAccountFrom(Action):
|
|
|
16
16
|
tracker: Tracker,
|
|
17
17
|
domain: Dict[Text, Any],
|
|
18
18
|
) -> List[Dict[Text, Any]]:
|
|
19
|
-
|
|
19
|
+
name = tracker.get_slot("name")
|
|
20
20
|
|
|
21
21
|
db = Database()
|
|
22
22
|
|
|
23
23
|
# Get user information
|
|
24
|
-
user = db.get_user_by_name(
|
|
24
|
+
user = db.get_user_by_name(name)
|
|
25
25
|
if not user:
|
|
26
26
|
dispatcher.utter_message(text="User not found.")
|
|
27
27
|
return []
|
|
28
28
|
|
|
29
29
|
# Get all accounts for the user
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
user_id = int(user["id"])
|
|
31
|
+
accounts = db.get_accounts_by_user(user_id)
|
|
32
|
+
print(f"DEBUG: Accounts found: {accounts}")
|
|
32
33
|
if not accounts:
|
|
33
34
|
dispatcher.utter_message(text="No accounts found for this user.")
|
|
34
35
|
return []
|
|
@@ -17,19 +17,19 @@ class ActionCheckPayeeExistence(Action):
|
|
|
17
17
|
tracker: Tracker,
|
|
18
18
|
domain: Dict[Text, Any],
|
|
19
19
|
) -> List[Dict[Text, Any]]:
|
|
20
|
-
|
|
20
|
+
name = tracker.get_slot("name")
|
|
21
21
|
payee_name = tracker.get_slot("payee_name")
|
|
22
22
|
|
|
23
23
|
db = Database()
|
|
24
24
|
|
|
25
25
|
# Get user information
|
|
26
|
-
user = db.get_user_by_name(
|
|
26
|
+
user = db.get_user_by_name(name)
|
|
27
27
|
if not user:
|
|
28
28
|
dispatcher.utter_message(text="User not found.")
|
|
29
29
|
return []
|
|
30
30
|
|
|
31
31
|
# Check if payee exists
|
|
32
|
-
payee = db.get_payee_by_name_and_user(payee_name, user["id"])
|
|
32
|
+
payee = db.get_payee_by_name_and_user(payee_name, int(user["id"]))
|
|
33
33
|
|
|
34
34
|
if payee:
|
|
35
35
|
return [SlotSet("payee_exists", True)]
|
|
@@ -17,25 +17,24 @@ class ActionCheckSufficientFunds(Action):
|
|
|
17
17
|
tracker: Tracker,
|
|
18
18
|
domain: Dict[Text, Any],
|
|
19
19
|
) -> List[Dict[Text, Any]]:
|
|
20
|
-
|
|
20
|
+
name = tracker.get_slot("name")
|
|
21
21
|
account_from = tracker.get_slot("account_from")
|
|
22
22
|
amount = float(tracker.get_slot("amount"))
|
|
23
23
|
|
|
24
24
|
db = Database()
|
|
25
25
|
|
|
26
26
|
# Get user information
|
|
27
|
-
user = db.get_user_by_name(
|
|
27
|
+
user = db.get_user_by_name(name)
|
|
28
28
|
if not user:
|
|
29
29
|
dispatcher.utter_message(text="User not found.")
|
|
30
30
|
return []
|
|
31
31
|
|
|
32
32
|
# Check if user has sufficient funds
|
|
33
33
|
has_sufficient_funds = db.check_sufficient_funds(
|
|
34
|
-
user["id"], account_from, amount
|
|
34
|
+
int(user["id"]), account_from, amount
|
|
35
35
|
)
|
|
36
36
|
|
|
37
37
|
if has_sufficient_funds:
|
|
38
38
|
return [SlotSet("sufficient_funds", True)]
|
|
39
39
|
else:
|
|
40
|
-
dispatcher.utter_message(text="Insufficient funds for this transaction.")
|
|
41
40
|
return [SlotSet("sufficient_funds", False)]
|
rasa/cli/project_templates/finance/actions/{action_list_payees.py → transfers/action_list_payees.py}
RENAMED
|
@@ -16,18 +16,19 @@ class ActionListPayees(Action):
|
|
|
16
16
|
tracker: Tracker,
|
|
17
17
|
domain: Dict[Text, Any],
|
|
18
18
|
) -> List[Dict[Text, Any]]:
|
|
19
|
-
|
|
19
|
+
name = tracker.get_slot("name")
|
|
20
20
|
|
|
21
21
|
db = Database()
|
|
22
22
|
|
|
23
23
|
# Get user information
|
|
24
|
-
user = db.get_user_by_name(
|
|
24
|
+
user = db.get_user_by_name(name)
|
|
25
25
|
if not user:
|
|
26
26
|
dispatcher.utter_message(text="User not found.")
|
|
27
27
|
return []
|
|
28
28
|
|
|
29
29
|
# Get payees for the user
|
|
30
|
-
|
|
30
|
+
user_id = int(user["id"])
|
|
31
|
+
payees = db.get_payees_by_user(user_id)
|
|
31
32
|
|
|
32
33
|
if not payees:
|
|
33
34
|
dispatcher.utter_message(text="You have no payees set up.")
|