Skip to content

Commit

Permalink
Merge branch 'master' into combined-entity-intent-model
Browse files Browse the repository at this point in the history
  • Loading branch information
tabergma committed Nov 12, 2019
2 parents 1c4591e + 99cd0d8 commit c558e0d
Show file tree
Hide file tree
Showing 139 changed files with 756 additions and 685 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.rst
Expand Up @@ -39,6 +39,16 @@ Fixed
- Fixed server hanging forever on leaving ``rasa shell`` before first message
- Fixed rasa init showing traceback error when user does Keyboard Interrupt before choosing a project path
- ``CountVectorsFeaturizer`` featurizes intents only if its analyzer is set to ``word``
- fixed bug where facebooks generic template was not rendered when buttons were None


[1.4.3] - 2019-10-29
^^^^^^^^^^^^^^^^^^^^

Fixed
-----
- Fixed ``Connection reset by peer`` errors and bot response delays when using the
RabbitMQ event broker.

[1.4.2] - 2019-10-28
^^^^^^^^^^^^^^^^^^^^
Expand All @@ -52,6 +62,8 @@ Fixed
- Fixed ``'Namespace' object has no attribute 'persist_nlu_data'`` error during
interactive learning
- Pinned `networkx~=2.3.0` to fix visualization in `rasa interactive` and Rasa X
- Fixed ``No model found`` error when using ``rasa run actions`` with "actions"
as a directory.

[1.4.1] - 2019-10-22
^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 2 additions & 0 deletions data/test/markdown_single_sections/section_with_delimiter.md
@@ -0,0 +1,2 @@
## synonym:10:00
- 10:00 am
11 changes: 4 additions & 7 deletions docs/conf.py
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# -- General configuration ------------------------------------------------
import re
Expand Down Expand Up @@ -324,9 +323,7 @@

# extlinks configuration

extlinks = {
"gh-code": ("https://github.com/RasaHQ/rasa/tree/{}/%s".format(release), "github ")
}
extlinks = {"gh-code": (f"https://github.com/RasaHQ/rasa/tree/{release}/%s", "github ")}

# Sphinxcontrib configuration
scv_priority = "tags"
Expand All @@ -340,9 +337,9 @@
re.compile(r"^[2-9]+\.\d+\.\d+$"),
re.compile(r"^1\.[456789]+\.\d+$"),
re.compile(r"^1\.3\.\d+$"),
re.compile("^1\.2\.9$"),
re.compile("^1\.1\.8$"),
re.compile("^1\.0\.9$"),
re.compile(r"^1\.2\.9$"),
re.compile(r"^1\.1\.8$"),
re.compile(r"^1\.0\.9$"),
)
scv_greatest_tag = True

Expand Down
2 changes: 2 additions & 0 deletions docs/core/actions.rst
Expand Up @@ -104,6 +104,8 @@ The only thing your action server needs to install is ``rasa-sdk``:
separate container, you only need to install ``rasa-sdk``.

The file that contains your custom actions should be called ``actions.py``.
Alternatively, you can use a package directory called ``actions`` or else
manually specify an actions module or package with the ``--actions`` flag.

If you have ``rasa`` installed, run this command to start your action server:

Expand Down
6 changes: 3 additions & 3 deletions docs/user-guide/connectors/mattermost.rst
Expand Up @@ -24,9 +24,9 @@ Getting Credentials
that is said.
4. Make sure **trigger when** is set to value
**first word matches a trigger word exactly**.
5. The callback url needs to be your ngrok url where you
5. The callback url needs to be either your localhost address for Rasa, or your ngrok url where you
have your webhook running in Core or your public address, e.g.
``http://test.example.com/webhooks/mattermost/webhook``.
``http://test.example.com/webhooks/mattermost/webhook`` or ``http://localhost:5005/webhooks/mattermost/webhook``.


For more detailed steps, visit the
Expand All @@ -49,7 +49,7 @@ you need to supply a ``credentials.yml`` with the following content:
mattermost:
url: "https://chat.example.com/api/v4"
team: "community"
user: "user@user.com"
user: "user@user.com" # actual username of your bot user, not displayname
pw: "password"
webhook_url: "https://server.example.com/webhooks/mattermost/webhook"
Expand Down
8 changes: 4 additions & 4 deletions examples/concertbot/actions.py
Expand Up @@ -12,7 +12,7 @@ def run(self, dispatcher, tracker, domain):
{"artist": "Katy Perry", "reviews": 5.0},
]
description = ", ".join([c["artist"] for c in concerts])
dispatcher.utter_message("{}".format(description))
dispatcher.utter_message(f"{description}")
return [SlotSet("concerts", concerts)]


