Dialog state is a structured representation of the dialog. It contains all information about user, bot and dialog process.
DeepPavlov Agent implies stateless information processing, i.g., all components do not store any information about the particular dialogs in their containers. There is an option to buffer some general knowledge that can be re-used in different dialogs. For example, News API Annotator stores all obtained from API news for some time (optional parameter) having an opportunity to utilize these news in other dialogs and not sending API requests every time.
The Dialog State is represented as a Python distionary. Its high-level structure is represented on the left in the following Image:
Basically, the Dialog State contains dialog identifier, rating, date start, date finish, utterances list, human and bot profiles.
Human and bot profiles are represented as dictionaries with the following keys: identifier, user type, attributes, persona, profile (for user only) and user external identifier (for user only). Structure information about user profile is stored in profile (specific parameters only) and attributes. Human attributes also contains states from scripted skills because the components are stateless, dialog history is not fully available (usually, we send to skills up to 3-5 last utterances to save time), while the skills need to know where the sub-dialog were finished, and what was discussed before to not repeat scripts and/or templates. The human attributes structure is shown in the image below:
Each human utterance is a dictionary of the following structure:
The dictionary contains text, user info, utterance identifier, date time, attributes, hypotheses, and annotations.
As shown in the image below human utterance’s annotations includes keys which correspond to human utterance’s annotators names from pipeline configuration file. Each field contains formatted output of the corresponding annotator.
Each human utterance contains hypotheses with response candidates from different skills. Each hypothesis has the following structure: text, confidence assigned by the skill, skill name, annotations, human and bot attributes. If the hypothesis will be selected as a final one, human and bot attributes of the hypothesis will update human and bot attributes in the upper level of the Dialog State. Similarly to human utterance annotations, hypothesis annotations consists of the outputs from the candidate annotators from the pipeline configuration file.
Bot utterances has similar to the human utterances structure except of hypotheses, confidence, original text and active skill fields. They also contain annotations of the bot utterances because a final response can be composed from several hypotheses while their annotations are not merged automatically (except of human and bot attributes).