rasa-pro 3.14.0.dev9__py3-none-any.whl → 3.14.0.dev11__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 +15 -3
- rasa/agents/agent_factory.py +2 -2
- rasa/agents/agent_manager.py +50 -2
- rasa/agents/constants.py +3 -0
- rasa/agents/core/types.py +11 -0
- rasa/agents/protocol/a2a/a2a_agent.py +76 -17
- rasa/agents/protocol/mcp/mcp_base_agent.py +29 -5
- rasa/agents/protocol/mcp/mcp_open_agent.py +27 -13
- rasa/agents/protocol/mcp/mcp_task_agent.py +46 -31
- rasa/agents/schemas/__init__.py +2 -1
- rasa/agents/schemas/agent_tool_result.py +0 -2
- rasa/agents/schemas/agent_tool_schema.py +55 -3
- rasa/agents/templates/mcp_open_agent_prompt_template.jinja2 +6 -1
- rasa/agents/templates/mcp_task_agent_prompt_template.jinja2 +5 -0
- rasa/agents/utils.py +42 -3
- rasa/agents/validation.py +4 -4
- rasa/builder/copilot/telemetry.py +35 -19
- rasa/builder/main.py +5 -14
- rasa/builder/project_generator.py +1 -1
- rasa/builder/service.py +5 -0
- rasa/builder/template_cache.py +9 -184
- rasa/cli/project_templates/basic/data/data.md +5 -6
- rasa/cli/project_templates/basic/domain/domain.md +5 -2
- rasa/cli/project_templates/finance/README.md +8 -7
- 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/{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/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 +6 -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 +6 -3
- rasa/cli/project_templates/finance/data/general/agent_details.yml +6 -0
- rasa/cli/project_templates/finance/data/general/hello.yml +1 -2
- rasa/cli/project_templates/finance/data/general/human_handoff.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/_system/patterns/pattern_session_start.yml +11 -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 +9 -1
- rasa/cli/project_templates/finance/domain/general/_shared.yml +53 -0
- rasa/cli/project_templates/finance/domain/general/agent_details.yml +19 -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/human_handoff.yml +7 -3
- rasa/cli/project_templates/finance/domain/general/welcome.yml +5 -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 +3 -2
- rasa/cli/project_templates/finance/prompts/rephraser_demo_personality_prompt.jinja2 +31 -12
- rasa/cli/project_templates/telco/data/data.md +1 -1
- rasa/cli/project_templates/telco/docs/docs.md +3 -0
- rasa/cli/project_templates/telco/domain/domain.md +1 -2
- rasa/constants.py +1 -1
- rasa/core/actions/direct_custom_actions_executor.py +9 -2
- rasa/core/agent.py +2 -3
- rasa/core/available_agents.py +8 -6
- rasa/core/brokers/broker.py +1 -1
- rasa/core/brokers/kafka.py +52 -8
- rasa/core/channels/__init__.py +82 -35
- rasa/core/channels/inspector/README.md +1 -1
- rasa/core/channels/telegram.py +4 -9
- rasa/core/channels/voice_stream/twilio_media_streams.py +5 -1
- rasa/core/concurrent_lock_store.py +66 -16
- rasa/core/iam_credentials_providers/aws_iam_credentials_providers.py +76 -1
- rasa/core/iam_credentials_providers/credentials_provider_protocol.py +1 -1
- rasa/core/lock_store.py +41 -7
- rasa/core/policies/flows/agent_executor.py +632 -0
- rasa/core/policies/flows/flow_executor.py +3 -418
- rasa/core/policies/flows/mcp_tool_executor.py +35 -14
- rasa/core/processor.py +49 -28
- rasa/core/run.py +22 -0
- rasa/dialogue_understanding/commands/cancel_flow_command.py +1 -1
- rasa/dialogue_understanding/commands/chit_chat_answer_command.py +11 -3
- rasa/dialogue_understanding/commands/clarify_command.py +11 -3
- rasa/dialogue_understanding/commands/knowledge_answer_command.py +11 -3
- rasa/dialogue_understanding/generator/prompt_templates/agent_command_prompt_v2_claude_3_5_sonnet_20240620_template.jinja2 +3 -3
- rasa/dialogue_understanding/generator/prompt_templates/agent_command_prompt_v2_gpt_4o_2024_11_20_template.jinja2 +3 -3
- rasa/dialogue_understanding/generator/prompt_templates/agent_command_prompt_v3_claude_3_5_sonnet_20240620_template.jinja2 +3 -3
- rasa/dialogue_understanding/generator/prompt_templates/agent_command_prompt_v3_gpt_4o_2024_11_20_template.jinja2 +3 -3
- rasa/dialogue_understanding/generator/single_step/single_step_based_llm_command_generator.py +2 -0
- rasa/dialogue_understanding/processor/command_processor.py +70 -0
- rasa/dialogue_understanding/stack/dialogue_stack.py +0 -25
- rasa/engine/loader.py +12 -0
- rasa/engine/recipes/default_components.py +111 -82
- rasa/engine/recipes/default_recipe.py +79 -22
- rasa/engine/runner/dask.py +8 -5
- rasa/graph_components/validators/default_recipe_validator.py +59 -19
- rasa/model_manager/warm_rasa_process.py +13 -3
- rasa/model_training.py +0 -14
- rasa/nlu/classifiers/logistic_regression_classifier.py +1 -22
- rasa/nlu/classifiers/mitie_intent_classifier.py +3 -0
- rasa/nlu/classifiers/sklearn_intent_classifier.py +1 -3
- rasa/nlu/extractors/crf_entity_extractor.py +9 -10
- rasa/nlu/extractors/mitie_entity_extractor.py +3 -0
- rasa/nlu/extractors/spacy_entity_extractor.py +3 -0
- rasa/nlu/featurizers/dense_featurizer/mitie_featurizer.py +2 -0
- rasa/nlu/featurizers/dense_featurizer/spacy_featurizer.py +3 -0
- rasa/nlu/featurizers/sparse_featurizer/count_vectors_featurizer.py +4 -2
- rasa/nlu/featurizers/sparse_featurizer/lexical_syntactic_featurizer.py +4 -0
- rasa/nlu/tokenizers/jieba_tokenizer.py +3 -4
- rasa/nlu/tokenizers/mitie_tokenizer.py +3 -2
- rasa/nlu/tokenizers/spacy_tokenizer.py +3 -2
- rasa/nlu/utils/mitie_utils.py +3 -0
- rasa/nlu/utils/spacy_utils.py +3 -2
- rasa/shared/agents/auth/agent_auth_manager.py +6 -3
- rasa/shared/agents/auth/auth_strategy/oauth2_auth_strategy.py +13 -5
- rasa/shared/core/constants.py +5 -1
- rasa/shared/utils/mcp/server_connection.py +1 -1
- rasa/telemetry.py +63 -0
- rasa/utils/log_utils.py +95 -4
- rasa/utils/tensorflow/__init__.py +0 -22
- rasa/utils/tensorflow/callback.py +17 -7
- rasa/utils/tensorflow/layers.py +10 -7
- rasa/utils/tensorflow/rasa_layers.py +1 -1
- rasa/version.py +1 -1
- {rasa_pro-3.14.0.dev9.dist-info → rasa_pro-3.14.0.dev11.dist-info}/METADATA +99 -89
- {rasa_pro-3.14.0.dev9.dist-info → rasa_pro-3.14.0.dev11.dist-info}/RECORD +171 -242
- 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/bot_identity.yml +0 -5
- rasa/cli/project_templates/finance/domain/general/defaults.yml +0 -24
- rasa/cli/project_templates/finance/domain/general/goodbye.yml +0 -7
- 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_pro-3.14.0.dev9.dist-info → rasa_pro-3.14.0.dev11.dist-info}/NOTICE +0 -0
- {rasa_pro-3.14.0.dev9.dist-info → rasa_pro-3.14.0.dev11.dist-info}/WHEEL +0 -0
- {rasa_pro-3.14.0.dev9.dist-info → rasa_pro-3.14.0.dev11.dist-info}/entry_points.txt +0 -0
rasa/core/channels/__init__.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# ruff: noqa: I001
|
|
2
|
-
from typing import Text, Dict, List, Type
|
|
2
|
+
from typing import Text, Dict, List, Type, Optional
|
|
3
3
|
|
|
4
4
|
from rasa.core.channels.channel import ( # noqa: F401
|
|
5
5
|
InputChannel,
|
|
@@ -15,54 +15,101 @@ from rasa.core.channels.socketio import SocketIOInput
|
|
|
15
15
|
from rasa.core.channels.botframework import BotFrameworkInput
|
|
16
16
|
from rasa.core.channels.callback import CallbackInput
|
|
17
17
|
from rasa.core.channels.console import CmdlineInput
|
|
18
|
-
from rasa.core.channels.facebook import FacebookInput
|
|
19
18
|
from rasa.core.channels.mattermost import MattermostInput
|
|
20
19
|
from rasa.core.channels.rasa_chat import RasaChatInput
|
|
21
20
|
from rasa.core.channels.rest import RestInput
|
|
22
21
|
from rasa.core.channels.rocketchat import RocketChatInput
|
|
23
|
-
from rasa.core.channels.slack import SlackInput
|
|
24
|
-
from rasa.core.channels.telegram import TelegramInput
|
|
25
|
-
from rasa.core.channels.twilio import TwilioInput
|
|
26
|
-
from rasa.core.channels.voice_ready.twilio_voice import TwilioVoiceInput
|
|
27
22
|
from rasa.core.channels.voice_ready.jambonz import JambonzVoiceReadyInput
|
|
28
23
|
from rasa.core.channels.voice_ready.audiocodes import AudiocodesInput
|
|
29
24
|
from rasa.core.channels.voice_stream.browser_audio import BrowserAudioInputChannel
|
|
30
|
-
from rasa.core.channels.webexteams import WebexTeamsInput
|
|
31
25
|
from rasa.core.channels.hangouts import HangoutsInput
|
|
32
|
-
from rasa.core.channels.vier_cvg import CVGInput
|
|
33
|
-
from rasa.core.channels.voice_stream.twilio_media_streams import (
|
|
34
|
-
TwilioMediaStreamsInputChannel,
|
|
35
|
-
)
|
|
36
26
|
from rasa.core.channels.voice_stream.genesys import GenesysInputChannel
|
|
37
27
|
from rasa.core.channels.studio_chat import StudioChatInput
|
|
38
28
|
from rasa.core.channels.voice_stream.audiocodes import AudiocodesVoiceInputChannel
|
|
39
29
|
from rasa.core.channels.voice_stream.jambonz import JambonzStreamInputChannel
|
|
40
30
|
|
|
31
|
+
# Type annotations for channels with optional dependencies
|
|
32
|
+
FacebookInput: Optional[Type[InputChannel]]
|
|
33
|
+
SlackInput: Optional[Type[InputChannel]]
|
|
34
|
+
TelegramInput: Optional[Type[InputChannel]]
|
|
35
|
+
TwilioInput: Optional[Type[InputChannel]]
|
|
36
|
+
TwilioVoiceInput: Optional[Type[InputChannel]]
|
|
37
|
+
TwilioMediaStreamsInputChannel: Optional[Type[InputChannel]]
|
|
38
|
+
WebexTeamsInput: Optional[Type[InputChannel]]
|
|
39
|
+
CVGInput: Optional[Type[InputChannel]]
|
|
40
|
+
|
|
41
|
+
# Channels with optional dependencies - import with try-except
|
|
42
|
+
try:
|
|
43
|
+
from rasa.core.channels.facebook import FacebookInput
|
|
44
|
+
except ImportError:
|
|
45
|
+
FacebookInput = None
|
|
46
|
+
|
|
47
|
+
try:
|
|
48
|
+
from rasa.core.channels.slack import SlackInput
|
|
49
|
+
except ImportError:
|
|
50
|
+
SlackInput = None
|
|
51
|
+
|
|
52
|
+
try:
|
|
53
|
+
from rasa.core.channels.telegram import TelegramInput
|
|
54
|
+
except ImportError:
|
|
55
|
+
TelegramInput = None
|
|
56
|
+
|
|
57
|
+
try:
|
|
58
|
+
from rasa.core.channels.twilio import TwilioInput
|
|
59
|
+
except ImportError:
|
|
60
|
+
TwilioInput = None
|
|
61
|
+
|
|
62
|
+
try:
|
|
63
|
+
from rasa.core.channels.voice_ready.twilio_voice import TwilioVoiceInput
|
|
64
|
+
except ImportError:
|
|
65
|
+
TwilioVoiceInput = None
|
|
66
|
+
|
|
67
|
+
try:
|
|
68
|
+
from rasa.core.channels.voice_stream.twilio_media_streams import (
|
|
69
|
+
TwilioMediaStreamsInputChannel,
|
|
70
|
+
)
|
|
71
|
+
except ImportError:
|
|
72
|
+
TwilioMediaStreamsInputChannel = None
|
|
73
|
+
|
|
74
|
+
try:
|
|
75
|
+
from rasa.core.channels.webexteams import WebexTeamsInput
|
|
76
|
+
except ImportError:
|
|
77
|
+
WebexTeamsInput = None
|
|
78
|
+
|
|
79
|
+
try:
|
|
80
|
+
from rasa.core.channels.vier_cvg import CVGInput
|
|
81
|
+
except ImportError:
|
|
82
|
+
CVGInput = None
|
|
83
|
+
|
|
41
84
|
input_channel_classes: List[Type[InputChannel]] = [
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
85
|
+
c
|
|
86
|
+
for c in [
|
|
87
|
+
CmdlineInput,
|
|
88
|
+
FacebookInput,
|
|
89
|
+
SlackInput,
|
|
90
|
+
TelegramInput,
|
|
91
|
+
MattermostInput,
|
|
92
|
+
TwilioInput,
|
|
93
|
+
TwilioVoiceInput,
|
|
94
|
+
RasaChatInput,
|
|
95
|
+
BotFrameworkInput,
|
|
96
|
+
RocketChatInput,
|
|
97
|
+
CallbackInput,
|
|
98
|
+
RestInput,
|
|
99
|
+
SocketIOInput,
|
|
100
|
+
WebexTeamsInput,
|
|
101
|
+
HangoutsInput,
|
|
102
|
+
AudiocodesInput,
|
|
103
|
+
CVGInput,
|
|
104
|
+
JambonzVoiceReadyInput,
|
|
105
|
+
TwilioMediaStreamsInputChannel,
|
|
106
|
+
BrowserAudioInputChannel,
|
|
107
|
+
GenesysInputChannel,
|
|
108
|
+
StudioChatInput,
|
|
109
|
+
AudiocodesVoiceInputChannel,
|
|
110
|
+
JambonzStreamInputChannel,
|
|
111
|
+
]
|
|
112
|
+
if c is not None
|
|
66
113
|
]
|
|
67
114
|
|
|
68
115
|
# Mapping from an input channel name to its class to allow name based lookup.
|
rasa/core/channels/telegram.py
CHANGED
|
@@ -4,6 +4,9 @@ import typing
|
|
|
4
4
|
from copy import deepcopy
|
|
5
5
|
from typing import Any, Awaitable, Callable, Dict, List, Optional, Text
|
|
6
6
|
|
|
7
|
+
# Import aiogram at module level to raise error if not installed
|
|
8
|
+
from aiogram import Bot
|
|
9
|
+
from aiogram.types import Message, Update
|
|
7
10
|
from sanic import Blueprint, response
|
|
8
11
|
from sanic.request import Request
|
|
9
12
|
from sanic.response import HTTPResponse
|
|
@@ -28,15 +31,7 @@ class TelegramOutput(OutputChannel):
|
|
|
28
31
|
return "telegram"
|
|
29
32
|
|
|
30
33
|
def __init__(self, access_token: Optional[Text]) -> None:
|
|
31
|
-
|
|
32
|
-
from aiogram import Bot
|
|
33
|
-
|
|
34
|
-
self.bot = Bot(access_token)
|
|
35
|
-
except ImportError:
|
|
36
|
-
raise ImportError(
|
|
37
|
-
"To use the Telegram channel, please install the aiogram package "
|
|
38
|
-
"with 'pip install aiogram'"
|
|
39
|
-
)
|
|
34
|
+
self.bot = Bot(access_token)
|
|
40
35
|
|
|
41
36
|
async def send_text_message(
|
|
42
37
|
self, recipient_id: Text, text: Text, **kwargs: Any
|
|
@@ -14,6 +14,9 @@ from sanic import ( # type: ignore[attr-defined]
|
|
|
14
14
|
response,
|
|
15
15
|
)
|
|
16
16
|
|
|
17
|
+
# Import twilio at module level to raise error if not installed
|
|
18
|
+
from twilio.twiml.voice_response import VoiceResponse
|
|
19
|
+
|
|
17
20
|
from rasa.core.channels import UserMessage
|
|
18
21
|
from rasa.core.channels.channel import (
|
|
19
22
|
create_auth_requested_response_provider,
|
|
@@ -145,7 +148,8 @@ class TwilioMediaStreamsInputChannel(VoiceInputChannel):
|
|
|
145
148
|
"""Get the sender ID for the channel.
|
|
146
149
|
|
|
147
150
|
Twilio Media Streams uses the Stream ID as Sender ID because
|
|
148
|
-
it is required in OutputChannel.send_text_message to send messages.
|
|
151
|
+
it is required in OutputChannel.send_text_message to send messages.
|
|
152
|
+
"""
|
|
149
153
|
return call_parameters.stream_id # type: ignore[return-value]
|
|
150
154
|
|
|
151
155
|
def channel_bytes_to_rasa_audio_bytes(self, input_bytes: bytes) -> RasaAudioBytes:
|
|
@@ -4,6 +4,7 @@ from collections import deque
|
|
|
4
4
|
from typing import Deque, Optional, Text
|
|
5
5
|
|
|
6
6
|
import structlog
|
|
7
|
+
from pydantic import ValidationError
|
|
7
8
|
|
|
8
9
|
from rasa.core.lock import Ticket, TicketLock
|
|
9
10
|
from rasa.core.lock_store import (
|
|
@@ -12,6 +13,12 @@ from rasa.core.lock_store import (
|
|
|
12
13
|
LockError,
|
|
13
14
|
LockStore,
|
|
14
15
|
)
|
|
16
|
+
from rasa.core.redis_connection_factory import (
|
|
17
|
+
DeploymentMode,
|
|
18
|
+
RedisConfig,
|
|
19
|
+
RedisConnectionFactory,
|
|
20
|
+
)
|
|
21
|
+
from rasa.shared.exceptions import RasaException
|
|
15
22
|
from rasa.utils.endpoints import EndpointConfig
|
|
16
23
|
|
|
17
24
|
DEFAULT_REDIS_DB = 1
|
|
@@ -74,9 +81,10 @@ class ConcurrentRedisLockStore(LockStore):
|
|
|
74
81
|
alphanumeric.
|
|
75
82
|
socket_timeout - Timeout in seconds after which an exception will be raised
|
|
76
83
|
in case Redis doesn't respond within `socket_timeout` seconds.
|
|
84
|
+
deployment_mode - Redis deployment mode: standard, cluster, or sentinel.
|
|
85
|
+
endpoints - List of endpoints for cluster/sentinel mode in host:port format.
|
|
86
|
+
sentinel_service - Sentinel service name.
|
|
77
87
|
"""
|
|
78
|
-
import redis
|
|
79
|
-
|
|
80
88
|
host = endpoint_config.kwargs.get("host", DEFAULT_HOSTNAME)
|
|
81
89
|
port = endpoint_config.kwargs.get("port", DEFAULT_PORT)
|
|
82
90
|
db = endpoint_config.kwargs.get("db", DEFAULT_REDIS_DB)
|
|
@@ -90,20 +98,33 @@ class ConcurrentRedisLockStore(LockStore):
|
|
|
90
98
|
socket_timeout = endpoint_config.kwargs.get(
|
|
91
99
|
"socket_timeout", DEFAULT_SOCKET_TIMEOUT_IN_SECONDS
|
|
92
100
|
)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
host=host,
|
|
96
|
-
port=int(port),
|
|
97
|
-
db=int(db),
|
|
98
|
-
username=username,
|
|
99
|
-
password=password,
|
|
100
|
-
ssl=use_ssl,
|
|
101
|
-
ssl_certfile=ssl_certfile,
|
|
102
|
-
ssl_keyfile=ssl_keyfile,
|
|
103
|
-
ssl_ca_certs=ssl_ca_certs,
|
|
104
|
-
socket_timeout=socket_timeout,
|
|
101
|
+
deployment_mode = endpoint_config.kwargs.get(
|
|
102
|
+
"deployment_mode", DeploymentMode.STANDARD.value
|
|
105
103
|
)
|
|
104
|
+
endpoints = endpoint_config.kwargs.get("endpoints", [])
|
|
105
|
+
sentinel_service = endpoint_config.kwargs.get("sentinel_service")
|
|
106
106
|
|
|
107
|
+
try:
|
|
108
|
+
redis_config = RedisConfig(
|
|
109
|
+
host=host,
|
|
110
|
+
port=port,
|
|
111
|
+
db=db,
|
|
112
|
+
username=username,
|
|
113
|
+
password=password,
|
|
114
|
+
use_ssl=use_ssl,
|
|
115
|
+
ssl_certfile=ssl_certfile,
|
|
116
|
+
ssl_keyfile=ssl_keyfile,
|
|
117
|
+
ssl_ca_certs=ssl_ca_certs,
|
|
118
|
+
socket_timeout=socket_timeout,
|
|
119
|
+
deployment_mode=deployment_mode,
|
|
120
|
+
endpoints=endpoints,
|
|
121
|
+
sentinel_service=sentinel_service,
|
|
122
|
+
)
|
|
123
|
+
self.red = RedisConnectionFactory.create_connection(redis_config)
|
|
124
|
+
except ValidationError as e:
|
|
125
|
+
raise RasaException(f"Invalid Redis configuration: {e}")
|
|
126
|
+
|
|
127
|
+
self.deployment_mode = deployment_mode
|
|
107
128
|
self.key_prefix = DEFAULT_CONCURRENT_REDIS_LOCK_STORE_KEY_PREFIX
|
|
108
129
|
if key_prefix:
|
|
109
130
|
structlogger.debug(
|
|
@@ -129,6 +150,32 @@ class ConcurrentRedisLockStore(LockStore):
|
|
|
129
150
|
),
|
|
130
151
|
)
|
|
131
152
|
|
|
153
|
+
def _get_keys_by_pattern(self, pattern: Text) -> list:
|
|
154
|
+
"""Get keys by pattern, using SCAN for cluster mode and KEYS for others."""
|
|
155
|
+
if self.deployment_mode == DeploymentMode.CLUSTER.value:
|
|
156
|
+
# In cluster mode, use SCAN to get keys more reliably
|
|
157
|
+
keys = []
|
|
158
|
+
cursor = 0
|
|
159
|
+
|
|
160
|
+
while True:
|
|
161
|
+
try:
|
|
162
|
+
cursor, batch_keys = self.red.scan(cursor, match=pattern, count=100)
|
|
163
|
+
keys.extend(batch_keys)
|
|
164
|
+
if cursor == 0:
|
|
165
|
+
break
|
|
166
|
+
except Exception as e:
|
|
167
|
+
structlogger.warning(
|
|
168
|
+
"concurrent_redis_lock_store._get_keys_by_pattern.scan_interrupted",
|
|
169
|
+
event_info=f"SCAN interrupted in cluster mode: {e}. "
|
|
170
|
+
f"Returning {len(keys)} keys found so far.",
|
|
171
|
+
)
|
|
172
|
+
break
|
|
173
|
+
else:
|
|
174
|
+
# Standard and sentinel modes use KEYS
|
|
175
|
+
keys = self.red.keys(pattern)
|
|
176
|
+
|
|
177
|
+
return keys
|
|
178
|
+
|
|
132
179
|
def issue_ticket(
|
|
133
180
|
self, conversation_id: Text, lock_lifetime: float = LOCK_LIFETIME
|
|
134
181
|
) -> int:
|
|
@@ -157,11 +204,14 @@ class ConcurrentRedisLockStore(LockStore):
|
|
|
157
204
|
tickets: Deque[Ticket] = deque()
|
|
158
205
|
|
|
159
206
|
pattern = self.key_prefix + conversation_id + ":" + "[0-9]*"
|
|
160
|
-
redis_keys = self.
|
|
207
|
+
redis_keys = self._get_keys_by_pattern(pattern)
|
|
161
208
|
|
|
162
209
|
for key in redis_keys:
|
|
163
210
|
serialised_ticket = self.red.get(key)
|
|
164
211
|
if serialised_ticket:
|
|
212
|
+
# Handle bytes to string conversion for JSON parsing
|
|
213
|
+
if isinstance(serialised_ticket, bytes):
|
|
214
|
+
serialised_ticket = serialised_ticket.decode("utf-8")
|
|
165
215
|
ticket = Ticket.from_dict(json.loads(serialised_ticket))
|
|
166
216
|
tickets.appendleft(ticket)
|
|
167
217
|
|
|
@@ -172,7 +222,7 @@ class ConcurrentRedisLockStore(LockStore):
|
|
|
172
222
|
def delete_lock(self, conversation_id: Text) -> None:
|
|
173
223
|
"""Deletes lock for conversation ID."""
|
|
174
224
|
pattern = self.key_prefix + conversation_id + ":*"
|
|
175
|
-
redis_keys = self.
|
|
225
|
+
redis_keys = self._get_keys_by_pattern(pattern)
|
|
176
226
|
|
|
177
227
|
if not redis_keys:
|
|
178
228
|
structlogger.debug(
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import threading
|
|
3
|
+
import time
|
|
1
4
|
from typing import Optional
|
|
2
5
|
|
|
3
6
|
import boto3
|
|
4
7
|
import structlog
|
|
8
|
+
from aws_msk_iam_sasl_signer import MSKAuthTokenProvider
|
|
5
9
|
from botocore.exceptions import BotoCoreError
|
|
6
10
|
|
|
7
11
|
from rasa.core.iam_credentials_providers.credentials_provider_protocol import (
|
|
@@ -10,6 +14,7 @@ from rasa.core.iam_credentials_providers.credentials_provider_protocol import (
|
|
|
10
14
|
SupportedServiceType,
|
|
11
15
|
TemporaryCredentials,
|
|
12
16
|
)
|
|
17
|
+
from rasa.shared.exceptions import ConnectionException
|
|
13
18
|
|
|
14
19
|
structlogger = structlog.get_logger(__name__)
|
|
15
20
|
|
|
@@ -17,7 +22,7 @@ structlogger = structlog.get_logger(__name__)
|
|
|
17
22
|
class AWSRDSIAMCredentialsProvider(IAMCredentialsProvider):
|
|
18
23
|
"""Generates temporary credentials for AWS RDS using IAM roles."""
|
|
19
24
|
|
|
20
|
-
def __init__(self, username: str, host: str, port: int):
|
|
25
|
+
def __init__(self, username: str, host: str, port: int) -> None:
|
|
21
26
|
"""Initializes the provider."""
|
|
22
27
|
self.username = username
|
|
23
28
|
self.host = host
|
|
@@ -52,6 +57,73 @@ class AWSRDSIAMCredentialsProvider(IAMCredentialsProvider):
|
|
|
52
57
|
return TemporaryCredentials(auth_token=None)
|
|
53
58
|
|
|
54
59
|
|
|
60
|
+
class AWSMSKafkaIAMCredentialsProvider(IAMCredentialsProvider):
|
|
61
|
+
"""Generates temporary credentials for AWS MSK using IAM roles."""
|
|
62
|
+
|
|
63
|
+
def __init__(self) -> None:
|
|
64
|
+
self.region = os.getenv("AWS_DEFAULT_REGION", os.getenv("AWS_REGION"))
|
|
65
|
+
self._token: Optional[str] = None
|
|
66
|
+
self._expires_at: float = 0
|
|
67
|
+
self.refresh_margin_seconds = 60 # Refresh 60 seconds before expiry
|
|
68
|
+
# ensure thread safety when refreshing token because the
|
|
69
|
+
# kafka client library we use (confluent-kafka) is multithreaded
|
|
70
|
+
self.lock = threading.Lock()
|
|
71
|
+
|
|
72
|
+
@property
|
|
73
|
+
def token(self) -> Optional[str]:
|
|
74
|
+
return self._token
|
|
75
|
+
|
|
76
|
+
@token.setter
|
|
77
|
+
def token(self, value: str) -> None:
|
|
78
|
+
self._token = value
|
|
79
|
+
|
|
80
|
+
@property
|
|
81
|
+
def expires_at(self) -> float:
|
|
82
|
+
return self._expires_at
|
|
83
|
+
|
|
84
|
+
@expires_at.setter
|
|
85
|
+
def expires_at(self, value: float) -> None:
|
|
86
|
+
self._expires_at = value
|
|
87
|
+
|
|
88
|
+
def get_credentials(self) -> TemporaryCredentials:
|
|
89
|
+
"""Generates temporary credentials for AWS MSK."""
|
|
90
|
+
with self.lock:
|
|
91
|
+
current_time = time.time() # Current time in seconds
|
|
92
|
+
if (
|
|
93
|
+
not self.token
|
|
94
|
+
or current_time >= self.expires_at - self.refresh_margin_seconds
|
|
95
|
+
):
|
|
96
|
+
try:
|
|
97
|
+
auth_token, expiry_ms = MSKAuthTokenProvider.generate_auth_token(
|
|
98
|
+
self.region
|
|
99
|
+
)
|
|
100
|
+
structlogger.debug(
|
|
101
|
+
"rasa.core.aws_msk_iam_credentials_provider.get_credentials",
|
|
102
|
+
event_info="Successfully generated AWS IAM token for "
|
|
103
|
+
"Kafka authentication.",
|
|
104
|
+
)
|
|
105
|
+
self.token = auth_token
|
|
106
|
+
self.expires_at = int(expiry_ms) / 1000 # Convert ms to seconds
|
|
107
|
+
return TemporaryCredentials(
|
|
108
|
+
auth_token=auth_token,
|
|
109
|
+
expiration=self.expires_at,
|
|
110
|
+
)
|
|
111
|
+
except Exception as exc:
|
|
112
|
+
raise ConnectionException(
|
|
113
|
+
f"Failed to generate AWS IAM token "
|
|
114
|
+
f"for MSK authentication. Original exception: {exc}"
|
|
115
|
+
) from exc
|
|
116
|
+
else:
|
|
117
|
+
structlogger.debug(
|
|
118
|
+
"rasa.core.aws_msk_iam_credentials_provider.get_credentials",
|
|
119
|
+
event_info="Using cached AWS IAM token for Kafka authentication.",
|
|
120
|
+
)
|
|
121
|
+
return TemporaryCredentials(
|
|
122
|
+
auth_token=self.token,
|
|
123
|
+
expiration=self.expires_at,
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
|
|
55
127
|
def create_aws_iam_credentials_provider(
|
|
56
128
|
provider_input: "IAMCredentialsProviderInput",
|
|
57
129
|
) -> Optional["IAMCredentialsProvider"]:
|
|
@@ -63,4 +135,7 @@ def create_aws_iam_credentials_provider(
|
|
|
63
135
|
port=provider_input.port,
|
|
64
136
|
)
|
|
65
137
|
|
|
138
|
+
if provider_input.service_name == SupportedServiceType.EVENT_BROKER:
|
|
139
|
+
return AWSMSKafkaIAMCredentialsProvider()
|
|
140
|
+
|
|
66
141
|
return None
|
|
@@ -16,7 +16,7 @@ class TemporaryCredentials(BaseModel):
|
|
|
16
16
|
"""Dataclass storing temporary credentials."""
|
|
17
17
|
|
|
18
18
|
auth_token: Optional[str] = None
|
|
19
|
-
expiration: Optional[
|
|
19
|
+
expiration: Optional[float] = None
|
|
20
20
|
username: Optional[str] = None
|
|
21
21
|
presigned_url: Optional[str] = None
|
|
22
22
|
|
rasa/core/lock_store.py
CHANGED
|
@@ -4,7 +4,7 @@ import asyncio
|
|
|
4
4
|
import json
|
|
5
5
|
import os
|
|
6
6
|
from contextlib import asynccontextmanager
|
|
7
|
-
from typing import Any, AsyncGenerator, Dict, Literal, Optional, Text, Union
|
|
7
|
+
from typing import Any, AsyncGenerator, Dict, List, Literal, Optional, Text, Union
|
|
8
8
|
|
|
9
9
|
import structlog
|
|
10
10
|
from pydantic import (
|
|
@@ -12,12 +12,18 @@ from pydantic import (
|
|
|
12
12
|
BaseModel,
|
|
13
13
|
Field,
|
|
14
14
|
NonNegativeInt,
|
|
15
|
+
ValidationError,
|
|
15
16
|
model_validator,
|
|
16
17
|
)
|
|
17
18
|
|
|
18
19
|
import rasa.shared.utils.common
|
|
19
20
|
from rasa.core.constants import DEFAULT_LOCK_LIFETIME
|
|
20
21
|
from rasa.core.lock import TicketLock
|
|
22
|
+
from rasa.core.redis_connection_factory import (
|
|
23
|
+
DeploymentMode,
|
|
24
|
+
RedisConfig,
|
|
25
|
+
RedisConnectionFactory,
|
|
26
|
+
)
|
|
21
27
|
from rasa.shared.exceptions import ConnectionException, RasaException
|
|
22
28
|
from rasa.shared.utils.io import raise_deprecation_warning
|
|
23
29
|
from rasa.utils.endpoints import EndpointConfig
|
|
@@ -269,6 +275,18 @@ class RedisLockStoreConfig(BaseModel):
|
|
|
269
275
|
"will be raised in case Redis doesn't respond "
|
|
270
276
|
"within `socket_timeout` seconds.",
|
|
271
277
|
)
|
|
278
|
+
deployment_mode: DeploymentMode = Field(
|
|
279
|
+
default=DeploymentMode.STANDARD,
|
|
280
|
+
description="Redis deployment mode: 'standard', 'cluster', or 'sentinel'",
|
|
281
|
+
)
|
|
282
|
+
endpoints: Optional[List[str]] = Field(
|
|
283
|
+
default=None,
|
|
284
|
+
description="List of endpoints for cluster/sentinel mode in 'host:port' format",
|
|
285
|
+
)
|
|
286
|
+
sentinel_service: Optional[str] = Field(
|
|
287
|
+
default=None,
|
|
288
|
+
description="Sentinel service name",
|
|
289
|
+
)
|
|
272
290
|
|
|
273
291
|
@model_validator(mode="before")
|
|
274
292
|
@classmethod
|
|
@@ -298,9 +316,6 @@ class RedisLockStoreConfig(BaseModel):
|
|
|
298
316
|
)
|
|
299
317
|
return self
|
|
300
318
|
|
|
301
|
-
def to_strict_redis(self) -> Dict[str, Any]:
|
|
302
|
-
return self.model_dump(by_alias=True, exclude={"key_prefix"})
|
|
303
|
-
|
|
304
319
|
|
|
305
320
|
class RedisLockStore(LockStore):
|
|
306
321
|
"""Redis store for ticket locks."""
|
|
@@ -314,10 +329,26 @@ class RedisLockStore(LockStore):
|
|
|
314
329
|
Args:
|
|
315
330
|
config: Redis lock store configuration.
|
|
316
331
|
"""
|
|
317
|
-
import redis
|
|
318
|
-
|
|
319
332
|
self.config = config
|
|
320
|
-
|
|
333
|
+
try:
|
|
334
|
+
redis_config = RedisConfig(
|
|
335
|
+
host=str(self.config.host),
|
|
336
|
+
port=self.config.port,
|
|
337
|
+
db=self.config.db,
|
|
338
|
+
username=self.config.username,
|
|
339
|
+
password=self.config.password,
|
|
340
|
+
use_ssl=self.config.use_ssl,
|
|
341
|
+
ssl_keyfile=self.config.ssl_keyfile,
|
|
342
|
+
ssl_certfile=self.config.ssl_certfile,
|
|
343
|
+
ssl_ca_certs=self.config.ssl_ca_certs,
|
|
344
|
+
deployment_mode=self.config.deployment_mode,
|
|
345
|
+
endpoints=self.config.endpoints,
|
|
346
|
+
sentinel_service=self.config.sentinel_service,
|
|
347
|
+
socket_timeout=self.config.socket_timeout,
|
|
348
|
+
)
|
|
349
|
+
self.red = RedisConnectionFactory.create_connection(redis_config)
|
|
350
|
+
except ValidationError as e:
|
|
351
|
+
raise RasaException(f"Invalid Redis configuration: {e}")
|
|
321
352
|
|
|
322
353
|
self.key_prefix = DEFAULT_REDIS_LOCK_STORE_KEY_PREFIX
|
|
323
354
|
if self.config.key_prefix:
|
|
@@ -349,6 +380,9 @@ class RedisLockStore(LockStore):
|
|
|
349
380
|
"""Retrieves lock (see parent docstring for more information)."""
|
|
350
381
|
serialised_lock = self.red.get(self.key_prefix + conversation_id)
|
|
351
382
|
if serialised_lock:
|
|
383
|
+
# Handle bytes to string conversion for JSON parsing
|
|
384
|
+
if isinstance(serialised_lock, bytes):
|
|
385
|
+
serialised_lock = serialised_lock.decode("utf-8")
|
|
352
386
|
return TicketLock.from_dict(json.loads(serialised_lock))
|
|
353
387
|
|
|
354
388
|
return None
|