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](/content/docs/index.html).

## InvalidDomain Objects

### `class InvalidDomain(RasaException)`

Exception that can be raised when domain is not valid.

## ActionNotFoundException Objects

### `class ActionNotFoundException(ValueError, RasaException)`

Raised when an action name could not be found.

## SessionConfig Objects

### `class SessionConfig(NamedTuple)`

The Session Configuration.

#### default

```python
@staticmethod
default() -> "SessionConfig"
```
Returns the SessionConfig with the default values.

#### are_sessions_enabled

```python
are_sessions_enabled() -> bool
```
Returns a boolean value depending on the value of session_expiration_time.

## Domain Objects

### `class Domain()`

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.

#### from_file

```python
@classmethod
from_file(cls, path: Text) -> "Domain"
```
Loads the `Domain` from a YAML file.

#### from_yaml

```python
@classmethod
from_yaml(cls, yaml: Text, original_filename: Text = "") -> "Domain"
```
Loads the `Domain` from YAML text after validating it.

#### from_dict

```python
@classmethod
from_dict(cls, data: Dict) -> "Domain"
```
Deserializes and creates domain.

**Arguments**:

- `data` - The serialized domain.

**Returns**:

The instantiated `Domain` object.

#### from_directory

```python
@classmethod
from_directory(cls, path: Text) -> "Domain"
```
Loads and merges multiple domain files recursively from a directory tree.

#### merge

```python
merge(domain: Optional["Domain"], override: bool = False) -> "Domain"
```
Merge this domain with another one, combining their attributes.

List attributes like `intents` and `actions` will be deduped and merged. Single attributes will be taken from `self` unless override is `True`, in which case they are taken from `domain`.

#### merge_domain_dicts

```python
merge_domain_dicts(domain1: Dict, domain2: Dict, override: bool = False) -> Dict[Text, Any]
```
Merges this domain dict with another one, combining their attributes.

This is used when multiple domain yml files are configured in a single directory. Unlike the merge method above, which merges Domain objects by creating each object then merging it with the previous, this method merges domain dicts, and ensures all attributes (like `intents`, `entities`, and `actions`) are known to the Domain when the object is created.

List attributes like `intents` and `actions` are deduped and merged. Single attributes are taken from `domain1` unless override is `True`, in which case they are taken from `domain2`.

#### extract_duplicates

```python
@staticmethod
extract_duplicates(list1: List[Any], list2: List[Any]) -> List[Any]
```
Extracts duplicates from two lists.

#### clean_duplicates

```python
@staticmethod
clean_duplicates(dupes: Dict[Text, Any]) -> Dict[Text, Any]
```
Removes keys for empty values.

#### merge_dicts

```python
@staticmethod
merge_dicts(tempDict1: Dict[Text, Any], tempDict2: Dict[Text, Any], override_existing_values: bool = False) -> Dict[Text, Any]
```
Merges two dicts.

#### merge_lists

```python
@staticmethod
merge_lists(list1: List[Any], list2: List[Any]) -> List[Any]
```
Merges 2 lists.

#### merge_lists_of_dicts

```python
@staticmethod
merge_lists_of_dicts(dict_list1: List[Dict], dict_list2: List[Dict], override_existing_values: bool = False) -> List[Dict]
```
Merges 2 dict lists.

#### collect_slots

```python
@staticmethod
collect_slots(slot_dict: Dict[Text, Any]) -> List[Slot]
```
Collects the slots.

#### retrieval_intents

```python
@rasa.shared.utils.common.lazy_property
retrieval_intents() -> List[Text]
```
List retrieval intents present in the domain.

#### collect_entity_properties

```python
@classmethod
collect_entity_properties(cls, domain_entities: List[Union[Text, Dict[Text, Any]]]) -> Tuple[List[Text], Dict[Text, List[Text]], Dict[Text, List[Text]]]
```
Get entity properties for a domain from what is provided by a domain file.

**Arguments**:

- `domain_entities` - The entities as provided by a domain file.

**Returns**:

A list of entity names.
A dictionary of entity names to roles.
A dictionary of entity names to groups.
