Skip to content

Commit

Permalink
introduce end-to-end processing into rasa (#7496)
Browse files Browse the repository at this point in the history
* fix a test

* action texts in importer added to action_text in domain

* a little end-to-end bot example

* implement hacky e2e prediction

* fix warnings

* fix user uttered featurization

* fix useruttered featurization

* 100 epochs

* fix writin bot action text to file

* store action text in wrong text

* add the comment to bot end-to-end utterance

* update printing e2e utterances

* fix single type input

* fix e2e prediction after action

* implement comparison between e2e policies

* reduce e2e confidence threshold

* fix rule policy

* fix non e2e prediction

* fix cleaning of working data

* fix in regex featurizer processing

* RasaModelData can handle 4D Tensors (#6833)

* handle 4d dense features

* padding for dense and sparse works

* update RasaModelData

* update RasaModelData tests

* update shape of sparse tensors

* update is_in_4d_format

* set eager back to False

* fix code quality issues

* formatting

* fix type issues

* refactoring

* update types

* formatting

* fix type issue

* subclass numpy array

* explicit specify number_of_dimensions

* clean up

* training is working again

* rename feature_dimension to units

* reset default eager values

* update comments

* refactoring

* fix type issue

* fix types

* review comments

* formatting

* Fix tests on e2e branch (#6984)

* fix tests in test_policies

* set use_text_for_featurization in example dialogues

* fix test for NLU training & test_rule_policy

* add missing import

* formatting

* fix more tests

* use intent for featurization by default

* fix test_processor

* fix test_trackers

* fix test_importer

* fix test_dialogues and test_policies

Co-authored-by: Vova Vv <[email protected]>

* Refactor creation of RasaModelData (#7010)

* fix tests in test_policies

* set use_text_for_featurization in example dialogues

* fix test for NLU training & test_rule_policy

* add missing import

* formatting

* fix more tests

* update doc strings

* refactor create_model_data in DIETClassifier

* create sub-methods

* make sure response selector trains

* reset default value of eager

* reset epoch of e2e example

* fix entity key

* fix tests, testing model is failing

* clean up

* fix import

* Fix issues in DIETClassifier

* remove zero features from DIETClassifier again

* add test

* remove whitespace in blank line

* clean up

* clean up model data utils

* fix type issue

* make sure only entity recognition works in diet

* Add tests for state and tracker featurizers (#7086)

* split test_featurizer.py into two files

* code style

* add test for prepare_from_domain

* add tracker featurizer tests

* add test

* fix imports in tests

* add more tests

* Add option "featurizers" to TEDPolicy (#7079)

* add FEATURIZERS to TEDPolicy parameters

* update tests

* fix import

* fix merging master

* Bring DIET into TED (#7131)

* add diet to ted

* reshape 4d tensors into 3d and back

* fix shapes in non eager mode

* make shape indices more general

* fix add_length

* add todo

* sentence features are now also 4D

* sequence length is 4D

* convert 4d to 3 during padding

* mask is 4d now

* bring mask in correct shape before transformer

* keep also the orginial dialogue length

* update doc strings

* use tf.scatter_nd to tranform 3d back to 4d

* move tensor transformation to _encode_features_per_attribute

* fix issues in _encode_features_per_attribute

* use correct dialogue length

* add comments

* clean up

* update constants

* Update rasa/utils/tensorflow/model_data.py

Co-authored-by: Vladimir Vlasov <[email protected]>

* review comment

* fix tests

* use correct attribute mask

* use 4d attribute mask

* set eager back to default

* fix test

* update _convert_to_original_shape

* add indices to model data

* fix tf.scatter_nd

* fix TED train and predict

* remove not needed constants

* fix failing tests

* update docstrings

* fix docstring issues

* review comments

* fix shape mismatches

Co-authored-by: Vova Vv <[email protected]>
Co-authored-by: Vladimir Vlasov <[email protected]>

* fix entities features

* resolve merge conflict in yaml_story_writer

* use story string when writing user uttered event

* create empty fakes (#7198)

* substitute fake features with empty arrays and use attribute mask to rebuild input

* remove unused import, remove comment

* refactor, add comments, add types

* support empty features

* add prepare_for_predict to precalculate self.all_labels_embed

* return to default config

* add error

* add prepare_for_predict to diet

* fix test_model_data_utils

* fix test gen_batch

* Update rasa/core/policies/ted_policy.py

Co-authored-by: Tanja <[email protected]>

* rename to filter fakes and create dial len beforehand

* add dtype=

* fix comment

* add comments about fake features

Co-authored-by: Tanja <[email protected]>

* Monster ted (#7262)

* add diet to ted

* reshape 4d tensors into 3d and back

* fix shapes in non eager mode

* make shape indices more general

* fix add_length

* add todo

* sentence features are now also 4D

* sequence length is 4D

* convert 4d to 3 during padding

* mask is 4d now

* bring mask in correct shape before transformer

* keep also the orginial dialogue length

* update doc strings

* use tf.scatter_nd to tranform 3d back to 4d

* move tensor transformation to _encode_features_per_attribute

* fix issues in _encode_features_per_attribute

* use correct dialogue length

* add comments

* clean up

* update constants

* review comment

* keep entity dict

* create tag_ids for TED

* clean up after merge

* add batch_loss_entities (not working)

* concatenate text and dialogue transformer output

* get last dialogue before CRF

* add predicting entities

* clean up

* differentiate between max history tracker featurizer used or not

* add todo

* add comments

* use correct tag id mapping

* check if text exists

* fix frozenset issues

* ignore actual entity value in MemoizationPolicy

* fix import

* fix some tests

* update after merge

* use python if instead of tf.cond

* we need to return a tensor in tf.cond instead of None

* create entity tags for all texts

* update batch loss entities (not yet working)

* input to entity loss

* update entity prediction

* fix randomness and shapes

* fix ffnn encoding layer name

* add todo

* Update rasa/core/policies/ted_policy.py

Co-authored-by: Tanja <[email protected]>

* Update rasa/core/featurizers/single_state_featurizer.py

Co-authored-by: Tanja <[email protected]>

* rename to entity_tag_id_mapping

* add comment to last dial mask

* add comments to tf.cond

* add docstrings

* refactor number of dims check

* rename zero features to fake features

* pre compute dialogue_indices

* create helper methods

* calculate number of units for text_transformer_output

* add todo

* fix tests

* use indices constant

Co-authored-by: Tanja Bergmann <[email protected]>

* refactor e2e ted choice (#7285)

* refactor e2e ted choice

* add comment why prediction batch of size 2

* fix test policies

* fix test ensemble

* fix e2e prediction

* utter end-to-end bot responses

* add docstring

* deprecate unused method

* add changelog for deprecation

* log end-to-end action with text

* pass flag instead of determining end-to-end utterance on the fly.

* Revert "pass flag instead of determining end-to-end utterance on the fly."

This reverts commit 868a715.

* remove `events_for_prediction`

* remove unused import

* fix e2e training edge cases

* use special action for end-to-end responses

* rename to `from_action_name_or_text`

* clarify in comment

* rename to `ActionEndToEndResponse`

* fix form tests

* add docstrings

* remove useless test

* remove user text if intent is present

* remove story read check for user and intent message

* ignore entities in text if intent is present

* Update rasa/shared/nlu/training_data/message.py

Co-authored-by: Alexander Khizov <[email protected]>

* Update rasa/shared/nlu/training_data/training_data.py

Co-authored-by: Alexander Khizov <[email protected]>

* PR comments

* black

* rename var

* remove unused `_action_event_for_prediction`

* improve phrasing / typing / code structure

* add test to ensure action text with `utter_` as start works

* rename `Domain.action_names` to `Domain.action_names_or_texts`

* fix docstrings

* remove unused imports

* test and fix writing YAML stories

* move `MarkdownStoryWriter` tests to separate file

* use `tmp_path`

* consider end-to-end stories correctly

* fix story reading for retrieval intents

* fix missing renames for `prepare_from_domain`

* fixup for last merge in from `master`

* dump story not as test story

* fix docstring errors

* remove unused method (not used in Rasa X either)

* raise if printing end-to-end things in Markdown

* add todos

* fix error with entity formatting

* move to `rasa.shared`

* remove CoreDataImporter

* change fingerprinting to use yaml writer

* fix tests failing due to new default story file

* adapt remaining parts to `as_story_string` failing if end-to-end event

* remove `as_story_string` from story validator

* don't add e2e entities as features (#7435)

* don't add e2e entities as features

* remove entities as input features for text

* simply don't add entities for e2e user utterances

* remove non existent import

* fix test

* add comment

* only train NLU model if data or end to end

* fix filter units

* fix import

* read and write in test

* fix displaying of end-to-end actions in rasa interactive

* skip warning for end-to-end user messages in training data

* add docs link

* remove trailing whitespace

* return `NotImplemented` if other class

* remove `md_` as it's not related to md

* add docstrings to entire module

* add more docstrings

* increase timeout due to failing windows tests

* improve string representation of `UserUttered`

* fix hashing of `UserUttered`

* Add entities to UserUttered event if they are predicted via a policy (#7443)

* remove unused import

* remove unused import

* fix problematic docstrings

* specify yaml content-type

* fix docstrings in featurearray

* fix docstrings

* Update rasa/core/policies/rule_policy.py

Co-authored-by: Tobias Wochinger <[email protected]>

* Update rasa/core/policies/rule_policy.py

Co-authored-by: Tobias Wochinger <[email protected]>

* Update rasa/core/policies/rule_policy.py

Co-authored-by: Tobias Wochinger <[email protected]>

* Update rasa/utils/tensorflow/model_data_utils.py

Co-authored-by: Daksh Varshneya <[email protected]>

* Update rasa/utils/tensorflow/model_data_utils.py

Co-authored-by: Daksh Varshneya <[email protected]>

* add tests for define featurization in ensemble

* update docstrings

* add tests for e2e rules

* Update rasa/core/policies/ted_policy.py

Co-authored-by: Daksh Varshneya <[email protected]>

* Update rasa/core/featurizers/tracker_featurizers.py

Co-authored-by: Daksh Varshneya <[email protected]>

* Update rasa/core/featurizers/tracker_featurizers.py

Co-authored-by: Daksh Varshneya <[email protected]>

* Update rasa/core/policies/sklearn_policy.py

Co-authored-by: Daksh Varshneya <[email protected]>

* Update rasa/core/policies/ted_policy.py

Co-authored-by: Daksh Varshneya <[email protected]>

* Update rasa/core/policies/ted_policy.py

Co-authored-by: Daksh Varshneya <[email protected]>

* Add experimental warning to e2e training (#7524)

* Add experimental warning to e2e training

* re-order imports

* update user messages in apply_to of define events (#7503)

* update user messages in apply_to of define events

* fix e2e entity prediction in ted

* rename method

* fix entity featurization for text input

* fix entity prediction in ted

* remove safeguard

* fix actionexecuted string

* fix comments

* keep __str__ inconsistent for actionexecuted

* increase number of epochs for ted

* add Define events in applied events

* clean states during prediction

* review comments

* add _prediction_with_unhappy_path

* review comments

* remove unneeded variable

* review comments in DIET

* renamed empty_features to absent_features

* remove unused imports

* update docstrings

* refactor entity data creation into a separate method

* Update rasa/shared/core/domain.py

Co-authored-by: Joe Juzl <[email protected]>

* Update rasa/shared/core/domain.py

Co-authored-by: Joe Juzl <[email protected]>

* Update rasa/shared/core/domain.py

Co-authored-by: Joe Juzl <[email protected]>

* shorten the long comment

* create separate constant for prediction features

* Update rasa/core/policies/ted_policy.py

Co-authored-by: Daksh Varshneya <[email protected]>

* add comment why we add 1 to sequence features

* rephrase last dial comment

* rephrase comments

* Add description to RasaModelData.

* explain choice of warning

* fix e2e train tests (#7540)

* remove prints

* use precise len in tests

* remove blank line

* type annotations

* fix dry run test

* fix test_surface_attributes

* fix typo in test

* Use tokens for story structure validation (#7436)

* Add tests

* Draft first implementation

* Fix random sorting before hash

* Update doc strings

* Add doc strings

* Fix minor issues

* Add config file loading

* Fix some docstrings

* Make test stories part of the test

* Update tests

* Fix minor issues

* Fix config param argument

* Add TrainingType to tests to avoid config change

* Delete hash again

* Update docs

* Update rasa/core/training/story_conflict.py

Co-authored-by: Tobias Wochinger <[email protected]>

* Update rasa/shared/nlu/training_data/features.py

Co-authored-by: Tobias Wochinger <[email protected]>

* Fix minor issues

Co-authored-by: Tobias Wochinger <[email protected]>

* move constant to red

* do not enumerate

* fix domain test conflicts

* add example showing e2e functionality (#7535)

* add basic files

* add NLU examples

* increase epochs and remove memoization policy

* Update examples/e2ebot/config.yml

Co-authored-by: Vladimir Vlasov <[email protected]>

* Update examples/e2ebot/domain.yml

Co-authored-by: Vladimir Vlasov <[email protected]>

* Update examples/e2ebot/data/stories.yml

Co-authored-by: Vladimir Vlasov <[email protected]>

* added a story with a bot utterance instead of an action label

* remove bot utterance again

Co-authored-by: Vladimir Vlasov <[email protected]>

* code quality check

* Update tests/test_server.py

Co-authored-by: Tobias Wochinger <[email protected]>

* Update rasa/shared/core/training_data/story_reader/yaml_story_reader.py

Co-authored-by: Alexander Khizov <[email protected]>

* add types

* Update tests/test_train.py

Co-authored-by: Tobias Wochinger <[email protected]>

* fix tests

* add types

* add types

* Update tests/test_train.py

Co-authored-by: Tobias Wochinger <[email protected]>

* add types

* Update tests/test_train.py

Co-authored-by: Tobias Wochinger <[email protected]>

* Update rasa/shared/nlu/training_data/features.py

Co-authored-by: Alexander Khizov <[email protected]>

* Update rasa/shared/nlu/training_data/message.py

Co-authored-by: Alexander Khizov <[email protected]>

* Update rasa/shared/nlu/training_data/message.py

Co-authored-by: Alexander Khizov <[email protected]>

* Update rasa/shared/nlu/training_data/message.py

Co-authored-by: Alexander Khizov <[email protected]>

* Update rasa/shared/nlu/training_data/training_data.py

Co-authored-by: Alexander Khizov <[email protected]>

* Update rasa/shared/nlu/training_data/training_data.py

Co-authored-by: Alexander Khizov <[email protected]>

* Update rasa/shared/nlu/training_data/training_data.py

Co-authored-by: Alexander Khizov <[email protected]>

* Update rasa/shared/nlu/training_data/message.py

Co-authored-by: Alexander Khizov <[email protected]>

* Update rasa/shared/nlu/training_data/message.py

Co-authored-by: Alexander Khizov <[email protected]>

* Update rasa/shared/nlu/training_data/message.py

Co-authored-by: Alexander Khizov <[email protected]>

* Update rasa/shared/nlu/training_data/message.py

Co-authored-by: Alexander Khizov <[email protected]>

* Update rasa/shared/nlu/training_data/message.py

Co-authored-by: Alexander Khizov <[email protected]>

* Update rasa/shared/nlu/training_data/message.py

Co-authored-by: Alexander Khizov <[email protected]>

* Update rasa/shared/nlu/training_data/training_data.py

Co-authored-by: Alexander Khizov <[email protected]>

* remove unused parameter

* assert return value

* use proper objects

* use dedent

* PR review comments

* use function scoped fixture

* create new domain to avoid interacting with session one

* use safer default for __eq__

* remove not required ignore comment

* fix docstrings

* mark `Event` class as abtract

* use correct docstring

* rename to `AlwaysEqualEventMixin`

* mark methods as abstract

* add docstring

* move comment out of docstring

* don't persist changed entities + autofill slots for policy entities (#7553)

* don't persist changed entities

* make tracker state return combined `UserUttered` event

* autofill slots for policy entities

* made if more explicit

* use constants

* rename `DefinePrevUserUtteredEntities` to `EntitiesAdded`

* rename and make `DefinePrevUserUttered` more general

* fix docstrings

* add e2e docs (#7512)

* change TED default params

* Update docs/docs/training-data-format.mdx

Co-authored-by: Tanja <[email protected]>

* Update docs/docs/training-data-format.mdx

Co-authored-by: Tanja <[email protected]>

* Update docs/docs/training-data-format.mdx

Co-authored-by: Tanja <[email protected]>

* update docs phrases

* break long line

* add changelog

* add deprecation config for dense dimension

* fix new config parameters

* add comments for config params

* fix docstrings

* update comments

* update migration guide with new ted parameters

* update changelog

* a lot of bug fixes regarding updating config

* fix updating config dict again

* Update docs/docs/training-data-format.mdx

Co-authored-by: Tanja <[email protected]>

* remove new-old config param descriptions

* remove else

* add docstring

* update changelog

* Update docs/docs/stories.mdx

Co-authored-by: Ella Rohm-Ensing <[email protected]>

* Update docs/docs/stories.mdx

Co-authored-by: Ella Rohm-Ensing <[email protected]>

* Update docs/docs/training-data-format.mdx

Co-authored-by: Ella Rohm-Ensing <[email protected]>

* Update docs/docs/training-data-format.mdx

Co-authored-by: Ella Rohm-Ensing <[email protected]>

* update stories.mdx

* update training-data-format.mdx

* substitute we with you

* don't include e2e in the stories example

* make list

* remove required

* add migration guide for domain changes

* mention  explicitly

* fix import

* add link to ted policy

* add docstrings

* fix updating config

* move e2e into separate paragraph

* add blank line back

* add increased train time note

* Update docs/docs/migration-guide.mdx

Co-authored-by: Ben Quachtran <[email protected]>

* Update docs/docs/migration-guide.mdx

Co-authored-by: Ben Quachtran <[email protected]>

* Update docs/docs/training-data-format.mdx

Co-authored-by: Akela Drissner-Schmid <[email protected]>

* remove the link to the training data format page

* remove the line'

* remove the line

* break long line

* Update changelog/7496.improvement.md

Co-authored-by: Tobias Wochinger <[email protected]>

* Update docs/docs/stories.mdx

Co-authored-by: Tobias Wochinger <[email protected]>

* Update docs/docs/stories.mdx

Co-authored-by: Tobias Wochinger <[email protected]>

* Update docs/docs/stories.mdx

Co-authored-by: Tobias Wochinger <[email protected]>

* Update docs/docs/training-data-format.mdx

Co-authored-by: Tobias Wochinger <[email protected]>

* Update docs/docs/training-data-format.mdx

Co-authored-by: Tobias Wochinger <[email protected]>

* Update docs/docs/migration-guide.mdx

Co-authored-by: Sam Sucik <[email protected]>

* Update docs/docs/stories.mdx

Co-authored-by: Tobias Wochinger <[email protected]>

* Update docs/docs/stories.mdx

Co-authored-by: Tobias Wochinger <[email protected]>

* Update docs/docs/policies.mdx

Co-authored-by: Sam Sucik <[email protected]>

* Update docs/docs/policies.mdx

Co-authored-by: Sam Sucik <[email protected]>

* Update docs/docs/policies.mdx

Co-authored-by: Sam Sucik <[email protected]>

* Update docs/docs/migration-guide.mdx

Co-authored-by: Sam Sucik <[email protected]>

* Update docs/docs/stories.mdx

Co-authored-by: Tobias Wochinger <[email protected]>

* Update docs/docs/stories.mdx

Co-authored-by: Tobias Wochinger <[email protected]>

* Update docs/docs/stories.mdx

Co-authored-by: Tobias Wochinger <[email protected]>

* Update docs/docs/policies.mdx

Co-authored-by: Sam Sucik <[email protected]>

* Update docs/docs/policies.mdx

Co-authored-by: Sam Sucik <[email protected]>

* Update docs/docs/policies.mdx

Co-authored-by: Sam Sucik <[email protected]>

* Update docs/docs/policies.mdx

Co-authored-by: Sam Sucik <[email protected]>

* Update docs/docs/policies.mdx

Co-authored-by: Sam Sucik <[email protected]>

* Update docs/docs/stories.mdx

Co-authored-by: Sam Sucik <[email protected]>

* Update docs/docs/stories.mdx

Co-authored-by: Sam Sucik <[email protected]>

* Update docs/docs/stories.mdx

Co-authored-by: Sam Sucik <[email protected]>

* Update docs/docs/stories.mdx

Co-authored-by: Sam Sucik <[email protected]>

* Update docs/docs/stories.mdx

Co-authored-by: Sam Sucik <[email protected]>

* Update docs/docs/training-data-format.mdx

Co-authored-by: Sam Sucik <[email protected]>

* Update docs/docs/training-data-format.mdx

Co-authored-by: Sam Sucik <[email protected]>

* Update docs/docs/training-data-format.mdx

Co-authored-by: Sam Sucik <[email protected]>

* Update docs/docs/training-data-format.mdx

Co-authored-by: Sam Sucik <[email protected]>

* Update docs/docs/training-data-format.mdx

Co-authored-by: Sam Sucik <[email protected]>

* Update docs/docs/training-data-format.mdx

Co-authored-by: Sam Sucik <[email protected]>

* Update docs/docs/training-data-format.mdx

Co-authored-by: Sam Sucik <[email protected]>

* Update docs/docs/migration-guide.mdx

Co-authored-by: Sam Sucik <[email protected]>

* add example to migration guide

* remove notes

* rename changelog to feature

* Update docs/docs/stories.mdx

Co-authored-by: Tobias Wochinger <[email protected]>

* expand explanation

* update examples in docs to have the same topic as e2ebot

* copy ted description from diet

* update parameter description

* fix overriding default config

* Update docs/docs/training-data-format.mdx

Co-authored-by: Tobias Wochinger <[email protected]>

* Update docs/docs/training-data-format.mdx

Co-authored-by: Tobias Wochinger <[email protected]>

* add actions to doc stories

* update story

* more details in error message

Co-authored-by: Tanja <[email protected]>
Co-authored-by: Ella Rohm-Ensing <[email protected]>
Co-authored-by: Tobias Wochinger <[email protected]>
Co-authored-by: Ben Quachtran <[email protected]>
Co-authored-by: Akela Drissner-Schmid <[email protected]>
Co-authored-by: Sam Sucik <[email protected]>
Co-authored-by: m-vdb <[email protected]>

* correctly use mixin class + filter out abstract classes

* add clarification comment

* make entities a list

* remove space

* fix assigning variables

* fix assigning variables

* Update docs/docs/components.mdx

Co-authored-by: Tobias Wochinger <[email protected]>

* add empty line add end

* fix breaking hash function (list is not hashable)

Co-authored-by: Zhenya Razumovskaia <[email protected]>
Co-authored-by: Tanja Bergmann <[email protected]>
Co-authored-by: Tobias Wochinger <[email protected]>
Co-authored-by: Joseph Juzl <[email protected]>
Co-authored-by: Alexander Khizov <[email protected]>
Co-authored-by: Daksh Varshneya <[email protected]>
Co-authored-by: Johannes E. M. Mosig <[email protected]>
Co-authored-by: Alan Nichol <[email protected]>
Co-authored-by: Roberto <[email protected]>
Co-authored-by: Ella Rohm-Ensing <[email protected]>
Co-authored-by: Ben Quachtran <[email protected]>
Co-authored-by: Akela Drissner-Schmid <[email protected]>
Co-authored-by: Sam Sucik <[email protected]>
Co-authored-by: m-vdb <[email protected]>
  • Loading branch information
15 people authored Dec 16, 2020
1 parent af973b5 commit 954e473
Show file tree
Hide file tree
Showing 115 changed files with 7,139 additions and 1,986 deletions.
5 changes: 5 additions & 0 deletions changelog/6410.removal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
`Domain.random_template_for` is deprecated and will be removed in Rasa Open Source
3.0.0. You can alternatively use the `TemplatedNaturalLanguageGenerator`.

`Domain.action_names` is deprecated and will be removed in Rasa Open Source
3.0.0. Please use `Domain.action_names_or_texts` instead.
4 changes: 4 additions & 0 deletions changelog/7436.improvement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Make `rasa data validate stories` work for end-to-end.

The `rasa data validate stories` function now considers the tokenized user text instead of the plain text that is part of a state.
This is closer to what Rasa Core actually uses to distinguish states and thus captures more story structure problems.
36 changes: 36 additions & 0 deletions changelog/7496.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Make [TED Policy](./policies.mdx#ted-policy) an end-to-end policy. Namely, make it possible to train TED on stories that contain
intent and entities or user text and bot actions or bot text.
If you don't have text in your stories, TED will behave the same way as before.
Add possibility to predict entities using TED.

Here's an example of a dialogue in the Rasa story format:

```rasa-yaml
stories:
- story: collect restaurant booking info # name of the story - just for debugging
steps:
- intent: greet # user message with no entities
- action: utter_ask_howcanhelp # action that the bot should execute
- intent: inform # user message with entities
entities:
- location: "rome"
- price: "cheap"
- bot: On it # actual text that bot can output
- action: utter_ask_cuisine
- user: I would like [spanish](cuisine). # actual text that user input
- action: utter_ask_num_people
```

Some model options for `TEDPolicy` got renamed.
Please update your configuration files using the following mapping:

| Old model option | New model option |
|-----------------------------|--------------------------------------------------------|
|transformer_size |dictionary “transformer_size” with keys |
| |“text”, “action_text”, “label_action_text”, “dialogue” |
|number_of_transformer_layers |dictionary “number_of_transformer_layers” with keys |
| |“text”, “action_text”, “label_action_text”, “dialogue” |
|dense_dimension |dictionary “dense_dimension” with keys |
| |“text”, “action_text”, “label_action_text”, “intent”, |
| |“action_name”, “label_action_name”, “entities”, “slots”,|
| |“active_loop” |
3 changes: 2 additions & 1 deletion data/test_dialogues/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
"text": "Hi my name is Peter"
},
"text": "Hi my name is Peter",
"timestamp": 1551953035.076376
"timestamp": 1551953035.076376,
"use_text_for_featurization": false
},
{
"py/object": "rasa.shared.core.events.SlotSet",
Expand Down
17 changes: 14 additions & 3 deletions data/test_dialogues/formbot.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
{
"py/object":"rasa.shared.core.events.ActionExecuted",
"action_name":"action_listen",
"action_text": null,
"confidence":null,
"policy":null,
"timestamp":1551884035.892855,
Expand Down Expand Up @@ -32,11 +33,13 @@
"text":"Hi I'm desperate to talk to you"
},
"text":"Hi I'm desperate to talk to you",
"timestamp":1551884050.259948
"timestamp":1551884050.259948,
"use_text_for_featurization": false
},
{
"py/object":"rasa.shared.core.events.ActionExecuted",
"action_name":"utter_greet",
"action_text": null,
"confidence":1.0,
"policy":"policy_2_MemoizationPolicy",
"timestamp":1551884060.466681,
Expand All @@ -55,6 +58,7 @@
{
"py/object":"rasa.shared.core.events.ActionExecuted",
"action_name":"action_listen",
"action_text": null,
"confidence":1.0,
"policy":"policy_2_MemoizationPolicy",
"timestamp":1551884061.9350882,
Expand Down Expand Up @@ -104,11 +108,13 @@
"text":"I'm looking for an indian restaurant...in Bombay"
},
"text":"I'm looking for an indian restaurant...in Bombay",
"timestamp":1551884090.9653602
"timestamp":1551884090.9653602,
"use_text_for_featurization": false
},
{
"py/object":"rasa.shared.core.events.ActionExecuted",
"action_name":"restaurant_form",
"action_text": null,
"confidence":1.0,
"policy":"policy_2_MemoizationPolicy",
"timestamp":1551884095.542748,
Expand All @@ -117,6 +123,7 @@
{
"py/object":"rasa.shared.core.events.ActionExecuted",
"action_name":"utter_slots_values",
"action_text": null,
"confidence":1.0,
"policy":"policy_2_MemoizationPolicy",
"timestamp":1551884097.570883,
Expand All @@ -135,6 +142,7 @@
{
"py/object":"rasa.shared.core.events.ActionExecuted",
"action_name":"action_listen",
"action_text": null,
"confidence":1.0,
"policy":"policy_2_MemoizationPolicy",
"timestamp":1551884098.8006358,
Expand Down Expand Up @@ -162,11 +170,13 @@
"text":"Let's just pretend everything went correctly"
},
"text":"Let's just pretend everything went correctly",
"timestamp":1551884208.092693
"timestamp":1551884208.092693,
"use_text_for_featurization": false
},
{
"py/object":"rasa.shared.core.events.ActionExecuted",
"action_name":"action_deactivate_loop",
"action_text": null,
"confidence":null,
"policy":null,
"timestamp":1551884214.951055,
Expand All @@ -186,6 +196,7 @@
{
"py/object":"rasa.shared.core.events.ActionExecuted",
"action_name":"action_listen",
"action_text": null,
"confidence":0.7680902069097734,
"policy":"policy_0_TEDPolicy",
"timestamp":1551884216.705635,
Expand Down
9 changes: 6 additions & 3 deletions data/test_dialogues/moodbot.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
"text":"Hi talk to me"
},
"text":"Hi talk to me",
"timestamp":1551883971.410778
"timestamp":1551883971.410778,
"use_text_for_featurization": false
},
{
"py/object":"rasa.shared.core.events.ActionExecuted",
Expand Down Expand Up @@ -146,7 +147,8 @@
"text":"Super sad"
},
"text":"Super sad",
"timestamp":1551883982.540276
"timestamp":1551883982.540276,
"use_text_for_featurization": false
},
{
"py/object":"rasa.shared.core.events.ActionExecuted",
Expand Down Expand Up @@ -243,7 +245,8 @@
"text":"No"
},
"text":"No",
"timestamp":1551883989.0720608
"timestamp":1551883989.0720608,
"use_text_for_featurization": false
},
{
"py/object":"rasa.shared.core.events.ActionExecuted",
Expand Down
5 changes: 5 additions & 0 deletions data/test_trackers/tracker_moodbot.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"timestamp": 1517821726.211031,
"event": "action",
"name": "action_listen",
"action_text": null,
"policy": null,
"confidence": null
},
Expand Down Expand Up @@ -75,13 +76,15 @@
"timestamp": 1517821726.200373,
"event": "action",
"name": "utter_greet",
"action_text": null,
"policy": null,
"confidence": null
},
{
"timestamp": 1517821726.211038,
"event": "action",
"name": "action_listen",
"action_text": null,
"policy": null,
"confidence": null
},
Expand Down Expand Up @@ -120,13 +123,15 @@
"timestamp": 1517821726.209908,
"event": "action",
"name": "utter_happy",
"action_text": null,
"policy": "policy_1_TEDPolicy",
"confidence": 0.8
},
{
"timestamp": 1517821726.211042,
"event": "action",
"name": "action_listen",
"action_text": null,
"policy": "policy_2_MemoizationPolicy",
"confidence": 1.0
}
Expand Down
30 changes: 30 additions & 0 deletions data/test_yaml_stories/stories_e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: "2.0"

stories:
- story: happy path (intent to action)
steps:
- intent: greet
- action: utter_greet
- intent: mood_great
- action: utter_happy

- story: sad path (text to text)
steps:
- user: "[Hello](bla)"
- bot: "Welcome to moodbot. How are you feeling today?"
- user: "Horrible"
- bot: "Oh no! Here is a kitten photo. Did it help?"
- user: "Yes"
- bot: "Perfect"

- story: sad path 2 (mixed)
steps:
- intent: greet
- action: utter_greet
- user: "I'm not happy"
- action: utter_cheer_up
- action: utter_did_that_help
- user: "Not at all"
- bot: "Goodbye!"


15 changes: 15 additions & 0 deletions data/test_yaml_stories/stories_hybrid_e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
stories:
- story: My hybrid End-to-End story
steps:
# Regular story with labels
- intent: simple
- action: utter_greet
# Actual messages are given instead of labels
- user: "I am looking for a [Kenyan](cuisine) restaurant"
- bot: "good for you"
# Regular labeled events
- intent: goodbye
- action: utter_goodbye
# Actual messages are given instead of labels
- user: One more thing
- bot: What?
8 changes: 8 additions & 0 deletions data/test_yaml_stories/stories_simple.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- story: simple_story
steps:
- intent: greet
- action: utter_greet
- intent: default
- action: utter_default
- intent: goodbye
- action: utter_goodbye
4 changes: 4 additions & 0 deletions docs/docs/command-line-interface.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,10 @@ rasa data validate stories
:::note
Running `rasa data validate` does **not** test if your [rules](./rules.mdx) are consistent with your stories.
However, during training, the `RulePolicy` checks for conflicts between rules and stories. Any such conflict will abort training.

Also, if you use end-to-end stories, then this might not capture all conflicts. Specifically, if two user inputs
result in different tokens yet exactly the same featurization, then conflicting actions after these inputs
may exist but will not be reported by the tool.
:::

To interrupt validation even for minor issues such as unused intents or responses, use the `--fail-on-warnings` flag.
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/components.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1485,7 +1485,7 @@ However, additional parameters exist that can be adapted.
+=================================+==================+==============================================================+
| hidden_layers_sizes | text: [] | Hidden layer sizes for layers before the embedding layers |
| | label: [] | for user messages and labels. The number of hidden layers is |
| | | equal to the length of the corresponding. |
| | | equal to the length of the corresponding list. |
+---------------------------------+------------------+--------------------------------------------------------------+
| share_hidden_layers | False | Whether to share the hidden layer weights between user |
| | | messages and labels. |
Expand Down Expand Up @@ -1519,8 +1519,8 @@ However, additional parameters exist that can be adapted.
+---------------------------------+------------------+--------------------------------------------------------------+
| embedding_dimension | 20 | Dimension size of embedding vectors. |
+---------------------------------+------------------+--------------------------------------------------------------+
| dense_dimension | text: 128 | Dense dimension for sparse features to use if no dense |
| | label: 20 | features are present. |
| dense_dimension | text: 128 | Dense dimension for sparse features to use. |
| | label: 20 | |
+---------------------------------+------------------+--------------------------------------------------------------+
| concat_dimension | text: 128 | Concat dimension for sequence and sentence features. |
| | label: 20 | |
Expand Down
56 changes: 56 additions & 0 deletions docs/docs/migration-guide.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,54 @@ how you can migrate from one version to another.

## Rasa 2.1 to Rasa 2.2

### General

`TEDPolicy`'s `transformer_size`, `number_of_transformer_layers`,
and `dense_dimensions` parameters have been renamed.
Please update your configuration files using the following mapping:

| Old Model Parameter | New Model Parameter |
|-----------------------------|--------------------------------------------------------|
|`transformer_size` |dictionary `transformer_size` with keys |
| |`text`, `action_text`, `label_action_text`, `dialogue` |
|`number_of_transformer_layers`|dictionary `number_of_transformer_layers` with keys |
| |`text`, `action_text`, `label_action_text`, `dialogue` |
|`dense_dimension` |dictionary `dense_dimension` with keys |
| |`text`, `action_text`, `label_action_text`, `intent`, |
| |`action_name`, `label_action_name`, `entities`, `slots`,|
| |`active_loop` |

For example:

```yaml-rasa title="config.yml"
policies:
- name: TEDPolicy
transformer_size:
text: 128
action_text: 128
label_action_text: 128
dialogue: 128
number_of_transformer_layers:
text: 1
action_text: 1
label_action_text: 1
dialogue: 1
dense_dimension:
text: 128
action_text: 128
label_action_text: 128
intent: 20
action_name: 20
label_action_name: 20
entities: 20
slots: 20
active_loop: 20
```


### Deprecations

#### Markdown Data
Training and test data in Markdown format is now deprecated. This includes:
- reading and writing of story files in Markdown format
- reading and writing of NLU data in Markdown format
Expand All @@ -24,13 +70,23 @@ Support for Markdown data will be removed entirely in Rasa Open Source 3.0.0.
Please convert your existing Markdown data by using the commands
described [here](./migration-guide.mdx#training-data-files).


### Policies

[Policies](./policies.mdx) now require a `**kwargs` argument in their constructor and `load` method.
Policies without `**kwargs` will be supported until Rasa version `3.0.0`.
However when using [incremental training](./command-line-interface.mdx#incremental-training)
`**kwargs` **must** be included.


#### Other

* `Domain.random_template_for` is deprecated and will be removed in Rasa Open Source
3.0.0. You can alternatively use the `TemplatedNaturalLanguageGenerator`.
* `Domain.action_names` is deprecated and will be removed in Rasa Open Source
3.0.0. Please use `Domain.action_names_or_texts` instead.


## Rasa 2.0 to Rasa 2.1

### Deprecations
Expand Down
Loading

0 comments on commit 954e473

Please sign in to comment.