SpotlightSearchTool Not Invoked, Console Error

I'm following along with the WWDC video on SpotlightSearchTool and hitting an error - looking for some guidance.

I've configured SpotlightSearchTool and I'm sending it to the session.

let session = LanguageModelSession(tools: [tool]) {
    spotlightSearchInstructions
}
let response = try await session.respond(to: prompt, options: GenerationOptions(toolCallingMode: .required))

I set the tool calling mode to required as a test - without it I don't get errors but the logging makes it seem like it's not calling the search tool and the responses would seem to confirm that (they're not grounded in my data).

So, I figured I'd try forcing it to use the tool. When I do that, I get this console error:

InferenceError::hostFailed::InferenceError::inferenceFailed::TokenGenerationCore.GuidedGenerationError.invalidConfiguration(errorMessage: "Tool Choice requires tools") in response to ExecuteRequest
Error during session.respond. description="The operation couldn’t be completed. (FoundationModels.LanguageModelError error -1.)"
Returning empty Spotlight result. elapsedMs=3254 toolReplies=0 totalSearchItems=0 uniqueSearchItems=0

What does that mean? I'm passing in a tool, everything compiles correctly, etc. Not sure how to debug - any advice appreciated!

Testing this via the Simulator on beta 3.

Thank you so much for the interesting post. Looks like you are on beta 3 but you are using the simulator instead of a physical device. May I ask you to try exactly that same code on a physical device running the iOS 27.0 beta 3 (24A5380h) released on July 6th?

https://developer.apple.com/download/os/#ios-restore-images-ipad-new

Apple Intelligence and the FoundationModels framework rely heavily on on-device hardware. Test this on a physical device that supports Apple Intelligence.

Looking forward to your reply.

Albert  WWDR

Fair enough.

Testing on a beta 3 device (iPhone 17 Pro Max), I get the identical console logging about the failure.

@Hunter Thank you for your efforts and response. On an iPhone 17 Pro Max running beta 3, do you observe the same results? If so, there is a team that you would like to see your sysdiagnose and code with a simple focus sample demonstrating this issue and the console logging failure.

May I ask you to file a bug with all that data?

Once you open the bug report, please post the FB number here for my reference.

If you have any questions about filing a bug report, take a look at Bug Reporting: How and Why?

Albert  WWDR

SpotlightSearchTool Not Invoked, Console Error
 
 
Q