This tutorial shows how to use the Alternative Inputs field for user utterances in the teaching interface.
This tutorial requires that the general tutorial bot is running
npm run tutorial-general
Alternative inputs are alternate, semantically equivalent user utterances which the user might have said at a particular point in a training dialog. These alternative inputs allow you to more compactly specify variations of utterances without having to address each variation in separate training dialogs.
- In the Web UI, click "New Model."
- In the "Name" field, type "AlternativeInputs" and hit enter.
- Click the "Create" button.
- On the left panel, click "Entities", then the "New Entity" button.
- Select "Custom Trained" for the "Entity Type."
- Type "city" for the "Entity Name."
- Click the "Create" button.
Now, let's create three actions.
- On the left panel, click "Actions", then the "New Action" button.
- In the "Bot's response..." field, type "Which city?"
- In the "Expected Entity in User reply..." field, type "city."
- In the "Disqualifying Entitles" field, type "city."
- Click the "Create" button.
- On the left panel, click "Actions", then the "New Action" button.
- In the "Bot's response..." field, type "The weather in $city is probably sunny."
- Click the "Create" button.
- On the left panel, click "Actions", then the "New Action" button.
- In the "Bot's response..." field, type "Try asking for the weather."
- In the "Disqualifying Entitles" field, type "city."
- Click the "Create" button.
You now have three actions.
- On the left panel, click "Train Dialogs", then the "New Train Dialog" button.
- In the chat panel, where it says "Type your message...", type in "What's the weather?"
- Click the "Score Actions" button.
- Select the response, "Which city?"
- In the chat panel, where it says "Type your message...", type in "Denver"
- Click the "Score Actions" button.
- Select the response, "The weather in Denver is probably sunny."
- Click the "Submit Changes" button.
Let's train the model more by creating another train dialog.
- On the left panel, click "Train Dialogs", then the "New Train Dialog" button.
- In the chat panel, where it says "Type your message...", type in "What can you do?"
- Click the "Score Actions" button.
- Select the response, "Try asking for weather."
- In the chat panel, where it says "Type your message...", type in "What's the weather in Seattle?"
- Click "Seattle", then click "city" from the Entity List.
- Click the "Score Actions" button.
- Select the response, "The weather in Seattle is probably sunny."
- Click the "Submit Changes" button.
- On the left panel, click "Train Dialogs", then the "New Train Dialog" button.
- In the chat panel, where it says "Type your message...", type in "help"
- Click the "Score Actions" button.
- The Model is uncertain to the best option, so it would choose the highest percentile by default.
- Click the "Abandon Teaching" button, then "Confirm" button.
Let's better tune the system using alternative inputs. You can add alternative input while teaching or later.
- On the left panel, click "Train Dialogs", then select "What can you do?" from the list of Train Dialogs.
- Click the "What can you do?" utterance in the chat panel.
- In the "Add alternative input..." field, type "help" and hit enter.
- Click the "Save Changes" button.
Let's add another alternative input to handle Houston.
- Click the "What's the weather in Seattle?" utterance in the chat panel.
- In the "Add alternative input..." field, type "forecast for Houston" and hit enter.
- The error message highlights the fact alternative inputs must be semantically equivalent and contain the same entities as the original utterance; not just the same values of entities. The presence of the same entities is required.
- Click on "Houston" and select "city" from the Entities List.
- In the "Add alternative input..." field, type "forecast for Seattle" and hit enter.
- Click on "Seattle" and select "city" from the Entities List.
- Click the "Save Changes" button.
- Click the "Save Edit" button.
- On the left panel, click "Log Dialogs", then the "New Log Dialog."
- In the chat panel, where it says "Type your message...", type in "help me"
- In the chat panel, where it says "Type your message...", type in "forecast for Denver"
[!div class="nextstepaction"] Log dialogs