I was able to open a new project and play around with the Foundation Model, but when I dropped this class in a production app (with a lot of files) I'm running into Safety Guardrail errors for this very small prompt. Specifically it's "Safety guardrail was triggered after consecutive failures during streaming." Does it have something to do with the size of the app? I don't know what else to try to get it to work?
import FoundationModels
import Playgrounds
@available(iOS 26.0, *)
#Playground {
Task {
do {
let session = LanguageModelSession()
let prompt = "Write a short story about a talking cat."
let response = try await session.respond(to: prompt)
print(response)
} catch {
print("Error: \(error)")
}
}
}
Topic:
Machine Learning & AI
SubTopic:
Foundation Models