notice

This is documentation for Rasa Documentation v2.x, which is no longer actively maintained.
For up-to-date documentation, see the latest version (3.x).

Version: 2.x

rasa.shared.core.slots

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 - True if the slot should be filled automatically by entities with the same name.
  • influence_conversation - If True the 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 - True if it should be auto-filled by entities with the same name.
  • influence_conversation - True if it should be featurized. Only False is allowed. Any other value will lead to a InvalidSlotConfigError.

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.