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
|
@@ -4,6 +4,9 @@ import logging
|
|
|
4
4
|
import typing
|
|
5
5
|
from typing import Any, Dict, List, Optional, Text, Type
|
|
6
6
|
|
|
7
|
+
# importing mitie at module level to ensure error is raised if mitie is not installed
|
|
8
|
+
import mitie
|
|
9
|
+
|
|
7
10
|
from rasa.engine.graph import ExecutionContext, GraphComponent
|
|
8
11
|
from rasa.engine.recipes.default_recipe import DefaultV1Recipe
|
|
9
12
|
from rasa.engine.storage.resource import Resource
|
|
@@ -6,6 +6,7 @@ import warnings
|
|
|
6
6
|
from typing import Any, Dict, List, Optional, Text, Tuple, Type
|
|
7
7
|
|
|
8
8
|
import numpy as np
|
|
9
|
+
import skops.io as sio
|
|
9
10
|
|
|
10
11
|
import rasa.shared.utils.io
|
|
11
12
|
from rasa.engine.graph import ExecutionContext, GraphComponent
|
|
@@ -266,8 +267,6 @@ class SklearnIntentClassifier(GraphComponent, IntentClassifier):
|
|
|
266
267
|
|
|
267
268
|
def persist(self) -> None:
|
|
268
269
|
"""Persist this model into the passed directory."""
|
|
269
|
-
import skops.io as sio
|
|
270
|
-
|
|
271
270
|
with self._model_storage.write_to(self._resource) as model_dir:
|
|
272
271
|
file_name = self.__class__.__name__
|
|
273
272
|
classifier_file_name = model_dir / f"{file_name}_classifier.skops"
|
|
@@ -291,7 +290,6 @@ class SklearnIntentClassifier(GraphComponent, IntentClassifier):
|
|
|
291
290
|
**kwargs: Any,
|
|
292
291
|
) -> SklearnIntentClassifier:
|
|
293
292
|
"""Loads trained component (see parent class for full docstring)."""
|
|
294
|
-
import skops.io as sio
|
|
295
293
|
from sklearn.preprocessing import LabelEncoder
|
|
296
294
|
|
|
297
295
|
try:
|
|
@@ -10,6 +10,9 @@ from typing import Any, Callable, Dict, List, Optional, Text, Tuple, Type
|
|
|
10
10
|
|
|
11
11
|
import numpy as np
|
|
12
12
|
|
|
13
|
+
# importing sklearn_crfsuite at module level to raise error if not installed
|
|
14
|
+
import sklearn_crfsuite
|
|
15
|
+
|
|
13
16
|
import rasa.nlu.utils.bilou_utils as bilou_utils
|
|
14
17
|
import rasa.shared.utils.io
|
|
15
18
|
import rasa.utils.train_utils
|
|
@@ -20,7 +23,6 @@ from rasa.engine.storage.storage import ModelStorage
|
|
|
20
23
|
from rasa.nlu.constants import TOKENS_NAMES
|
|
21
24
|
from rasa.nlu.extractors.extractor import EntityExtractorMixin
|
|
22
25
|
from rasa.nlu.test import determine_token_labels
|
|
23
|
-
from rasa.nlu.tokenizers.spacy_tokenizer import POS_TAG_KEY
|
|
24
26
|
from rasa.nlu.tokenizers.tokenizer import Token, Tokenizer
|
|
25
27
|
from rasa.shared.constants import DOCS_URL_COMPONENTS
|
|
26
28
|
from rasa.shared.nlu.constants import (
|
|
@@ -37,6 +39,8 @@ from rasa.shared.nlu.training_data.message import Message
|
|
|
37
39
|
from rasa.shared.nlu.training_data.training_data import TrainingData
|
|
38
40
|
from rasa.utils.tensorflow.constants import BILOU_FLAG, FEATURIZERS
|
|
39
41
|
|
|
42
|
+
POS_TAG_KEY = "pos"
|
|
43
|
+
|
|
40
44
|
logger = logging.getLogger(__name__)
|
|
41
45
|
|
|
42
46
|
if typing.TYPE_CHECKING:
|
|
@@ -445,13 +449,11 @@ class CRFEntityExtractor(GraphComponent, EntityExtractorMixin):
|
|
|
445
449
|
def _load_taggers(
|
|
446
450
|
cls, model_dir: Path, config: Dict[Text, Any]
|
|
447
451
|
) -> Dict[str, "CRF"]:
|
|
448
|
-
"""
|
|
449
|
-
Load taggers from model directory that persists trained binary
|
|
450
|
-
`model.crfsuite` files.
|
|
451
|
-
"""
|
|
452
|
+
"""Load taggers from model directory.
|
|
452
453
|
|
|
454
|
+
It persists trained binary `model.crfsuite` files.
|
|
455
|
+
"""
|
|
453
456
|
import pycrfsuite
|
|
454
|
-
import sklearn_crfsuite
|
|
455
457
|
|
|
456
458
|
# Get tagger directories
|
|
457
459
|
taggers_base = model_dir / TAGGERS_DIR
|
|
@@ -613,8 +615,7 @@ class CRFEntityExtractor(GraphComponent, EntityExtractorMixin):
|
|
|
613
615
|
|
|
614
616
|
@staticmethod
|
|
615
617
|
def _pattern_of_token(message: Message, idx: int) -> Dict[Text, bool]:
|
|
616
|
-
"""Get
|
|
617
|
-
'RegexFeaturizer'.
|
|
618
|
+
"""Get patterns of token at the given index extracted by 'RegexFeaturizer'.
|
|
618
619
|
|
|
619
620
|
The 'RegexFeaturizer' adds all patterns listed in the training data to the
|
|
620
621
|
token. The pattern name is mapped to either 'True' (pattern applies to token) or
|
|
@@ -728,8 +729,6 @@ class CRFEntityExtractor(GraphComponent, EntityExtractorMixin):
|
|
|
728
729
|
crf_order: List[str],
|
|
729
730
|
) -> OrderedDict[str, CRF]:
|
|
730
731
|
"""Train the crf tagger based on the training data."""
|
|
731
|
-
import sklearn_crfsuite
|
|
732
|
-
|
|
733
732
|
entity_taggers = OrderedDict()
|
|
734
733
|
|
|
735
734
|
for tag_name in crf_order:
|
|
@@ -4,6 +4,9 @@ import logging
|
|
|
4
4
|
import typing
|
|
5
5
|
from typing import Any, Dict, List, Optional, Text, Type
|
|
6
6
|
|
|
7
|
+
# importing mitie at module level to ensure error is raised if mitie is not installed
|
|
8
|
+
import mitie
|
|
9
|
+
|
|
7
10
|
import rasa.shared.utils.io
|
|
8
11
|
from rasa.engine.graph import ExecutionContext, GraphComponent
|
|
9
12
|
from rasa.engine.recipes.default_recipe import DefaultV1Recipe
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import typing
|
|
2
2
|
from typing import Any, Dict, List, Text, Type
|
|
3
3
|
|
|
4
|
+
# importing spacy at module level to ensure error is raised if spacy is not installed
|
|
5
|
+
import spacy # noqa: F401
|
|
6
|
+
|
|
4
7
|
from rasa.engine.graph import ExecutionContext, GraphComponent
|
|
5
8
|
from rasa.engine.recipes.default_recipe import DefaultV1Recipe
|
|
6
9
|
from rasa.engine.storage.resource import Resource
|
|
@@ -4,6 +4,8 @@ import logging
|
|
|
4
4
|
import typing
|
|
5
5
|
from typing import Any, Dict, List, Text, Tuple, Type
|
|
6
6
|
|
|
7
|
+
# importing mitie at module level to ensure error is raised if mitie is not installed
|
|
8
|
+
import mitie
|
|
7
9
|
import numpy as np
|
|
8
10
|
|
|
9
11
|
from rasa.engine.graph import ExecutionContext, GraphComponent
|
|
@@ -4,6 +4,9 @@ from typing import Any, Dict, List, Text, Type
|
|
|
4
4
|
|
|
5
5
|
import numpy as np
|
|
6
6
|
|
|
7
|
+
# importing spacy at module level to ensure error is raised if spacy is not installed
|
|
8
|
+
import spacy # noqa: F401
|
|
9
|
+
|
|
7
10
|
from rasa.engine.graph import ExecutionContext, GraphComponent
|
|
8
11
|
from rasa.engine.recipes.default_recipe import DefaultV1Recipe
|
|
9
12
|
from rasa.engine.storage.resource import Resource
|
|
@@ -21,12 +21,14 @@ from rasa.nlu.constants import (
|
|
|
21
21
|
)
|
|
22
22
|
from rasa.nlu.featurizers.sparse_featurizer.sparse_featurizer import SparseFeaturizer
|
|
23
23
|
from rasa.nlu.tokenizers.tokenizer import Tokenizer
|
|
24
|
-
from rasa.nlu.utils.spacy_utils import SpacyModel
|
|
25
24
|
from rasa.shared.constants import DOCS_URL_COMPONENTS
|
|
26
25
|
from rasa.shared.exceptions import FileIOException, RasaException
|
|
27
26
|
from rasa.shared.nlu.constants import ACTION_NAME, INTENT, INTENT_RESPONSE_KEY, TEXT
|
|
28
27
|
from rasa.shared.nlu.training_data.message import Message
|
|
29
28
|
from rasa.shared.nlu.training_data.training_data import TrainingData
|
|
29
|
+
from rasa.shared.utils.common import conditional_import
|
|
30
|
+
|
|
31
|
+
SpacyModel, _ = conditional_import("rasa.nlu.utils.spacy_utils", "SpacyModel")
|
|
30
32
|
|
|
31
33
|
BUFFER_SLOTS_PREFIX = "buf_"
|
|
32
34
|
|
|
@@ -603,7 +605,7 @@ class CountVectorsFeaturizer(SparseFeaturizer, GraphComponent):
|
|
|
603
605
|
return [], []
|
|
604
606
|
|
|
605
607
|
def train(
|
|
606
|
-
self, training_data: TrainingData, model: Optional[
|
|
608
|
+
self, training_data: TrainingData, model: Optional[Any] = None
|
|
607
609
|
) -> Resource:
|
|
608
610
|
"""Trains the featurizer.
|
|
609
611
|
|
|
@@ -18,6 +18,10 @@ from typing import (
|
|
|
18
18
|
import numpy as np
|
|
19
19
|
import scipy.sparse
|
|
20
20
|
|
|
21
|
+
# importing spacy at module level to ensure error is raised if spacy is not installed
|
|
22
|
+
# spacy is needed when importing from rasa.nlu.tokenizers.spacy_tokenizer
|
|
23
|
+
import spacy # noqa: F401
|
|
24
|
+
|
|
21
25
|
import rasa.shared.utils.io
|
|
22
26
|
import rasa.utils.io
|
|
23
27
|
from rasa.engine.graph import ExecutionContext, GraphComponent
|
|
@@ -6,6 +6,9 @@ import os
|
|
|
6
6
|
import shutil
|
|
7
7
|
from typing import Any, Dict, List, Optional, Text
|
|
8
8
|
|
|
9
|
+
# importing jieba at module level to ensure error is raised if jieba is not installed
|
|
10
|
+
import jieba
|
|
11
|
+
|
|
9
12
|
from rasa.engine.graph import ExecutionContext
|
|
10
13
|
from rasa.engine.recipes.default_recipe import DefaultV1Recipe
|
|
11
14
|
from rasa.engine.storage.resource import Resource
|
|
@@ -81,8 +84,6 @@ class JiebaTokenizer(Tokenizer):
|
|
|
81
84
|
be found in the documentation of jieba.
|
|
82
85
|
https://github.com/fxsjy/jieba#load-dictionary
|
|
83
86
|
"""
|
|
84
|
-
import jieba
|
|
85
|
-
|
|
86
87
|
jieba_userdicts = glob.glob(f"{path}/*")
|
|
87
88
|
for jieba_userdict in jieba_userdicts:
|
|
88
89
|
logger.info(f"Loading Jieba User Dictionary at {jieba_userdict}")
|
|
@@ -95,8 +96,6 @@ class JiebaTokenizer(Tokenizer):
|
|
|
95
96
|
|
|
96
97
|
def tokenize(self, message: Message, attribute: Text) -> List[Token]:
|
|
97
98
|
"""Tokenizes the text of the provided attribute of the incoming message."""
|
|
98
|
-
import jieba
|
|
99
|
-
|
|
100
99
|
text = message.get(attribute)
|
|
101
100
|
|
|
102
101
|
tokenized = jieba.tokenize(text)
|
|
@@ -2,6 +2,9 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
from typing import Any, Dict, List, Text
|
|
4
4
|
|
|
5
|
+
# importing mitie at module level to ensure error is raised if mitie is not installed
|
|
6
|
+
import mitie
|
|
7
|
+
|
|
5
8
|
from rasa.engine.graph import ExecutionContext
|
|
6
9
|
from rasa.engine.recipes.default_recipe import DefaultV1Recipe
|
|
7
10
|
from rasa.engine.storage.resource import Resource
|
|
@@ -49,8 +52,6 @@ class MitieTokenizer(Tokenizer):
|
|
|
49
52
|
|
|
50
53
|
def tokenize(self, message: Message, attribute: Text) -> List[Token]:
|
|
51
54
|
"""Tokenizes the text of the provided attribute of the incoming message."""
|
|
52
|
-
import mitie
|
|
53
|
-
|
|
54
55
|
text = message.get(attribute)
|
|
55
56
|
|
|
56
57
|
encoded_sentence = text.encode(DEFAULT_ENCODING)
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import typing
|
|
2
2
|
from typing import Any, Dict, List, Optional, Text, Type
|
|
3
3
|
|
|
4
|
+
# importing spacy at module level to ensure error is raised if spacy is not installed
|
|
5
|
+
import spacy
|
|
6
|
+
|
|
4
7
|
from rasa.engine.recipes.default_recipe import DefaultV1Recipe
|
|
5
8
|
from rasa.nlu.constants import SPACY_DOCS
|
|
6
9
|
from rasa.nlu.tokenizers.tokenizer import Token, Tokenizer
|
|
@@ -64,8 +67,6 @@ class SpacyTokenizer(Tokenizer):
|
|
|
64
67
|
|
|
65
68
|
@staticmethod
|
|
66
69
|
def _tag_of_token(token: Any) -> Text:
|
|
67
|
-
import spacy
|
|
68
|
-
|
|
69
70
|
if spacy.about.__version__ > "2" and token._.has("tag"):
|
|
70
71
|
return token._.get("tag")
|
|
71
72
|
else:
|
rasa/nlu/utils/mitie_utils.py
CHANGED
|
@@ -4,6 +4,9 @@ import typing
|
|
|
4
4
|
from pathlib import Path
|
|
5
5
|
from typing import Any, Dict, List, Optional, Text
|
|
6
6
|
|
|
7
|
+
# importing mitie at module level to ensure error is raised if mitie is not installed
|
|
8
|
+
import mitie
|
|
9
|
+
|
|
7
10
|
from rasa.engine.graph import ExecutionContext, GraphComponent
|
|
8
11
|
from rasa.engine.recipes.default_recipe import DefaultV1Recipe
|
|
9
12
|
from rasa.engine.storage.resource import Resource
|
rasa/nlu/utils/spacy_utils.py
CHANGED
|
@@ -5,6 +5,9 @@ import logging
|
|
|
5
5
|
import typing
|
|
6
6
|
from typing import Any, Dict, List, Optional, Text, Tuple
|
|
7
7
|
|
|
8
|
+
# importing spacy at module level to ensure error is raised if spacy is not installed
|
|
9
|
+
import spacy
|
|
10
|
+
|
|
8
11
|
from rasa.engine.graph import ExecutionContext, GraphComponent
|
|
9
12
|
from rasa.engine.recipes.default_recipe import DefaultV1Recipe
|
|
10
13
|
from rasa.engine.storage.resource import Resource
|
|
@@ -76,8 +79,6 @@ class SpacyNLP(GraphComponent):
|
|
|
76
79
|
@staticmethod
|
|
77
80
|
def load_model(spacy_model_name: Text) -> SpacyModel:
|
|
78
81
|
"""Try loading the model, catching the OSError if missing."""
|
|
79
|
-
import spacy
|
|
80
|
-
|
|
81
82
|
if not spacy_model_name:
|
|
82
83
|
raise InvalidModelError(
|
|
83
84
|
f"Missing model configuration for `SpacyNLP` in `config.yml`.\n"
|
|
@@ -51,7 +51,9 @@ class AgentAuthManager:
|
|
|
51
51
|
)
|
|
52
52
|
|
|
53
53
|
@classmethod
|
|
54
|
-
def load_auth(
|
|
54
|
+
def load_auth(
|
|
55
|
+
cls, config: Optional[Dict[str, Any]]
|
|
56
|
+
) -> Optional["AgentAuthManager"]:
|
|
55
57
|
"""Connect to authentication using specified strategy type and persist
|
|
56
58
|
the auth instance to the manager in a ready-to-use state.
|
|
57
59
|
|
|
@@ -61,7 +63,8 @@ class AgentAuthManager:
|
|
|
61
63
|
Raises:
|
|
62
64
|
AgentAuthInitializationException: If the authentication connection fails.
|
|
63
65
|
"""
|
|
64
|
-
|
|
66
|
+
if not config:
|
|
67
|
+
return None
|
|
65
68
|
try:
|
|
66
69
|
auth_type = AgentAuthManager.detect_auth_type(config)
|
|
67
70
|
|
|
@@ -83,4 +86,4 @@ class AgentAuthManager:
|
|
|
83
86
|
event_info=event_info,
|
|
84
87
|
config=config,
|
|
85
88
|
)
|
|
86
|
-
raise AgentAuthInitializationException(e)
|
|
89
|
+
raise AgentAuthInitializationException(e) from e
|
|
@@ -10,6 +10,7 @@ from rasa.shared.agents.auth.auth_strategy import AgentAuthStrategy
|
|
|
10
10
|
from rasa.shared.agents.auth.constants import (
|
|
11
11
|
CONFIG_CLIENT_ID_KEY,
|
|
12
12
|
CONFIG_CLIENT_SECRET_KEY,
|
|
13
|
+
CONFIG_OAUTH_KEY,
|
|
13
14
|
CONFIG_SCOPE_KEY,
|
|
14
15
|
CONFIG_TIMEOUT_KEY,
|
|
15
16
|
CONFIG_TOKEN_URL_KEY,
|
|
@@ -56,11 +57,18 @@ class OAuth2AuthStrategy(AgentAuthStrategy):
|
|
|
56
57
|
@classmethod
|
|
57
58
|
def from_config(cls, config: Dict[str, Any]) -> "OAuth2AuthStrategy":
|
|
58
59
|
"""Create OAuth2AuthStrategy from configuration dictionary."""
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
# Extract OAuth2 config from nested "oauth" key if present
|
|
61
|
+
oauth_config = config.get(CONFIG_OAUTH_KEY, config)
|
|
62
|
+
if not oauth_config:
|
|
63
|
+
raise ValueError("OAuth2 configuration is required")
|
|
64
|
+
|
|
65
|
+
token_url = oauth_config.get(CONFIG_TOKEN_URL_KEY)
|
|
66
|
+
client_id = oauth_config.get(CONFIG_CLIENT_ID_KEY)
|
|
67
|
+
client_secret = oauth_config.get(CONFIG_CLIENT_SECRET_KEY)
|
|
68
|
+
scope = oauth_config.get(CONFIG_SCOPE_KEY)
|
|
69
|
+
timeout = (
|
|
70
|
+
oauth_config.get(CONFIG_TIMEOUT_KEY) or cls.DEFAULT_ACCESS_TOKEN_TIMEOUT
|
|
71
|
+
)
|
|
64
72
|
|
|
65
73
|
if not token_url:
|
|
66
74
|
raise ValueError("Token URL is required for OAuth2 authentication")
|
rasa/shared/core/constants.py
CHANGED
|
@@ -129,7 +129,7 @@ GLOBAL_SILENCE_TIMEOUT_KEY = "global_silence_timeout"
|
|
|
129
129
|
SILENCE_TIMEOUT_SLOT = "silence_timeout"
|
|
130
130
|
SLOT_CONSECUTIVE_SILENCE_TIMEOUTS = "consecutive_silence_timeouts"
|
|
131
131
|
GLOBAL_SILENCE_TIMEOUT_DEFAULT_VALUE = 7.0
|
|
132
|
-
SILENCE_SLOTS =
|
|
132
|
+
SILENCE_SLOTS = {SILENCE_TIMEOUT_SLOT, SLOT_CONSECUTIVE_SILENCE_TIMEOUTS}
|
|
133
133
|
# slots for knowledge base
|
|
134
134
|
SLOT_LISTED_ITEMS = "knowledge_base_listed_objects"
|
|
135
135
|
SLOT_LAST_OBJECT = "knowledge_base_last_object"
|
|
@@ -148,6 +148,10 @@ DEFAULT_SLOT_NAMES = {
|
|
|
148
148
|
FLOW_HASHES_SLOT,
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
+
SLOTS_EXCLUDED_FOR_AGENT = (
|
|
152
|
+
SILENCE_SLOTS | DEFAULT_SLOT_NAMES | KNOWLEDGE_BASE_SLOT_NAMES
|
|
153
|
+
)
|
|
154
|
+
|
|
151
155
|
SLOT_MAPPINGS = "mappings"
|
|
152
156
|
MAPPING_CONDITIONS = "conditions"
|
|
153
157
|
KEY_MAPPING_TYPE = "type"
|
|
@@ -67,7 +67,7 @@ class MCPServerConnection:
|
|
|
67
67
|
def from_config(cls, server_config: Dict[str, Any]) -> "MCPServerConnection":
|
|
68
68
|
"""Initialize the MCP server connection from a configuration dictionary."""
|
|
69
69
|
auth_config = server_config.get("additional_params")
|
|
70
|
-
_auth_manager = AgentAuthManager.load_auth(auth_config)
|
|
70
|
+
_auth_manager = AgentAuthManager.load_auth(auth_config)
|
|
71
71
|
return cls(
|
|
72
72
|
server_config["name"],
|
|
73
73
|
server_config["url"],
|
rasa/telemetry.py
CHANGED
|
@@ -50,6 +50,7 @@ from rasa.shared.constants import (
|
|
|
50
50
|
UTTER_ASK_PREFIX,
|
|
51
51
|
)
|
|
52
52
|
from rasa.shared.core.flows import Flow
|
|
53
|
+
from rasa.shared.core.flows.flows_list import FlowsList
|
|
53
54
|
from rasa.shared.core.flows.steps import (
|
|
54
55
|
CallFlowStep,
|
|
55
56
|
CollectInformationFlowStep,
|
|
@@ -1083,6 +1084,7 @@ def track_model_training(
|
|
|
1083
1084
|
"num_regexes": len(nlu_data.regex_features),
|
|
1084
1085
|
"is_finetuning": is_finetuning,
|
|
1085
1086
|
"recipe": config.get(CONFIG_RECIPE_KEY),
|
|
1087
|
+
"agents": _collect_agent_configuration(flows),
|
|
1086
1088
|
}
|
|
1087
1089
|
|
|
1088
1090
|
flow_statistics = _collect_flow_statistics(flows.underlying_flows)
|
|
@@ -1125,6 +1127,67 @@ def track_model_training(
|
|
|
1125
1127
|
)
|
|
1126
1128
|
|
|
1127
1129
|
|
|
1130
|
+
def _collect_agent_configuration(flows: FlowsList) -> Dict[str, Any]:
|
|
1131
|
+
agent_data: Dict[str, Any] = {}
|
|
1132
|
+
|
|
1133
|
+
from rasa.core.available_agents import AvailableAgents
|
|
1134
|
+
from rasa.core.available_endpoints import AvailableEndpoints
|
|
1135
|
+
|
|
1136
|
+
agents = AvailableAgents.get_instance().agents
|
|
1137
|
+
mcp_servers = AvailableEndpoints.get_instance().mcp_servers
|
|
1138
|
+
|
|
1139
|
+
if not agents and not mcp_servers:
|
|
1140
|
+
return agent_data
|
|
1141
|
+
|
|
1142
|
+
agent_data["usage"] = []
|
|
1143
|
+
|
|
1144
|
+
for flow in flows.underlying_flows:
|
|
1145
|
+
for step in flow.steps:
|
|
1146
|
+
if isinstance(step, CallFlowStep):
|
|
1147
|
+
if flows.flow_by_id(step.call) is not None:
|
|
1148
|
+
continue
|
|
1149
|
+
|
|
1150
|
+
if step.is_calling_mcp_tool():
|
|
1151
|
+
agent_data["usage"].append(
|
|
1152
|
+
{
|
|
1153
|
+
"flow": flow.id,
|
|
1154
|
+
"mcp_tool": step.call,
|
|
1155
|
+
"mcp_server": step.mcp_server,
|
|
1156
|
+
"mapping": step.mapping,
|
|
1157
|
+
}
|
|
1158
|
+
)
|
|
1159
|
+
|
|
1160
|
+
if step.is_calling_agent():
|
|
1161
|
+
if step.exit_if:
|
|
1162
|
+
agent_data["usage"].append(
|
|
1163
|
+
{
|
|
1164
|
+
"flow": flow.id,
|
|
1165
|
+
"agent": step.call,
|
|
1166
|
+
"exit_if": step.exit_if,
|
|
1167
|
+
}
|
|
1168
|
+
)
|
|
1169
|
+
else:
|
|
1170
|
+
agent_data["usage"].append(
|
|
1171
|
+
{
|
|
1172
|
+
"flow": flow.id,
|
|
1173
|
+
"agent": step.call,
|
|
1174
|
+
}
|
|
1175
|
+
)
|
|
1176
|
+
|
|
1177
|
+
# dump mcp_servers and agents as json and exclude any values that are None
|
|
1178
|
+
if mcp_servers:
|
|
1179
|
+
agent_data["mcp_servers"] = [
|
|
1180
|
+
mcp_server.model_dump(exclude_none=True) for mcp_server in mcp_servers
|
|
1181
|
+
]
|
|
1182
|
+
if agents:
|
|
1183
|
+
agent_data["agents"] = [
|
|
1184
|
+
{agent_name: agent_info.model_dump(exclude_none=True)}
|
|
1185
|
+
for agent_name, agent_info in agents.items()
|
|
1186
|
+
]
|
|
1187
|
+
|
|
1188
|
+
return agent_data
|
|
1189
|
+
|
|
1190
|
+
|
|
1128
1191
|
def _collect_flow_statistics(flows: List[Flow]) -> Dict[str, Any]:
|
|
1129
1192
|
"""Collects some statistics about the flows, such as number of specific steps."""
|
|
1130
1193
|
data = {
|
rasa/utils/log_utils.py
CHANGED
|
@@ -19,19 +19,110 @@ from rasa.shared.constants import (
|
|
|
19
19
|
)
|
|
20
20
|
|
|
21
21
|
FORCE_JSON_LOGGING = os.environ.get("FORCE_JSON_LOGGING")
|
|
22
|
+
ANSI_CYAN_BOLD = "\033[1;36m"
|
|
23
|
+
ANSI_RESET = "\033[0m"
|
|
22
24
|
|
|
23
25
|
|
|
24
26
|
class HumanConsoleRenderer(ConsoleRenderer):
|
|
25
27
|
"""Console renderer that outputs human-readable logs."""
|
|
26
28
|
|
|
27
29
|
def __call__(self, logger: WrappedLogger, name: str, event_dict: EventDict) -> str:
|
|
30
|
+
should_highlight = event_dict.get("highlight", False)
|
|
31
|
+
terminal_width = self._get_terminal_width()
|
|
32
|
+
|
|
33
|
+
# Use event_info as title for the log entry
|
|
28
34
|
if "event_info" in event_dict:
|
|
29
35
|
event_key = event_dict["event"]
|
|
30
36
|
event_dict["event"] = event_dict["event_info"]
|
|
31
37
|
event_dict["event_key"] = event_key
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
38
|
+
event_dict.pop("event_info", None)
|
|
39
|
+
|
|
40
|
+
# In case the log entry should be highlighted
|
|
41
|
+
# make sure to surround the log entry with ===
|
|
42
|
+
event_dict = self._highlight_log_entry(
|
|
43
|
+
event_dict, terminal_width, should_highlight
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
# Format JSON data for better readability
|
|
47
|
+
event_dict = self._format_json_data(event_dict)
|
|
48
|
+
|
|
49
|
+
# Render the log entry first
|
|
50
|
+
result = super().__call__(logger, name, event_dict)
|
|
51
|
+
|
|
52
|
+
# ensure that newlines are properly rendered
|
|
53
|
+
result = "\n".join(result.split("\\n"))
|
|
54
|
+
|
|
55
|
+
# Add closing === if we highlighted this entry
|
|
56
|
+
if should_highlight:
|
|
57
|
+
result += f"\n{'=' * terminal_width}"
|
|
58
|
+
|
|
59
|
+
return result
|
|
60
|
+
|
|
61
|
+
def _highlight_log_entry(
|
|
62
|
+
self, event_dict: EventDict, terminal_width: int, should_highlight: bool
|
|
63
|
+
) -> EventDict:
|
|
64
|
+
if should_highlight:
|
|
65
|
+
# Only highlight if log level is DEBUG
|
|
66
|
+
# structlog passes log level as 'level' or 'levelname'
|
|
67
|
+
level = event_dict.get("level", event_dict.get("levelname", "")).upper()
|
|
68
|
+
if level == "DEBUG":
|
|
69
|
+
# Add opening === before the event info
|
|
70
|
+
if "event" in event_dict and isinstance(event_dict["event"], str):
|
|
71
|
+
event_info = event_dict["event"]
|
|
72
|
+
event_dict["event"] = (
|
|
73
|
+
f"\n{'=' * terminal_width}\n"
|
|
74
|
+
f"{ANSI_CYAN_BOLD}{event_info}{ANSI_RESET}\n"
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
event_dict.pop("highlight", None)
|
|
78
|
+
|
|
79
|
+
return event_dict
|
|
80
|
+
|
|
81
|
+
def _format_json_data(self, event_dict: EventDict) -> EventDict:
|
|
82
|
+
"""Format JSON data in the event dict for better readability."""
|
|
83
|
+
# Get the list of fields to format from the event dict
|
|
84
|
+
fields_to_format = event_dict.get("json_formatting", [])
|
|
85
|
+
|
|
86
|
+
if not fields_to_format:
|
|
87
|
+
return event_dict
|
|
88
|
+
|
|
89
|
+
import json
|
|
90
|
+
|
|
91
|
+
# Format only the specified fields
|
|
92
|
+
for key in fields_to_format:
|
|
93
|
+
if key in event_dict:
|
|
94
|
+
value = event_dict[key]
|
|
95
|
+
|
|
96
|
+
try:
|
|
97
|
+
# Try to parse as JSON if it's a string
|
|
98
|
+
if isinstance(value, str):
|
|
99
|
+
parsed = json.loads(value)
|
|
100
|
+
# If it's a dict or list, format it nicely
|
|
101
|
+
if isinstance(parsed, (dict, list)):
|
|
102
|
+
formatted = json.dumps(parsed, indent=2, ensure_ascii=False)
|
|
103
|
+
event_dict[key] = formatted
|
|
104
|
+
elif isinstance(value, (dict, list)):
|
|
105
|
+
# Format JSON with indentation for better readability
|
|
106
|
+
formatted = json.dumps(value, indent=2, ensure_ascii=False)
|
|
107
|
+
event_dict[key] = formatted
|
|
108
|
+
except (TypeError, ValueError, json.JSONDecodeError):
|
|
109
|
+
# If it's not JSON serializable or if it's not valid JSON,
|
|
110
|
+
# leave it as is
|
|
111
|
+
pass
|
|
112
|
+
|
|
113
|
+
# Remove the json_formatting key from the output
|
|
114
|
+
event_dict.pop("json_formatting", None)
|
|
115
|
+
|
|
116
|
+
return event_dict
|
|
117
|
+
|
|
118
|
+
def _get_terminal_width(self) -> int:
|
|
119
|
+
"""Get the width of the terminal."""
|
|
120
|
+
import shutil
|
|
121
|
+
|
|
122
|
+
try:
|
|
123
|
+
return shutil.get_terminal_size((80, 20)).columns
|
|
124
|
+
except Exception:
|
|
125
|
+
return 80
|
|
35
126
|
|
|
36
127
|
|
|
37
128
|
def configure_structlog(
|
|
@@ -52,7 +143,7 @@ def configure_structlog(
|
|
|
52
143
|
level=log_level,
|
|
53
144
|
)
|
|
54
145
|
|
|
55
|
-
shared_processors = [
|
|
146
|
+
shared_processors: List[structlog.typing.Processor] = [
|
|
56
147
|
# Processors that have nothing to do with output,
|
|
57
148
|
# e.g., add timestamps or log level names.
|
|
58
149
|
# If log level is too low, abort pipeline and throw away log entry.
|
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
"""TensorFlow utilities for Rasa components.
|
|
2
|
-
|
|
3
|
-
This module provides TensorFlow-related utilities and components.
|
|
4
|
-
TensorFlow is an optional dependency and should be installed separately
|
|
5
|
-
if you want to use components that require it. These are:
|
|
6
|
-
- DIETClassifier
|
|
7
|
-
- TEDPolicy
|
|
8
|
-
- UnexpecTEDIntentPolicy
|
|
9
|
-
- ResponseSelector
|
|
10
|
-
- ConveRTFeaturizer
|
|
11
|
-
- LanguageModelFeaturizer
|
|
12
|
-
|
|
13
|
-
To install Rasa with TensorFlow support:
|
|
14
|
-
`pip install "rasa[tensorflow]"`
|
|
15
|
-
|
|
16
|
-
To install it with poetry:
|
|
17
|
-
`poetry install --extras tensorflow`
|
|
18
|
-
|
|
19
|
-
For macOS with Apple Silicon (M1/M2) (platform-specific TensorFlow installation):
|
|
20
|
-
`pip install "rasa[tensorflow,metal]"`
|
|
21
|
-
"""
|
|
22
|
-
|
|
23
1
|
import importlib.util
|
|
24
2
|
import logging
|
|
25
3
|
|
|
@@ -67,15 +67,24 @@ class RasaModelCheckpoint(tf.keras.callbacks.Callback):
|
|
|
67
67
|
"""
|
|
68
68
|
if self._does_model_improve(logs):
|
|
69
69
|
logger.debug(f"Creating model checkpoint at epoch={epoch + 1} ...")
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
# Ensure model is built before saving weights
|
|
71
|
+
if not self.model.built:
|
|
72
|
+
# Build the model with dummy data to ensure it's built
|
|
73
|
+
import tensorflow as tf
|
|
74
|
+
|
|
75
|
+
dummy_input = tf.zeros((1, 1))
|
|
76
|
+
_ = self.model(dummy_input)
|
|
77
|
+
# Ensure the directory exists before saving
|
|
78
|
+
import os
|
|
79
|
+
|
|
80
|
+
os.makedirs(os.path.dirname(self.checkpoint_file), exist_ok=True)
|
|
81
|
+
self.model.save_weights(self.checkpoint_file, overwrite=True)
|
|
73
82
|
|
|
74
83
|
def _does_model_improve(self, curr_results: Dict[Text, Any]) -> bool:
|
|
75
84
|
"""Checks whether the current results are better than the best so far.
|
|
76
85
|
|
|
77
|
-
Results are considered better if each metric is
|
|
78
|
-
far, and at least one is better.
|
|
86
|
+
Results are considered better if each metric is
|
|
87
|
+
equal or better than the best so far, and at least one is better.
|
|
79
88
|
|
|
80
89
|
Args:
|
|
81
90
|
curr_results: The training metrics for this epoch.
|
|
@@ -85,7 +94,8 @@ class RasaModelCheckpoint(tf.keras.callbacks.Callback):
|
|
|
85
94
|
for k in curr_results.keys()
|
|
86
95
|
if k.startswith("val") and (k.endswith("_acc") or k.endswith("_f1"))
|
|
87
96
|
]
|
|
88
|
-
# the "val" prefix is prepended to metrics in fit
|
|
97
|
+
# the "val" prefix is prepended to metrics in fit
|
|
98
|
+
# if _should_eval returns true
|
|
89
99
|
# for this particular epoch
|
|
90
100
|
if len(curr_metric_names) == 0:
|
|
91
101
|
# the metrics are not validation metrics
|
|
@@ -94,7 +104,7 @@ class RasaModelCheckpoint(tf.keras.callbacks.Callback):
|
|
|
94
104
|
if not self.best_metrics_so_far:
|
|
95
105
|
for metric_name in curr_metric_names:
|
|
96
106
|
self.best_metrics_so_far[metric_name] = float(curr_results[metric_name])
|
|
97
|
-
|
|
107
|
+
return True
|
|
98
108
|
|
|
99
109
|
at_least_one_improved = False
|
|
100
110
|
improved_metrics = {}
|