rasa-pro 3.14.0.dev20250901__py3-none-any.whl → 3.14.0.dev20250922__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/config.py +1 -0
- rasa/builder/copilot/constants.py +3 -0
- rasa/builder/copilot/copilot.py +128 -54
- rasa/builder/copilot/models.py +39 -3
- rasa/builder/copilot/prompts/copilot_system_prompt.jinja2 +183 -188
- rasa/builder/copilot/prompts/latest_user_message_context_prompt.jinja2 +61 -0
- rasa/builder/copilot/telemetry.py +46 -20
- rasa/builder/document_retrieval/models.py +3 -3
- rasa/builder/download.py +1 -8
- rasa/builder/jobs.py +33 -21
- rasa/builder/main.py +38 -62
- rasa/builder/models.py +7 -7
- rasa/builder/project_generator.py +143 -147
- rasa/builder/service.py +42 -27
- rasa/builder/template_cache.py +69 -0
- rasa/builder/training_service.py +74 -4
- rasa/cli/project_templates/basic/README.md +23 -0
- rasa/cli/project_templates/basic/actions/actions.md +10 -0
- rasa/cli/project_templates/basic/config.yml +6 -4
- rasa/cli/project_templates/basic/data/data.md +5 -6
- rasa/cli/project_templates/basic/domain/domain.md +7 -5
- rasa/cli/project_templates/basic/domain/general/show_faqs.yml +1 -1
- rasa/cli/project_templates/basic/endpoints.yml +5 -1
- rasa/cli/project_templates/default/config.yml +4 -0
- rasa/cli/project_templates/default/endpoints.yml +4 -0
- rasa/cli/project_templates/finance/README.md +26 -0
- rasa/cli/project_templates/finance/actions/__init__.py +0 -46
- rasa/cli/project_templates/finance/actions/accounts/check_balance.py +18 -0
- rasa/cli/project_templates/finance/actions/actions.md +15 -0
- rasa/cli/project_templates/finance/actions/{transfers/action_process_immediate_payment.py → cards/check_that_card_exists.py} +6 -3
- rasa/cli/project_templates/finance/actions/cards/list_cards.py +22 -0
- rasa/cli/project_templates/finance/actions/contacts/__init__.py +0 -0
- rasa/cli/project_templates/finance/actions/contacts/add_contact.py +30 -0
- rasa/cli/project_templates/finance/actions/contacts/list_contacts.py +22 -0
- rasa/cli/project_templates/finance/actions/contacts/remove_contact.py +35 -0
- rasa/cli/project_templates/finance/actions/db.py +117 -0
- rasa/cli/project_templates/finance/actions/general/__init__.py +0 -0
- rasa/cli/project_templates/finance/actions/general/action_human_handoff.py +49 -0
- rasa/cli/project_templates/finance/actions/transfers/check_transfer_funds.py +27 -0
- rasa/cli/project_templates/finance/actions/transfers/check_transfer_limit.py +36 -0
- rasa/cli/project_templates/finance/actions/transfers/execute_recurrent_payment.py +20 -0
- rasa/cli/project_templates/finance/actions/transfers/execute_transfer.py +45 -0
- rasa/cli/project_templates/finance/actions/transfers/list_transactions.py +32 -0
- rasa/cli/project_templates/finance/config.yml +8 -0
- rasa/cli/project_templates/finance/credentials.yml +7 -6
- rasa/cli/project_templates/finance/data/accounts/check_balance.yml +3 -4
- rasa/cli/project_templates/finance/data/accounts/download_statements.yml +26 -0
- rasa/cli/project_templates/finance/data/bills/bill_pay_reminder.yml +25 -0
- rasa/cli/project_templates/finance/data/cards/activate_card.yml +35 -0
- rasa/cli/project_templates/finance/data/cards/block_card.yml +37 -58
- rasa/cli/project_templates/finance/data/cards/list_cards.yml +14 -0
- rasa/cli/project_templates/finance/data/cards/replace_card.yml +16 -0
- rasa/cli/project_templates/finance/data/cards/replace_eligible_card.yml +29 -0
- rasa/cli/project_templates/finance/data/contacts/add_contact.yml +33 -0
- rasa/cli/project_templates/finance/data/contacts/list_contacts.yml +14 -0
- rasa/cli/project_templates/finance/data/contacts/remove_contact.yml +31 -0
- rasa/cli/project_templates/finance/data/data.md +14 -0
- rasa/cli/project_templates/finance/data/general/bot_challenge.yml +6 -0
- rasa/cli/project_templates/finance/data/general/goodbye.yml +1 -1
- rasa/cli/project_templates/finance/data/general/hello.yml +1 -2
- rasa/cli/project_templates/finance/data/general/help.yml +2 -2
- rasa/cli/project_templates/finance/data/general/human_handoff.yml +2 -2
- rasa/cli/project_templates/finance/data/system/patterns/pattern_session_start.yml +1 -1
- rasa/cli/project_templates/finance/data/transfers/check_transfer_limit.yml +18 -0
- rasa/cli/project_templates/finance/data/transfers/list_transactions.yml +46 -0
- rasa/cli/project_templates/finance/data/transfers/move_money_between_accounts.yml +51 -0
- rasa/cli/project_templates/finance/data/transfers/transfer_money.yml +29 -62
- rasa/cli/project_templates/finance/data/transfers/transfer_money_to_a_third_party.yml +175 -0
- rasa/cli/project_templates/finance/db/cards.json +18 -0
- rasa/cli/project_templates/finance/db/contacts.json +10 -0
- rasa/cli/project_templates/finance/db/my_account.json +6 -0
- rasa/cli/project_templates/finance/db/transactions.json +22 -0
- rasa/cli/project_templates/finance/docs/docs.md +8 -0
- rasa/cli/project_templates/finance/docs/fenlo_banking_faq/account_features/budgeting_analytics.txt +22 -0
- rasa/cli/project_templates/finance/docs/fenlo_banking_faq/account_features/multi_currency_accounts.txt +19 -0
- rasa/cli/project_templates/finance/docs/fenlo_banking_faq/account_features/premium_benefits.txt +19 -0
- rasa/cli/project_templates/finance/docs/fenlo_banking_faq/card_management/contactless_limits.txt +16 -0
- rasa/cli/project_templates/finance/docs/fenlo_banking_faq/card_management/freeze_unfreeze_card.txt +16 -0
- rasa/cli/project_templates/finance/docs/fenlo_banking_faq/card_management/lost_stolen_card.txt +19 -0
- rasa/cli/project_templates/finance/docs/fenlo_banking_faq/money_transfers/instant_payments.txt +19 -0
- rasa/cli/project_templates/finance/docs/fenlo_banking_faq/money_transfers/international_transfers.txt +19 -0
- rasa/cli/project_templates/finance/docs/fenlo_banking_faq/security_fraud/fraud_protection.txt +22 -0
- rasa/cli/project_templates/finance/docs/fenlo_banking_faq/security_fraud/secure_payments.txt +22 -0
- rasa/cli/project_templates/finance/domain/accounts/check_balance.yml +9 -5
- rasa/cli/project_templates/finance/domain/accounts/download_statements.yml +40 -0
- rasa/cli/project_templates/finance/domain/bills/bill_pay_reminder.yml +49 -0
- rasa/cli/project_templates/finance/domain/cards/activate_card.yml +24 -0
- rasa/cli/project_templates/finance/domain/cards/block_card.yml +33 -90
- rasa/cli/project_templates/finance/domain/cards/list_cards.yml +16 -0
- rasa/cli/project_templates/finance/domain/cards/replace_card.yml +43 -0
- rasa/cli/project_templates/finance/domain/cards/shared.yml +15 -0
- rasa/cli/project_templates/finance/domain/contacts/add_contact.yml +37 -0
- rasa/cli/project_templates/finance/domain/contacts/list_contacts.yml +16 -0
- rasa/cli/project_templates/finance/domain/contacts/remove_contact.yml +32 -0
- rasa/cli/project_templates/finance/domain/domain.md +18 -0
- rasa/cli/project_templates/finance/domain/general/_shared.yml +39 -0
- rasa/cli/project_templates/finance/domain/general/bot_challenge.yml +4 -0
- rasa/cli/project_templates/finance/domain/general/cannot_handle.yml +5 -2
- rasa/cli/project_templates/finance/domain/general/feedback.yml +0 -3
- rasa/cli/project_templates/finance/domain/general/goodbye.yml +6 -6
- rasa/cli/project_templates/finance/domain/general/human_handoff.yml +10 -9
- rasa/cli/project_templates/finance/domain/general/welcome.yml +33 -2
- rasa/cli/project_templates/finance/domain/transfers/check_transfer_limit.yml +32 -0
- rasa/cli/project_templates/finance/domain/transfers/list_transactions.yml +44 -0
- rasa/cli/project_templates/finance/domain/transfers/shared.yml +17 -0
- rasa/cli/project_templates/finance/domain/transfers/transfer_money.yml +203 -61
- rasa/cli/project_templates/finance/endpoints.yml +8 -4
- rasa/cli/project_templates/finance/prompts/rephraser_demo_personality_prompt.jinja2 +31 -12
- rasa/cli/project_templates/finance/tests/e2e_test_cases/accounts/check_balance.yml +9 -0
- rasa/cli/project_templates/finance/tests/e2e_test_cases/accounts/download_statements.yml +43 -0
- rasa/cli/project_templates/finance/tests/e2e_test_cases/cards/block_card.yml +55 -0
- rasa/cli/project_templates/finance/tests/e2e_test_cases/general/bot_challenge.yml +8 -0
- rasa/cli/project_templates/finance/tests/e2e_test_cases/general/feedback.yml +46 -0
- rasa/cli/project_templates/finance/tests/e2e_test_cases/general/goodbye.yml +9 -0
- rasa/cli/project_templates/finance/tests/e2e_test_cases/general/hello.yml +8 -0
- rasa/cli/project_templates/finance/tests/e2e_test_cases/general/human_handoff.yml +35 -0
- rasa/cli/project_templates/finance/tests/e2e_test_cases/general/patterns.yml +22 -0
- rasa/cli/project_templates/finance/tests/e2e_test_cases/transfers/transfer_money.yml +56 -0
- rasa/cli/project_templates/telco/README.md +25 -0
- rasa/cli/project_templates/telco/actions/actions.md +12 -0
- rasa/cli/project_templates/telco/config.yml +6 -4
- rasa/cli/project_templates/telco/data/data.md +11 -0
- rasa/cli/project_templates/telco/data/general/human_handoff.yml +1 -1
- rasa/cli/project_templates/telco/docs/docs.md +3 -0
- rasa/cli/project_templates/telco/domain/domain.md +13 -0
- rasa/cli/project_templates/telco/domain/general/human_handoff.yml +3 -6
- rasa/cli/project_templates/telco/endpoints.yml +5 -1
- rasa/cli/project_templates/telco/prompts/rephraser_demo_personality_prompt.jinja2 +1 -1
- rasa/cli/project_templates/telco/tests/e2e_test_cases/billing/understand_bill.yml +67 -0
- rasa/cli/project_templates/telco/tests/e2e_test_cases/general/bot_challenge.yml +8 -0
- rasa/cli/project_templates/telco/tests/e2e_test_cases/general/feedback.yml +46 -0
- rasa/cli/project_templates/telco/tests/e2e_test_cases/general/goodbye.yml +9 -0
- rasa/cli/project_templates/telco/tests/e2e_test_cases/general/hello.yml +8 -0
- rasa/cli/project_templates/telco/tests/e2e_test_cases/general/human_handoff.yml +35 -0
- rasa/cli/project_templates/telco/tests/e2e_test_cases/general/patterns.yml +23 -0
- rasa/cli/project_templates/telco/tests/e2e_test_cases/network/solve_internet_issue.yml +57 -0
- rasa/core/actions/action_run_slot_rejections.py +1 -1
- rasa/core/actions/direct_custom_actions_executor.py +9 -2
- rasa/core/brokers/broker.py +1 -1
- rasa/core/brokers/kafka.py +52 -8
- rasa/core/channels/development_inspector.py +1 -21
- rasa/core/channels/hangouts.py +2 -2
- rasa/core/channels/inspector/dist/assets/{arc-18042c22.js → arc-35222594.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{blockDiagram-38ab4fdb-fdd6bcfa.js → blockDiagram-38ab4fdb-a0efbfd3.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{c4Diagram-3d4e48cf-f5ae6786.js → c4Diagram-3d4e48cf-0584c0f2.js} +1 -1
- rasa/core/channels/inspector/dist/assets/channel-8e08bed9.js +1 -0
- rasa/core/channels/inspector/dist/assets/{classDiagram-70f12bd4-81efba3e.js → classDiagram-70f12bd4-39f40dbe.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{classDiagram-v2-f2320105-3b6b6a92.js → classDiagram-v2-f2320105-1ad755f3.js} +1 -1
- rasa/core/channels/inspector/dist/assets/clone-78c82dea.js +1 -0
- rasa/core/channels/inspector/dist/assets/{createText-2e5e7dd3-31422447.js → createText-2e5e7dd3-b0f4f0fe.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{edges-e0da2a9e-518a90db.js → edges-e0da2a9e-9039bff9.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{erDiagram-9861fffd-a6d3c25a.js → erDiagram-9861fffd-65c9b127.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDb-956e92f1-e048c2be.js → flowDb-956e92f1-4f08b38e.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{flowDiagram-66a62f08-c7474c91.js → flowDiagram-66a62f08-e95c362a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-2b08f601.js +1 -0
- rasa/core/channels/inspector/dist/assets/{flowchart-elk-definition-4a651766-cb4d8723.js → flowchart-elk-definition-4a651766-703c3015.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{ganttDiagram-c361ad54-346636a2.js → ganttDiagram-c361ad54-699328ea.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{gitGraphDiagram-72cf32ee-7c508874.js → gitGraphDiagram-72cf32ee-04cf4b05.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{graph-14702d8a.js → graph-ee94449e.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-3862675e-f18b534b.js → index-3862675e-940162b4.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{index-4d4bdf3a.js → index-c941dcb3.js} +132 -131
- rasa/core/channels/inspector/dist/assets/{infoDiagram-f8f76790-64154b83.js → infoDiagram-f8f76790-c79c2866.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{journeyDiagram-49397b02-833a5f95.js → journeyDiagram-49397b02-84489d30.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{layout-5a3b2123.js → layout-a9aa9858.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{line-2272a8c7.js → line-eb73cf26.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{linear-35bcf273.js → linear-b3399f9a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{mindmap-definition-fc14e90a-92dcb0e9.js → mindmap-definition-fc14e90a-b095bf1a.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{pieDiagram-8a3498a8-94dbc900.js → pieDiagram-8a3498a8-07644b66.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{quadrantDiagram-120e2f19-8b7a9c33.js → quadrantDiagram-120e2f19-573a3f9c.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{requirementDiagram-deff3bca-6f7eab81.js → requirementDiagram-deff3bca-d457e1e1.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sankeyDiagram-04a897e0-f43e581d.js → sankeyDiagram-04a897e0-9d26e1a2.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{sequenceDiagram-704730f1-0bcbefc3.js → sequenceDiagram-704730f1-3a9cde10.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-587899a1-b8a74083.js → stateDiagram-587899a1-4f3e8cec.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{stateDiagram-v2-d93cdb3a-2070218f.js → stateDiagram-v2-d93cdb3a-e617e5bf.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-6aaf32cf-f1d54e34.js → styles-6aaf32cf-eab30d2f.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-9a916d00-980de489.js → styles-9a916d00-09994be2.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{styles-c10674c1-3c03abde.js → styles-c10674c1-b7110364.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{svgDrawCommon-08f97a94-46ba068f.js → svgDrawCommon-08f97a94-3ebc92ad.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{timeline-definition-85554ec2-901f5e3d.js → timeline-definition-85554ec2-7d13d2f2.js} +1 -1
- rasa/core/channels/inspector/dist/assets/{xychartDiagram-e933f94c-acbc628a.js → xychartDiagram-e933f94c-488385e1.js} +1 -1
- rasa/core/channels/inspector/dist/index.html +1 -1
- rasa/core/channels/inspector/src/App.tsx +5 -31
- rasa/core/channels/inspector/src/components/Chat.tsx +2 -3
- rasa/core/channels/inspector/src/components/DialogueInformation.tsx +9 -1
- rasa/core/channels/inspector/src/components/LatencyDisplay.tsx +63 -35
- rasa/core/channels/inspector/src/helpers/audio/audiostream.ts +14 -0
- rasa/core/channels/inspector/src/types.ts +32 -7
- rasa/core/channels/studio_chat.py +23 -41
- rasa/core/channels/voice_stream/asr/asr_event.py +1 -1
- rasa/core/channels/voice_stream/asr/azure.py +6 -3
- rasa/core/channels/voice_stream/asr/deepgram.py +1 -1
- rasa/core/channels/voice_stream/audiocodes.py +3 -0
- rasa/core/channels/voice_stream/browser_audio.py +55 -3
- rasa/core/channels/voice_stream/genesys.py +2 -1
- rasa/core/channels/voice_stream/jambonz.py +9 -1
- rasa/core/channels/voice_stream/twilio_media_streams.py +16 -0
- rasa/core/channels/voice_stream/voice_channel.py +61 -0
- rasa/core/concurrent_lock_store.py +66 -16
- rasa/core/constants.py +7 -0
- rasa/core/iam_credentials_providers/__init__.py +0 -0
- rasa/core/iam_credentials_providers/aws_iam_credentials_providers.py +226 -0
- rasa/core/iam_credentials_providers/credentials_provider_protocol.py +90 -0
- rasa/core/lock_store.py +46 -10
- rasa/core/nlg/generator.py +1 -1
- rasa/core/policies/flows/flow_executor.py +1 -1
- rasa/core/processor.py +32 -0
- rasa/core/redis_connection_factory.py +469 -0
- rasa/core/tracker_stores/redis_tracker_store.py +32 -14
- rasa/core/tracker_stores/sql_tracker_store.py +57 -1
- rasa/engine/graph.py +5 -1
- rasa/engine/loader.py +12 -0
- rasa/engine/storage/local_model_storage.py +41 -4
- rasa/model_manager/socket_bridge.py +1 -2
- rasa/model_manager/warm_rasa_process.py +13 -3
- rasa/shared/core/constants.py +1 -0
- rasa/shared/core/events.py +2 -0
- rasa/shared/core/flows/flow.py +1 -1
- rasa/shared/nlu/training_data/schemas/responses.yml +3 -0
- rasa/utils/pypred.py +38 -0
- rasa/validator.py +12 -8
- rasa/version.py +1 -1
- {rasa_pro-3.14.0.dev20250901.dist-info → rasa_pro-3.14.0.dev20250922.dist-info}/METADATA +19 -16
- {rasa_pro-3.14.0.dev20250901.dist-info → rasa_pro-3.14.0.dev20250922.dist-info}/RECORD +231 -266
- rasa/cli/project_templates/finance/actions/accounts/action_ask_account.py +0 -47
- rasa/cli/project_templates/finance/actions/accounts/action_check_balance.py +0 -40
- rasa/cli/project_templates/finance/actions/action_session_start.py +0 -74
- rasa/cli/project_templates/finance/actions/cards/action_ask_card.py +0 -48
- rasa/cli/project_templates/finance/actions/cards/action_check_card_existence.py +0 -36
- rasa/cli/project_templates/finance/actions/cards/action_update_card_status.py +0 -54
- rasa/cli/project_templates/finance/actions/database.py +0 -277
- rasa/cli/project_templates/finance/actions/transfers/action_add_payee.py +0 -52
- rasa/cli/project_templates/finance/actions/transfers/action_ask_account_from.py +0 -51
- rasa/cli/project_templates/finance/actions/transfers/action_check_payee_existence.py +0 -40
- rasa/cli/project_templates/finance/actions/transfers/action_check_sufficient_funds.py +0 -40
- rasa/cli/project_templates/finance/actions/transfers/action_list_payees.py +0 -46
- rasa/cli/project_templates/finance/actions/transfers/action_remove_payee.py +0 -49
- rasa/cli/project_templates/finance/actions/transfers/action_schedule_payment.py +0 -19
- rasa/cli/project_templates/finance/actions/transfers/action_validate_payment_date.py +0 -36
- rasa/cli/project_templates/finance/csvs/accounts.csv +0 -8
- rasa/cli/project_templates/finance/csvs/advisors.csv +0 -7
- rasa/cli/project_templates/finance/csvs/appointments.csv +0 -211
- rasa/cli/project_templates/finance/csvs/branches.csv +0 -10
- rasa/cli/project_templates/finance/csvs/cards.csv +0 -11
- rasa/cli/project_templates/finance/csvs/payees.csv +0 -11
- rasa/cli/project_templates/finance/csvs/transactions.csv +0 -71
- rasa/cli/project_templates/finance/csvs/users.csv +0 -4
- rasa/cli/project_templates/finance/data/cards/select_card.yml +0 -12
- rasa/cli/project_templates/finance/data/general/bot_identity.yml +0 -6
- rasa/cli/project_templates/finance/data/system/patterns/pattern_chitchat.yml +0 -5
- rasa/cli/project_templates/finance/data/system/source/accounts.json +0 -51
- rasa/cli/project_templates/finance/data/system/source/advisors.json +0 -44
- rasa/cli/project_templates/finance/data/system/source/appointments.json +0 -1474
- rasa/cli/project_templates/finance/data/system/source/branches.json +0 -47
- rasa/cli/project_templates/finance/data/system/source/cards.json +0 -72
- rasa/cli/project_templates/finance/data/system/source/payees.json +0 -74
- rasa/cli/project_templates/finance/data/system/source/transactions.json +0 -492
- rasa/cli/project_templates/finance/data/system/source/users.json +0 -29
- rasa/cli/project_templates/finance/data/transfers/add_payee.yml +0 -29
- rasa/cli/project_templates/finance/data/transfers/list_payees.yml +0 -5
- rasa/cli/project_templates/finance/data/transfers/remove_payee.yml +0 -21
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/consequences_of_blocking_card.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/reasons_to_block_card.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/recovering_from_card_fraud.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/tips_for_card_security.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/block_card/what_to_do_if_card_is_lost.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/account_balance_security.txt +0 -7
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/common_balance_inquiries.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/methods_to_check_balance.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/understanding_balance_updates.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/check_balance/what_to_do_if_balance_is_incorrect.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/benefits_of_authorised_payees.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/common_issues_with_payees.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/general_payee_information.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/payee_management_tips.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/manage_payees/understanding_payee_types.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/common_transfer_errors.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/fees_for_transfers.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/general_transfer_information.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/security_tips_for_transfers.txt +0 -8
- rasa/cli/project_templates/finance/docs/bank_of_rasa_faq/transfer_money/transfer_processing_times.txt +0 -8
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part1.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part10.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part11.txt +0 -48
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part12.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part13.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part14.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part15.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part16.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part17.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part18.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part19.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part2.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part20.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part21.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part22.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part23.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part24.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part25.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part26.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part27.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part28.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part29.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part3.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part30.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part31.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part32.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part33.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part34.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part35.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part36.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part37.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part38.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part39.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part4.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part40.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part41.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part42.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part43.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part44.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part45.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part46.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part47.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part48.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part49.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part5.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part50.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part51.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part52.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part53.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part54.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part55.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part56.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part57.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part58.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part59.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part6.txt +0 -47
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part60.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part61.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part7.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part8.txt +0 -50
- rasa/cli/project_templates/finance/docs/huggingface_alpaca_dataset/questions_part9.txt +0 -47
- rasa/cli/project_templates/finance/domain/cards/select_card.yml +0 -12
- rasa/cli/project_templates/finance/domain/general/assistant_details.yml +0 -12
- rasa/cli/project_templates/finance/domain/general/bot_identity.yml +0 -5
- rasa/cli/project_templates/finance/domain/general/defaults.yml +0 -24
- rasa/cli/project_templates/finance/domain/general/help.yml +0 -5
- rasa/cli/project_templates/finance/domain/general/utils.yml +0 -13
- rasa/cli/project_templates/finance/domain/transfers/add_payee.yml +0 -47
- rasa/cli/project_templates/finance/domain/transfers/list_payees.yml +0 -4
- rasa/cli/project_templates/finance/domain/transfers/remove_payee.yml +0 -16
- rasa/core/channels/inspector/dist/assets/channel-b9b536fc.js +0 -1
- rasa/core/channels/inspector/dist/assets/clone-78d2ddcf.js +0 -1
- rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-8b09c060.js +0 -1
- /rasa/cli/project_templates/telco/domain/billing/{domain_undertand_bill.yml → understand_bill.yml} +0 -0
- /rasa/cli/project_templates/telco/domain/network/{domain_reboot_router.yml → reboot_router.yml} +0 -0
- /rasa/cli/project_templates/telco/domain/network/{domain_reset_router.yml → reset_router.yml} +0 -0
- /rasa/cli/project_templates/telco/domain/network/{domain_run_speed_test.yml → run_speed_test.yml} +0 -0
- /rasa/cli/project_templates/telco/domain/network/{domain_solve_internet_issue.yml → solve_internet_issue.yml} +0 -0
- {rasa_pro-3.14.0.dev20250901.dist-info → rasa_pro-3.14.0.dev20250922.dist-info}/NOTICE +0 -0
- {rasa_pro-3.14.0.dev20250901.dist-info → rasa_pro-3.14.0.dev20250922.dist-info}/WHEEL +0 -0
- {rasa_pro-3.14.0.dev20250901.dist-info → rasa_pro-3.14.0.dev20250922.dist-info}/entry_points.txt +0 -0
rasa/builder/config.py
CHANGED
|
@@ -39,6 +39,7 @@ VALIDATION_MAX_HISTORY = None # Could be configured if needed
|
|
|
39
39
|
COPILOT_CONTROLLED_RESPONSE_MAX_TOKENS = 20
|
|
40
40
|
COPILOT_HANDLER_ROLLING_BUFFER_SIZE = 20
|
|
41
41
|
COPILOT_ASSISTANT_TRACKER_MAX_TURNS = 10
|
|
42
|
+
COPILOT_DOCUMENTATION_SEARCH_QUERY_HISTORY_MESSAGES = 5
|
|
42
43
|
|
|
43
44
|
# Guardrail Configuration
|
|
44
45
|
LAKERA_BASE_URL = os.getenv("LAKERA_BASE_URL", "https://api.lakera.ai/v2").rstrip("/")
|
|
@@ -3,6 +3,9 @@ from typing import Literal
|
|
|
3
3
|
# A dot-path for importlib to the copilot prompt
|
|
4
4
|
COPILOT_PROMPTS_DIR = "builder.copilot.prompts"
|
|
5
5
|
COPILOT_PROMPTS_FILE = "copilot_system_prompt.jinja2"
|
|
6
|
+
COPILOT_LAST_USER_MESSAGE_CONTEXT_PROMPT_FILE = (
|
|
7
|
+
"latest_user_message_context_prompt.jinja2"
|
|
8
|
+
)
|
|
6
9
|
|
|
7
10
|
# A dot-path for importlib to the rasa internal messages templates
|
|
8
11
|
COPILOT_MESSAGE_TEMPLATES_DIR = "builder.copilot.templated_messages"
|
rasa/builder/copilot/copilot.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import asyncio
|
|
2
|
+
import copy
|
|
2
3
|
import importlib
|
|
3
4
|
import json
|
|
4
5
|
from contextlib import asynccontextmanager
|
|
@@ -10,7 +11,9 @@ from jinja2 import Template
|
|
|
10
11
|
from typing_extensions import AsyncGenerator
|
|
11
12
|
|
|
12
13
|
from rasa.builder import config
|
|
14
|
+
from rasa.builder.config import COPILOT_DOCUMENTATION_SEARCH_QUERY_HISTORY_MESSAGES
|
|
13
15
|
from rasa.builder.copilot.constants import (
|
|
16
|
+
COPILOT_LAST_USER_MESSAGE_CONTEXT_PROMPT_FILE,
|
|
14
17
|
COPILOT_PROMPTS_DIR,
|
|
15
18
|
COPILOT_PROMPTS_FILE,
|
|
16
19
|
ROLE_COPILOT,
|
|
@@ -20,8 +23,11 @@ from rasa.builder.copilot.constants import (
|
|
|
20
23
|
)
|
|
21
24
|
from rasa.builder.copilot.exceptions import CopilotStreamError
|
|
22
25
|
from rasa.builder.copilot.models import (
|
|
26
|
+
CopilotChatMessage,
|
|
23
27
|
CopilotContext,
|
|
28
|
+
CopilotGenerationContext,
|
|
24
29
|
ResponseCategory,
|
|
30
|
+
TextContent,
|
|
25
31
|
UsageStatistics,
|
|
26
32
|
)
|
|
27
33
|
from rasa.builder.document_retrieval.inkeep_document_retrieval import (
|
|
@@ -48,6 +54,12 @@ class Copilot:
|
|
|
48
54
|
COPILOT_PROMPTS_FILE,
|
|
49
55
|
)
|
|
50
56
|
)
|
|
57
|
+
self._last_user_message_context_prompt_template = Template(
|
|
58
|
+
importlib.resources.read_text(
|
|
59
|
+
f"{PACKAGE_NAME}.{COPILOT_PROMPTS_DIR}",
|
|
60
|
+
COPILOT_LAST_USER_MESSAGE_CONTEXT_PROMPT_FILE,
|
|
61
|
+
)
|
|
62
|
+
)
|
|
51
63
|
|
|
52
64
|
# The final stream chunk includes usage statistics.
|
|
53
65
|
self.usage_statistics = UsageStatistics()
|
|
@@ -55,29 +67,7 @@ class Copilot:
|
|
|
55
67
|
@asynccontextmanager
|
|
56
68
|
async def _get_client(self) -> AsyncGenerator[openai.AsyncOpenAI, None]:
|
|
57
69
|
"""Create a fresh OpenAI client, yield it, and always close it."""
|
|
58
|
-
|
|
59
|
-
if config.HELLO_LLM_PROXY_BASE_URL:
|
|
60
|
-
structlogger.debug(
|
|
61
|
-
"copilot.using_llm_proxy", base_url=config.HELLO_LLM_PROXY_BASE_URL
|
|
62
|
-
)
|
|
63
|
-
if not config.RASA_PRO_LICENSE:
|
|
64
|
-
structlogger.error(
|
|
65
|
-
"copilot.proxy_missing_license",
|
|
66
|
-
event_info=(
|
|
67
|
-
"HELLO_LLM_PROXY_BASE_URL is set "
|
|
68
|
-
"but RASA_PRO_LICENSE is missing."
|
|
69
|
-
),
|
|
70
|
-
)
|
|
71
|
-
raise CopilotStreamError(
|
|
72
|
-
"HELLO_LLM_PROXY_BASE_URL is set but RASA_PRO_LICENSE is missing. "
|
|
73
|
-
"Provide a valid license token for proxy authentication."
|
|
74
|
-
)
|
|
75
|
-
|
|
76
|
-
kwargs["base_url"] = config.HELLO_LLM_PROXY_BASE_URL
|
|
77
|
-
kwargs["api_key"] = config.RASA_PRO_LICENSE
|
|
78
|
-
|
|
79
|
-
client = openai.AsyncOpenAI(**kwargs)
|
|
80
|
-
|
|
70
|
+
client = openai.AsyncOpenAI(timeout=config.OPENAI_TIMEOUT)
|
|
81
71
|
try:
|
|
82
72
|
yield client
|
|
83
73
|
except Exception as e:
|
|
@@ -124,7 +114,7 @@ class Copilot:
|
|
|
124
114
|
async def generate_response(
|
|
125
115
|
self,
|
|
126
116
|
context: CopilotContext,
|
|
127
|
-
) -> tuple[AsyncGenerator[str, None],
|
|
117
|
+
) -> tuple[AsyncGenerator[str, None], CopilotGenerationContext]:
|
|
128
118
|
"""Generate a response from the copilot.
|
|
129
119
|
|
|
130
120
|
This method performs document retrieval and response generation as a single
|
|
@@ -136,22 +126,27 @@ class Copilot:
|
|
|
136
126
|
context: The context of the copilot.
|
|
137
127
|
|
|
138
128
|
Returns:
|
|
139
|
-
A tuple containing the async response stream
|
|
140
|
-
|
|
129
|
+
A tuple containing the async response stream and a
|
|
130
|
+
CopilotGenerationContext object with relevant documents, and all the
|
|
131
|
+
messages used to generate the response.
|
|
141
132
|
|
|
142
133
|
Raises:
|
|
143
134
|
CopilotStreamError: If the stream fails.
|
|
144
135
|
Exception: If an unexpected error occurs.
|
|
145
136
|
"""
|
|
146
137
|
relevant_documents = await self.search_rasa_documentation(context)
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
138
|
+
messages = await self._build_messages(context, relevant_documents)
|
|
139
|
+
|
|
140
|
+
support_evidence = CopilotGenerationContext(
|
|
141
|
+
relevant_documents=relevant_documents,
|
|
142
|
+
system_message=messages[0],
|
|
143
|
+
chat_history=messages[1:-1],
|
|
144
|
+
last_user_message=messages[-1],
|
|
145
|
+
)
|
|
150
146
|
|
|
151
147
|
return (
|
|
152
148
|
self._stream_response(messages),
|
|
153
|
-
|
|
154
|
-
system_message.get("content", ""),
|
|
149
|
+
support_evidence,
|
|
155
150
|
)
|
|
156
151
|
|
|
157
152
|
async def _stream_response(
|
|
@@ -196,60 +191,139 @@ class Copilot:
|
|
|
196
191
|
)
|
|
197
192
|
raise
|
|
198
193
|
|
|
199
|
-
async def
|
|
194
|
+
async def _build_messages(
|
|
200
195
|
self,
|
|
201
196
|
context: CopilotContext,
|
|
202
197
|
relevant_documents: List[Document],
|
|
203
|
-
) -> Dict[str, Any]:
|
|
204
|
-
"""
|
|
205
|
-
# Format relevant documentation
|
|
206
|
-
documents = [doc.model_dump() for doc in relevant_documents]
|
|
207
|
-
|
|
208
|
-
# Format conversation history
|
|
209
|
-
conversation = self._format_conversation_history(context.tracker_context)
|
|
198
|
+
) -> List[Dict[str, Any]]:
|
|
199
|
+
"""Build the complete message list for the OpenAI API.
|
|
210
200
|
|
|
211
|
-
|
|
212
|
-
|
|
201
|
+
Args:
|
|
202
|
+
context: The context of the copilot.
|
|
203
|
+
relevant_documents: The relevant documents to use in the context.
|
|
213
204
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
205
|
+
Returns:
|
|
206
|
+
A list of messages in OpenAI format.
|
|
207
|
+
"""
|
|
208
|
+
# Split chat history into past messages and latest message
|
|
209
|
+
past_messages = [
|
|
210
|
+
message
|
|
211
|
+
for message in context.copilot_chat_history[:-1]
|
|
212
|
+
if message.response_category != ResponseCategory.GUARDRAILS_POLICY_VIOLATION
|
|
213
|
+
]
|
|
214
|
+
latest_message = context.copilot_chat_history[-1]
|
|
215
|
+
|
|
216
|
+
# Create the system message
|
|
217
|
+
system_message = await self._create_system_message()
|
|
218
|
+
# Create the chat history messages (excludes the last message)
|
|
219
|
+
chat_history = self._create_chat_history_messages(past_messages)
|
|
220
|
+
# Create the last message and add the context to it
|
|
221
|
+
latest_message_with_context = self._create_last_user_message_with_context(
|
|
222
|
+
latest_message, context, relevant_documents
|
|
221
223
|
)
|
|
224
|
+
return [system_message, *chat_history, latest_message_with_context]
|
|
225
|
+
|
|
226
|
+
async def _create_system_message(self) -> Dict[str, Any]:
|
|
227
|
+
"""Render the correct Jinja template based on desired output_type."""
|
|
228
|
+
rendered_prompt = self._system_message_prompt_template.render()
|
|
222
229
|
return {"role": ROLE_SYSTEM, "content": rendered_prompt}
|
|
223
230
|
|
|
224
231
|
def _create_chat_history_messages(
|
|
225
232
|
self,
|
|
226
|
-
|
|
233
|
+
past_messages: List["CopilotChatMessage"],
|
|
227
234
|
) -> List[Dict[str, Any]]:
|
|
228
235
|
"""Create the chat history messages for the copilot.
|
|
229
236
|
|
|
230
237
|
Filter out messages with response_category of GUARDRAILS_POLICY_VIOLATION.
|
|
231
238
|
This will filter out all the user messages that were flagged by guardrails, but
|
|
232
239
|
also the copilot messages that were produced by guardrails.
|
|
240
|
+
|
|
241
|
+
Args:
|
|
242
|
+
past_messages: List of past messages (excluding the latest message).
|
|
243
|
+
|
|
244
|
+
Returns:
|
|
245
|
+
List of messages in OpenAI format.
|
|
233
246
|
"""
|
|
234
|
-
# Filter out messages with response_category of GUARDRAILS_POLICY_VIOLATION.
|
|
235
|
-
# This will filter out all the user messages flagged by guardrails, but also the
|
|
236
|
-
# copilot messages that were produced.
|
|
237
247
|
return [
|
|
238
248
|
message.to_openai_format()
|
|
239
|
-
for message in
|
|
249
|
+
for message in past_messages
|
|
240
250
|
if message.response_category != ResponseCategory.GUARDRAILS_POLICY_VIOLATION
|
|
241
251
|
]
|
|
242
252
|
|
|
253
|
+
def _create_last_user_message_with_context(
|
|
254
|
+
self,
|
|
255
|
+
latest_message: "CopilotChatMessage",
|
|
256
|
+
context: CopilotContext,
|
|
257
|
+
relevant_documents: List[Document],
|
|
258
|
+
) -> Dict[str, Any]:
|
|
259
|
+
"""Create the last user message with context.
|
|
260
|
+
|
|
261
|
+
The last user message is the last message in the copilot chat history.
|
|
262
|
+
We add the context prompt with the current conversation, state, assistant logs,
|
|
263
|
+
assistant files, and relevant documents as a text content block to the beginning
|
|
264
|
+
of the message.
|
|
265
|
+
|
|
266
|
+
Args:
|
|
267
|
+
context: The context of the copilot.
|
|
268
|
+
relevant_documents: The relevant documents to use in the context.
|
|
269
|
+
|
|
270
|
+
Returns:
|
|
271
|
+
The last user message with context in the OpenAI format.
|
|
272
|
+
"""
|
|
273
|
+
last_user_message = copy.deepcopy(latest_message)
|
|
274
|
+
context_prompt = self._render_last_user_message_context_prompt(
|
|
275
|
+
context, relevant_documents
|
|
276
|
+
)
|
|
277
|
+
last_user_message.content.insert(
|
|
278
|
+
0, TextContent(type="text", text=context_prompt)
|
|
279
|
+
)
|
|
280
|
+
return {
|
|
281
|
+
"role": ROLE_USER,
|
|
282
|
+
"content": [
|
|
283
|
+
{"type": "text", "text": content.text}
|
|
284
|
+
for content in last_user_message.content
|
|
285
|
+
if isinstance(content, TextContent)
|
|
286
|
+
],
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
def _render_last_user_message_context_prompt(
|
|
290
|
+
self,
|
|
291
|
+
context: CopilotContext,
|
|
292
|
+
relevant_documents: List[Document],
|
|
293
|
+
) -> str:
|
|
294
|
+
# Format relevant documentation
|
|
295
|
+
documents = [doc.model_dump() for doc in relevant_documents]
|
|
296
|
+
# Format conversation history
|
|
297
|
+
conversation = self._format_conversation_history(context.tracker_context)
|
|
298
|
+
# Format current state
|
|
299
|
+
current_state = self._format_current_state(context.tracker_context)
|
|
300
|
+
|
|
301
|
+
rendered_prompt = self._last_user_message_context_prompt_template.render(
|
|
302
|
+
current_conversation=conversation,
|
|
303
|
+
current_state=current_state,
|
|
304
|
+
assistant_logs=context.assistant_logs,
|
|
305
|
+
assistant_files=context.assistant_files,
|
|
306
|
+
documentation_results=documents,
|
|
307
|
+
)
|
|
308
|
+
return rendered_prompt
|
|
309
|
+
|
|
243
310
|
@staticmethod
|
|
244
311
|
def _create_documentation_search_query(context: CopilotContext) -> str:
|
|
245
312
|
"""Format chat messages between user and copilot for documentation search."""
|
|
313
|
+
|
|
246
314
|
result = ""
|
|
247
315
|
role_to_prefix = {
|
|
248
316
|
ROLE_USER: "User",
|
|
249
317
|
ROLE_COPILOT: "Assistant",
|
|
250
318
|
ROLE_COPILOT_INTERNAL: "Copilot Internal Request",
|
|
251
319
|
}
|
|
252
|
-
|
|
320
|
+
|
|
321
|
+
# Only use the last N messages for documentation search
|
|
322
|
+
messages_to_include = context.copilot_chat_history[
|
|
323
|
+
-COPILOT_DOCUMENTATION_SEARCH_QUERY_HISTORY_MESSAGES:
|
|
324
|
+
]
|
|
325
|
+
|
|
326
|
+
for message in messages_to_include:
|
|
253
327
|
prefix = role_to_prefix[message.role]
|
|
254
328
|
text = message.get_text_content().strip()
|
|
255
329
|
if text:
|
rasa/builder/copilot/models.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import json
|
|
2
1
|
from abc import ABC, abstractmethod
|
|
3
2
|
from enum import Enum
|
|
4
3
|
from typing import Any, Dict, List, Literal, Optional, Union
|
|
@@ -14,6 +13,7 @@ from rasa.builder.copilot.constants import (
|
|
|
14
13
|
ROLE_COPILOT_INTERNAL,
|
|
15
14
|
ROLE_USER,
|
|
16
15
|
)
|
|
16
|
+
from rasa.builder.document_retrieval.models import Document
|
|
17
17
|
from rasa.builder.models import ServerSentEvent
|
|
18
18
|
from rasa.builder.shared.tracker_context import TrackerContext
|
|
19
19
|
|
|
@@ -231,8 +231,11 @@ class CopilotChatMessage(BaseModel):
|
|
|
231
231
|
|
|
232
232
|
def _copilot_message_to_openai_format(self) -> Dict[str, Any]:
|
|
233
233
|
role = self._map_role_to_openai()
|
|
234
|
-
|
|
235
|
-
|
|
234
|
+
# For now the Copilot responds only with the text content and all the content
|
|
235
|
+
# is formatted as a markdown.
|
|
236
|
+
# TODO: Once we start predicting the files, and expecting other content blocks
|
|
237
|
+
# we should update this.
|
|
238
|
+
content = self.get_text_content()
|
|
236
239
|
return {"role": role, "content": content}
|
|
237
240
|
|
|
238
241
|
def _map_role_to_openai(self) -> str:
|
|
@@ -462,3 +465,36 @@ class SigningContext(BaseModel):
|
|
|
462
465
|
"""Signing is enabled if a non-empty secret is present."""
|
|
463
466
|
secret = (self.secret or "").strip()
|
|
464
467
|
return bool(secret)
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
class CopilotGenerationContext(BaseModel):
|
|
471
|
+
"""Container for copilot generation context and supporting evidence.
|
|
472
|
+
|
|
473
|
+
This class organizes the context and supporting evidence information used by the
|
|
474
|
+
copilot's generate_response method, providing a cleaner interface than returning
|
|
475
|
+
a tuple for the non-streaming data.
|
|
476
|
+
"""
|
|
477
|
+
|
|
478
|
+
relevant_documents: List["Document"] = Field(
|
|
479
|
+
...,
|
|
480
|
+
description=(
|
|
481
|
+
"The relevant documents used as supporting evidence for the respons."
|
|
482
|
+
),
|
|
483
|
+
)
|
|
484
|
+
system_message: Dict[str, Any] = Field(
|
|
485
|
+
..., description="The system message with instructions."
|
|
486
|
+
)
|
|
487
|
+
chat_history: List[Dict[str, Any]] = Field(
|
|
488
|
+
...,
|
|
489
|
+
description=(
|
|
490
|
+
"The chat history messages (excluding the last message) used as a context."
|
|
491
|
+
),
|
|
492
|
+
)
|
|
493
|
+
last_user_message: Optional[Dict[str, Any]] = Field(
|
|
494
|
+
None, description="The last user message with context that was processed."
|
|
495
|
+
)
|
|
496
|
+
|
|
497
|
+
class Config:
|
|
498
|
+
"""Config for CopilotGenerationContext."""
|
|
499
|
+
|
|
500
|
+
arbitrary_types_allowed = True
|