Constructing a basic agent

The simplest way to construct an artificial assistant with TensorFlow is to use a sequence-to-sequence (Seq2Seq) model, which we learned in the chapter on RNNs.

While originally developed for neural machine translation, we can adjust this model to act as an intelligent chatbot for our own purposes. We'll create the brain behind our assistant as a Python class called IntelligentAssistant. Then, we'll create the training and chatting functions for our assistant:

  1. First, let's start with our standard imports and initialize our variables. Take special note of the mask variable here; masks are placeholders that allow ...

Get Hands-On Artificial Intelligence for Beginners 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.