Rasa documentation

I am looking into Rasa NLU and Core documentation for better explanation of some of the common classes used throughout the tutorials - Trainer, Agent, Interpreter etc.

Specially looking for what different methods return, what some of the parameter means etc.

For example

  1. What is the purpose of policies parameter in Agent class? What are the different policies and what do they mean? Such as MemoizationPolicy, KerasPolicy etc. I looked into github code but there is no explanation.
  2. What is the return value of Agent.load agent.train etc. The API doc https://rasa.com/docs/core/api/agent/ doesn’t explain them

Any takers? @Juste @amn41

Let me help you.

Q1: If you haven’t yet read this section then please have a look, it may help you. You’d better start with the high level architecture to better understand the role of policies in how RASA core responds to a user.

Simply, the policy class decides which action (e.g. greet, goodbye, utter_ask_name) to take at every step, that is, when a user sends a message to the bot. In other words, this is how bot decides with what to respond to a user.

So, RASA by default uses two (out-of-box) policies: memoization and keras policies. As for keras policy it uses Neural network to train the language model (in particular LSTM). You can read about it here. Also, you can write your own policy class and use it when you train your bot.

Q2: Agent.load loads a persistent model. In other words, when you train your bot, Agent creates a model and usually you specify the folder where to store/persist this model, under, say, model folder. For example,

...
agent.persist('models/dialogue')

A model (in RASA) are some files. In particular, several text files (in JSON or md format), a file with some real valued numbers (weights for example if it is output from a Neural network, Keras/LSTM). When you finish training you can look into this folder and examine what the agent has generated. For example, you may train the bot and store the model. Later your colleague may take this model and use it. He/she will have to load it using Agent.load. This function returns rasa_core.agent.Agent object.

Agent.train returns nothing. It simply trains your bot (using policies, training data, etc…) and then you sore/persist the generated model in some folder (say in model).

Typical steps are: Agent.train => Agent.persist => Agent.load => Agent.handle_messages.

I hope this will help you. :).

1 Like