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

Yes, same results on device - same log messages, same lack of results.

A bug report and a sysdiagnose is not a problem. A sample that reproduces I can put on my list though that may take some more time. This is part of a big project, not sure how much I'll have to extract to get it to reproduce.

In the meantime, if anyone else sees this I'd love to hear about it. Or if you're using SpotlightSearchTool with great success I'd be interested in that too!

FB number incoming...

Started the FB here with sysdiagnose and basic info, will work on sample.

FB23643759

@Hunter Thanks so much for the post and the bug. The bug has been routed to the correct team and they are looking into it. A simple focused project will be extremely helpful for the team to see the issue in iOS 27.0 beta 3 (24A5380h)

Thanks again for all your work.

You can see the status of your feedback in Feedback Assistant. There, you can track if the report is still being investigated, has a potential identifiable fix, or has been resolved in another way. The status appears beside the label "Resolution." We're unable to share any updates on specific reports on the forums.

For more details on when you'll see updates to your report, please see What to expect after submission.

Albert  WWDR

SpotlightSearchTool Not Invoked, Console Error
 
 
Q