rasa-pro 3.13.1a18__py3-none-any.whl → 3.13.1.dev1__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/__init__.py +6 -0
- rasa/cli/scaffold.py +3 -22
- rasa/core/actions/action.py +3 -5
- rasa/core/channels/studio_chat.py +10 -34
- rasa/core/policies/enterprise_search_policy.py +8 -7
- rasa/core/policies/flows/flow_executor.py +1 -8
- rasa/dialogue_understanding/generator/flow_retrieval.py +9 -10
- rasa/dialogue_understanding/generator/llm_based_command_generator.py +15 -4
- rasa/dialogue_understanding/generator/llm_command_generator.py +3 -1
- rasa/dialogue_understanding/generator/multi_step/multi_step_llm_command_generator.py +48 -3
- rasa/dialogue_understanding/generator/single_step/single_step_based_llm_command_generator.py +15 -1
- rasa/hooks.py +55 -0
- rasa/llm_fine_tuning/utils.py +4 -2
- 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/monkey_patches.py +91 -0
- rasa/shared/constants.py +6 -0
- 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/shared/providers/constants.py +10 -0
- rasa/shared/providers/llm/_base_litellm_client.py +14 -4
- rasa/shared/providers/llm/litellm_router_llm_client.py +23 -12
- rasa/shared/providers/llm/llm_client.py +19 -15
- rasa/shared/providers/llm/self_hosted_llm_client.py +23 -18
- rasa/studio/upload.py +45 -10
- rasa/telemetry.py +1 -2
- rasa/tracing/instrumentation/attribute_extractors.py +1 -0
- 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.1.dev1.dist-info}/METADATA +9 -9
- {rasa_pro-3.13.1a18.dist-info → rasa_pro-3.13.1.dev1.dist-info}/RECORD +44 -265
- 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.1.dev1.dist-info}/NOTICE +0 -0
- {rasa_pro-3.13.1a18.dist-info → rasa_pro-3.13.1.dev1.dist-info}/WHEEL +0 -0
- {rasa_pro-3.13.1a18.dist-info → rasa_pro-3.13.1.dev1.dist-info}/entry_points.txt +0 -0
rasa/shared/importers/static.py
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
from typing import Dict, Optional, Text
|
|
3
|
-
|
|
4
|
-
from rasa.shared.core.domain import Domain
|
|
5
|
-
from rasa.shared.core.flows import FlowsList
|
|
6
|
-
from rasa.shared.core.training_data.structures import StoryGraph
|
|
7
|
-
from rasa.shared.importers.importer import TrainingDataImporter
|
|
8
|
-
from rasa.shared.nlu.training_data.training_data import TrainingData
|
|
9
|
-
from rasa.shared.utils.common import cached_method
|
|
10
|
-
|
|
11
|
-
logger = logging.getLogger(__name__)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class StaticTrainingDataImporter(TrainingDataImporter):
|
|
15
|
-
"""Static `TrainingFileImporter` implementation."""
|
|
16
|
-
|
|
17
|
-
def __init__(
|
|
18
|
-
self,
|
|
19
|
-
domain: Domain,
|
|
20
|
-
stories: Optional[StoryGraph] = None,
|
|
21
|
-
flows: Optional[FlowsList] = None,
|
|
22
|
-
nlu_data: Optional[TrainingData] = None,
|
|
23
|
-
config: Optional[Dict] = None,
|
|
24
|
-
):
|
|
25
|
-
self.domain = domain
|
|
26
|
-
self.stories = stories or StoryGraph([])
|
|
27
|
-
self.flows = flows or FlowsList(underlying_flows=[])
|
|
28
|
-
self.nlu_data = nlu_data or TrainingData()
|
|
29
|
-
self.config = config or {}
|
|
30
|
-
|
|
31
|
-
@cached_method
|
|
32
|
-
def get_config(self) -> Dict:
|
|
33
|
-
"""Retrieves model config (see parent class for full docstring)."""
|
|
34
|
-
return self.config
|
|
35
|
-
|
|
36
|
-
def get_config_file_for_auto_config(self) -> Optional[Text]:
|
|
37
|
-
"""Returns config file path for auto-config only if there is a single one."""
|
|
38
|
-
return None
|
|
39
|
-
|
|
40
|
-
@cached_method
|
|
41
|
-
def get_stories(self, exclusion_percentage: Optional[int] = None) -> StoryGraph:
|
|
42
|
-
"""Retrieves training stories / rules (see parent class for full docstring)."""
|
|
43
|
-
return self.stories
|
|
44
|
-
|
|
45
|
-
@cached_method
|
|
46
|
-
def get_flows(self) -> FlowsList:
|
|
47
|
-
"""Retrieves training stories / rules (see parent class for full docstring)."""
|
|
48
|
-
return self.flows
|
|
49
|
-
|
|
50
|
-
@cached_method
|
|
51
|
-
def get_conversation_tests(self) -> StoryGraph:
|
|
52
|
-
"""Retrieves conversation test stories (see parent class for full docstring)."""
|
|
53
|
-
return StoryGraph([])
|
|
54
|
-
|
|
55
|
-
@cached_method
|
|
56
|
-
def get_nlu_data(self, language: Optional[Text] = "en") -> TrainingData:
|
|
57
|
-
"""Retrieves NLU training data (see parent class for full docstring)."""
|
|
58
|
-
return self.nlu_data
|
|
59
|
-
|
|
60
|
-
@cached_method
|
|
61
|
-
def get_domain(self) -> Domain:
|
|
62
|
-
"""Retrieves model domain (see parent class for full docstring)."""
|
|
63
|
-
return self.domain
|
rasa/utils/openapi.py
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
from typing import Any, Dict, List, Type
|
|
2
|
-
|
|
3
|
-
from pydantic.main import BaseModel
|
|
4
|
-
from sanic_openapi import openapi
|
|
5
|
-
from sanic_openapi.openapi3.types import Schema
|
|
6
|
-
|
|
7
|
-
_SUPPORTED_ATTRIBUTES = frozenset(["format", "enum", "required", "example"])
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def _to_schema(
|
|
11
|
-
definition_stack: List[str], schema_def: Dict[str, Any], definitions: Dict[str, Any]
|
|
12
|
-
) -> Schema:
|
|
13
|
-
type = schema_def.get("type")
|
|
14
|
-
|
|
15
|
-
if type == "object":
|
|
16
|
-
properties_spec = schema_def.get("properties", {})
|
|
17
|
-
properties = {}
|
|
18
|
-
for key in properties_spec:
|
|
19
|
-
properties[key] = _to_schema(
|
|
20
|
-
definition_stack=definition_stack,
|
|
21
|
-
schema_def=properties_spec[key],
|
|
22
|
-
definitions=definitions,
|
|
23
|
-
)
|
|
24
|
-
schema = openapi.Object(
|
|
25
|
-
title=schema_def.get("title"),
|
|
26
|
-
description=schema_def.get("description"),
|
|
27
|
-
required=schema_def.get("required"),
|
|
28
|
-
properties=properties,
|
|
29
|
-
)
|
|
30
|
-
elif type == "array":
|
|
31
|
-
schema = openapi.Array(
|
|
32
|
-
description=schema_def.get("description"),
|
|
33
|
-
required=schema_def.get("required"),
|
|
34
|
-
items=_to_schema(
|
|
35
|
-
definition_stack=definition_stack,
|
|
36
|
-
schema_def=schema_def.get("items"),
|
|
37
|
-
definitions=definitions,
|
|
38
|
-
),
|
|
39
|
-
)
|
|
40
|
-
elif type is None:
|
|
41
|
-
if allof_spec := schema_def.get("allOf"): # Model, Enum
|
|
42
|
-
definition = allof_spec[0]["$ref"].split("/")[-1]
|
|
43
|
-
definition_data = definitions.get(definition)
|
|
44
|
-
if definition_data is None:
|
|
45
|
-
schema = openapi.Object(
|
|
46
|
-
title=definition, description=schema_def.get("description")
|
|
47
|
-
)
|
|
48
|
-
else:
|
|
49
|
-
schema = (
|
|
50
|
-
_to_schema(
|
|
51
|
-
definition_stack=definition_stack + [definition],
|
|
52
|
-
schema_def={**definition_data},
|
|
53
|
-
definitions=definitions,
|
|
54
|
-
)
|
|
55
|
-
if definition not in definition_stack
|
|
56
|
-
else openapi.Object(
|
|
57
|
-
title=definition, description=schema_def.get("description")
|
|
58
|
-
)
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
elif anyof_spec := schema_def.get("anyOf"): # Union
|
|
62
|
-
anyof = []
|
|
63
|
-
for any in anyof_spec:
|
|
64
|
-
if any.get("type"):
|
|
65
|
-
schema_type_obj = Schema(
|
|
66
|
-
**{
|
|
67
|
-
"type": any.get("type"),
|
|
68
|
-
"description": any.get("description"),
|
|
69
|
-
}
|
|
70
|
-
)
|
|
71
|
-
anyof.append(schema_type_obj)
|
|
72
|
-
else:
|
|
73
|
-
definition = any["$ref"].split("/")[-1]
|
|
74
|
-
if definition not in definition_stack:
|
|
75
|
-
definition_data = definitions.get(definition)
|
|
76
|
-
if definition_data is not None:
|
|
77
|
-
anyof.append(
|
|
78
|
-
_to_schema(
|
|
79
|
-
definition_stack=definition_stack + [definition],
|
|
80
|
-
schema_def=definition_data,
|
|
81
|
-
definitions=definitions,
|
|
82
|
-
)
|
|
83
|
-
)
|
|
84
|
-
else:
|
|
85
|
-
anyof.append(
|
|
86
|
-
openapi.Object(
|
|
87
|
-
title=definition,
|
|
88
|
-
description=schema_def.get(
|
|
89
|
-
"description", definition
|
|
90
|
-
),
|
|
91
|
-
properties={},
|
|
92
|
-
)
|
|
93
|
-
)
|
|
94
|
-
else:
|
|
95
|
-
anyof.append(
|
|
96
|
-
openapi.Object(
|
|
97
|
-
title=definition,
|
|
98
|
-
description=schema_def.get("description", definition),
|
|
99
|
-
properties={},
|
|
100
|
-
)
|
|
101
|
-
)
|
|
102
|
-
schema = Schema(anyOf=anyof)
|
|
103
|
-
elif ref := schema_def.get("$ref"): # $ref
|
|
104
|
-
definition = ref.split("/")[-1]
|
|
105
|
-
definition_data = definitions.get(definition)
|
|
106
|
-
if definition_data is not None:
|
|
107
|
-
schema = _to_schema(
|
|
108
|
-
definition_stack=definition_stack,
|
|
109
|
-
schema_def=definition_data,
|
|
110
|
-
definitions=definitions,
|
|
111
|
-
)
|
|
112
|
-
else:
|
|
113
|
-
schema = openapi.Object(
|
|
114
|
-
title=definition, description=schema_def.get("description")
|
|
115
|
-
)
|
|
116
|
-
else: # Any type
|
|
117
|
-
schema = Schema(
|
|
118
|
-
**{"type": "object", "description": schema_def.get("description")}
|
|
119
|
-
)
|
|
120
|
-
|
|
121
|
-
else:
|
|
122
|
-
schema_spec = {
|
|
123
|
-
"type": schema_def.get("type"),
|
|
124
|
-
"description": schema_def.get("description"),
|
|
125
|
-
}
|
|
126
|
-
for spec in _SUPPORTED_ATTRIBUTES:
|
|
127
|
-
if schema_def.get(spec):
|
|
128
|
-
schema_spec[spec] = schema_def.get(spec)
|
|
129
|
-
schema = Schema(**schema_spec)
|
|
130
|
-
|
|
131
|
-
return schema
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
def model_to_schema(model: Type[BaseModel]) -> Schema:
|
|
135
|
-
schema = model.model_json_schema()
|
|
136
|
-
# Handle both $defs (newer JSON Schema) and definitions (older JSON Schema)
|
|
137
|
-
definitions = schema.get("$defs") or schema.get("definitions") or {}
|
|
138
|
-
return _to_schema(
|
|
139
|
-
definition_stack=[],
|
|
140
|
-
schema_def=dict(
|
|
141
|
-
filter(lambda key: key[0] not in ("definitions", "$defs"), schema.items())
|
|
142
|
-
),
|
|
143
|
-
definitions=definitions,
|
|
144
|
-
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|