async throws -> String { let source = CoreSpotlightSource( searchableIndexDelegate: indexDelegate, fetchAttributes: [.title, .contentDescription, .textContent, .contentCreationDate] ) let profile = SpotlightSearchTool.GuidanceProfile( textMatch: true, similarityMatch: true, dates: true, people: false, attributes: [.title, .contentDescription, .textContent, .contentCreationDate] ) let tool = SpotlightSearchTool( configuration: .init(sources: [.coreSpotlight(source)], guide: .init(level: .dynamic(profile))) ) let session = LanguageModelSession( model: SystemLanguageModel.default, tools: [tool], instructions: """ You are an assistant for Recall, an audio recording app. Answer the user's questions based on the content of their past recordings. Always use the Spotlight search tool to find relevant recordings before answering. Base every answer only on the retrieved recordings and mention the titles you relied on. Respond in the same language as the user's question. """ ) let response = try await session.respond(to: question) return response.content }