@@ -3,40 +3,6 @@ import FoundationModels
33import Observation
44import os
55
6- // MARK: - AISessionType
7-
8- /// Defines the type of AI session to create, each optimized for specific use cases.
9- ///
10- /// Session types help organize the code and provide semantic meaning,
11- /// but note that Apple's Foundation Models framework does not expose
12- /// temperature control in macOS 26. All sessions use the system default.
13- @available ( macOS 26 . 0 , * )
14- enum AISessionType : String , CaseIterable , Sendable {
15- /// Quick command parsing (play, skip, queue, etc.)
16- /// Best for predictable structured output.
17- case command
18-
19- /// Creative analysis (lyrics explanation, recommendations)
20- /// Best for more insightful, varied responses.
21- case analysis
22-
23- /// Multi-turn conversation (future use)
24- /// Best for natural dialogue.
25- case conversational
26-
27- /// Human-readable description for logging and debugging.
28- var description : String {
29- switch self {
30- case . command:
31- " Command parsing (structured output) "
32- case . analysis:
33- " Creative analysis (insightful responses) "
34- case . conversational:
35- " Conversational (multi-turn dialogue) "
36- }
37- }
38- }
39-
406// MARK: - FoundationModelsService
417
428/// Service for managing Apple Foundation Models integration.
@@ -208,26 +174,6 @@ final class FoundationModelsService {
208174 )
209175 }
210176
211- // MARK: - Legacy Session Creation (Deprecated)
212-
213- /// Creates a new language model session for a given task.
214- /// - Parameter instructions: System instructions for the session.
215- /// - Returns: A configured LanguageModelSession, or nil if unavailable.
216- @available ( * , deprecated, message: " Use createAnalysisSession or createCommandSession for better optimization " )
217- func createSession( instructions: String ) -> LanguageModelSession ? {
218- self . createAnalysisSession ( instructions: instructions)
219- }
220-
221- /// Creates a session with tool access for grounded responses.
222- /// - Parameters:
223- /// - instructions: System instructions for the session.
224- /// - tools: Tools the model can use during generation.
225- /// - Returns: A configured LanguageModelSession with tools, or nil if unavailable.
226- @available ( * , deprecated, message: " Use createCommandSession for tool-based sessions " )
227- func createSession( instructions: String , tools: [ any Tool ] ) -> LanguageModelSession ? {
228- self . createCommandSession ( instructions: instructions, tools: tools)
229- }
230-
231177 /// Clears any cached session state.
232178 /// This can help if the model gets into a bad state.
233179 func clearContext( ) {
0 commit comments