rasa.shared.core.slots
You are viewing documentation for our open source project which is maintained by the community. If you want to get started building assistants with Rasa please check out our latest documentation here.
InvalidSlotTypeException Objects
class InvalidSlotTypeException(RasaException)
Raised if a slot type is invalid.
InvalidSlotConfigError Objects
class InvalidSlotConfigError(RasaException, ValueError)
Raised if a slot's config is invalid.
Slot Objects
class Slot()
Key-value store for storing information during a conversation.
init
| init(name: Text, initial_value: Any =None, value_reset_delay: Optional[int]=None, auto_fill:bool=True, influence_conversation:bool=True)->None
Create a Slot.
Arguments:
name- The name of the slot.initial_value- The initial value of the slot.value_reset_delay- After how many turns the slot should be reset to the initial_value. This is behavior is currently not implemented.auto_fill-Trueif the slot should be filled automatically by entities with the same name.influence_conversation- IfTruethe slot will be featurized and hence influence the predictions of the dialogue polices.
feature_dimensionality
| feature_dimensionality()->int
How many features this single slot creates.
Returns:
The number of features. 0 if the slot is unfeaturized. The dimensionality of the array returned by as_feature needs to correspond to this value.
has_features
| has_features()->bool
Indicate if the slot creates any features.
value_reset_delay
| value_reset_delay()-> Optional[int]
After how many turns the slot should be reset to the initial_value. If the delay is set to None, the slot will keep its value forever.
reset
| reset()->None
Resets the slot's value to the initial value.
value
| @property
| value()-> Any
Gets the slot's value.
value
| @value.setter
| value(value: Any)->None
Sets the slot's value.
has_been_set
| @property
| has_been_set()->bool
Indicates if the slot's value has been set.
resolve_by_type
| @staticmethod
| resolve_by_type(type_name: Text)-> Type["Slot"]
Returns a slots class by its type name.
FloatSlot Objects
class FloatSlot(Slot)
persistence_info
| persistence_info()-> Dict[Text, Any]
Returns relevant information to persist this slot.
BooleanSlot Objects
class BooleanSlot(Slot)
A slot storing a truth value.
bool_from_any
bool_from_any(x: Any)->bool
Converts bool/float/int/str to bool or raises error.
ListSlot Objects
class ListSlot(Slot)
value
| @Slot.value.setter
| value(value: Any)->None
Sets the slot's value.
UnfeaturizedSlot Objects
class UnfeaturizedSlot(Slot)
Deprecated slot type to represent slots which don't influence conversations.
init
| init(name: Text, initial_value: Any =None, value_reset_delay: Optional[int]=None, auto_fill:bool=True, influence_conversation:bool=False)->None
Creates unfeaturized slot.
Arguments:
name- The name of the slot.initial_value- Its initial value.value_reset_delay- After how many turns the slot should be reset to the initial_value. This is behavior is currently not implemented.auto_fill-Trueif it should be auto-filled by entities with the same name.influence_conversation-Trueif it should be featurized. OnlyFalseis allowed. Any other value will lead to aInvalidSlotConfigError.
CategoricalSlot Objects
class CategoricalSlot(Slot)
add_default_value
| add_default_value()->None
Adds the special default value to the list of possible values.
persistence_info
| persistence_info()-> Dict[Text, Any]
Returns serialized slot.
AnySlot Objects
class AnySlot(Slot)
Slot which can be used to store any value. Users need to create a subclass of Slot in case the information is supposed to get featurized.
eq
| eq(other: Any)->bool
Compares object with other object.