# Dream Builder Technical Specification Dream Builder is a desktop/web UI application for creating, configuring, and deploying conversational AI-s built on the [Dream platform](http://deeppavlov.ai/dream/). ## 1. Requirements - 1.1. Tool can be installed as a desktop application. - 1.2. Tool can open a folder containing a Dream distribution [1] for editing, or in the absence thereof, create a new one from scratch. - 1.3. Tool can recognize and verify components [2] present in the distribution. - 1.4. Tool can create new components based on provided templates, as well as remove existing ones. - 1.5. Tool can provide a comprehensive visual overview of all the components within the opened distribution. - 1.6. Tool provides a separate view (*editor*) for each component within the distribution. - 1.7. All component editors are provided as extension to the tool, but a number of them come preinstalled. - 1.8. Editors display the properties of the selected component as well as allow editing them. - 1.9. Tool ensures that the state of edited component is saved back to the distribution. - 1.10. Tool provides intuitive navigation between editors and other views. - 1.11. Tool can host a fully functional instance of DF Designer [3] inside its own UI, as one of its builtin editors. - 1.12. Tool can open any DFF-based skill [4] within the distribution, and load, edit, and save its main plot using a builtin DF Designer editor. - 1.13. Tool provides robust version control for the entire distribution being edited. This means that no significant edits made to any component should ever be lost, neither due to user nor system errors, and any previous version made with the tool can be recovered easily. This extends to assets kept outside of the distribution repo as well. - 1.14. Tool provides a UI view for managing the aforementioned version control, allowing previous version to be previewed and rolled back in an intuitive way. - 1.15. Tool is able to automatically run training for components that require it. This training logic is specific to individual component types, and is provided as an extension alongside the corresponding editor. - 1.16. Tool saves the results of training for components that require it, and keeps them in its own version control system, with references to the configuration and training data that was used for reproducibility. - 1.17. Tool is able to deploy individual components for testing them in isolation. - 1.18. Tool can recognize all dependencies of the tested component, and proxy its outgoing connections to remotely deployed versions of these dependencies. - 1.20. Tool provides a UI for interacting with the tested component. For DFF-skills, this is a chat window, but individual components may have customized interaction UIs, provided along with their editor extensions. - 1.19. Tool can deploy the entire distribution for testing, using docker compose. - 1.20. Tool provides a UI view for interacting with the entire deployed distribution, through a simple chat window. - 1.21. Tool is able to connect to remote workers [5] and perform computationally heavy tasks, such as trainings or test deployments, there. ### Long-term requirements - 1.22. Tool can be deployed as a web-service, with a browser frontend and cloud backend. - 1.23. Tool can deploy and connect to remote GPU-enabled workers running on common cloud platforms. - 1.24. Tool provides a way for extensions to display analytics for individual components in separate views. ## 2. Main Components 1. Base UI - A frame for the pluggable editors, provides navigation and state management. 2. UI component library - A library of custom styled components for building editors. For details see [https://github.com/deepmipt/dp-builder/issues/2](https://github.com/deepmipt/dp-builder/issues/2) 3. API server - A small Python server providing an REST API to the frontend through which it can access all other components. 4. Dreamtools integration - A wrapper around dreamtools which allows it to be called through the REST API. 5. Adapter framework - A Python library which facilitates the creation of adapter modules for different components. 3. Custom version control - A layer between the filesystem and the rest of Dream Builder. Ensures that all changes are recorded in an off-site "shadow" Git repository. Also allows rolling back to any previous version. For details, see spec (*TODO*) 7. Runner - Python module responsible for training and running components in Docker. 7. DFF integration - Editor component that integrates DF Designer and an adapter wrapping DF Parser. 8. Intent catcher integration - Editor component for intent catcher and an adapter for its config files. ## 5. API server A small Python server providing a REST API to the frontend through which it can access all other components. ### Adapters Python classes which parse and update the files of supported components. ```python= class BaseAdapter(ABC): @abstractmethod @staticmethod def can_open(dir_listing: List[str]) -> float: """Given a list of files in the component directory, returns a confidence score indicating whether this adapter would be able to edit the given component.""" ... ``` ## Appendix [1] Dream distribution - A directory containing a conversational AI program built with Dream. [2] Dream component - A component of a Dream distribution to be run in its own Docker container. It is kept in a separate sub-directory in the distribution. May be an annotator, skill, response/skill selector, or any other custom component. [3] DF Designer - [DF Designer](https://github.com/deepmipt/dialog_flow_designer) is an application for graphically editing DFF (Dialog Flow Framework, see DFF-based skill) plots. It is currently available as a VSCode extension, but it should be integrated into Dream Builder. [4] DFF-based skill - A component, usually located in sub-directory within the distributions top-level `skills` directory, that is built with [DFF](https://github.com/deepmipt/dialog_flow_framework). [5] Remote worker - A remote server, usually equipped with a GPU, which is running Dream Builder's worker process.