Skip to content

Commit d266c0d

Browse files
authored
Merge branch 'master' into augmented-memo-docs
2 parents e2fd15b + 73de37c commit d266c0d

31 files changed

+606
-194
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ jobs:
5959
- stage: test
6060
name: "Test Docs"
6161
install:
62+
- pip install -r requirements.txt
6263
- pip install -r requirements-docs.txt
6364
- pip install -e .[sql]
6465
- pip list
@@ -72,6 +73,7 @@ jobs:
7273
- RASABASTER=rasabaster-0.7.23.tar.gz
7374
- curl -sSL -o $RASABASTER "https://storage.googleapis.com/docs-theme/${RASABASTER}?q=$(date +%s%N)"
7475
- pip install $RASABASTER
76+
- pip install -r requirements.txt
7577
- pip install --no-cache-dir -r requirements-docs.txt
7678
- pip install git+https://${GITHUB_TOKEN}:[email protected]/RasaHQ/sphinxcontrib-versioning.git@version_list
7779
- pip install -e .

CHANGELOG.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,16 @@ This project adheres to `Semantic Versioning`_ starting with version 1.0.
1313

1414
Added
1515
-----
16+
- Added data validator that checks if domain object returned is empty. If so, exit early from the command ``rasa data validate``
1617
- Added the KeywordIntentClassifier
1718
- Added documentation for ``AugmentedMemoizationPolicy``
19+
- Fall back to ``InMemoryTrackerStore`` in case there is any problem with the current
20+
tracker store
1821

1922
Changed
2023
-------
24+
- Do not retrain the entire Core model if only the ``templates`` section of the domain is changed.
25+
- Upgraded ``jsonschema`` version
2126

2227
Removed
2328
-------
@@ -229,7 +234,6 @@ Changed
229234
-------
230235
- Pin gast to == 0.2.2
231236

232-
233237
[1.3.0] - 2019-09-05
234238
^^^^^^^^^^^^^^^^^^^^
235239

docs/user-guide/validate-files.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ actions.
4141

4242
**verify_all():** Runs all verifications above.
4343

44+
**verify_domain_validity():** Check if domain is valid.
45+
4446
To use these functions it is necessary to create a `Validator` object and initialize the logger. See the following code:
4547

4648
.. code-block:: python

rasa/cli/data.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,9 @@ def validate_files(args):
103103
)
104104

105105
validator = loop.run_until_complete(Validator.from_importer(file_importer))
106+
domain_is_valid = validator.verify_domain_validity()
107+
if not domain_is_valid:
108+
sys.exit(1)
109+
106110
everything_is_alright = validator.verify_all(not args.fail_on_warnings)
107111
sys.exit(0) if everything_is_alright else sys.exit(1)

rasa/cli/x.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ def run_in_production(args: argparse.Namespace):
347347

348348

349349
def _get_credentials_and_endpoints_paths(
350-
args: argparse.Namespace
350+
args: argparse.Namespace,
351351
) -> Tuple[Optional[Text], Optional[Text]]:
352352
config_endpoint = args.config_endpoint
353353
if config_endpoint:

rasa/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
DEFAULT_DATA_PATH = "data"
1010
DEFAULT_RESULTS_PATH = "results"
1111
DEFAULT_NLU_RESULTS_PATH = "nlu_comparison_results"
12+
DEFAULT_CORE_SUBDIRECTORY_NAME = "core"
1213
DEFAULT_REQUEST_TIMEOUT = 60 * 5 # 5 minutes
1314

1415
TEST_DATA_FILE = "test.md"

