Hi guys,
I'm testing the Foundation Models Framework with the on-device model in iOS 27 (beta 4) and macOS 27 (beta 4) and is completely failing to respond.
There are many errors. For starters, the model doesn't respond to prompts directly, you need to specify instructions, otherwise it refuses to provide an answer. It is always looking for tools, even when no tool has been provided, and returns an error saying that it couldn't find the tool. Then, when it produces a response, it shows all the thinking process first, which completely ruins the response. Most of the time, the response begins with all the JSON code. And when I try to have a long conversation, it just says "I cannot write content or generate text."
I wonder if someone is experiencing the same issues or maybe the way to implement this model changed and I'm missing something?
Here is a screenshot of one of my interactions when I asked the model to describe a unicorn. It tried to access a tool that doesn't exist. (the app just prints the value of the content property)
Here is the code. It is performing a simple request.
struct ContentView: View {
@State private var response = ""
var body: some View {
VStack {
Button("Send") {
let prompt = "Write a paragraph describing a unicorn"
let session = LanguageModelSession {
"Respond to the user's request. Never acknowledge the request, add preamble, or comment on what you are about to write."
}
if !session.isResponding {
Task {
do {
let answer = try await session.respond(to: prompt)
response = answer.content
} catch {
response = "Error accessing the model: \(error)"
}
}
}
}
.buttonStyle(.borderedProminent)
Text(response)
.font(Font.system(size: 18))
.padding()
Spacer()
}
.padding()
}
}