Slot List Rasa
Posted : admin On 4/4/2022From above changes first if the slot is null uttergetpartnumber will trigger and if the slot is filled with a value utterconfirmpartnumber will trigger. If this doesn't fulfill your need or doesn't work as expected, you can try rasa interactive training. Just run rasa interactive on CMD or try rasa x interactive talk. From this you can. In RASA, the context of a conversation can be handled by using slot values and it helps to decide the flow of chat. Slot values can be used in the user stories to provide context to the conversation and decide the next action. Events provide flexibility to control the context by manually setting or resetting the slot values from custom actions. In this video you will learn what are slots and how they are useful in creating the Rasa chatbot. Also you will learn what are the different types of slots and how to define them in Rasa chatbot. Here you can find the full list of slot types defined by Rasa Core, along with syntax for including them in your domain file. Actions are the things your bot can actually do. For example, an action could: respond to a user, make an external API call, query a database,. Just about anything!
The Domain
defines the universe in which your assistant operates.It specifies the intents
, entities
, slots
, and actions
your bot should know about. Optionally, it can also include responses
for the things your bot can say.
As an example, the domain created by rasainit
has the following yaml definition:
What does this mean?
Your NLU model will define the intents
and entities
that youneed to include in the domain. The entities
section lists all entitiesextracted by any entity extractor in yourNLU pipeline.
For example:
Slots hold information you want to keep track of during a conversation.A categorical slot called risk_level
would bedefined like this:
Slot List Rasa Example
Here you can find the full list of slot types defined byRasa Core, along with syntax for including them in your domain file.
Actions are the things your bot can actually do.For example, an action could:
respond to a user,
make an external API call,
query a database, or
just about anything!
To reference slots in your domain, you need to reference them bytheir module path. To reference custom actions, use their name.For example, if you have a module called my_actions
containinga class MyAwesomeAction
, and module my_slots
containingMyAwesomeSlot
, you would add these lines to the domain file:
The name
function of MyAwesomeAction
needs to returnmy_custom_action
in this example (for more details,see Custom Actions).
Responses are messages the bot will send back to the user. There aretwo ways to use these responses:
If the name of the response starts with
utter_
, the response candirectly be used as an action. You would add the responseto the domain:Afterwards, you can use the response as an action in thestories:
When
utter_greet
is run as an action, it will send the message fromthe response back to the user.You can use the responses to generate response messages from yourcustom actions using the dispatcher:
dispatcher.utter_message(template='utter_greet')
.This allows you to separate the logic of generatingthe messages from the actual copy. In your custom action code, you cansend a message based on the response like this:
Responses defined in a domain’s yaml file can contain images andbuttons as well:
Note
Please keep in mind that it is up to the implementation of the outputchannel on how to display the defined buttons. The command line, forexample, can’t display buttons or images, but tries to mimic them byprinting the options.
You can also send any arbitrary output to the output channel using thecustom:
key. Note that since the domain is in yaml format, the jsonpayload should first be converted to yaml format.
For example, although date pickers are not a defined parameter in responsesbecause they are not supported by most channels, a Slack date pickercan be sent like so:
For each response, you can have multiple response templates (see Variations).If you have certain response templates that you would like sent only to specificchannels, you can specify this with the channel:
key. The value should matchthe name defined in the name()
method of the channel’s OutputChannel
class. Channel-specific responses are especially useful if creating customoutput payloads that will only work in certain channels.
Each time your bot looks for responses, it will first check to see if thereare any channel-specific response templates for the connected channel. If there are, itwill choose only from these response templates. If no channel-specific response templates arefound, it will choose from any response templates that do not have a defined channel
.Therefore, it is good practice to always have at least one response template for eachresponse that has no channel
specified so that your bot can respond in allenvironments, including in the shell and in interactive learning.
You can also use variables in your responses to insert informationcollected during the dialogue. You can either do that in your custom pythoncode or by using the automatic slot filling mechanism. For example, if youhave a response like this:
Rasa will automatically fill that variable with a value found in a slot calledname
.
In custom code, you can retrieve a response by using:
Slot List Rasa Tv
If the response contains variables denoted with {my_variable}
you can supply values for the fields by passing them as keywordarguments to utter_message
:
Slot List Rasa Youtube
If you want to randomly vary the response sent to the user, you can listmultiple response templates and Rasa will randomly pick one of them, e.g.:
If you want all entities to be ignored for certain intents, you canadd the use_entities:[]
parameter to the intent in your domainfile like this:
To ignore some entities or explicitly take only certain entitiesinto account you can use this syntax:
This means that excluded entities for those intents will be unfeaturized and thereforewill not impact the next action predictions. This is useful when you havean intent where you don’t care about the entities being picked up. If you listyour intents as normal without this parameter, the entities will befeaturized as normal.
Note
If you really want these entities not to influence action prediction wesuggest you make the slots with the same name of type unfeaturized
.
A conversation session represents the dialogue between the assistant and the user.Conversation sessions can begin in three ways:
the user begins the conversation with the assistant,
the user sends their first message after a configurable period of inactivity, or
a manual session start is triggered with the
/session_start
intent message.
You can define the period of inactivity after which a new conversationsession is triggered in the domain under the session_config
key.session_expiration_time
defines the time of inactivity in minutes after which anew session will begin. carry_over_slots_to_new_session
determines whetherexisting set slots should be carried over to new sessions.

The default session configuration looks as follows:
This means that if a user sends their first message after 60 minutes of inactivity, anew conversation session is triggered, and that any existing slots are carried overinto the new session. Setting the value of session_expiration_time
to 0 meansthat sessions will not end (note that the action_session_start
action will stillbe triggered at the very beginning of conversations).
Note
A session start triggers the default action action_session_start
. Its defaultimplementation moves all existing slots into the new session. Note that allconversations begin with an action_session_start
. Overriding this action couldfor instance be used to initialise the tracker with slots from an external APIcall, or to start the conversation with a bot message. The docs onCustomising the session start action shows you how to do that.