rasa/core/agent.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@
1212
import rasa
1313
import rasa.utils.io
1414
import rasa.core.utils
15-
from rasa.constants import DEFAULT_DOMAIN_PATH, LEGACY_DOCS_BASE_URL, ENV_SANIC_BACKLOG
15+
from rasa.constants import (
16+
DEFAULT_DOMAIN_PATH,
17+
LEGACY_DOCS_BASE_URL,
18+
ENV_SANIC_BACKLOG,
19+
DEFAULT_CORE_SUBDIRECTORY_NAME,
20+
)
1621
from rasa.core import constants, jobs, training
1722
from rasa.core.channels.channel import InputChannel, OutputChannel, UserMessage
1823
from rasa.core.constants import DEFAULT_REQUEST_TIMEOUT
@@ -25,7 +30,11 @@
2530
from rasa.core.policies.memoization import MemoizationPolicy
2631
from rasa.core.policies.policy import Policy
2732
from rasa.core.processor import MessageProcessor
28-
from rasa.core.tracker_store import InMemoryTrackerStore, TrackerStore
33+
from rasa.core.tracker_store import (
34+
InMemoryTrackerStore,
35+
TrackerStore,
36+
FailSafeTrackerStore,
37+
)
2938
from rasa.core.trackers import DialogueStateTracker
3039
from rasa.exceptions import ModelNotFound
3140
from rasa.importers.importer import TrainingDataImporter
@@ -764,8 +773,8 @@ def persist(self, model_path: Text, dump_flattened_stories: bool = False) -> Non
764773
if not self.is_core_ready():
765774
raise AgentNotReady("Can't persist without a policy ensemble.")
766775

767-
if not model_path.endswith("core"):
768-
model_path = os.path.join(model_path, "core")
776+
if not model_path.endswith(DEFAULT_CORE_SUBDIRECTORY_NAME):
777+
model_path = os.path.join(model_path, DEFAULT_CORE_SUBDIRECTORY_NAME)
769778

770779
self._clear_model_directory(model_path)
771780

@@ -851,9 +860,11 @@ def create_tracker_store(
851860
) -> TrackerStore:
852861
if store is not None:
853862
store.domain = domain
854-
return store
863+
tracker_store = store
855864
else:
856-
return InMemoryTrackerStore(domain)
865+
tracker_store = InMemoryTrackerStore(domain)
866+
867+
return FailSafeTrackerStore(tracker_store)
857868

858869
@staticmethod
859870
def _create_lock_store(store: Optional[LockStore]) -> LockStore:

rasa/core/brokers/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515

1616
def from_endpoint_config(
17-
broker_config: Optional[EndpointConfig]
17+
broker_config: Optional[EndpointConfig],
1818
) -> Optional["EventChannel"]:
1919
"""Instantiate an event channel based on its configuration."""
2020

@@ -41,7 +41,7 @@ def from_endpoint_config(
4141

4242

4343
def load_event_channel_from_module_string(
44-
broker_config: EndpointConfig
44+
broker_config: EndpointConfig,
4545
) -> Optional["EventChannel"]:
4646
"""Instantiate an event channel based on its class name."""
4747

@@ -57,7 +57,7 @@ def load_event_channel_from_module_string(
5757

5858

5959
def create_rabbitmq_ssl_options(
60-
rabbitmq_host: Optional[Text] = None
60+
rabbitmq_host: Optional[Text] = None,
6161
) -> Optional["pika.SSLOptions"]:
6262
"""Create RabbitMQ SSL options.
6363

rasa/core/domain.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import logging
44
import os
55
import typing
6+
from pathlib import Path
67
from typing import Any, Dict, List, Optional, Text, Tuple, Union, Set
78

89
import rasa.core.constants
@@ -664,7 +665,7 @@ def as_dict(self) -> Dict[Text, Any]:
664665
"forms": self.form_names,
665666
}
666667

667-
def persist(self, filename: Text) -> None:
668+
def persist(self, filename: Union[Text, Path]) -> None:
668669
"""Write domain to a file."""
669670

670671
domain_data = self.as_dict()

rasa/core/interpreter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def _starts_with_intent_prefix(self, text: Text) -> bool:
135135

136136
@staticmethod
137137
def extract_intent_and_entities(
138-
user_input: Text
138+
user_input: Text,
139139
) -> Tuple[Optional[Text], float, List[Dict[Text, Any]]]:
140140
"""Parse the user input using regexes to extract intent & entities."""
141141

0 commit comments

Comments
 (0)