Skip to content

Commit

Permalink
Merge branch 'main' into switch-to-mypy-part1
Browse files Browse the repository at this point in the history
  • Loading branch information
m-vdb committed Mar 11, 2021
2 parents 6176569 + 4e61878 commit 768068b
Show file tree
Hide file tree
Showing 136 changed files with 2,934 additions and 2,583 deletions.
25 changes: 0 additions & 25 deletions .github/workflows/automatic-pr-merger.yml

This file was deleted.

19 changes: 19 additions & 0 deletions .github/workflows/automatic-pr-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Automatic PR Merger

on:
push: {} # update PR when base branch is updated

jobs:
# thats's all. single step is needed - if PR is mergeable according to
# branch protection rules it will be merged automatically
mergepal:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: rasahq/update-pr-branch@601ac3dadf708b14e7f0252d98230538235f99d9
if: github.repository == 'RasaHQ/rasa'
with:
token: ${{ secrets.RASABOT_AUTOMERGE_GITHUB_TOKEN }}
# required parameter by original action -
# check is already done through protected branches so not needed for us
required_approval_count: 0
31 changes: 11 additions & 20 deletions .github/workflows/continous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,16 @@ jobs:
needs: [changes]
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: [3.6, 3.7, 3.8]
test: [test-non-training, test-training]
test:
- test-cli
- test-core-featurizers
- test-policies
- test-nlu-featurizers
- test-nlu-predictors
- test-full-model-training
- test-other-unit-tests
os: [ ubuntu-latest, windows-latest ]
python-version: [ 3.6, 3.7, 3.8 ]

steps:
- name: Checkout git repository 🕝
Expand Down Expand Up @@ -285,6 +292,7 @@ jobs:
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: github
COVERALLS_PARALLEL: true
run: poetry run coveralls

