The Domain
defines the universe in which your bot operates.It specifies the intents
, entities
, slots
, and actions
your bot should know about. Optionally, it can also include templates
for the things your bot can say.
As an example, the DefaultDomain
has the following yaml definition:
This is the training data for Rasa Core. The way it works is: Give some examples of sample story paths that the user is expected to follow; Rasa Core combines them randomly to create more complex user paths; It then builds a probabilistic model out of that. This model is used to predict the next action Rasa should take. The way the slot influences the conversation will depend on its slot type. The following example defines a slot homecity that influences the conversation. A text slot will influence the assistant's behavior depending on 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.
- By default, Rasa Open Source fills a slot with an entity that has the same name. So if you've defined a name slot in your domain file, and you also have a name entity defined in your domain and training data, when the NLU model extracts the name entity, it'll be saved to the name slot automatically.
- For example, in the above sentence, the intent is ordering and the entity is a book. Rasa NLU internally uses Bag-of-Word (BoW) algorithm to find intent and Conditional Random Field (CRF) to find entities. Although you can use other algorithms for finding intent and entities using Rasa. RASA CORE: Core is.
- This is also called slot filling. If you need to collect multiple pieces of information in a row, we recommended that you create a FormAction. This is a single action which contains the logic to loop over the required slots and ask the user for this information. There is a full example using forms in the examples/formbot directory of Rasa Core.
What does this mean?
Your NLU model will define the intents
and entities
that youneed to include in the domain.
slots
are the things you want to keep track of during a conversation,see Using Slots . A categorical slot called risk_level
would bedefined like this:
Here is 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
can:
THe strong vibro-acoustic influence of the slot numbers combination used in squirrel-cage induction machines was experimented at the early beginning of the twentieth century. Consequently, some researchers started to look for some general rules to decrease these motor noise and vibra-tions mainly due to Maxwell air-gap magnetic forces, the first. Induction Motor Slot Combinations Rules to Predetermine Crawling, Vibration, Noise and Hooks in the Speed-Torque Curve Abstract: A theory of coexisting stationary and rotating slot openings is developed with the aid of ``revolving permeances,' and the magnitude and speed of the parasitic fluxes due to the slot openings and the fundamental. 7 different slot combinations have been here swept in a few seconds of calculation only. Results show that the choice of the rotor slot number has a large influence on the noise and vibration levels of induction motors. The best slot combination is here found with Zr=24. A complete study should involve the torque harmonics. The stator–rotor slot combination is an important parameter in the design of high-voltage induction motor (HVIM). The different design of the stator–rotor slot combination will have an effect on the performance of the HVIM, such as torque, air-gap flux density, loss and so on. In order to analyze its influence, 10 kV, 1000 kW HVIM is taken as an example and the finite element.
- respond to a user
- make an external API call
- query a database
see Actions
For a more complete example domain, check the Quickstart.
Custom Actions and Slots¶
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 Actions).
Utterance templates¶
Utterance templates are messages the bot will send back to the user. There aretwo ways to use these templates:
if the name of the template starts with
utter_
, the utterance candirectly be used like an action. You would add the utterance templateto the domainAfterwards, you can use the template as if it were an action in thestories: Hilton aruba casino poker room events.
When
utter_greet
is run as an action, it will send the message fromthe template back to the user.You can use the templates to generate response messages from yourcustom actions using the dispatcher:
dispatcher.utter_template('utter_greet')
.This allows you to separate the logic of generatingthe messages from the actual copy. In you custom action code, you cansend a message based on the template like this:
Images and Buttons¶
Templates defined in a domains yaml file can contain images andbuttons as well:
Note
Slot Example Rasa Al
Please keep in mind that it is up to the implementation of the outputchannel on how to display the defined buttons. E.g. the cmdlineinterface can not display buttons or images, but tries to mimic them inthe command line.
Variables¶
You can also use variables in your templates to insert informationcollected during the dialogue. You can either do that in your custom pythoncode or by using the automatic slot filling mechanism. E.g if yougot a template like this:
Slot Example Rasa Video
Rasa will automatically fill that variable with a value found in a slot calledname
. Our lucaya freeport bahamas casino buffet.
In custom code, you can retrieve a template by using:
If the template contains variables denoted with {my_variable}
you can supply values for the fields by passing them as key wordarguments to utter_template
:
Variations¶
If you want to randomly vary the response sent to the user, you can listmultiple responses and Rasa will randomly pick one of them, e.g.:
Ignoring entities for certain intents¶
- respond to a user
- make an external API call
- query a database
see Actions
For a more complete example domain, check the Quickstart.
Custom Actions and Slots¶
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 Actions).
Utterance templates¶
Utterance templates are messages the bot will send back to the user. There aretwo ways to use these templates:
if the name of the template starts with
utter_
, the utterance candirectly be used like an action. You would add the utterance templateto the domainAfterwards, you can use the template as if it were an action in thestories: Hilton aruba casino poker room events.
When
utter_greet
is run as an action, it will send the message fromthe template back to the user.You can use the templates to generate response messages from yourcustom actions using the dispatcher:
dispatcher.utter_template('utter_greet')
.This allows you to separate the logic of generatingthe messages from the actual copy. In you custom action code, you cansend a message based on the template like this:
Images and Buttons¶
Templates defined in a domains yaml file can contain images andbuttons as well:
Note
Slot Example Rasa Al
Please keep in mind that it is up to the implementation of the outputchannel on how to display the defined buttons. E.g. the cmdlineinterface can not display buttons or images, but tries to mimic them inthe command line.
Variables¶
You can also use variables in your templates to insert informationcollected during the dialogue. You can either do that in your custom pythoncode or by using the automatic slot filling mechanism. E.g if yougot a template like this:
Slot Example Rasa Video
Rasa will automatically fill that variable with a value found in a slot calledname
. Our lucaya freeport bahamas casino buffet.
In custom code, you can retrieve a template by using:
If the template contains variables denoted with {my_variable}
you can supply values for the fields by passing them as key wordarguments to utter_template
:
Variations¶
If you want to randomly vary the response sent to the user, you can listmultiple responses and Rasa will randomly pick one of them, e.g.:
Ignoring entities for certain intents¶
If you want entities to be ignored for certain intents, you canadd the use_entities:false
parameter to the intent in your domainfile like this:
This means that 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
Slot Example Rasa Mp3
If you really want these entities not to influence action prediction wesuggest you make the slots with the same name of type unfeaturized
Have questions or feedback?¶
Slot List Rasa Example
We have a very active support community on Rasa Community Forumthat is happy to help you with your questions. If you have any feedback for us or a specificsuggestion for improving the docs, feel free to share it by creating an issue on Rasa CoreGitHub repository.