-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8913 from RasaHQ/intent-ted
`UnexpecTEDIntentPolicy` final merge
- Loading branch information
Showing
75 changed files
with
8,919 additions
and
755 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|
||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
12
data/test_yaml_stories/stories_unexpected_intent_unlearnable.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
28 changes: 28 additions & 0 deletions
28
data/test_yaml_stories/test_multiple_action_unlikely_intent_warnings.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.