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.
![](https://static.packt-cdn.com/products/9781788991063/graphics/assets/75eb64b2-8221-4770-be93-dc9377127796.png)
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:
- 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 us to handle variable-length inputs in our network:
import numpy as np
import tensorflow as tf
class IntelligentAssistant:
''' The "Brain" behind our assistant '''
def __init__(self, forwardPass...