rasa-pro 3.13.1a18__py3-none-any.whl → 3.13.3__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/cli/project_templates/defaults.py +25 -3
- rasa/cli/scaffold.py +3 -22
- rasa/core/actions/action.py +2 -4
- rasa/core/channels/studio_chat.py +10 -34
- rasa/core/channels/voice_stream/asr/asr_engine.py +5 -1
- rasa/core/channels/voice_stream/asr/deepgram.py +5 -0
- rasa/core/channels/voice_stream/audiocodes.py +9 -4
- rasa/core/channels/voice_stream/jambonz.py +1 -1
- rasa/core/channels/voice_stream/voice_channel.py +7 -0
- rasa/core/nlg/callback.py +1 -1
- rasa/core/policies/enterprise_search_policy.py +9 -8
- rasa/core/policies/flows/flow_executor.py +1 -8
- rasa/dialogue_understanding/commands/correct_slots_command.py +0 -10
- rasa/dialogue_understanding/generator/command_generator.py +5 -5
- rasa/dialogue_understanding/generator/flow_retrieval.py +9 -10
- rasa/dialogue_understanding/processor/command_processor.py +6 -1
- rasa/model_manager/model_api.py +3 -2
- rasa/model_manager/runner_service.py +1 -1
- rasa/model_manager/trainer_service.py +9 -12
- rasa/model_manager/utils.py +29 -1
- rasa/shared/core/domain.py +15 -62
- rasa/shared/core/flows/flow_step.py +1 -7
- rasa/shared/core/flows/yaml_flows_io.py +8 -16
- rasa/shared/core/slots.py +0 -4
- rasa/shared/importers/importer.py +0 -6
- rasa/shared/importers/utils.py +1 -77
- rasa/studio/upload.py +45 -10
- rasa/telemetry.py +1 -2
- rasa/utils/io.py +9 -27
- rasa/utils/json_utils.py +1 -6
- rasa/utils/log_utils.py +1 -5
- rasa/utils/plotting.py +1 -1
- rasa/validator.py +3 -7
- rasa/version.py +1 -1
- {rasa_pro-3.13.1a18.dist-info → rasa_pro-3.13.3.dist-info}/METADATA +8 -9
- {rasa_pro-3.13.1a18.dist-info → rasa_pro-3.13.3.dist-info}/RECORD +39 -261
- rasa/builder/README.md +0 -120
- rasa/builder/__init__.py +0 -0
- rasa/builder/config.py +0 -79
- rasa/builder/create_openai_vector_store.py +0 -228
- rasa/builder/exceptions.py +0 -55
- rasa/builder/inkeep-rag-response-schema.json +0 -64
- rasa/builder/inkeep_document_retrieval.py +0 -212
- rasa/builder/llm-helper-schema.json +0 -69
- rasa/builder/llm_context.py +0 -81
- rasa/builder/llm_helper_prompt.jinja2 +0 -245
- rasa/builder/llm_service.py +0 -317
- rasa/builder/logging_utils.py +0 -51
- rasa/builder/main.py +0 -147
- rasa/builder/models.py +0 -225
- rasa/builder/project_generator.py +0 -282
- rasa/builder/scrape_rasa_docs.py +0 -97
- rasa/builder/service.py +0 -742
- rasa/builder/skill_to_bot_prompt.jinja2 +0 -164
- rasa/builder/training_service.py +0 -132
- rasa/builder/validation_service.py +0 -93
- rasa/cli/project_templates/finance/actions/__init__.py +0 -0
- rasa/cli/project_templates/finance/actions/action_add_payee.py +0 -47
- rasa/cli/project_templates/finance/actions/action_ask_account.py +0 -50
- rasa/cli/project_templates/finance/actions/action_ask_account_from.py +0 -50
- rasa/cli/project_templates/finance/actions/action_ask_card.py +0 -47
- rasa/cli/project_templates/finance/actions/action_check_balance.py +0 -40
- rasa/cli/project_templates/finance/actions/action_check_card_existence.py +0 -35
- rasa/cli/project_templates/finance/actions/action_check_payee_existence.py +0 -40
- rasa/cli/project_templates/finance/actions/action_check_sufficient_funds.py +0 -41
- rasa/cli/project_templates/finance/actions/action_list_payees.py +0 -45
- rasa/cli/project_templates/finance/actions/action_process_immediate_payment.py +0 -18
- rasa/cli/project_templates/finance/actions/action_remove_payee.py +0 -49
- rasa/cli/project_templates/finance/actions/action_schedule_payment.py +0 -19
- rasa/cli/project_templates/finance/actions/action_session_start.py +0 -69
- rasa/cli/project_templates/finance/actions/action_update_card_status.py +0 -45
- rasa/cli/project_templates/finance/actions/action_validate_payment_date.py +0 -36
- rasa/cli/project_templates/finance/actions/database.py +0 -276
- rasa/cli/project_templates/finance/config.yml +0 -32
- rasa/cli/project_templates/finance/credentials.yml +0 -33
- 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 -10
- 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/flows/add_payee.yml +0 -29
- rasa/cli/project_templates/finance/data/flows/block_card.yml +0 -66
- rasa/cli/project_templates/finance/data/flows/check_balance.yml +0 -9
- rasa/cli/project_templates/finance/data/flows/list_payees.yml +0 -5
- rasa/cli/project_templates/finance/data/flows/remove_payee.yml +0 -21
- rasa/cli/project_templates/finance/data/flows/select_card.yml +0 -12
- rasa/cli/project_templates/finance/data/flows/transfer_money.yml +0 -67
- rasa/cli/project_templates/finance/data/flows/welcome.yml +0 -14
- rasa/cli/project_templates/finance/data/nlu.yml +0 -29
- rasa/cli/project_templates/finance/data/patterns/pattern_chitchat.yml +0 -7
- rasa/cli/project_templates/finance/data/patterns/pattern_completed.yml +0 -6
- rasa/cli/project_templates/finance/data/patterns/pattern_search.yml +0 -5
- rasa/cli/project_templates/finance/data/patterns/pattern_session_start.yml +0 -9
- rasa/cli/project_templates/finance/data/source/accounts.json +0 -51
- rasa/cli/project_templates/finance/data/source/advisors.json +0 -44
- rasa/cli/project_templates/finance/data/source/appointments.json +0 -1474
- rasa/cli/project_templates/finance/data/source/branches.json +0 -47
- rasa/cli/project_templates/finance/data/source/cards.json +0 -72
- rasa/cli/project_templates/finance/data/source/payees.json +0 -74
- rasa/cli/project_templates/finance/data/source/transactions.json +0 -492
- rasa/cli/project_templates/finance/data/source/users.json +0 -29
- 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/add_payee.yml +0 -47
- rasa/cli/project_templates/finance/domain/block_card.yml +0 -101
- rasa/cli/project_templates/finance/domain/check_balance.yml +0 -9
- rasa/cli/project_templates/finance/domain/default_actions.yml +0 -16
- rasa/cli/project_templates/finance/domain/default_flows.yml +0 -33
- rasa/cli/project_templates/finance/domain/list_payees.yml +0 -4
- rasa/cli/project_templates/finance/domain/remove_payee.yml +0 -16
- rasa/cli/project_templates/finance/domain/select_card.yml +0 -12
- rasa/cli/project_templates/finance/domain/transfer_money.yml +0 -79
- rasa/cli/project_templates/finance/endpoints.yml +0 -62
- rasa/cli/project_templates/finance/prompts/command-generator.jinja2 +0 -57
- rasa/cli/project_templates/finance/prompts/rephraser_demo_personality_prompt.jinja2 +0 -19
- rasa/cli/project_templates/finance/tests/conversation_repair/cancellations.yml +0 -12
- rasa/cli/project_templates/finance/tests/conversation_repair/cannot_handle.yml +0 -7
- rasa/cli/project_templates/finance/tests/conversation_repair/chitchat.yml +0 -7
- rasa/cli/project_templates/finance/tests/conversation_repair/clarification.yml +0 -9
- rasa/cli/project_templates/finance/tests/conversation_repair/completion.yml +0 -18
- rasa/cli/project_templates/finance/tests/conversation_repair/corrections.yml +0 -17
- rasa/cli/project_templates/finance/tests/conversation_repair/digressions.yml +0 -32
- rasa/cli/project_templates/finance/tests/conversation_repair/human_handoff.yml +0 -21
- rasa/cli/project_templates/finance/tests/conversation_repair/skipping_collect_steps.yml +0 -16
- rasa/cli/project_templates/finance/tests/demo_scripts/main.yml +0 -16
- rasa/cli/project_templates/finance/tests/happy_paths/balance_verification.yml +0 -15
- rasa/cli/project_templates/finance/tests/happy_paths/banking_questions.yml +0 -12
- rasa/cli/project_templates/finance/tests/happy_paths/card_blocking.yml +0 -52
- rasa/cli/project_templates/finance/tests/happy_paths/money_transfer.yml +0 -136
- rasa/cli/project_templates/finance/tests/happy_paths/payee_management.yml +0 -27
- rasa/cli/project_templates/finance/tests/happy_paths/user_greeted.yml +0 -5
- rasa/cli/project_templates/plain/actions/__init__.py +0 -0
- rasa/cli/project_templates/plain/config.yml +0 -17
- rasa/cli/project_templates/plain/credentials.yml +0 -33
- rasa/cli/project_templates/plain/data/patterns/pattern_session_start.yml +0 -7
- rasa/cli/project_templates/plain/domain.yml +0 -5
- rasa/cli/project_templates/plain/endpoints.yml +0 -58
- rasa/cli/project_templates/telco/actions/__init__.py +0 -0
- rasa/cli/project_templates/telco/actions/actions_billing.py +0 -197
- rasa/cli/project_templates/telco/actions/actions_get_data_from_db.py +0 -43
- rasa/cli/project_templates/telco/actions/actions_run_diagnostics.py +0 -23
- rasa/cli/project_templates/telco/actions/actions_session_start.py +0 -13
- rasa/cli/project_templates/telco/config.yml +0 -25
- rasa/cli/project_templates/telco/credentials.yml +0 -33
- rasa/cli/project_templates/telco/csvs/billing.csv +0 -10
- rasa/cli/project_templates/telco/csvs/customers.csv +0 -5
- rasa/cli/project_templates/telco/data/flows/flow_global.yml +0 -5
- rasa/cli/project_templates/telco/data/flows/flow_reboot_router.yml +0 -8
- rasa/cli/project_templates/telco/data/flows/flow_reset_router.yml +0 -7
- rasa/cli/project_templates/telco/data/flows/flow_solve_internet_issue.yml +0 -73
- rasa/cli/project_templates/telco/data/flows/flow_undertand_bill.yml +0 -45
- rasa/cli/project_templates/telco/data/patterns/pattern_completed.yml +0 -7
- rasa/cli/project_templates/telco/data/patterns/pattern_human_handoff.yml +0 -6
- rasa/cli/project_templates/telco/data/patterns/pattern_search.yml +0 -7
- rasa/cli/project_templates/telco/data/patterns/pattern_session_start.yml +0 -9
- rasa/cli/project_templates/telco/docs/reset_vs_rboot_router.txt +0 -1
- rasa/cli/project_templates/telco/docs/restart_router.txt +0 -6
- rasa/cli/project_templates/telco/docs/run_speed_test.txt +0 -6
- rasa/cli/project_templates/telco/domain/domain_global.yml +0 -29
- rasa/cli/project_templates/telco/domain/domain_patterns.yml +0 -17
- rasa/cli/project_templates/telco/domain/domain_reboot_router.yml +0 -20
- rasa/cli/project_templates/telco/domain/domain_reset_router.yml +0 -11
- rasa/cli/project_templates/telco/domain/domain_run_speed_test.yml +0 -24
- rasa/cli/project_templates/telco/domain/domain_solve_internet_issue.yml +0 -74
- rasa/cli/project_templates/telco/domain/domain_undertand_bill.yml +0 -102
- rasa/cli/project_templates/telco/endpoints.yml +0 -60
- rasa/cli/project_templates/telco/prompts/command-generator.jinja2 +0 -57
- rasa/cli/project_templates/telco/tests/e2e_results_failed.yml +0 -62
- rasa/cli/project_templates/telco/tests/e2e_results_passed.yml +0 -130
- rasa/cli/project_templates/telco/tests/e2e_test_cases/billing_test_cases.yml +0 -68
- rasa/cli/project_templates/telco/tests/e2e_test_cases/global_test_cases.yml +0 -13
- rasa/cli/project_templates/telco/tests/e2e_test_cases/internet_slow_test_case.yml +0 -47
- rasa/cli/project_templates/telco/tests/e2e_test_cases/out_of_scope_test_case.yml +0 -21
- rasa/cli/project_templates/telco/tests/e2e_test_cases/patterns_test_cases.yml +0 -15
- rasa/shared/importers/static.py +0 -63
- rasa/utils/openapi.py +0 -144
- {rasa_pro-3.13.1a18.dist-info → rasa_pro-3.13.3.dist-info}/NOTICE +0 -0
- {rasa_pro-3.13.1a18.dist-info → rasa_pro-3.13.3.dist-info}/WHEEL +0 -0
- {rasa_pro-3.13.1a18.dist-info → rasa_pro-3.13.3.dist-info}/entry_points.txt +0 -0
rasa/shared/core/domain.py
CHANGED
|
@@ -98,8 +98,6 @@ IS_RETRIEVAL_INTENT_KEY = "is_retrieval_intent"
|
|
|
98
98
|
ENTITY_ROLES_KEY = "roles"
|
|
99
99
|
ENTITY_GROUPS_KEY = "groups"
|
|
100
100
|
ENTITY_FEATURIZATION_KEY = "influence_conversation"
|
|
101
|
-
STORE_ENTITIES_AS_SLOTS_KEY = "store_entities_as_slots"
|
|
102
|
-
DOMAIN_CONFIG_KEY = "config"
|
|
103
101
|
|
|
104
102
|
KEY_SLOTS = "slots"
|
|
105
103
|
KEY_INTENTS = "intents"
|
|
@@ -148,8 +146,6 @@ MERGE_FUNC_MAPPING: Dict[Text, Callable[..., Any]] = {
|
|
|
148
146
|
KEY_FORMS: rasa.shared.utils.common.merge_dicts,
|
|
149
147
|
}
|
|
150
148
|
|
|
151
|
-
DEFAULT_STORE_ENTITIES_AS_SLOTS = True
|
|
152
|
-
|
|
153
149
|
DICT_DATA_KEYS = [
|
|
154
150
|
key
|
|
155
151
|
for key, value in MERGE_FUNC_MAPPING.items()
|
|
@@ -322,7 +318,7 @@ class Domain:
|
|
|
322
318
|
actions = cls._collect_action_names(domain_actions)
|
|
323
319
|
|
|
324
320
|
additional_arguments = {
|
|
325
|
-
**data.get(
|
|
321
|
+
**data.get("config", {}),
|
|
326
322
|
"actions_which_explicitly_need_domain": (
|
|
327
323
|
cls._collect_actions_which_explicitly_need_domain(domain_actions)
|
|
328
324
|
),
|
|
@@ -472,9 +468,9 @@ class Domain:
|
|
|
472
468
|
return domain_dict
|
|
473
469
|
|
|
474
470
|
if override:
|
|
475
|
-
config = domain_dict.get(
|
|
471
|
+
config = domain_dict.get("config", {})
|
|
476
472
|
for key, val in config.items():
|
|
477
|
-
combined[
|
|
473
|
+
combined["config"][key] = val
|
|
478
474
|
|
|
479
475
|
if (
|
|
480
476
|
override
|
|
@@ -512,10 +508,10 @@ class Domain:
|
|
|
512
508
|
return combined
|
|
513
509
|
|
|
514
510
|
def partial_merge(self, other: Domain) -> Domain:
|
|
515
|
-
"""
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
511
|
+
"""
|
|
512
|
+
Returns a new Domain with intersection-based merging:
|
|
513
|
+
- For each domain section only overwrite items that already exist in self.
|
|
514
|
+
- Brand-new items in `other` are ignored.
|
|
519
515
|
|
|
520
516
|
Args:
|
|
521
517
|
other: The domain to merge with.
|
|
@@ -547,9 +543,9 @@ class Domain:
|
|
|
547
543
|
return Domain.from_dict(updated_self)
|
|
548
544
|
|
|
549
545
|
def difference(self, other: Domain) -> Domain:
|
|
550
|
-
"""
|
|
551
|
-
|
|
552
|
-
|
|
546
|
+
"""
|
|
547
|
+
Returns a new Domain containing items in `self` that are NOT in `other`,
|
|
548
|
+
using simple equality checks for dict/list items.
|
|
553
549
|
|
|
554
550
|
Args:
|
|
555
551
|
other: The domain to compare with.
|
|
@@ -602,16 +598,9 @@ class Domain:
|
|
|
602
598
|
) -> Dict:
|
|
603
599
|
# add the config, session_config and training data version defaults
|
|
604
600
|
# if not included in the original domain dict
|
|
605
|
-
if
|
|
606
|
-
DOMAIN_CONFIG_KEY not in data
|
|
607
|
-
and store_entities_as_slots != DEFAULT_STORE_ENTITIES_AS_SLOTS
|
|
608
|
-
):
|
|
601
|
+
if "config" not in data and not store_entities_as_slots:
|
|
609
602
|
data.update(
|
|
610
|
-
{
|
|
611
|
-
DOMAIN_CONFIG_KEY: {
|
|
612
|
-
STORE_ENTITIES_AS_SLOTS_KEY: store_entities_as_slots
|
|
613
|
-
}
|
|
614
|
-
}
|
|
603
|
+
{"config": {"store_entities_as_slots": store_entities_as_slots}}
|
|
615
604
|
)
|
|
616
605
|
|
|
617
606
|
if SESSION_CONFIG_KEY not in data:
|
|
@@ -948,7 +937,7 @@ class Domain:
|
|
|
948
937
|
forms: Union[Dict[Text, Any], List[Text]],
|
|
949
938
|
data: Dict,
|
|
950
939
|
action_texts: Optional[List[Text]] = None,
|
|
951
|
-
store_entities_as_slots: bool =
|
|
940
|
+
store_entities_as_slots: bool = True,
|
|
952
941
|
session_config: SessionConfig = SessionConfig.default(),
|
|
953
942
|
**kwargs: Any,
|
|
954
943
|
) -> None:
|
|
@@ -1722,45 +1711,9 @@ class Domain:
|
|
|
1722
1711
|
else:
|
|
1723
1712
|
return True
|
|
1724
1713
|
|
|
1725
|
-
def
|
|
1726
|
-
"""Check if the domain uses a custom session config."""
|
|
1727
|
-
return self._data.get(SESSION_CONFIG_KEY) != SessionConfig.default().as_dict()
|
|
1728
|
-
|
|
1729
|
-
def _uses_custom_domain_config(self) -> bool:
|
|
1730
|
-
"""Check if the domain uses a custom domain config."""
|
|
1731
|
-
return self._data.get(DOMAIN_CONFIG_KEY) != {
|
|
1732
|
-
STORE_ENTITIES_AS_SLOTS_KEY: DEFAULT_STORE_ENTITIES_AS_SLOTS
|
|
1733
|
-
}
|
|
1734
|
-
|
|
1735
|
-
def _cleaned_json_data(self) -> Dict[Text, Any]:
|
|
1736
|
-
"""Remove default values from the domain data.
|
|
1737
|
-
|
|
1738
|
-
Only retains data that was customized by the user.
|
|
1739
|
-
|
|
1740
|
-
Returns:
|
|
1741
|
-
A cleaned dictionary version of the domain.
|
|
1742
|
-
"""
|
|
1743
|
-
cleaned_data = copy.deepcopy(self._data)
|
|
1744
|
-
|
|
1745
|
-
# Remove default config if it only contains store_entities_as_slots: False
|
|
1746
|
-
if DOMAIN_CONFIG_KEY in cleaned_data and not self._uses_custom_domain_config():
|
|
1747
|
-
del cleaned_data[DOMAIN_CONFIG_KEY]
|
|
1748
|
-
|
|
1749
|
-
# Remove default session config if it matches the default values
|
|
1750
|
-
if (
|
|
1751
|
-
SESSION_CONFIG_KEY in cleaned_data
|
|
1752
|
-
and not self._uses_custom_session_config()
|
|
1753
|
-
):
|
|
1754
|
-
del cleaned_data[SESSION_CONFIG_KEY]
|
|
1755
|
-
|
|
1756
|
-
return cleaned_data
|
|
1757
|
-
|
|
1758
|
-
def as_dict(self, should_clean_json: bool = False) -> Dict[Text, Any]:
|
|
1714
|
+
def as_dict(self) -> Dict[Text, Any]:
|
|
1759
1715
|
"""Return serialized `Domain`."""
|
|
1760
|
-
|
|
1761
|
-
return self._cleaned_json_data()
|
|
1762
|
-
else:
|
|
1763
|
-
return self._data
|
|
1716
|
+
return self._data
|
|
1764
1717
|
|
|
1765
1718
|
@staticmethod
|
|
1766
1719
|
def get_responses_with_multilines(
|
|
@@ -52,13 +52,7 @@ def step_from_json(flow_id: Text, data: Dict[Text, Any]) -> FlowStep:
|
|
|
52
52
|
return SetSlotsFlowStep.from_json(flow_id, data)
|
|
53
53
|
if "noop" in data:
|
|
54
54
|
return NoOperationFlowStep.from_json(flow_id, data)
|
|
55
|
-
|
|
56
|
-
required_properties = ["action", "collect", "link", "call", "set_slots", "noop"]
|
|
57
|
-
raise RasaException(
|
|
58
|
-
f"Failed to parse step from json. Unknown type for {data}. "
|
|
59
|
-
f"At lest one of the following properties is required: "
|
|
60
|
-
f"{', '.join(required_properties)}"
|
|
61
|
-
)
|
|
55
|
+
raise RasaException(f"Failed to parse step from json. Unknown type for {data}.")
|
|
62
56
|
|
|
63
57
|
|
|
64
58
|
@dataclass
|
|
@@ -262,9 +262,12 @@ class YamlFlowsWriter:
|
|
|
262
262
|
Returns:
|
|
263
263
|
The dumped YAML.
|
|
264
264
|
"""
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
265
|
+
dump = {}
|
|
266
|
+
for flow in flows:
|
|
267
|
+
dumped_flow = get_flow_as_json(flow, should_clean_json)
|
|
268
|
+
del dumped_flow["id"]
|
|
269
|
+
dump[flow.id] = dumped_flow
|
|
270
|
+
return dump_obj_as_yaml_to_string({KEY_FLOWS: dump})
|
|
268
271
|
|
|
269
272
|
@staticmethod
|
|
270
273
|
def dump(
|
|
@@ -421,20 +424,9 @@ def process_yaml_content(yaml_content: Dict[str, Any]) -> Dict[str, Any]:
|
|
|
421
424
|
return yaml_content
|
|
422
425
|
|
|
423
426
|
|
|
424
|
-
def get_flows_as_json(
|
|
425
|
-
flows: FlowsList, should_clean_json: bool = False
|
|
426
|
-
) -> Dict[str, Any]:
|
|
427
|
-
"""Get the flows as a JSON dictionary."""
|
|
428
|
-
dump = {}
|
|
429
|
-
for flow in flows:
|
|
430
|
-
dumped_flow = get_flow_as_json(flow, should_clean_json)
|
|
431
|
-
del dumped_flow["id"]
|
|
432
|
-
dump[flow.id] = dumped_flow
|
|
433
|
-
return dump
|
|
434
|
-
|
|
435
|
-
|
|
436
427
|
def get_flow_as_json(flow: Flow, should_clean_json: bool = False) -> Dict[str, Any]:
|
|
437
|
-
"""
|
|
428
|
+
"""
|
|
429
|
+
Clean the Flow JSON by removing default values and empty fields.
|
|
438
430
|
|
|
439
431
|
Args:
|
|
440
432
|
flow: The Flow object to clean.
|
rasa/shared/core/slots.py
CHANGED
|
@@ -273,14 +273,10 @@ class Slot(ABC):
|
|
|
273
273
|
try:
|
|
274
274
|
return rasa.shared.utils.common.class_from_module_path(type_name)
|
|
275
275
|
except (ImportError, AttributeError):
|
|
276
|
-
known_types = [
|
|
277
|
-
cls.type_name for cls in rasa.shared.utils.common.all_subclasses(Slot)
|
|
278
|
-
]
|
|
279
276
|
raise InvalidSlotTypeException(
|
|
280
277
|
f"Failed to find slot type, '{type_name}' is neither a known type nor "
|
|
281
278
|
f"user-defined. If you are creating your own slot type, make "
|
|
282
279
|
f"sure its module path is correct. "
|
|
283
|
-
f"Known types: {', '.join(known_types)} "
|
|
284
280
|
f"You can find all build in types at {DOCS_URL_SLOTS}"
|
|
285
281
|
)
|
|
286
282
|
|
|
@@ -207,12 +207,6 @@ class TrainingDataImporter(ABC):
|
|
|
207
207
|
)
|
|
208
208
|
]
|
|
209
209
|
|
|
210
|
-
return TrainingDataImporter.wrap_in_builtins(importers)
|
|
211
|
-
|
|
212
|
-
@staticmethod
|
|
213
|
-
def wrap_in_builtins(
|
|
214
|
-
importers: List["TrainingDataImporter"],
|
|
215
|
-
) -> "TrainingDataImporter":
|
|
216
210
|
return LanguageImporter(
|
|
217
211
|
E2EImporter(
|
|
218
212
|
FlowSyncImporter(ResponsesSyncImporter(CombinedDataImporter(importers)))
|
rasa/shared/importers/utils.py
CHANGED
|
@@ -1,37 +1,9 @@
|
|
|
1
|
-
from typing import
|
|
2
|
-
|
|
3
|
-
from pydantic import BaseModel, Field
|
|
1
|
+
from typing import Iterable, List, Optional, Text
|
|
4
2
|
|
|
5
3
|
from rasa.shared.core.domain import Domain
|
|
6
4
|
from rasa.shared.core.flows import FlowsList
|
|
7
|
-
from rasa.shared.core.flows.yaml_flows_io import get_flows_as_json
|
|
8
5
|
from rasa.shared.core.training_data.structures import StoryGraph
|
|
9
|
-
from rasa.shared.importers.importer import TrainingDataImporter
|
|
10
|
-
from rasa.shared.nlu.training_data.formats.rasa_yaml import RasaYAMLWriter
|
|
11
6
|
from rasa.shared.nlu.training_data.training_data import TrainingData
|
|
12
|
-
from rasa.utils.json_utils import extract_values
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class CALMUserData(BaseModel):
|
|
16
|
-
"""All pieces that will be uploaded to Rasa Studio."""
|
|
17
|
-
|
|
18
|
-
flows: Dict[str, Any] = Field(default_factory=dict)
|
|
19
|
-
domain: Dict[str, Any] = Field(default_factory=dict)
|
|
20
|
-
config: Dict[str, Any] = Field(default_factory=dict)
|
|
21
|
-
endpoints: Dict[str, Any] = Field(default_factory=dict)
|
|
22
|
-
nlu: Dict[str, Any] = Field(default_factory=dict)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
DOMAIN_KEYS = [
|
|
26
|
-
"version",
|
|
27
|
-
"actions",
|
|
28
|
-
"responses",
|
|
29
|
-
"slots",
|
|
30
|
-
"intents",
|
|
31
|
-
"entities",
|
|
32
|
-
"forms",
|
|
33
|
-
"session_config",
|
|
34
|
-
]
|
|
35
7
|
|
|
36
8
|
|
|
37
9
|
def training_data_from_paths(paths: Iterable[Text], language: Text) -> TrainingData:
|
|
@@ -62,51 +34,3 @@ def flows_from_paths(files: List[Text]) -> FlowsList:
|
|
|
62
34
|
)
|
|
63
35
|
flows.validate()
|
|
64
36
|
return flows
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
def extract_calm_import_parts_from_importer(
|
|
68
|
-
importer: TrainingDataImporter,
|
|
69
|
-
config: Optional[Dict[str, Any]] = None,
|
|
70
|
-
endpoints: Optional[Dict[str, Any]] = None,
|
|
71
|
-
) -> CALMUserData:
|
|
72
|
-
"""Extracts CALMUserData from a TrainingDataImporter.
|
|
73
|
-
|
|
74
|
-
Args:
|
|
75
|
-
importer: The training data importer
|
|
76
|
-
data_paths: The path(s) to the training data for flows
|
|
77
|
-
config: Optional config dict, if not provided will use importer.get_config()
|
|
78
|
-
endpoints: Optional endpoints dict, defaults to empty dict
|
|
79
|
-
|
|
80
|
-
Returns:
|
|
81
|
-
CALMUserData containing flows, domain, config, endpoints, and nlu data
|
|
82
|
-
"""
|
|
83
|
-
# Extract config
|
|
84
|
-
if config is None:
|
|
85
|
-
config = importer.get_config()
|
|
86
|
-
|
|
87
|
-
# Extract domain
|
|
88
|
-
domain_from_files = importer.get_user_domain().as_dict()
|
|
89
|
-
domain = extract_values(domain_from_files, DOMAIN_KEYS)
|
|
90
|
-
|
|
91
|
-
# Extract flows
|
|
92
|
-
flows = importer.get_user_flows()
|
|
93
|
-
flows_dict = get_flows_as_json(flows)
|
|
94
|
-
|
|
95
|
-
# Extract NLU data
|
|
96
|
-
nlu_data = importer.get_nlu_data()
|
|
97
|
-
nlu_examples = nlu_data.filter_training_examples(
|
|
98
|
-
lambda ex: ex.get("intent") in nlu_data.intents
|
|
99
|
-
)
|
|
100
|
-
nlu_dict = RasaYAMLWriter().training_data_to_dict(nlu_examples)
|
|
101
|
-
|
|
102
|
-
# Use provided endpoints or default to empty dict
|
|
103
|
-
if endpoints is None:
|
|
104
|
-
endpoints = {}
|
|
105
|
-
|
|
106
|
-
return CALMUserData(
|
|
107
|
-
flows=flows_dict or {},
|
|
108
|
-
domain=domain or {},
|
|
109
|
-
config=config or {},
|
|
110
|
-
endpoints=endpoints or {},
|
|
111
|
-
nlu=nlu_dict or {},
|
|
112
|
-
)
|
rasa/studio/upload.py
CHANGED
|
@@ -7,6 +7,7 @@ from typing import Any, Dict, Iterable, List, Optional, Set, Text, Tuple, Union
|
|
|
7
7
|
import questionary
|
|
8
8
|
import requests
|
|
9
9
|
import structlog
|
|
10
|
+
from pydantic import BaseModel, Field
|
|
10
11
|
|
|
11
12
|
import rasa.cli.telemetry
|
|
12
13
|
import rasa.cli.utils
|
|
@@ -23,13 +24,9 @@ from rasa.shared.constants import (
|
|
|
23
24
|
DEFAULT_DOMAIN_PATHS,
|
|
24
25
|
)
|
|
25
26
|
from rasa.shared.core.domain import Domain
|
|
26
|
-
from rasa.shared.core.flows.yaml_flows_io import YAMLFlowsReader
|
|
27
|
+
from rasa.shared.core.flows.yaml_flows_io import YAMLFlowsReader, YamlFlowsWriter
|
|
27
28
|
from rasa.shared.exceptions import RasaException
|
|
28
|
-
from rasa.shared.importers.importer import TrainingDataImporter
|
|
29
|
-
from rasa.shared.importers.utils import (
|
|
30
|
-
CALMUserData,
|
|
31
|
-
extract_calm_import_parts_from_importer,
|
|
32
|
-
)
|
|
29
|
+
from rasa.shared.importers.importer import FlowSyncImporter, TrainingDataImporter
|
|
33
30
|
from rasa.shared.nlu.training_data.formats.rasa_yaml import (
|
|
34
31
|
RasaYAMLReader,
|
|
35
32
|
RasaYAMLWriter,
|
|
@@ -37,6 +34,7 @@ from rasa.shared.nlu.training_data.formats.rasa_yaml import (
|
|
|
37
34
|
from rasa.shared.utils.llm import collect_custom_prompts
|
|
38
35
|
from rasa.shared.utils.yaml import (
|
|
39
36
|
dump_obj_as_yaml_to_string,
|
|
37
|
+
read_yaml,
|
|
40
38
|
read_yaml_file,
|
|
41
39
|
)
|
|
42
40
|
from rasa.studio import results_logger
|
|
@@ -45,7 +43,6 @@ from rasa.studio.config import StudioConfig
|
|
|
45
43
|
from rasa.studio.results_logger import StudioResult, with_studio_error_handler
|
|
46
44
|
from rasa.studio.utils import validate_argument_paths
|
|
47
45
|
from rasa.telemetry import track_upload_to_studio_failed
|
|
48
|
-
from rasa.utils.json_utils import extract_values
|
|
49
46
|
|
|
50
47
|
structlogger = structlog.get_logger()
|
|
51
48
|
|
|
@@ -71,6 +68,16 @@ DOMAIN_KEYS = [
|
|
|
71
68
|
]
|
|
72
69
|
|
|
73
70
|
|
|
71
|
+
class CALMImportParts(BaseModel):
|
|
72
|
+
"""All pieces that will be uploaded to Rasa Studio."""
|
|
73
|
+
|
|
74
|
+
flows: Dict[str, Any]
|
|
75
|
+
domain: Dict[str, Any]
|
|
76
|
+
config: Dict[str, Any]
|
|
77
|
+
endpoints: Dict[str, Any]
|
|
78
|
+
nlu: Dict[str, Any] = Field(default_factory=dict)
|
|
79
|
+
|
|
80
|
+
|
|
74
81
|
def _get_selected_entities_and_intents(
|
|
75
82
|
args: argparse.Namespace,
|
|
76
83
|
intents_from_files: Set[Text],
|
|
@@ -187,6 +194,11 @@ config_keys = [
|
|
|
187
194
|
]
|
|
188
195
|
|
|
189
196
|
|
|
197
|
+
def extract_values(data: Dict, keys: List[Text]) -> Dict:
|
|
198
|
+
"""Extracts values for given keys from a dictionary."""
|
|
199
|
+
return {key: data.get(key) for key in keys if data.get(key)}
|
|
200
|
+
|
|
201
|
+
|
|
190
202
|
def _get_assistant_name(config: Dict[Text, Any]) -> str:
|
|
191
203
|
config_assistant_id = config.get("assistant_id", "")
|
|
192
204
|
assistant_name = questionary.text(
|
|
@@ -225,7 +237,7 @@ def build_calm_import_parts(
|
|
|
225
237
|
config_path: Text,
|
|
226
238
|
endpoints_path: Optional[Text] = None,
|
|
227
239
|
assistant_name: Optional[Text] = None,
|
|
228
|
-
) -> Tuple[str,
|
|
240
|
+
) -> Tuple[str, CALMImportParts]:
|
|
229
241
|
"""Builds the parts of the assistant to be uploaded to Studio.
|
|
230
242
|
|
|
231
243
|
Args:
|
|
@@ -248,10 +260,33 @@ def build_calm_import_parts(
|
|
|
248
260
|
endpoints = read_yaml_file(endpoints_path, expand_env_vars=False)
|
|
249
261
|
assistant_name = assistant_name or _get_assistant_name(config)
|
|
250
262
|
|
|
251
|
-
|
|
252
|
-
|
|
263
|
+
domain_from_files = importer.get_user_domain().as_dict()
|
|
264
|
+
domain = extract_values(domain_from_files, DOMAIN_KEYS)
|
|
265
|
+
|
|
266
|
+
flow_importer = FlowSyncImporter.load_from_dict(
|
|
267
|
+
training_data_paths=[str(data_path)], expand_env_vars=False
|
|
268
|
+
)
|
|
269
|
+
|
|
270
|
+
flows = list(flow_importer.get_user_flows())
|
|
271
|
+
flows_yaml = YamlFlowsWriter().dumps(flows)
|
|
272
|
+
flows = read_yaml(flows_yaml, expand_env_vars=False)
|
|
273
|
+
|
|
274
|
+
nlu_importer = TrainingDataImporter.load_from_dict(
|
|
275
|
+
training_data_paths=[str(data_path)], expand_env_vars=False
|
|
276
|
+
)
|
|
277
|
+
nlu_data = nlu_importer.get_nlu_data()
|
|
278
|
+
nlu_examples = nlu_data.filter_training_examples(
|
|
279
|
+
lambda ex: ex.get("intent") in nlu_data.intents
|
|
280
|
+
)
|
|
281
|
+
nlu_examples_yaml = RasaYAMLWriter().dumps(nlu_examples)
|
|
282
|
+
nlu = read_yaml(nlu_examples_yaml, expand_env_vars=False)
|
|
283
|
+
|
|
284
|
+
parts = CALMImportParts(
|
|
285
|
+
flows=flows,
|
|
286
|
+
domain=domain,
|
|
253
287
|
config=config,
|
|
254
288
|
endpoints=endpoints,
|
|
289
|
+
nlu=nlu,
|
|
255
290
|
)
|
|
256
291
|
|
|
257
292
|
return assistant_name, parts
|
rasa/telemetry.py
CHANGED
|
@@ -1426,7 +1426,6 @@ def track_shell_started(model_type: Text, assistant_id: Text) -> None:
|
|
|
1426
1426
|
|
|
1427
1427
|
Args:
|
|
1428
1428
|
model_type: Type of the model, core / nlu or rasa.
|
|
1429
|
-
assistant_id: ID of the assistant being inspected.
|
|
1430
1429
|
"""
|
|
1431
1430
|
_track(
|
|
1432
1431
|
TELEMETRY_SHELL_STARTED_EVENT,
|
|
@@ -1998,7 +1997,7 @@ def _extract_stream_pii(event_broker: Optional["EventBroker"]) -> bool:
|
|
|
1998
1997
|
def track_privacy_enabled(
|
|
1999
1998
|
privacy_config: "PrivacyConfig", event_broker: Optional["EventBroker"]
|
|
2000
1999
|
) -> None:
|
|
2001
|
-
"""Track when PII management capability is enabled
|
|
2000
|
+
"""Track when PII management capability is enabled"""
|
|
2002
2001
|
stream_pii = _extract_stream_pii(event_broker)
|
|
2003
2002
|
privacy_properties = _extract_privacy_enabled_event_properties(
|
|
2004
2003
|
privacy_config, stream_pii
|
rasa/utils/io.py
CHANGED
|
@@ -26,7 +26,6 @@ from typing_extensions import Protocol
|
|
|
26
26
|
|
|
27
27
|
import rasa.shared.constants
|
|
28
28
|
import rasa.shared.utils.io
|
|
29
|
-
from rasa.shared.exceptions import RasaException
|
|
30
29
|
|
|
31
30
|
if TYPE_CHECKING:
|
|
32
31
|
from prompt_toolkit.validation import Validator
|
|
@@ -125,7 +124,9 @@ def create_path(file_path: Text) -> None:
|
|
|
125
124
|
def file_type_validator(
|
|
126
125
|
valid_file_types: List[Text], error_message: Text
|
|
127
126
|
) -> Type["Validator"]:
|
|
128
|
-
"""Creates a
|
|
127
|
+
"""Creates a `Validator` class which can be used with `questionary` to validate
|
|
128
|
+
file paths.
|
|
129
|
+
"""
|
|
129
130
|
|
|
130
131
|
def is_valid(path: Text) -> bool:
|
|
131
132
|
return path is not None and any(
|
|
@@ -136,7 +137,9 @@ def file_type_validator(
|
|
|
136
137
|
|
|
137
138
|
|
|
138
139
|
def not_empty_validator(error_message: Text) -> Type["Validator"]:
|
|
139
|
-
"""Creates a
|
|
140
|
+
"""Creates a `Validator` class which can be used with `questionary` to validate
|
|
141
|
+
that the user entered something other than whitespace.
|
|
142
|
+
"""
|
|
140
143
|
|
|
141
144
|
def is_valid(input: Text) -> bool:
|
|
142
145
|
return input is not None and input.strip() != ""
|
|
@@ -147,7 +150,9 @@ def not_empty_validator(error_message: Text) -> Type["Validator"]:
|
|
|
147
150
|
def create_validator(
|
|
148
151
|
function: Callable[[Text], bool], error_message: Text
|
|
149
152
|
) -> Type["Validator"]:
|
|
150
|
-
"""Helper method to create
|
|
153
|
+
"""Helper method to create `Validator` classes from callable functions. Should be
|
|
154
|
+
removed when questionary supports `Validator` objects.
|
|
155
|
+
"""
|
|
151
156
|
from prompt_toolkit.document import Document
|
|
152
157
|
from prompt_toolkit.validation import ValidationError, Validator
|
|
153
158
|
|
|
@@ -245,26 +250,3 @@ def write_yaml(
|
|
|
245
250
|
|
|
246
251
|
with Path(target).open("w", encoding="utf-8") as outfile:
|
|
247
252
|
dumper.dump(data, outfile, transform=transform)
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
class InvalidPathException(RasaException):
|
|
251
|
-
"""Raised if a path is invalid - e.g. path traversal is detected."""
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
def subpath(parent: str, child: str) -> str:
|
|
255
|
-
"""Return the path to the child directory of the parent directory.
|
|
256
|
-
|
|
257
|
-
Ensures, that child doesn't navigate to parent directories. Prevents
|
|
258
|
-
path traversal. Raises an InvalidPathException if the path is invalid.
|
|
259
|
-
|
|
260
|
-
Based on Snyk's directory traversal mitigation:
|
|
261
|
-
https://learn.snyk.io/lesson/directory-traversal/
|
|
262
|
-
"""
|
|
263
|
-
safe_path = os.path.abspath(os.path.join(parent, child))
|
|
264
|
-
parent = os.path.abspath(parent)
|
|
265
|
-
|
|
266
|
-
common_base = os.path.commonpath([parent, safe_path])
|
|
267
|
-
if common_base != parent:
|
|
268
|
-
raise InvalidPathException(f"Invalid path: {safe_path}")
|
|
269
|
-
|
|
270
|
-
return safe_path
|
rasa/utils/json_utils.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import json
|
|
2
2
|
from decimal import Decimal
|
|
3
|
-
from typing import Any,
|
|
3
|
+
from typing import Any, Text
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class DecimalEncoder(json.JSONEncoder):
|
|
@@ -58,8 +58,3 @@ def replace_decimals_with_floats(obj: Any) -> Any:
|
|
|
58
58
|
Input `obj` with all `Decimal` types replaced by `float`s.
|
|
59
59
|
"""
|
|
60
60
|
return json.loads(json.dumps(obj, cls=DecimalEncoder))
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
def extract_values(data: Dict, keys: List[Text]) -> Dict:
|
|
64
|
-
"""Extracts values for given keys from a dictionary."""
|
|
65
|
-
return {key: data.get(key) for key in keys if data.get(key)}
|
rasa/utils/log_utils.py
CHANGED
|
@@ -3,7 +3,7 @@ from __future__ import annotations
|
|
|
3
3
|
import logging
|
|
4
4
|
import os
|
|
5
5
|
import sys
|
|
6
|
-
from typing import Any,
|
|
6
|
+
from typing import Any, Optional
|
|
7
7
|
|
|
8
8
|
import structlog
|
|
9
9
|
from structlog.dev import ConsoleRenderer
|
|
@@ -37,7 +37,6 @@ class HumanConsoleRenderer(ConsoleRenderer):
|
|
|
37
37
|
def configure_structlog(
|
|
38
38
|
log_level: Optional[int] = None,
|
|
39
39
|
include_time: bool = False,
|
|
40
|
-
additional_processors: Optional[List[structlog.processors.Processor]] = None,
|
|
41
40
|
) -> None:
|
|
42
41
|
"""Configure logging of the server."""
|
|
43
42
|
if log_level is None: # Log level NOTSET is 0 so we use `is None` here
|
|
@@ -76,9 +75,6 @@ def configure_structlog(
|
|
|
76
75
|
if include_time:
|
|
77
76
|
shared_processors.append(structlog.processors.TimeStamper(fmt="iso"))
|
|
78
77
|
|
|
79
|
-
if additional_processors:
|
|
80
|
-
shared_processors.extend(additional_processors)
|
|
81
|
-
|
|
82
78
|
if not FORCE_JSON_LOGGING and sys.stderr.isatty():
|
|
83
79
|
# Pretty printing when we run in a terminal session.
|
|
84
80
|
# Automatically prints pretty tracebacks when "rich" is installed
|
rasa/utils/plotting.py
CHANGED
|
@@ -99,7 +99,7 @@ def plot_confusion_matrix(
|
|
|
99
99
|
zmax = confusion_matrix.max() if len(confusion_matrix) > 0 else 1
|
|
100
100
|
plt.clf()
|
|
101
101
|
if not color_map:
|
|
102
|
-
color_map = plt.cm.
|
|
102
|
+
color_map = plt.cm.Blues
|
|
103
103
|
plt.imshow(
|
|
104
104
|
confusion_matrix,
|
|
105
105
|
interpolation="nearest",
|
rasa/validator.py
CHANGED
|
@@ -630,14 +630,11 @@ class Validator:
|
|
|
630
630
|
flow_id: str,
|
|
631
631
|
) -> bool:
|
|
632
632
|
"""Validates that a collect step can have either an action or an utterance.
|
|
633
|
-
|
|
634
633
|
Also logs an error if neither an action nor an utterance is defined.
|
|
635
634
|
|
|
636
635
|
Args:
|
|
637
636
|
collect: the name of the slot to collect
|
|
638
637
|
all_good: boolean value indicating the validation status
|
|
639
|
-
domain_slots: the slots of the domain
|
|
640
|
-
flow_id: the id of the flow
|
|
641
638
|
|
|
642
639
|
Returns:
|
|
643
640
|
False, if validation failed, true, otherwise
|
|
@@ -686,10 +683,9 @@ class Validator:
|
|
|
686
683
|
has_action_defined=has_action_defined,
|
|
687
684
|
flow=flow_id,
|
|
688
685
|
event_info=(
|
|
689
|
-
f"The collect step '{collect.collect}' has neither
|
|
690
|
-
f"nor an action defined,
|
|
691
|
-
f"
|
|
692
|
-
f"'{collect.utter}' used in the collect step."
|
|
686
|
+
f"The collect step '{collect.collect}' has neither an utterance "
|
|
687
|
+
f"nor an action defined, or an initial value defined in the domain."
|
|
688
|
+
f"You need to define either an utterance or an action."
|
|
693
689
|
),
|
|
694
690
|
)
|
|
695
691
|
all_good = False
|
rasa/version.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: rasa-pro
|
|
3
|
-
Version: 3.13.
|
|
3
|
+
Version: 3.13.3
|
|
4
4
|
Summary: State-of-the-art open-core Conversational AI framework for Enterprises that natively leverages generative AI for effortless assistant development.
|
|
5
5
|
Keywords: nlp,machine-learning,machine-learning-library,bot,bots,botkit,rasa conversational-agents,conversational-ai,chatbot,chatbot-framework,bot-framework
|
|
6
6
|
Author: Rasa Technologies GmbH
|
|
@@ -41,11 +41,11 @@ Requires-Dist: colorhash (>=2.0,<2.1.0)
|
|
|
41
41
|
Requires-Dist: confluent-kafka (>=2.10.0,<3.0.0)
|
|
42
42
|
Requires-Dist: cryptography (>=44.0.1)
|
|
43
43
|
Requires-Dist: cvg-python-sdk (>=0.5.1,<0.6.0)
|
|
44
|
-
Requires-Dist: dask (>=2024.
|
|
44
|
+
Requires-Dist: dask (>=2024.7.0,<2024.8.0)
|
|
45
45
|
Requires-Dist: demoji (>=1.1.0,<2.0.0)
|
|
46
46
|
Requires-Dist: diskcache (>=5.6.3,<5.7.0)
|
|
47
47
|
Requires-Dist: dnspython (==2.6.1)
|
|
48
|
-
Requires-Dist: faiss-cpu (>=1.
|
|
48
|
+
Requires-Dist: faiss-cpu (>=1.7.4,<2.0.0)
|
|
49
49
|
Requires-Dist: fbmessenger (>=6.0.0,<6.1.0)
|
|
50
50
|
Requires-Dist: github3.py (>=3.2.0,<3.3.0) ; extra == "gh-release-notes"
|
|
51
51
|
Requires-Dist: gitpython (>=3.1.41,<3.2.0) ; extra == "full"
|
|
@@ -65,7 +65,7 @@ Requires-Dist: langchain (>=0.2.17,<0.3.0)
|
|
|
65
65
|
Requires-Dist: langchain-community (>=0.2.19,<0.3.0)
|
|
66
66
|
Requires-Dist: langcodes (>=3.5.0,<4.0.0)
|
|
67
67
|
Requires-Dist: litellm (>=1.69.0,<1.70.0)
|
|
68
|
-
Requires-Dist: matplotlib (>=3.
|
|
68
|
+
Requires-Dist: matplotlib (>=3.7,<3.8)
|
|
69
69
|
Requires-Dist: mattermostwrapper (>=2.2,<2.3)
|
|
70
70
|
Requires-Dist: networkx (>=3.1,<3.2)
|
|
71
71
|
Requires-Dist: numpy (>=1.26.4,<1.27.0)
|
|
@@ -110,15 +110,14 @@ Requires-Dist: safetensors (>=0.4.5,<0.5.0)
|
|
|
110
110
|
Requires-Dist: sanic (>=22.12,<22.13)
|
|
111
111
|
Requires-Dist: sanic-cors (>=2.2.0,<2.3.0)
|
|
112
112
|
Requires-Dist: sanic-jwt (>=1.8.0,<2.0.0)
|
|
113
|
-
Requires-Dist: sanic-openapi (>=21.12.0,<22.0.0)
|
|
114
113
|
Requires-Dist: sanic-routing (>=22.8.0,<23.0.0)
|
|
115
|
-
Requires-Dist: scikit-learn (>=1.
|
|
114
|
+
Requires-Dist: scikit-learn (>=1.5.1,<1.6.0)
|
|
116
115
|
Requires-Dist: scipy (>=1.13.1,<1.14.0)
|
|
117
116
|
Requires-Dist: sentencepiece[sentencepiece] (>=0.1.99,<0.2.0) ; extra == "transformers" or extra == "full"
|
|
118
117
|
Requires-Dist: sentry-sdk (>=2.8.0,<3)
|
|
119
118
|
Requires-Dist: setuptools (>=78.1.1,<78.2.0)
|
|
120
|
-
Requires-Dist: sklearn-crfsuite (>=0.
|
|
121
|
-
Requires-Dist: skops (>=0.
|
|
119
|
+
Requires-Dist: sklearn-crfsuite (>=0.3.6,<0.4.0)
|
|
120
|
+
Requires-Dist: skops (>=0.10.0,<0.11.0)
|
|
122
121
|
Requires-Dist: slack-sdk (>=3.27.1,<3.28.0)
|
|
123
122
|
Requires-Dist: spacy (>=3.5.4,<4.0.0) ; extra == "spacy" or extra == "full"
|
|
124
123
|
Requires-Dist: structlog (>=23.1.0,<23.2.0)
|
|
@@ -136,7 +135,7 @@ Requires-Dist: tensorflow-metal (==1.1.0) ; (sys_platform == "darwin" and platfo
|
|
|
136
135
|
Requires-Dist: tensorflow-text (==2.14.0) ; sys_platform != "win32" and platform_machine != "arm64" and platform_machine != "aarch64"
|
|
137
136
|
Requires-Dist: tensorflow_hub (>=0.13.0,<0.14.0)
|
|
138
137
|
Requires-Dist: terminaltables (>=3.1.10,<3.2.0)
|
|
139
|
-
Requires-Dist: tiktoken (>=0.
|
|
138
|
+
Requires-Dist: tiktoken (>=0.7.0,<0.8.0)
|
|
140
139
|
Requires-Dist: tqdm (>=4.66.2,<5.0.0)
|
|
141
140
|
Requires-Dist: transformers (>=4.38.2,<4.39.0) ; extra == "transformers" or extra == "full"
|
|
142
141
|
Requires-Dist: twilio (>=8.4,<8.5)
|