Maintaining context

Storing the context is a strategy used to keep track of what has been said before, and to be able to reuse it for the conversation. This becomes necessary when the response of the chatbot cannot be based only on the last message sent by the user but must draw information from some previous message.

To better understand the usefulness of context management, let's take an example:

  • User: My name is Giuseppe.
  • Chatbot: Okay Giuseppe.
  • User: What is my name?
  • Chatbot: You told me before calling you Giuseppe.

If the user has not yet declared his name, the chatbot's answer will have to be something like:

  • User: What is my name?
  • Chatbot: You still have not told me your name.

It is therefore easy to understand how to manage the ...

Get Hands-On Machine Learning on Google Cloud Platform now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.