Teacher Gavin's Transformer Live Lessons - Illustration of Rasa Dialogue Robot Project Actual Education Bot Project and Comprehensive Debugging Debugging Actual Combat Decryption (77)

    This article continues to focus on the industrial-grade business dialogue platform and framework Rasa, analyzes the architecture of the Education Bot project in the education field of the Rasa dialogue robot project, and demonstrates and analyzes how Rasa Agent interacts with the core components NLU Pipeline and Dialogue Policies through the debug mode. Complete language understanding and prediction of user input, as well as microservice calls.

1. Deciphering the Education Bot project in the education field and the comprehensive debugging and debugging of the actual combat of the Rasa dialogue robot project

  1. The Education Bot project in the field of education through the Rasa Architecture diagrammatic dialogue robot project

Run the command rasa shell to start Rasa Server (Agent), which will load the trained model, including the models used by NLU Pipeline and Dialogue Polices:

Running the command rasa run actions will start the rasa action server and register the microservice actions:

The Agent is equivalent to the control center of the dialogue robot, and the business processing such as accessing the database or calling the third-party API is handled by the Action Server. As can be seen from the architecture diagram, the core path is the interaction between the user and the Agent and the interaction between the Action Server and the Agent. The nlu part of the project is related to NLU Pipelines:

And the rules and stories section is related to Dialogue Polices:

The Actions section defines and configures the microservices running on the Action Sever:

Config.yml defines various graph components used in NLU Pipeline, including intent classification and entity extraction components:

Config.yml also defines the various policies components used in the Dialogue Policies section of the architecture diagram:

 2. The Education Bot project in the field of education through the Graph Architecture diagrammatic dialogue robot project

The Rasa graph architecture diagram shown at the beginning of this article shows the dependencies between the various graph components, forming a directed acyclic graph (abbreviated DAG). The Rasa framework blurs the difference between the components in the NLU Pipeline and the components in the Dialogue Policies by abstracting each component into a graph component, so all components are unified in a DAG graph. As can be seen from the figure, each component is not completely executed sequentially, and components can run in parallel, which brings high efficiency. In addition, as can be seen from the DAG diagram, Rasa also provides an end-to-end learning method, that is, the Dialogue Policies part can be processed directly by relying on the output of the Featurizers component without relying on the output of the DIETClassifier. The Policy Ensemble component will give the best prediction results about the next action according to the prediction results of each policy component.

 3. The Education Bot project in the field of education through the Training Flow graphic dialogue robot project

In the following flowchart, first load the domain configuration information and training data (nlu, rules, stories, etc.), train each component and perform persistence operations. Policies will extract features based on the data of stories and update the parameters of their own models.

 4. Debugging and diagram of Rasa Server NLU startup process

During the Rasa server startup process, you can see an error message, because the ducking server is not started, and the DuckllingEntityExtractor is used in the NLU pipeline configuration:

Enter debug mode:

Many libraries will be loaded, including Rasa SDK-related libraries, redis-related, tensor flow-related, etc.:

Start the Rasa server built on the Sanic framework:

The InMemoryTrackerStore commonly used in development mode is used here:

Load the components of each NLU pipeline:

 5. Debugging and diagram of Rasa Server Policies startup process

During the Rasa server startup process, various components in Dialogue Policies are also loaded, such as RulePolicy, AugmentedMoizationPolicy, TEDPolicy, etc.:

Start the Rasa server to complete:

 6. Analyze the complete NLU processing process of user input Message through Debugging mode

Enter information:

First get the lock from the Lock Store, start a new session, and execute action_session_start:

This is the status information of the slots in the current tracker, all of which are None:

Then call each component of the NLU pipeline in turn to process the input information:

Run ResponseSelector, add the keys of each category, and if the intent identified by the user input matches these categories, it will be processed accordingly:

This is the intent and entities information output after processing the user input message:

The conversation bot retrieves the information through the microservice and returns:

The search is performed by calling the API in the run method of the microservice:

This is the query method defined by the discourse API:

Extract and verify the slots information:

 7. Analyze the complete Policies processing process of user input Message through Debugging mode

Run RulePolicy and TEDPolicy to predict the next action:

Each policy prediction result is selected through the Policy Ensemble component, and finally the RulePolicy prediction result is selected, and the microservice action is called to perform the search:

After the search is completed, each policy will be called again to predict the next action. You can see that the last predicted action is "action_listen" (the default behavior of the system), that is, it enters the state of waiting for the user to enter the next message:

Guess you like

Origin blog.csdn.net/m0_49380401/article/details/123468884
Recommended