Response Content Filtering to Ensure Specific Output Types?

I’m building an application to evaluate the adherence of given text to a tone. The application should return a score between 0-100 (int) or 0.0 to 1.0 (float) to indicate how well the text aligns with the target tone.

To ensure the output is strictly in the desired format and to prevent any prompt manipulation, where is the best layer to implement this check?

  1. Should this be implemented in the postprocess method of the Pipeline?
  2. Or should I handle this at a higher level in the application?