Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnexpecTEDIntentPolicy final merge #8913

Merged
merged 360 commits into from
Jul 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
360 commits
Select commit Hold shift + click to select a range
2340bcb
Convert empty list to None everywhere in predictions[DIAGNOSTIC_DATA].
samsucik Mar 22, 2021
62f8f18
Shorten long lines.
samsucik Mar 22, 2021
824a69f
Add a changelog entry.
samsucik Mar 22, 2021
dc949ee
Add type annotations to new unit tests.
samsucik Mar 22, 2021
e241bf4
Merge branch 'main' into e2e-feature-combining-layers-2.2
samsucik Mar 22, 2021
7fefe8c
Merge branch 'main' into e2e-feature-combining-layers-2.2
samsucik Mar 26, 2021
5fc0149
Merge branch 'main' into e2e-feature-combining-layers-2.2
samsucik Mar 29, 2021
3f2eb9b
Merge branch 'main' into e2e-feature-combining-layers-2.2
samsucik Mar 29, 2021
61dba92
Merge branch 'main' into e2e-feature-combining-layers-2.2
samsucik Mar 29, 2021
55a91f2
Merge branch 'main' into e2e-feature-combining-layers-2.2
samsucik Mar 31, 2021
6b5c9ba
Merge branch 'main' into e2e-feature-combining-layers-2.2
samsucik Apr 6, 2021
1d0f20e
Resolve merge conflicts.
samsucik Apr 8, 2021
1960afe
Type-annotate forgotten function.
samsucik Apr 8, 2021
fe864b6
Make small changes (typing & docstrings) based on review comments.
samsucik Apr 12, 2021
1957519
Merge branch 'main' of github.com:RasaHQ/rasa into e2e-feature-combin…
samsucik Apr 12, 2021
365d0dd
Merge branch 'main' into e2e-feature-combining-layers-2.2
samsucik Apr 12, 2021
4a9687f
Merge branch 'main' into e2e-feature-combining-layers-2.2
samsucik Apr 14, 2021
de665cd
Make small improvements based on review comments.
samsucik Apr 14, 2021
506cb25
Merge branch 'main' of github.com:RasaHQ/rasa into e2e-feature-combin…
samsucik Apr 14, 2021
3548b55
Merge branch 'e2e-feature-combining-layers-2.2' of github.com:RasaHQ/…
samsucik Apr 14, 2021
652b972
Increase DIET's # of epochs for stable results of .
samsucik Apr 15, 2021
cfcc02d
Merge branch 'main' of github.com:RasaHQ/rasa into e2e-feature-combin…
samsucik Apr 15, 2021
6ba4d78
Remove unused imports.
samsucik Apr 16, 2021
f83e85f
Split a method into two to avoid conflicting method name vs behaviour.
samsucik Apr 19, 2021
8133fbe
Merge branch 'main' of github.com:RasaHQ/rasa into e2e-feature-combin…
samsucik Apr 19, 2021
1bb5338
Fix a tiny bug.
samsucik Apr 19, 2021
044ed83
Merge branch 'main' into e2e-feature-combining-layers-2.2
samsucik Apr 19, 2021
eb80440
`action_unlikely_intent` and dump mechanisms
alwx Apr 13, 2021
9e1c88f
Test update
alwx Apr 13, 2021
0806a7f
Pass the prediction metadata
alwx Apr 14, 2021
a2db9ab
Updated ActionExecuted representation; `test_action_unlikely_intent_m…
alwx Apr 15, 2021
bdcb72e
Updated `MINIMUM_COMPATIBLE_VERSION`
alwx Apr 15, 2021
6b1fab8
`test_markdown_writer_doesnt_dump_action_unlikely_intent`
alwx Apr 15, 2021
7838912
Code style updates
alwx Apr 15, 2021
5e8d4a0
Changelog entries
alwx Apr 15, 2021
b9ac36c
Updated docstrings
alwx Apr 15, 2021
2824504
Updated docstrings
alwx Apr 15, 2021
10f0221
Updated tests
alwx Apr 16, 2021
4c1a6e9
Updated constants.py
alwx Apr 16, 2021
c266e9b
Bugfixes
alwx Apr 20, 2021
582f199
Updated tests
alwx Apr 20, 2021
ff02e00
Updated `ActionUnlikelyIntent` `run` method to return the empty event
alwx Apr 20, 2021
65c98c3
Update for `test_convert_labels_to_ids`
alwx Apr 20, 2021
9dfb637
Merge branch 'main' into e2e-feature-combining-layers-2.2
samsucik Apr 21, 2021
3d68c68
Post-review fixes
alwx Apr 21, 2021
6d7f03b
Merge pull request #8457 from RasaHQ/intent-ted-policy
alwx Apr 21, 2021
d6169e9
Merge branch 'main' into e2e-feature-combining-layers-2.2
samsucik Apr 23, 2021
96de8a7
Merge branch 'main' into e2e-feature-combining-layers-2.2
samsucik Apr 26, 2021
8e2a8a0
Merge branch 'main' into e2e-feature-combining-layers-2.2
samsucik Apr 26, 2021
25d418b
Add dummy docstrings to satisfy code quality checks.
samsucik Apr 26, 2021
0193e80
Merge branch 'main' into intent-ted
dakshvar22 Apr 26, 2021
8735f0d
Add missing return type annotation.
samsucik Apr 26, 2021
13a8c5c
Merge branch 'e2e-feature-combining-layers-2.2' into intent-ted
dakshvar22 Apr 26, 2021
afc499f
Merge branch 'main' into intent-ted
dakshvar22 Apr 27, 2021
d600cd0
Extended tracker featurizer tests.
kedz Apr 27, 2021
ebad334
Refactor MaxHistoryTrackerFeaturizer to make sublcassing easier for I…
kedz Apr 27, 2021
edb2b67
Added tests for IntentMaxHistoryTrackerFeaturizer.
kedz Apr 27, 2021
8d9cfd2
Added first pass implementation of IntentMaxHistoryTrackerFeaturizer.
kedz Apr 27, 2021
ff767bc
Merge branch 'main' into intent-ted
dakshvar22 Apr 28, 2021
a2d8ffc
Changed logging and debug statements to use 'intent labels' phrasing …
kedz Apr 28, 2021
fe7ca9c
Added deprecation warning tests.
kedz Apr 28, 2021
cc4bf32
Added deprecation warnings for 'training_states_actions_and_entities'…
kedz Apr 28, 2021
ae19ea0
Cleaned up tests and fixed type hints.
kedz Apr 29, 2021
0d11428
Renamed some functions to be private.
kedz Apr 29, 2021
b2354ec
_find_unpredictable_events
alwx May 5, 2021
67e0e79
Minor updates
alwx May 5, 2021
a3f53cd
Tests
alwx May 5, 2021
52e2a81
Changelog entry; black
alwx May 5, 2021
0d97bef
Newline update
alwx May 5, 2021
b3c66f6
Style changes and some extra arguments added to matching integration …
kedz May 5, 2021
5b4214b
Doc change (`actions` -> `action-hashes`)
alwx May 6, 2021
4ea3338
Code style update
alwx May 6, 2021
20e002c
Update for docstrings
alwx May 7, 2021
96ecb95
Merge pull request #8608 from RasaHQ/enhancement/8563
alwx May 7, 2021
9337a3a
merge main
dakshvar22 May 12, 2021
c1b9832
Merge branch 'intent-ted' into intent-max-history-tracker-featurizer
kedz May 17, 2021
28e1df0
Implemented alternative method of reverting to last user utterance.
kedz May 17, 2021
90eb95f
Reduced expected counts by 1 of trackers returned by generate_all_pri…
kedz May 17, 2021
8d70fe1
Added tests for rule hiding.
kedz May 17, 2021
7ef6a9b
Style.
kedz May 17, 2021
a36cb31
updated how trackers are yielded, how user utterance is reverted and …
dakshvar22 May 18, 2021
bfefef5
Merge branch 'main' into intent-ted
dakshvar22 May 18, 2021
16d43b2
refactor when state is cleaned up
dakshvar22 May 18, 2021
a08b96d
Fixed expected output for MaxHistoryTrackerFeaturizer prediction_stat…
kedz May 19, 2021
50d6320
Fixed tracker input for IntentMaxHistoryTrackerFeaturizer prediction_…
kedz May 19, 2021
6d5ade0
Fixed incorrect deprecation message.
kedz May 20, 2021
80142eb
Put NotImplementedError in training_states_labels_and_entities, and m…
kedz May 20, 2021
d9f1fa6
Refactored training_states_labels_and_entities to remove setup and cl…
kedz May 21, 2021
b3e2c2f
Replaced strings with constants.
kedz May 21, 2021
951905f
Added IntentTokenizerSingleStateFeaturizer and used it in IntentMaxHi…
kedz May 21, 2021
f1c9b45
Added a function to check if a tracker state's previous action is act…
kedz May 21, 2021
2f4e7ed
Added filtering of action_unlikely_intent from states.
kedz May 21, 2021
cd28eba
Added docstrings and fixed style issues.
kedz May 21, 2021
c0ef951
Move fixtures to tests.core.conftest.py
kedz May 21, 2021
9e0931e
Move duplicate example checking logic into training_states_labels_and…
kedz May 21, 2021
1fd6ef2
Fixed defaultdict typing hint error.
kedz May 21, 2021
01a167b
Moved filtering of action_unlikely_intent from _create_states to Trac…
kedz May 25, 2021
0088111
Style
kedz May 25, 2021
cf09770
Added ignore_action_unlikely_intent flag to prediction_states, create…
kedz May 26, 2021
432a27b
Revert classemthod to staticmethod.
kedz May 27, 2021
09f34f4
Changed declarative docstrings to descriptive docstrings.
kedz May 27, 2021
6dacf4b
Removed type mentions in docstrings. General docstring cleanup.
kedz May 27, 2021
da08802
Consolidated action_unlikely_intent state and event filtering in one …
kedz May 28, 2021
a7f1e91
Typo.
kedz May 28, 2021
a0e0a06
Added test for encode_all_labels for SingleStateFeaturizer and Intent…
kedz May 28, 2021
47c7e59
Used domain to get label ids in test_convert_action_labels_to_ids and…
kedz Jun 1, 2021
2f4e6e7
Created separate method for remove action_unlikely_intent events in T…
kedz Jun 2, 2021
a617e49
Fixed docstring.
kedz Jun 2, 2021
ee82439
Added comment on LABEL_PAD_ID value.
kedz Jun 2, 2021
20fc169
Put expected state or feature sequence dictionaries in chronological …
kedz Jun 2, 2021
e0e9180
Fixed docstrings.
kedz Jun 2, 2021
601ab3d
Merge branch 'main' into intent-ted
dakshvar22 Jun 3, 2021
ac38a45
Changed codebase calls of training_states_and_actions to training_sta…
kedz Jun 4, 2021
f0f311d
Merge pull request #8570 from RasaHQ/intent-max-history-tracker-featu…
Jun 4, 2021
020ffa5
MultiLabelDotProductLoss for IntentTED (new) (#8688)
Jun 6, 2021
4d0bd75
merge main
dakshvar22 Jun 8, 2021
8c3e949
IntentTEDPolicy: Implement Policy (#8555)
dakshvar22 Jun 8, 2021
b2b086c
Add `IntentTEDPolicy` to the default config.
alwx May 26, 2021
25bfebd
Changelog entry
alwx May 26, 2021
dad1b8d
Merge branch 'main' into intent-ted
dakshvar22 Jun 10, 2021
c38c86c
Changing one line there
alwx Jun 11, 2021
88005a4
Having both `IntentTEDPolicy` and `TEDPolicy` in the config
alwx Jun 15, 2021
9a9f670
Updates for the configs
alwx Jun 15, 2021
8b2a01b
Removing redundant constrain_similarities param
alwx Jun 15, 2021
7979891
Merge pull request #8748 from RasaHQ/intent-ted-policy-default
alwx Jun 15, 2021
85247d7
IntentTEDPolicy: Add `tolerance` parameter (#8855)
dakshvar22 Jun 15, 2021
441dab8
IntentTEDPolicy: Fix when predictions should be skipped (#8912)
dakshvar22 Jun 21, 2021
4ee5e51
Merge branch 'main' into intent-ted
dakshvar22 Jun 22, 2021
83a8b95
Refactor cli/test.py
alwx Jun 7, 2021
50e5f47
Adding stories_with_warnings.yml
alwx Jun 7, 2021
672b00b
Specifying right comment messages for `_log_stories`
alwx Jun 7, 2021
942190f
Updated comment message
alwx Jun 7, 2021
037fcb2
Ignore the `action_unlikely_intent` when making predictions
alwx Jun 8, 2021
96489dc
Refactoring; bugfixes
alwx Jun 8, 2021
295792c
Add information about stories with warnings to `story_report.json`
alwx Jun 8, 2021
b4d3a8f
Tests
alwx Jun 9, 2021
b8455e7
Config update
alwx Jun 9, 2021
a92a2cd
Examples added
alwx Jun 9, 2021
5b4cb14
Fix for tests
alwx Jun 9, 2021
2ce51c6
Small test
alwx Jun 9, 2021
9e9a5fe
Updated logic; updates for tests
alwx Jun 9, 2021
a51fe3a
should_ignore_prediction update
alwx Jun 9, 2021
cb3a685
Config is back
alwx Jun 10, 2021
2cbea4c
Updated tests
alwx Jun 14, 2021
4fd2a12
Update to the core logic
alwx Jun 15, 2021
a3c11a1
Updated configs and tests
alwx Jun 15, 2021
50cc175
Updated configs
alwx Jun 15, 2021
e0a6a83
Finally the correct configs
alwx Jun 15, 2021
dbe642b
Code style updates
alwx Jun 17, 2021
18e71d4
Updated tests
alwx Jun 22, 2021
61ac8ff
Fix for f-strings
alwx Jun 22, 2021
74cf886
Updates for existing tests
alwx Jun 23, 2021
3fe0c6d
Use `predicted_warning` inside `_collect_story_predictions`
alwx Jun 23, 2021
edfc45e
POC
alwx Jun 15, 2021
efcc347
Updated text
alwx Jun 15, 2021
227eed8
Replacing an action name with a constant
alwx Jun 15, 2021
80a99e9
Changelog entry
alwx Jun 17, 2021
960e248
Code style updates
alwx Jun 17, 2021
8764c79
Updates
alwx Jun 21, 2021
052b26c
Updated text
alwx Jun 21, 2021
62c2283
Updated tests
alwx Jun 22, 2021
294586e
Updated tests
alwx Jun 23, 2021
86569c6
Black fixes
alwx Jun 23, 2021
dfab681
Code quality fixes
alwx Jun 23, 2021
3485d14
Test code style update
alwx Jun 23, 2021
4d60144
Small style fix
alwx Jun 23, 2021
6dc009e
Remove example
alwx Jun 23, 2021
989f78d
Merge pull request #8843 from RasaHQ/rasa-train-intent-ted
alwx Jun 23, 2021
fc0b28a
IntentTEDPolicy: Add severity to metadata (#8931)
dakshvar22 Jun 23, 2021
5679205
resolve merge conflicts
dakshvar22 Jun 23, 2021
ed8e177
Merge branch 'intent-ted' of github.com:RasaHQ/rasa into intent-ted
dakshvar22 Jun 23, 2021
829c262
Patched tests
alwx Jun 24, 2021
6b88b4d
Some description added
alwx Jun 24, 2021
07c1676
Changing `rasa.core.test` imports
alwx Jun 24, 2021
768d885
Post-review updates
alwx Jun 25, 2021
853e15c
Black
alwx Jun 25, 2021
05d0df1
Merge pull request #8949 from RasaHQ/intent-ted-patched-tests
alwx Jun 25, 2021
2b8f13f
Merge branch 'main' into intent-ted
dakshvar22 Jun 28, 2021
fa78973
Merge branch 'main' into intent-ted
dakshvar22 Jun 29, 2021
cff5e16
IntentTEDPolicy: Misc updates from QA (#8977)
dakshvar22 Jun 29, 2021
7a46a8a
Merge branch 'main' into intent-ted
dakshvar22 Jun 30, 2021
e2159ee
address some review comments partially
dakshvar22 Jun 30, 2021
eb7d518
more review comments addressed
dakshvar22 Jun 30, 2021
18438b4
fix code quality, tests
dakshvar22 Jun 30, 2021
2203d23
Post-review fixes
alwx Jul 1, 2021
682b2d2
merge main with conflicts resolved
dakshvar22 Jul 1, 2021
17074d1
Merge branch 'intent-ted' of github.com:RasaHQ/rasa into intent-ted
dakshvar22 Jul 1, 2021
97c63c2
trained_intent_ted_policy_moodbot_path -> trained_intent_ted_policy_path
alwx Jul 1, 2021
8e4578e
ensure docstrings are correctly formatted
dakshvar22 Jul 1, 2021
a42f419
Rename code occurrences of `IntentTEDPolicy` to `UnexpecTEDIntentPoli…
dakshvar22 Jul 1, 2021
e78cc80
Review updates & fixes
alwx Jul 1, 2021
bc88676
Updated yaml files
alwx Jul 1, 2021
575d87f
rename extra files and their reference
dakshvar22 Jul 1, 2021
7435812
Merge branch 'main' into intent-ted
dakshvar22 Jul 1, 2021
76b6782
lots of variable renames
dakshvar22 Jul 2, 2021
6d6050c
reduce epochs in memory leak test.
dakshvar22 Jul 2, 2021
1979521
address Sam's comments
dakshvar22 Jul 2, 2021
fb33168
Merge branch 'main' into intent-ted
dakshvar22 Jul 2, 2021
8db9030
IntentTEDPolicy: Sort rasa test output by severity (#8969)
dakshvar22 Jul 2, 2021
3f2184e
memory leak tests epochs to 300 and memory to 1200
dakshvar22 Jul 2, 2021
6d8a35b
print out ignore intents list as well
dakshvar22 Jul 2, 2021
3071c56
alternative of tf.fill
dakshvar22 Jul 2, 2021
76f7909
typo
dakshvar22 Jul 2, 2021
67fbe98
show intent labels instead of intent index
dakshvar22 Jul 2, 2021
2fd7bee
Merge branch 'main' into intent-ted
dakshvar22 Jul 2, 2021
d6e8b14
Merge branch 'main' into intent-ted
dakshvar22 Jul 5, 2021
043f9c6
remove changelogs as they will go in docs PR
dakshvar22 Jul 5, 2021
61d8a5e
address Sam's comments on layer testing
dakshvar22 Jul 5, 2021
7c045bb
find_story_conflicts update
alwx Jul 5, 2021
4145b74
Merge branch 'intent-ted' of github.com:RasaHQ/rasa into intent-ted
alwx Jul 5, 2021
20d32b6
run black on non formatted commit
dakshvar22 Jul 5, 2021
1b94d74
UnexpecTEDIntentPolicy: Address review comments (#9016)
dakshvar22 Jul 5, 2021
4074105
update for interactive
alwx Jul 5, 2021
1cb9f80
Merge branch 'intent-ted' of github.com:RasaHQ/rasa into intent-ted
alwx Jul 5, 2021
9b7e4ba
Moved import
alwx Jul 5, 2021
496872f
Merge branch 'main' into intent-ted
dakshvar22 Jul 6, 2021
c785d03
address review comments
dakshvar22 Jul 7, 2021
197bbb2
fix mypy issues
dakshvar22 Jul 7, 2021
658f370
Final Review of IntentMaxHistoryTrackerFeaturizer (#9005)
Jul 7, 2021
ef078a7
remove empty pipeline
dakshvar22 Jul 7, 2021
72ec268
Merge branch 'intent-ted' of github.com:RasaHQ/rasa into intent-ted
dakshvar22 Jul 7, 2021
279f02d
Set `epochs` to `1`
alwx Jul 7, 2021
b000364
rename IntentTEDPolicy
dakshvar22 Jul 7, 2021
a17730c
merge base
dakshvar22 Jul 7, 2021
0157880
don't rely on non-deterministic policy agents
dakshvar22 Jul 7, 2021
2dec365
Updated spec
alwx Jul 7, 2021
77f54bc
refactor another test
dakshvar22 Jul 7, 2021
a578bb0
Updated `rasa interactive` and test for it
alwx Jul 7, 2021
4203ad0
Merge pull request #9063 from RasaHQ/ited_test_refactor
wochinge Jul 7, 2021
9eb0692
Rolling back the `_predict_till_next_listen` change.
alwx Jul 8, 2021
4413b9b
Fix interactive learning (#9075)
dakshvar22 Jul 8, 2021
d480c76
UnexpecTEDIntentPolicy: Deduplicate multiple data points with same in…
dakshvar22 Jul 9, 2021
4b6b983
UnexpecTEDIntentPolicy: Docs (#8908)
dakshvar22 Jul 9, 2021
21385ff
Update docs/docs/migration-guide.mdx
dakshvar22 Jul 12, 2021
b54a4be
Merge branch 'main' into intent-ted
dakshvar22 Jul 12, 2021
7b76242
Update changelog/8913.feature.md
dakshvar22 Jul 12, 2021
2017371
Apply suggestions from code review
dakshvar22 Jul 12, 2021
070b3e4
Merge branch 'main' into intent-ted
HotThoughts Jul 12, 2021
d62ccf9
add custom action to domain
dakshvar22 Jul 12, 2021
60d5b32
`UnexpecTEDIntentPolicy` predictions fix (#9079)
alwx Jul 12, 2021
12db8cf
fix type for ted policy
dakshvar22 Jul 12, 2021
8f918a0
Merge branch 'intent-ted' of github.com:RasaHQ/rasa into intent-ted
dakshvar22 Jul 12, 2021
da54c27
fix
dakshvar22 Jul 12, 2021
1fb233d
fix test
dakshvar22 Jul 12, 2021
2e86483
Merge branch 'main' into intent-ted
dakshvar22 Jul 12, 2021
c554cfb
remove non used exception type
dakshvar22 Jul 12, 2021
7d26a0a
Merge branch 'intent-ted' of github.com:RasaHQ/rasa into intent-ted
dakshvar22 Jul 12, 2021
4179836
change to warning
dakshvar22 Jul 12, 2021
4e89e81
fix code quality
dakshvar22 Jul 12, 2021
0dcb3c0
Merge branch 'main' into intent-ted
dakshvar22 Jul 12, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions changelog/8913.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Introduces a new policy called [`UnexpecTEDIntentPolicy`](./policies.mdx#unexpected-intent-policy).

`UnexpecTEDIntentPolicy` helps you [review conversations](./conversation-driven-development.mdx#review)
and also allows your bot to react to unexpected user turns in conversations.
It is an auxiliary policy that should only be used in conjunction with
at least one other policy, as the only action that it can trigger
is the special and newly introduced
[`action_unlikely_intent`](./default-actions.mdx#action_unlikely_intent) action.

The auto-configuration will include `UnexpecTEDIntentPolicy` in your
configuration automatically, but you can also include it yourself
in the `policies` section of the configuration:

```
policies:
- name: UnexpecTEDIntentPolicy
epochs: 200
max_history: 5
```

As part of the feature, it also introduces:

- [`IntentMaxHistoryTrackerFeaturizer`](./policies.mdx#3-intent-max-history)
to featurize the trackers for `UnexpecTEDIntentPolicy`.
- `MultiLabelDotProductLoss` to support `UnexpecTEDIntentPolicy`'s multi-label training objective.
- A new default action called [`action_unlikely_intent`](./default-actions.mdx#action_unlikely_intent).


`rasa test` command has also been adapted to `UnexpecTEDIntentPolicy`:

- If a test story contains `action_unlikely_intent` and the policy ensemble does not trigger it, this leads to
a test error (wrongly predicted action) and the corresponding story will be logged in `failed_test_stories.yml`.
- If the story does not contain `action_unlikely_intent` and Rasa Open Source does predict it then
the prediction of `action_unlikely_intent` will be ignored for the evaluation (and hence not lead
to a prediction error) but the story will be logged in a file called `stories_with_warnings.yml`.


The `rasa data validate` command will warn if `action_unlikely_intent` is
included in the training stories. Accordingly, `YAMLStoryWriter` and `MarkdownStoryWriter` have been updated to not dump `action_unlikely_intent` when writing stories to a file.

:::caution
The introduction of a new default action **breaks backward compatibility of previously trained models**.
It is not possible to load models trained with previous versions of Rasa Open Source. Please re-train
your assistant before trying to use this version.

:::
3 changes: 3 additions & 0 deletions data/test_config/config_empty_en_after_dumping.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ policies:
# # See https://rasa.com/docs/rasa/policies for more information.
# - name: MemoizationPolicy
# - name: RulePolicy
# - name: UnexpecTEDIntentPolicy
# max_history: 5
# epochs: 100
# - name: TEDPolicy
# max_history: 5
# epochs: 100
Expand Down
3 changes: 3 additions & 0 deletions data/test_config/config_empty_en_after_dumping_core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ policies:
# # See https://rasa.com/docs/rasa/policies for more information.
# - name: MemoizationPolicy
# - name: RulePolicy
# - name: UnexpecTEDIntentPolicy
# max_history: 5
# epochs: 100
# - name: TEDPolicy
# max_history: 5
# epochs: 100
Expand Down
3 changes: 3 additions & 0 deletions data/test_config/config_empty_fr_after_dumping.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ policies:
# # See https://rasa.com/docs/rasa/policies for more information.
# - name: MemoizationPolicy
# - name: RulePolicy
# - name: UnexpecTEDIntentPolicy
# max_history: 5
# epochs: 100
# - name: TEDPolicy
# max_history: 5
# epochs: 100
Expand Down
3 changes: 3 additions & 0 deletions data/test_config/config_with_comment_between_suggestions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ policies:
# # If you'd like to customize them, uncomment and adjust the policies.
# # See https://rasa.com/docs/rasa/policies for more information.
# - name: MemoizationPolicy
# - name: UnexpecTEDIntentPolicy
# max_history: 5
# epochs: 100
# - name: TEDPolicy
# max_history: 5
# epochs: 100
Expand Down
3 changes: 3 additions & 0 deletions data/test_config/config_with_comments_after_dumping.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ policies: # even here
# # See https://rasa.com/docs/rasa/policies for more information.
# - name: MemoizationPolicy
# - name: RulePolicy
# - name: UnexpecTEDIntentPolicy
# max_history: 5
# epochs: 100
# - name: TEDPolicy
# max_history: 5
# epochs: 100
Expand Down
14 changes: 14 additions & 0 deletions data/test_moodbot/unexpected_intent_policy_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
language: en

pipeline:

policies:
- name: MemoizationPolicy
- name: UnexpecTEDIntentPolicy
max_history: 5
epochs: 1
- name: TEDPolicy
max_history: 5
epochs: 1
constrain_similarities: true
- name: RulePolicy
12 changes: 12 additions & 0 deletions data/test_yaml_stories/stories_unexpected_intent_unlearnable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: "2.0"
stories:
- story: "story 1"
steps:
- intent: greet
- action: action_unlikely_intent

- story: "story 2"
steps:
- intent: greet
- action: utter_greet
- action: action_unlikely_intent
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: "2.0"
stories:
- story: path 1
steps:
- user: |
hello there!
intent: greet
- action: utter_greet
- user: |
amazing
intent: mood_great
- action: utter_happy

- story: path 2
steps:
- user: |
hello there!
intent: greet
- action: utter_greet
- user: |
very sad
intent: mood_unhappy
- action: utter_cheer_up
- action: utter_did_that_help
- user: |
yes
intent: affirm
- action: utter_happy
14 changes: 14 additions & 0 deletions docs/docs/command-line-interface.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,20 @@ rasa interactive

This will first train a model and then start an interactive shell session.
You can then correct your assistants predictions as you talk to it.
If [`UnexpecTEDIntentPolicy`](./policies.mdx#unexpected-intent-policy) is
included in the pipeline, [`action_unlikely_intent`](./default-actions.mdx#action_unlikely_intent)
can be triggered at any conversation turn. Subsequently, the following message will be displayed:

```
The bot wants to run 'action_unlikely_intent' to indicate that the last user message was unexpected
at this point in the conversation. Check out UnexpecTEDIntentPolicy docs to learn more.
```

As the message states, this is an indication that you have explored a conversation path
which is unexpected according to the current set of training stories and hence adding this
path to training stories is recommended. Like other bot actions, you can choose to confirm
or deny running this action.


If you provide a trained model using the `--model` argument, training is skipped
and that model will be loaded instead.
Expand Down
17 changes: 17 additions & 0 deletions docs/docs/conversation-driven-development.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,23 @@ Your test users had at least some instruction about what the bot was intended to

* Look at conversations where an “out_of_scope” intent or fallback behavior occurred. These could indicate a potential new skill, or just a misclassified user utterance.
* Look for user frustration, such as requests for transfer to a human.
* If the assistant was trained with [`UnexpecTEDIntentPolicy`](./policies.mdx#unexpected-intent-policy) included in the pipeline,
you can look for conversations where `action_unlikely_intent` is predicted at any conversation turn.
An `action_unlikely_intent` is predicted when the last intent expressed by the user is
unexpected in the current conversation context. You can also filter out such conversations by
running a [standalone script](https://gist.github.com/alwx/b426b7b573ff963c85c65ea6466528d7) which does the following:

- Fetch real conversations from a tracker store.
- Run `rasa test` on the fetched conversations and filter conversations containing `action_unlikely_intent`
in a separate warnings file. You can read more on [how to interpret these warnings](./testing-your-assistant.mdx#interpreting-the-generated-warnings).

Reviewing this subset of conversations can help you understand if real users have taken a
conversation path which is not present in the training data and hence "surprising"
for machine learning policies like `TEDPolicy`. Adding these conversation paths (with potential
corrections if `TEDPolicy` subsequently failed) as training stories will result in more robust action prediction
by policies such as `TEDPolicy`. Users are encouraged to [adjust the `tolerance` parameter of
`UnexpecTEDIntentPolicy`](./policies.mdx#tuning-the-tolerance-parameter) to control how
"surprising" a conversation should be to be included in the warnings file.

### Annotate

Expand Down
50 changes: 50 additions & 0 deletions docs/docs/default-actions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,53 @@ Overriding the default action for forms should **only** be used during the proce
migrating from Rasa Open Source 1 to 2. In this case you can override the default
action to instruct Rasa Open Source to use the deprecated `FormAction` which is part of
the Rasa SDK.

## action_unlikely_intent

Rasa Open Source triggers `action_unlikely_intent` via [`UnexpecTEDIntentPolicy`](./policies.mdx#unexpected-intent-policy).
You can control how often this action is predicted by tuning the [`tolerance`](./policies.mdx#unexpected-intent-policy)
parameter of `UnexpecTEDIntentPolicy`.

### Customization

You can customize your assistant's behaviour to configure what should happen once `action_unlikely_intent`
is triggered. For example, as a follow up you can trigger a hand-off to a human agent with a rule:

```yaml
- rule: trigger human handoff with action_unlikely_intent
steps:
- action: action_unlikely_intent
- action: ask_human_handoff
- intent: affirm
- action: trigger_human_handoff
```

Alternatively, you can also override it's behaviour as a [`custom action`](./custom-actions.mdx) by
adding `action_unlikely_intent` to the list of actions in the domain and implementing the custom behaviour:

```python
class ActionUnlikelyIntent(Action):

def name(self) -> Text:
return "action_unlikely_intent"

async def run(
self, dispatcher, tracker: Tracker, domain: Dict[Text, Any],
) -> List[Dict[Text, Any]]:

# Implement custom logic here
return []
```

:::note
Since `action_unlikely_intent` can be triggered at any conversation step during inference,
all policies which are trained on only story data, for example - `TEDPolicy`, `UnexpecTEDIntentPolicy`,
`MemoizationPolicy` ignore its presence in the tracker when making a prediction. However, `RulePolicy`
takes its presence into account so that [conversation behaviour is customizable](./default-actions.mdx#customization-1).

:::

:::note
`action_unlikely_intent` cannot be included in the training stories. It can **only** be added to rules.

:::
27 changes: 27 additions & 0 deletions docs/docs/migration-guide.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,33 @@ how you can migrate from one version to another.

## Rasa 2.7 to 2.8

:::caution
This release **breaks backward compatibility of machine learning models**.
It is not possible to load models trained with previous versions of Rasa Open Source. Please re-train
your assistant before using this version.

:::

### Deprecations

#### Tracker Featurizers

`training_states_actions_and_entities` method of `TrackerFeaturizer`, `FullDialogueTrackerFeaturizer` and
`MaxHistoryTrackerFeaturizer` classes is deprecated and will be removed in Rasa Open Source 3.0 .
If you had a custom tracker featurizer which relied on this method from any of the above classes, please use
`training_states_labels_and_entities` instead.

`training_states_actions` method of `TrackerFeaturizer`, `FullDialogueTrackerFeaturizer` and
`MaxHistoryTrackerFeaturizer` classes is deprecated and will be removed in Rasa Open Source 3.0 .
If you had a custom tracker featurizer which relied on this method from any of the above classes, please use
`training_states_labels` instead.

#### State Featurizer

`encode_all_actions` method of `SingleStateFeaturizer` class is deprecated and will be removed in Rasa Open Source 3.0 .
It is recommended to use the method `encode_all_labels` instead.


### Incremental Training

Users don't need to specify an additional buffer size for sparse featurizers anymore during incremental training.
Expand Down
Loading