Exception that can be raised when domain is not valid.
Raised when an action name could not be found.
The domain specifies the universe in which the bot's policy acts.
A Domain subclass provides the actions the bot can take, the intents and entities it can recognise.
Loads and merges multiple domain files recursively from a directory tree.
Merge this domain with another one, combining their attributes.
List attributes like
actions will be deduped
and merged. Single attributes will be taken from
True, in which case they are taken from
List retrieval intents present in the domain.
Get entity properties for a domain from what is provided by a domain file.
domain_entities- The entities as provided by a domain file.
A list of entity names. A dictionary of entity names to roles. A dictionary of entity names to groups.
Get intent properties for a domain from what is provided by a domain file.
intents- The intents as provided by a domain file.
entities- All entities as provided by a domain file.
roles- The roles of entities as provided by a domain file.
groups- The groups of entities as provided by a domain file.
The intent properties to be stored in the domain.
Enables making a deep copy of the
See https://docs.python.org/3/library/copy.html#copy.deepcopy for more implementation.
memo- Optional dictionary of objects already copied during the current copying pass.
A deep copy of the current domain.
Returns a unique hash for the domain.
Returns a unique hash for the domain which is stable across python runs.
fingerprint of the domain
Returns combination of user actions and forms.
Returns the number of available actions.
Number of used input states for the action prediction.
Return only the templates which are defined for retrieval intents
Check if the response template is for a retrieval intent.
These templates have a
/ symbol in their name. Use that to filter them from the rest.
Sets up the default slots and slot values for the domain.
Add a default value to all categorical slots.
All unseen values found for the slot will be mapped to this default value for featurization.
Add a slot called
requested_slot to the list of slots.
The value of this slot will hold the name of the slot which the user needs to fill in next (either explicitly or implicitly) as part of a form.
Add slots for the knowledge base action to the list of slots, if the default knowledge base action name is present.
As soon as the knowledge base action is not experimental anymore, we should consider creating a new section in the domain file dedicated to knowledge base slots.
Look up which action index corresponds to this action name.
Returns all available slot state strings.
Returns all available entity state strings.
Concatenates the given entity labels with their corresponding sub-labels.
If a specific entity label is given, only this entity label will be concatenated with its corresponding sub-labels.
entity_labels- A map of an entity label to its sub-label list.
entity- If present, only this entity will be considered.
A list of labels.
Provide a mapping from state names to indices.
Returns all available states.
Return a bag of active states from the tracker state.
Array of states for each state of the trackers history.
Persist the domain specification to storage.
Load a domains specification from a dumped model directory.
Compare the domain spec of the current and the loaded domain.
Throws exception if the loaded domain specification is different to the current domain are different.
responses with preserved multilines in the
responses with preserved multilines in the
Fetch cleaned domain to display or write into a file.
used_entities property is replaced by
ignore_entities and redundant keys are replaced with default values
to make the domain easier readable.
A cleaned dictionary version of the domain.
Write domain to a file.
Write cleaned domain to a file.
Domain object as a YAML string.
This function preserves the orders of the keys in the domain.
clean_before_dump- When set to
True, this method returns a version of the domain without internal information. Defaults to
A string in YAML format representing the domain.
Return the configuration for an intent.
Generate domain warnings from intents, entities, actions and slots.
Returns a dictionary with entries for
slot_warnings. Excludes domain slots
from domain warnings in case they are not featurized.
Warn user of utterance names which have no specified template.
Check whether the domain is empty.
Checks whether the given file path is a Rasa domain file.
filename- Path of the file which should be checked.
True if it's a domain file, otherwise
YamlException- if the file seems to be a YAML file (extension) but can not be read / parsed.
Retrieve the slot mappings for a form which are defined in the domain.
- an extracted entity
- intent: value pairs
- trigger_intent: value pairs
- a whole message or a list of them, where the first match will be picked
form_name- The name of the form.
The slot mapping or an empty dictionary in case no mapping was found.
Defines the available slot mappings.
Returns a string representation of the object.
Validates a slot mapping.
mapping- The mapping which is validated.
form_name- The name of the form which uses this slot mapping.
slot_name- The name of the slot which is mapped by this mapping.
InvalidDomain- In case the slot mapping is not valid.