From 432771f764d71fb178b6783fdb4263e337bb1521 Mon Sep 17 00:00:00 2001 From: Tobias Wochinger Date: Tue, 3 Nov 2020 17:55:30 +0100 Subject: [PATCH] polish --- changelog/7068.improvement.md | 8 ++++---- rasa/core/actions/action.py | 11 ++++++++++- rasa/shared/core/domain.py | 15 ++++++++------- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/changelog/7068.improvement.md b/changelog/7068.improvement.md index 200bbe6e4f51..f3a918715272 100644 --- a/changelog/7068.improvement.md +++ b/changelog/7068.improvement.md @@ -1,5 +1,5 @@ -Slot mappings for [Forms](forms.mdx) in the domain are now optional. If you do not -provide any slot mappings as part within the domain, you need to provide +Slot mappings for [Forms](forms.mdx) in the domain are now optional. If you do not +provide any slot mappings as part of the domain, you need to provide [custom slot mappings](forms.mdx#custom-slot-mappings) through a custom action. A form without slot mappings is specified as follows: @@ -10,7 +10,7 @@ forms: ``` The action for [forms](forms.mdx) can now be overridden by defining a custom action -with the same name as the form. This can be used to keep using the deprecated +with the same name as the form. This can be used to keep using the deprecated Rasa Open Source `FormAction` which is implemented within the Rasa SDK. Note that it is -**not** recommended to override the form action for anything else than using the +**not** recommended to override the form action for anything else than using the deprecated Rasa SDK `FormAction`. diff --git a/rasa/core/actions/action.py b/rasa/core/actions/action.py index 62a4e4a68032..9660e1f07273 100644 --- a/rasa/core/actions/action.py +++ b/rasa/core/actions/action.py @@ -155,8 +155,17 @@ def action_from_name( action_endpoint: Optional[EndpointConfig], retrieval_intents: Optional[List[Text]] = None, ) -> "Action": - """Return an action instance for the name.""" + """Retrieves an action by its name. + Args: + name: The name of the action. + domain: The current model domain. + action_endpoint: The endpoint to execute custom actions. + retrieval_intents: Retrieval intents used by the current model. + + Returns: + The instantiated action. + """ defaults = {a.name(): a for a in default_actions(action_endpoint)} if name in defaults and name not in domain.user_actions_and_forms: diff --git a/rasa/shared/core/domain.py b/rasa/shared/core/domain.py index 8e107f90a0b1..f97c836c3fb5 100644 --- a/rasa/shared/core/domain.py +++ b/rasa/shared/core/domain.py @@ -601,13 +601,13 @@ def _initialize_forms( if isinstance(forms, list) and (not forms or isinstance(forms[0], str)): # list of form names (Rasa Open Source 1 format) rasa.shared.utils.io.raise_warning( - f"The `forms` section in the domain used the old Rasa Open Source 1 " - f"list format to define forms. Rasa Open Source will be configured to " - f"use the deprecated `FormAction` within the Rasa SDK. If you want to " - f"use the new Rasa Open Source 2 `FormAction` adapt your `forms`" - f"section as described in the documentation. Support for the " - f"deprecated `FormAction` in the Rasa SDK will be removed in Rasa Open " - f"Source 3.0.", + "The `forms` section in the domain used the old Rasa Open Source 1 " + "list format to define forms. Rasa Open Source will be configured to " + "use the deprecated `FormAction` within the Rasa SDK. If you want to " + "use the new Rasa Open Source 2 `FormAction` adapt your `forms` " + "section as described in the documentation. Support for the " + "deprecated `FormAction` in the Rasa SDK will be removed in Rasa Open " + "Source 3.0.", docs=rasa.shared.constants.DOCS_URL_FORMS, category=FutureWarning, ) @@ -622,6 +622,7 @@ def _initialize_forms( return [], {}, [] def __hash__(self) -> int: + """Returns a unique hash for the domain.""" self_as_dict = self.as_dict() self_as_dict[ KEY_INTENTS