Make prediction with CLM

I have trained a CLM using this link (Google Colab). I wonder how should I make prediction with the model, given any sequence?

Another question, can I output a text from a limited set, such as {left, right}? I am working on an RL project, where I train an agent to move left and right along a long sequence of words, in order to reach a target word on the sequence.