Expand All @@ -27,7 +27,7 @@ def run(self, dispatcher, tracker, domain):
]
dispatcher.utter_message("here are some venues I found")
description = ", ".join([c["name"] for c in venues])
dispatcher.utter_message("{}".format(description))
dispatcher.utter_message(f"{description}")
return [SlotSet("venues", venues)]


Expand All @@ -37,7 +37,7 @@ def name(self):

def run(self, dispatcher, tracker, domain):
concerts = tracker.get_slot("concerts")
dispatcher.utter_message("concerts from slots: {}".format(concerts))
dispatcher.utter_message(f"concerts from slots: {concerts}")
return []


Expand All @@ -47,5 +47,5 @@ def name(self):

def run(self, dispatcher, tracker, domain):
venues = tracker.get_slot("venues")
dispatcher.utter_message("venues from slots: {}".format(venues))
dispatcher.utter_message(f"venues from slots: {venues}")
return []
1 change: 0 additions & 1 deletion examples/formbot/actions.py
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from typing import Dict, Text, Any, List, Union, Optional

from rasa_sdk import Tracker
Expand Down
2 changes: 1 addition & 1 deletion examples/restaurantbot/actions.py
Expand Up @@ -2,7 +2,7 @@
from rasa_sdk.events import SlotSet


class RestaurantAPI(object):
class RestaurantAPI:
def search(self, info):
return "papi's pizza place"

Expand Down
6 changes: 3 additions & 3 deletions examples/restaurantbot/run.py
Expand Up @@ -19,7 +19,7 @@ async def parse(text: Text, model_path: Text):

response = await agent.handle_text(text)

logger.info("Text: '{}'".format(text))
logger.info(f"Text: '{text}'")
logger.info("Response:")
logger.info(response)

