Closed end text generation

Is there a way to generate close ended text? My training data contains sentences with each sentence containing BOS words EOS token. But on text generation pipeline it is open ended and does not end with EOS.