How to Add Custom Guardrails to Your FoundationModels Generation
Learn how to add custom guardrails to Apple’s on-device FoundationModels framework to validate and filter user input using structured prompts and model-generated reasoning.
In a previous blog posts, I gave an example of a StudyPlan app that uses Apple’s new FoundationModels framework to generated customized study plans for students.
You’ll notice that while most input fields are restricted, the “Subject” field is completely open so the student can be very specific about their area of study. For example, instead of somethin…