integration_test:
Expand Down Expand Up @@ -735,20 +743,3 @@ jobs:
pip install -U github3.py pep440-version-utils
python3 scripts/publish_gh_release_notes.py
./scripts/ping_slack_about_package_release.sh
mergepal-merge: # run merge pal in the end
runs-on: ubuntu-latest
needs: [quality, test, documentation, docker]
steps:
- uses: actions/checkout@v1
- name: Make sure there is a github token
shell: bash
run: |
if [ -z "${{ secrets.RASABOT_AUTOMERGE_GITHUB_TOKEN }}" ]; then
echo "MERGE_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
else
echo "MERGE_TOKEN=${{ secrets.RASABOT_AUTOMERGE_GITHUB_TOKEN }}" >> $GITHUB_ENV
fi
- uses: rasahq/merge-pal-action@master
with:
token: ${{ env.MERGE_TOKEN }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ examples/moodbot/errors.json
examples/formbot/models*
examples/concertbot/models*
examples/moodbot/models*
examples/e2ebot/results/*
failed_stories.md
errors.json
pip-wheel-metadata/*
Expand All @@ -83,6 +84,6 @@ env
.history
rasa/segment_key
rasa/keys

/results/
# Local Netlify folder
.netlify
29 changes: 23 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,30 @@ else
set -o allexport; source tests_deployment/.env && OMP_NUM_THREADS=1 poetry run pytest $(INTEGRATION_TEST_FOLDER) -n $(JOBS) -m $(INTEGRATION_TEST_PYTEST_MARKERS) && set +o allexport
endif

test-non-training: clean
# OMP_NUM_THREADS can improve overall performance using one thread by process (on tensorflow), avoiding overload
RAISE_ON_TRAIN=True OMP_NUM_THREADS=1 poetry run pytest tests -n $(JOBS) --cov rasa -m "not trains_model" --ignore $(INTEGRATION_TEST_FOLDER)
test-cli: PYTEST_MARKER=category_cli
test-cli: test-marker

test-training: clean
# OMP_NUM_THREADS can improve overall performance using one thread by process (on tensorflow), avoiding overload
OMP_NUM_THREADS=1 poetry run pytest tests -n $(JOBS) --cov rasa -m "trains_model" --ignore $(INTEGRATION_TEST_FOLDER)
test-core-featurizers: PYTEST_MARKER=category_core_featurizers
test-core-featurizers: test-marker

test-policies: PYTEST_MARKER=category_policies
test-policies: test-marker

test-nlu-featurizers: PYTEST_MARKER=category_nlu_featurizers
test-nlu-featurizers: test-marker

test-nlu-predictors: PYTEST_MARKER=category_nlu_predictors
test-nlu-predictors: test-marker

test-full-model-training: PYTEST_MARKER=category_full_model_training
test-full-model-training: test-marker

test-other-unit-tests: PYTEST_MARKER=category_other_unit_tests
test-other-unit-tests: test-marker

test-marker: clean
# OMP_NUM_THREADS can improve overall performance using one thread by process (on tensorflow), avoiding overload
OMP_NUM_THREADS=1 poetry run pytest tests -n $(JOBS) --cov rasa -m "$(PYTEST_MARKER)" --ignore $(INTEGRATION_TEST_FOLDER)

generate-pending-changelog:
poetry run python -c "from scripts import release; release.generate_changelog('major.minor.patch')"
Expand Down
15 changes: 0 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,21 +193,6 @@ JOBS=[n] make test

Where `[n]` is the number of jobs desired. If omitted, `[n]` will be automatically chosen by pytest.

#### Tests that train
A test that trains a model is defined as any test that explicitly or inadvertently calls any method annotated with `@rasa.shared.utils.common.raise_on_unexpected_train`.
Currently, this is: `nlu.train`, `core.train`, `Agent.train`, and `Trainer.train`.

We specify tests that train a model using the pytest mark `trains_model`.
e.g:

@pytest.mark.trains_model
def test_some_training()
...

These test are then run separately in the CI using the make commands `make test-non-training` and `make test-training` respectively.

The command `make test-non-training` will fail if training occurs.


### Running the Integration Tests

Expand Down
4 changes: 4 additions & 0 deletions changelog/6484.misc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- Renamed `templates` to `responses` across Rasa code base and documentation.
- Renamed `response_templates` to `responses` across the Rasa code base.
- Renamed `template_name` and `response_name` to `utter_action` in Rasa Core and rasa/shared.
- Renamed `utter_templates` to `responses` in rasa/shared.
19 changes: 19 additions & 0 deletions changelog/6484.removal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
NLG Server
- Changed request format to send `response` as well as `template` as a field. The `template` field will be removed in Rasa Open Source 3.0.0.

`rasa.core.agent`
- The terminology `template` is deprecated and replaced by `response`. Support for `template` from the NLG response will be removed in Rasa Open Source 3.0.0. Please see [here](nlg.mdx) for more details.

`rasa.core.nlg.generator`
- `generate()` now takes in `utter_action` as a parameter.
- The terminology `template` is deprecated and replaced by `response`. Support for `template` in the `NaturalLanguageGenerator` will be removed in Rasa Open Source 3.0.0.

`rasa.shared.core.domain`
- The property `templates` is deprecated. Use `responses` instead. It will be removed in Rasa Open Source 3.0.0.
- `retrieval_intent_templates` will be removed in Rasa Open Source 3.0.0. Please use `retrieval_intent_responses` instead.
- `is_retrieval_intent_template` will be removed in Rasa Open Source 3.0.0. Please use `is_retrieval_intent_response` instead.
- `check_missing_templates` will be removed in Rasa Open Source 3.0.0. Please use `check_missing_responses` instead.

Response Selector
- The field `template_name` will be deprecated in Rasa Open Source 3.0.0. Please use `utter_action` instead. Please see [here](components.mdx#selectors) for more details.
- The field `response_templates` will be deprecated in Rasa Open Source 3.0.0. Please use `responses` instead. Please see [here](components.mdx#selectors) for more details.
10 changes: 10 additions & 0 deletions changelog/7438.improvement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Simplify our training by overwriting `train_step` instead of `fit` for our custom models.

This allows us to use the build-in callbacks from Keras, such as the
[Tensorboard Callback](https://www.tensorflow.org/api_docs/python/tf/keras/callbacks/TensorBoard),
which offers more functionality compared to what we had before.

:::warning
If you want to use Tensorboard for `DIETClassifier`, `ResponseSelector`, or `TEDPolicy` and log metrics after
every (mini)batch, please use 'batch' instead of 'minibatch' as 'tensorboard_log_level'.

10 changes: 10 additions & 0 deletions changelog/7470.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Allow to have slots with values that result to a dictionary under the key `slot_was_set` (in `stories.yml` file).

An example would be to have the following story step in `stories.yml`:
```yaml
- slot_was_set:
- some_slot:
some_key: 'some_value'
other_key: 'other_value'
```
This would be allowed if the `some_slot` is also set accordingly in the `domain.yml` with type `any`.
File renamed without changes.
23 changes: 11 additions & 12 deletions docs/docs/components.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1607,7 +1607,7 @@ However, additional parameters exist that can be adapted.
+---------------------------------+------------------+--------------------------------------------------------------+
| tensorboard_log_level | "epoch" | Define when training metrics for tensorboard should be |
| | | logged. Either after every epoch ('epoch') or for every |
| | | training step ('minibatch'). |
| | | training step ('batch'). |
+---------------------------------+------------------+--------------------------------------------------------------+
| featurizers | [] | List of featurizer names (alias names). Only features |
| | | coming from the listed names are used. If list is empty |
Expand Down Expand Up @@ -2488,7 +2488,7 @@ The `SpacyEntityExtractor` extractor does not provide a `confidence` level and w
+---------------------------------+------------------+--------------------------------------------------------------+
| tensorboard_log_level | "epoch" | Define when training metrics for tensorboard should be |
| | | logged. Either after every epoch ('epoch') or for every |
| | | training step ('minibatch'). |
| | | training step ('batch'). |
+---------------------------------+------------------+--------------------------------------------------------------+
| featurizers | [] | List of featurizer names (alias names). Only features |
| | | coming from the listed names are used. If list is empty |
Expand Down Expand Up @@ -2529,7 +2529,7 @@ Selectors predict a bot response from a set of candidate responses.
* **Outputs**

A dictionary with the key as the retrieval intent of the response selector
and value containing predicted response templates, confidence and the response key under the retrieval intent
and value containing predicted responses, confidence and the response key under the retrieval intent



Expand All @@ -2547,7 +2547,7 @@ Selectors predict a bot response from a set of candidate responses.
and stores two properties:

* `response`: The predicted response key under the corresponding retrieval intent,
prediction's confidence and the associated response templates.
prediction's confidence and the associated responses.

* `ranking`: Ranking with confidences of top 10 candidate response keys.

Expand All @@ -2561,7 +2561,7 @@ Selectors predict a bot response from a set of candidate responses.
"id": 1388783286124361986,
"confidence": 0.7,
"intent_response_key": "chitchat/ask_weather",
"response_templates": [
"responses": [
{
"text": "It's sunny in Berlin today",
"image": "https://i.imgur.com/nGF1K8f.jpg"
Expand All @@ -2570,7 +2570,7 @@ Selectors predict a bot response from a set of candidate responses.
"text": "I think it's about to rain."
}
],
"template_name": "utter_chitchat/ask_weather"
"utter_action": "utter_chitchat/ask_weather"
},
"ranking": [
{
Expand Down Expand Up @@ -2600,7 +2600,7 @@ Selectors predict a bot response from a set of candidate responses.
"id": 1388783286124361986,
"confidence": 0.7,
"intent_response_key": "chitchat/ask_weather",
"response_templates": [
"responses": [
{
"text": "It's sunny in Berlin today",
"image": "https://i.imgur.com/nGF1K8f.jpg"
Expand All @@ -2609,7 +2609,7 @@ Selectors predict a bot response from a set of candidate responses.
"text": "I think it's about to rain."
}
],
"template_name": "utter_chitchat/ask_weather"
"utter_action": "utter_chitchat/ask_weather"
},
"ranking": [
{
Expand Down Expand Up @@ -2715,9 +2715,8 @@ Selectors predict a bot response from a set of candidate responses.
Default is `None`, i.e. the model is trained for all retrieval intents.

In its default configuration, the component uses the retrieval intent with the response key(e.g. `faq/ask_name`) as the label for training.
Alternatively, it can also be configured to use the text of the response templates as the training label
by switching `use_text_as_label` to `True`. In this mode, the component will use the first available response
template which has a text attribute for training. If none are found, it falls back to using the retrieval intent
Alternatively, it can also be configured to use the text of the responses as the training label
by switching `use_text_as_label` to `True`. In this mode, the component will use the first available response which has a text attribute for training. If none are found, it falls back to using the retrieval intent
combined with the response key as the label.

:::note examples and tutorials
Expand Down Expand Up @@ -2846,7 +2845,7 @@ However, additional parameters exist that can be adapted.
+---------------------------------+-------------------+--------------------------------------------------------------+
| tensorboard_log_level | "epoch" | Define when training metrics for tensorboard should be |
| | | logged. Either after every epoch ("epoch") or for every |
| | | training step ("minibatch"). |
| | | training step ("batch"). |
+---------------------------------+-------------------+--------------------------------------------------------------+
| featurizers | [] | List of featurizer names (alias names). Only features |
| | | coming from the listed names are used. If list is empty |
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/connectors/facebook-messenger.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ to make the new channel endpoint available for Facebook Messenger to send messag
## Supported response attachments

In addition to typical text, image, and custom responses, the Facebook Messenger
channel supports the following additional response template attachments:
channel supports the following additional response attachments:

* [Buttons](https://developers.facebook.com/docs/messenger-platform/send-messages/buttons)
are structured the same as other Rasa buttons. Facebook API limits the amount of
Expand Down
28 changes: 28 additions & 0 deletions docs/docs/migration-guide.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,28 @@ description: |
This page contains information about changes between major versions and
how you can migrate from one version to another.

## Rasa 2.3 to Rasa 2.4
### Deprecating `template` for `response`
NLG Server
- Changed request format to send `response` as well as `template` as a field. The `template` field will be removed in Rasa Open Source 3.0.0.

`rasa.core.agent`
- The terminology `template` is deprecated and replaced by `response`. Support for `template` from the NLG response will be removed in Rasa Open Source 3.0.0. Please see [here](./nlg.mdx) for more details.

`rasa.core.nlg.generator`
- `generate()` now takes in `utter_action` as a parameter.
- The terminology `template` is deprecated and replaced by `response`. Support for `template` in the `NaturalLanguageGenerator` will be removed in Rasa Open Source 3.0.0.

`rasa.shared.core.domain`
- The property `templates` is deprecated. Use `responses` instead. It will be removed in Rasa Open Source 3.0.0.
- `retrieval_intent_templates` will be removed in Rasa Open Source 3.0.0. Please use `retrieval_intent_responses` instead.
- `is_retrieval_intent_template` will be removed in Rasa Open Source 3.0.0. Please use `is_retrieval_intent_response` instead.
- `check_missing_templates` will be removed in Rasa Open Source 3.0.0. Please use `check_missing_responses` instead.

Response Selector
- The field `template_name` will be deprecated in Rasa Open Source 3.0.0. Please use `utter_action` instead. Please see [here](./components.mdx#selectors) for more details.
- The field `response_templates` will be deprecated in Rasa Open Source 3.0.0. Please use `responses` instead. Please see [here](./components.mdx#selectors) for more details.

## Rasa 2.3.3 to Rasa 2.3.4

:::caution
Expand Down Expand Up @@ -38,6 +60,12 @@ If you trained a model with `model_confidence=cosine` or `model_confidence=inner

## Rasa 2.2 to Rasa 2.3

### General

If you want to use Tensorboard for `DIETClassifier`, `ResponseSelector`, or `TEDPolicy` and log metrics after
every (mini)batch, please use 'batch' instead of 'minibatch' as 'tensorboard_log_level'.


### Machine Learning Components

A few changes have been made to the loss function inside machine learning (ML)
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/nlg.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ external HTTP server that you define.

## Responding to Requests

### Response Format
### Request Format

When your model predicts that your bot should send a response to the user,
it will send a request to your server, giving you the information
Expand All @@ -28,7 +28,7 @@ like this:

```json
{
"template":"utter_what_can_do",
"response":"utter_what_can_do",
"arguments":{

},
Expand Down Expand Up @@ -170,7 +170,7 @@ Here is an overview of the high-level keys in the post request:

Key | Description
---|---
`template` | The name of the response predicted by Rasa Open Source.
`response` | The name of the response predicted by Rasa Open Source.
`arguments` | Optional keyword arguments that can be provided by custom actions.
`tracker` | A dictionary containing the entire conversation history.
`channel` | The output channel this message will be sent to.
Expand Down
Loading

0 comments on commit 768068b

Please sign in to comment.