Make prediction with trained causal language model

I have trained a CLM with colab using this (Google Colab). How do I make a prediction with the model, given any piece of sentence, to output a predicted text?

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