From 0fc5d255c61bdae75f78ffbf4cf39d88f9e16da7 Mon Sep 17 00:00:00 2001 From: Tobias Wochinger Date: Tue, 6 Oct 2020 16:06:18 +0200 Subject: [PATCH] enable conversation sessions by default (#6934) * delete duplicate session config constants * change default session timeout from 0 to 60 minutes This enables sessions by default. Co-authored-by: Roberto <43567378+rasabot@users.noreply.github.com> --- changelog/6934.removal.md | 12 ++++++++++++ docs/docs/migration-guide.mdx | 12 ++++++++++++ rasa/constants.py | 3 --- rasa/shared/constants.py | 2 +- rasa/shared/core/domain.py | 2 -- tests/shared/core/test_domain.py | 2 +- 6 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 changelog/6934.removal.md diff --git a/changelog/6934.removal.md b/changelog/6934.removal.md new file mode 100644 index 000000000000..b52ac10a36c8 --- /dev/null +++ b/changelog/6934.removal.md @@ -0,0 +1,12 @@ +[Conversation sessions](domain.mdx#session-configuration) are now enabled by default +if your [Domain](domain.mdx) does not contain a session configuration. +Previously a missing session configuration was treated as if conversation sessions +were disabled. You can explicitly disable conversation sessions using the following +snippet: + +```yaml-rasa title="domain.yml" +session_config: + # A session expiration time of `0` + # disables conversation sessions + session_expiration_time: 0 +``` \ No newline at end of file diff --git a/docs/docs/migration-guide.mdx b/docs/docs/migration-guide.mdx index 8cb1ae9e8444..1b1395f87ee6 100644 --- a/docs/docs/migration-guide.mdx +++ b/docs/docs/migration-guide.mdx @@ -29,6 +29,18 @@ how you can migrate from one version to another. component in your `policies` configuration (`config.yml`) you can replace it with `TEDPolicy`. It accepts the same configuration parameters. +* [Conversation sessions](domain.mdx#session-configuration) are now enabled by default + if your [Domain](domain.mdx) does not contain a session configuration. Previously a + missing session configuration was treated as if conversation sessions were disabled. + You can explicitly disable conversation sessions using the following snippet: + + ```yaml-rasa title="domain.yml" + session_config: + # A session expiration time of `0` + # disables conversation sessions + session_expiration_time: 0 + ``` + ### Training data files You can convert existing NLU, Stories, and NLG (i.e. `responses.md`) training data diff --git a/rasa/constants.py b/rasa/constants.py index 00088957f935..696ac97f789a 100644 --- a/rasa/constants.py +++ b/rasa/constants.py @@ -36,9 +36,6 @@ ENV_SANIC_WORKERS = "SANIC_WORKERS" ENV_SANIC_BACKLOG = "SANIC_BACKLOG" -DEFAULT_SESSION_EXPIRATION_TIME_IN_MINUTES = 0 -DEFAULT_CARRY_OVER_SLOTS_TO_NEW_SESSION = True - ENV_GPU_CONFIG = "TF_GPU_MEMORY_ALLOC" ENV_CPU_INTER_OP_CONFIG = "TF_INTER_OP_PARALLELISM_THREADS" ENV_CPU_INTRA_OP_CONFIG = "TF_INTRA_OP_PARALLELISM_THREADS" diff --git a/rasa/shared/constants.py b/rasa/shared/constants.py index 20eda5a9b647..9ef8fad715bb 100644 --- a/rasa/shared/constants.py +++ b/rasa/shared/constants.py @@ -32,7 +32,7 @@ DOMAIN_SCHEMA_FILE = "utils/schemas/domain.yml" -DEFAULT_SESSION_EXPIRATION_TIME_IN_MINUTES = 0 +DEFAULT_SESSION_EXPIRATION_TIME_IN_MINUTES = 60 DEFAULT_CARRY_OVER_SLOTS_TO_NEW_SESSION = True DEFAULT_NLU_FALLBACK_INTENT_NAME = "nlu_fallback" diff --git a/rasa/shared/core/domain.py b/rasa/shared/core/domain.py index cd6dccfcb560..5b2ce8b0cfbd 100644 --- a/rasa/shared/core/domain.py +++ b/rasa/shared/core/domain.py @@ -86,7 +86,6 @@ class SessionConfig(NamedTuple): @staticmethod def default() -> "SessionConfig": - # TODO: 2.0, reconsider how to apply sessions to old projects return SessionConfig( rasa.shared.constants.DEFAULT_SESSION_EXPIRATION_TIME_IN_MINUTES, rasa.shared.constants.DEFAULT_CARRY_OVER_SLOTS_TO_NEW_SESSION, @@ -185,7 +184,6 @@ def from_dict(cls, data: Dict) -> "Domain": def _get_session_config(session_config: Dict) -> SessionConfig: session_expiration_time_min = session_config.get(SESSION_EXPIRATION_TIME_KEY) - # TODO: 2.0 reconsider how to apply sessions to old projects and legacy trackers if session_expiration_time_min is None: session_expiration_time_min = ( rasa.shared.constants.DEFAULT_SESSION_EXPIRATION_TIME_IN_MINUTES diff --git a/tests/shared/core/test_domain.py b/tests/shared/core/test_domain.py index 2f73317183b9..bcdf0552cd6a 100644 --- a/tests/shared/core/test_domain.py +++ b/tests/shared/core/test_domain.py @@ -6,7 +6,7 @@ import pytest import rasa.shared.utils.io -from rasa.constants import DEFAULT_SESSION_EXPIRATION_TIME_IN_MINUTES +from rasa.shared.constants import DEFAULT_SESSION_EXPIRATION_TIME_IN_MINUTES from rasa.core import training, utils from rasa.core.featurizers.tracker_featurizers import MaxHistoryTrackerFeaturizer from rasa.shared.core.slots import TextSlot