Expand Down Expand Up @@ -49,7 +49,7 @@ async def train_core(
model_path = os.path.join(model_directory, model_name, "core")
agent.persist(model_path)

logger.info("Model trained. Stored in '{}'.".format(model_path))
logger.info(f"Model trained. Stored in '{model_path}'.")

return model_path

Expand All @@ -73,7 +73,7 @@ def train_nlu(
model_path = os.path.join(model_directory, model_name)
model_directory = trainer.persist(model_path, fixed_model_name="nlu")

logger.info("Model trained. Stored in '{}'.".format(model_directory))
logger.info(f"Model trained. Stored in '{model_directory}'.")

return model_directory

Expand Down
4 changes: 2 additions & 2 deletions rasa/cli/arguments/default_arguments.py
Expand Up @@ -36,7 +36,7 @@ def add_stories_param(
"--stories",
type=str,
default=DEFAULT_DATA_PATH,
help="File or folder containing your {} stories.".format(stories_name),
help=f"File or folder containing your {stories_name} stories.",
)


Expand Down Expand Up @@ -100,7 +100,7 @@ def add_data_param(
"--data",
type=str,
default=default,
help="Path to the file or directory containing {} data.".format(data_type),
help=f"Path to the file or directory containing {data_type} data.",
required=required,
)

Expand Down
4 changes: 2 additions & 2 deletions rasa/cli/data.py
Expand Up @@ -86,8 +86,8 @@ def split_nlu_data(args):

train, test = nlu_data.train_test_split(args.training_fraction)

train.persist(args.out, filename="training_data.{}".format(fformat))
test.persist(args.out, filename="test_data.{}".format(fformat))
train.persist(args.out, filename=f"training_data.{fformat}")
test.persist(args.out, filename=f"test_data.{fformat}")


def validate_files(args):
Expand Down
8 changes: 3 additions & 5 deletions rasa/cli/run.py
Expand Up @@ -55,13 +55,11 @@ def run_actions(args: argparse.Namespace):
def _validate_model_path(model_path: Text, parameter: Text, default: Text):

if model_path is not None and not os.path.exists(model_path):
reason_str = "'{}' not found.".format(model_path)
reason_str = f"'{model_path}' not found."
if model_path is None:
reason_str = "Parameter '{}' not set.".format(parameter)
reason_str = f"Parameter '{parameter}' not set."

logger.debug(
"{} Using default location '{}' instead.".format(reason_str, default)
)
logger.debug(f"{reason_str} Using default location '{default}' instead.")

os.makedirs(default, exist_ok=True)
model_path = default
Expand Down
2 changes: 1 addition & 1 deletion rasa/cli/scaffold.py
Expand Up @@ -134,7 +134,7 @@ def _ask_create_path(path: Text) -> None:
import questionary

should_create = questionary.confirm(
"Path '{}' does not exist 馃. Create path?".format(path)
f"Path '{path}' does not exist 馃. Create path?"
).ask()
if should_create:
os.makedirs(path)
Expand Down
2 changes: 1 addition & 1 deletion rasa/cli/test.py
Expand Up @@ -124,7 +124,7 @@ def test_nlu(args: argparse.Namespace) -> None:
config_files.append(file)
except validation_utils.InvalidYamlFileError:
logger.debug(
"Ignoring file '{}' as it is not a valid config file.".format(file)
f"Ignoring file '{file}' as it is not a valid config file."
)
continue

Expand Down
19 changes: 10 additions & 9 deletions rasa/cli/utils.py
Expand Up @@ -36,19 +36,17 @@ def get_validated_path(
"""
if current is None or current is not None and not os.path.exists(current):
if default is not None and os.path.exists(default):
reason_str = "'{}' not found.".format(current)
reason_str = f"'{current}' not found."
if current is None:
reason_str = "Parameter '{}' not set.".format(parameter)
reason_str = f"Parameter '{parameter}' not set."
else:
logger.warning(
"'{}' does not exist. Using default value '{}' instead.".format(
current, default
)
)

logger.debug(
"{} Using default location '{}' instead.".format(reason_str, default)
)
logger.debug(f"{reason_str} Using default location '{default}' instead.")
current = default
elif none_is_valid:
current = None
Expand Down Expand Up @@ -83,7 +81,7 @@ def cancel_cause_not_found(

default_clause = ""
if default:
default_clause = "use the default location ('{}') or ".format(default)
default_clause = f"use the default location ('{default}') or "
print_error(
"The path '{}' does not exist. Please make sure to {}specify it"
" with '--{}'.".format(current, default_clause, parameter)
Expand All @@ -97,7 +95,10 @@ def parse_last_positional_argument_as_model_path() -> None:

if (
len(sys.argv) >= 2
# support relevant commands ...
and sys.argv[1] in ["run", "shell", "interactive"]
# but avoid interpreting subparser commands as model paths
and sys.argv[1:] != ["run", "actions"]
and not sys.argv[-2].startswith("-")
and os.path.exists(sys.argv[-1])
):
Expand Down Expand Up @@ -130,8 +131,8 @@ def create_output_path(
else:
time_format = "%Y%m%d-%H%M%S"
name = time.strftime(time_format)
name = "{}{}".format(prefix, name)
file_name = "{}.tar.gz".format(name)
name = f"{prefix}{name}"
file_name = f"{name}.tar.gz"
return os.path.join(output_path, file_name)


Expand Down Expand Up @@ -196,7 +197,7 @@ def payload_from_button_question(button_question: "Question") -> Text:
return response


class bcolors(object):
class bcolors:
HEADER = "\033[95m"
OKBLUE = "\033[94m"
OKGREEN = "\033[92m"
Expand Down
6 changes: 3 additions & 3 deletions rasa/cli/x.py
Expand Up @@ -113,7 +113,7 @@ def _overwrite_endpoints_for_local_x(
import questionary

endpoints.model = EndpointConfig(
"{}/projects/default/models/tags/production".format(rasa_x_url),
f"{rasa_x_url}/projects/default/models/tags/production",
token=rasa_x_token,
wait_time_between_pulls=2,
)
Expand Down Expand Up @@ -153,7 +153,7 @@ def start_rasa_for_local_rasa_x(args: argparse.Namespace, rasa_x_token: Text):
credentials_path, endpoints_path = _get_credentials_and_endpoints_paths(args)
endpoints = AvailableEndpoints.read_endpoints(endpoints_path)

rasa_x_url = "http://localhost:{}/api".format(args.rasa_x_port)
rasa_x_url = f"http://localhost:{args.rasa_x_port}/api"
_overwrite_endpoints_for_local_x(endpoints, rasa_x_token, rasa_x_url)

vars(args).update(
Expand Down Expand Up @@ -324,7 +324,7 @@ async def _pull_runtime_config_from_server(
"".format(resp.status, await resp.text())
)
except aiohttp.ClientError as e:
logger.debug("Failed to connect to server. Retrying. {}".format(e))
logger.debug(f"Failed to connect to server. Retrying. {e}")

await asyncio.sleep(wait_time_between_pulls)
attempts -= 1
Expand Down

0 comments on commit c558e0d

Please sign in to comment.