Custom Actions Flashcards
(35 cards)
What are custom actions?
Custom Actions allows you to run any code you want, like adding an event to a calendar, calling an API, sending emails, or anything else according to your requirement.
How can we setup a custom action to fill slots and send emails?
We need to run an action server by defining action endpoint in the endpoints.yml file.
E.g.:
action_endpoint:
url: 'http://localhost:5055/webhook'
What are slots?
- Slots are our bot’s memory.
- Slots act as key-value store which can be used to store useful information that users provide.
- These information can be used later during conversation. Slots are also useful to gather information from the outside world.
- Results of a database query
what ways can a slots be set?
- using custom actions
- from NLU
- from buttons in the UI
4.
How are slots set in custom actions?
Slots can only be set by returning it in the custom action, as shown below:
class AskReason(Action):
def name(self):
return ‘action_ask_reason’
~~~
def run(self, dispatcher, tracker, domain): personal = tracker.latest_message.get('text') return [SlotSet('reason',personal)]
~~~
Where should every single custom action and slots used be defined?
Every single custom action and slots used should be defined in our domain file i.e domain.yml.
What are the possible types of slots?
Slots can be of different types for eg: text — for text type value, boolean — for true or false values, Category, List, unfeaturized — to not influence the dialog flow, and so on.
What is SMTP?
Simple Mail Transfer Protocol (SMTP) is a protocol, which handles sending an e-mail and routing email between mail servers.
What is Python’s built-in module for sending emails?
The smtplib module defines an SMTP client session object that can be used to send mail to any Internet machine with an SMTP or ESMTP listener daemon. The smtplib modules is useful for communicating with mail servers to send mail.
What does Rasa NLU do to understand information?
It does intent classification and entity extraction.
What is the purpose of stories.md?
Stories are used to teach Rasa real conversation designs to learn from providing the basis for a scalable machine learning dialogue management.
Rasa stories are a form of training data used to train the Rasa’s dialogue management models.
A story is a representation of a conversation between a user and an AI assistant, converted into a specific format where user inputs are expressed as corresponding intents (and entities where necessary) while the responses of an assistant are expressed as corresponding action names.
A training example for the Rasa Core dialogue system is called a story.
What is interactive learning?
Interactive learning is the way of providing feedback to your bot while you talk to it.
What are the benefits of interactive learning?
- To generate training stories while talking to your bot.
- To do debuggings and see if our intents and entities are being correctly classified using interactive learning.
- To generate new training stories by asking newer and surprising questions to the bot.
- If the information does not fall on any of the given intents, we can also create a new intent and assign it there.
- To teach the bot something it doesn’t know yet.
All conversations you have with your bot in an interactive learning session can later be exported as NLU and dialogue training examples and attached to your original training data sample.
What is required to train the bot in an interactive training session?
To train your bot in interactive learning session, you should have few training stories beforehand.
What labels do you need to to train the model?
the intents for pieces of text
What are the preprocessing steps for raw data?
- Cleaning the text by removing stopwords and stemming
Identifying keywords - Calculating term frequencies
- K-means clustering in the space of term frequency vectors.
If the value of a slot is important what types to use and why?
- If the value itself is important, use a categorical or a bool slot.
- There are also float, and list slots.
- If you just want to store some data, but don’t want it to affect the flow of the conversation, use an unfeaturized slot.
What is the purpose of a text slot?
- A text slot only tells Rasa Core whether the slot has a value.
- The specific value of a text slot (e.g. Bangalore or New York or Hong Kong) doesn’t make any difference.
How are Slots Set from NLU?
If your NLU model picks up an entity, and your domain contains a slot with the same name, the slot will be set automatically. For example:
# story_01 * greet{"name": "Ali"} - slot{"name": "Ali"} - utter_greet
How disable auto filling of slots by the nlu?
To disable this behavior for a particular slot, you can set the auto_fill attribute to False in the domain file:
slots:
name:
type: text
auto_fill: False
~~~
~~~
How are Slots Set By Clicking Buttons?
Rasa Core will send messages starting with a / to the RegexInterpreter, which expects NLU input in the same format as in story files, e.g. /intent{entities}.
For example, if you let users choose a color by clicking a button, the button payloads might be /choose{“color”: “blue”} and /choose{“color”: “red”}.
What tool can we user to create training data?
You can install and use rasa-nlu-trainer:
npm i -g rasa-nlu-trainer
What is the purpose of the configuration file config_spacy.json
- To specify configuration parameters used in training like:
- pipeline
- path
- data
What is the purpose of the pipeline parameter in file config_spacy.json
It specifies
- what featurizers/ feature extractors will be used to extract information