“Confidence “ metric for text to text generation pipeline

I was wondering, there is a way to get a “confidence” metric for text to text generation (e.g., translation) to discard “low confidence” predictions?