← Back to report

FoundationModels.swiftinterface 3,948 rows

1// swift-interface-format-version: 1.0
2// swift-compiler-version: Apple Swift version 6.3.2 (swiftlang-6.3.2.1.2 clang-2100.0.123.2)
3// swift-module-flags: -target arm64e-apple-ios26.5 -enable-objc-interop -enable-library-evolution -swift-version 6 -enforce-exclusivity=checked -O -library-level api -enable-upcoming-feature InternalImportsByDefault -enable-upcoming-feature MemberImportVisibility -enable-experimental-feature DebugDescriptionMacro -user-module-version 1.5.2 -module-name FoundationModels -package-name com.apple.foundationmodels
4// swift-module-flags-ignorable: -formal-cxx-interoperability-mode=off -interface-compiler-version 6.3.2
5public import CoreGraphics
6public import Foundation
7public import Observation
8public import Swift
9public import _Concurrency
1// swift-interface-format-version: 1.0
2// swift-compiler-version: Apple Swift version 6.4 (swiftlang-6.4.0.19.103 clang-2100.3.19.4)
3// swift-module-flags: -target arm64e-apple-ios27.0 -enable-objc-interop -enable-library-evolution -language-mode 6 -O -library-level api -enable-upcoming-feature InternalImportsByDefault -enable-upcoming-feature NonisolatedNonsendingByDefault -enable-upcoming-feature MemberImportVisibility -enable-experimental-feature DebugDescriptionMacro -user-module-version 2.0.51.3 -module-name FoundationModels -package-name com.apple.foundationmodels
4// swift-module-flags-ignorable: -formal-cxx-interoperability-mode=off -interface-compiler-version 6.4
5public import CoreGraphics
6public import CoreImage
7public import CoreVideo
8public import Foundation
9public import ImageIO
10public import Observation
11public import Swift
12public import _Concurrency
… 2 unchanged lines …
12@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
13@available(tvOS, unavailable)
14@available(watchOS, unavailable)
15@attached(extension, conformances: FoundationModels.Generable, names: named(init(_:)), named(generatedContent)) @attached(member, names: arbitrary) public macro Generable(description: Swift.String? = nil) = #externalMacro(module: "FoundationModelsMacros", type: "GenerableMacro")
16@available(iOS 26.4, macOS 26.4, visionOS 26.4, *)
17@available(tvOS, unavailable)
18@available(watchOS, unavailable)
19@attached(extension, conformances: FoundationModels.Generable, names: named(init(_:)), named(generatedContent)) @attached(member, names: arbitrary) public macro Generable(description: Swift.String? = nil, representNilExplicitlyInGeneratedContent: Swift.Bool) = #externalMacro(module: "FoundationModelsMacros", type: "GenerableMacro")
20@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
21@available(tvOS, unavailable)
22@available(watchOS, unavailable)
23@attached(peer) public macro Guide<T>(description: Swift.String? = nil, _ guides: FoundationModels.GenerationGuide<T>...) = #externalMacro(module: "FoundationModelsMacros", type: "GuideMacro") where T : FoundationModels.Generable
24@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
25@available(tvOS, unavailable)
26@available(watchOS, unavailable)
27@attached(peer) public macro Guide<RegexOutput>(description: Swift.String? = nil, _ guides: _StringProcessing.Regex<RegexOutput>) = #externalMacro(module: "FoundationModelsMacros", type: "GuideMacro")
28@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
29@available(tvOS, unavailable)
30@available(watchOS, unavailable)
31@attached(peer) public macro Guide(description: Swift.String) = #externalMacro(module: "FoundationModelsMacros", type: "GuideMacro")
32@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
33@available(tvOS, unavailable)
34@available(watchOS, unavailable)
35public protocol Generable : FoundationModels.ConvertibleFromGeneratedContent, FoundationModels.ConvertibleToGeneratedContent {
36 associatedtype PartiallyGenerated : FoundationModels.ConvertibleFromGeneratedContent = Self
37 static var generationSchema: FoundationModels.GenerationSchema { get }
38}
39@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
40@available(tvOS, unavailable)
41@available(watchOS, unavailable)
42extension FoundationModels.Generable {
43 public func asPartiallyGenerated() -> Self.PartiallyGenerated
44}
45@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
46@available(tvOS, unavailable)
47@available(watchOS, unavailable)
48public protocol ConvertibleFromGeneratedContent : Swift.SendableMetatype {
49 init(_ content: FoundationModels.GeneratedContent) throws
50}
51@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
52@available(tvOS, unavailable)
53@available(watchOS, unavailable)
54public protocol ConvertibleToGeneratedContent : FoundationModels.InstructionsRepresentable, FoundationModels.PromptRepresentable {
55 var generatedContent: FoundationModels.GeneratedContent { get }
56}
57@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
58@available(tvOS, unavailable)
59@available(watchOS, unavailable)
60extension FoundationModels.ConvertibleToGeneratedContent {
61 public var instructionsRepresentation: FoundationModels.Instructions {
62 get
63 }
64 public var promptRepresentation: FoundationModels.Prompt {
65 get
66 }
67}
68@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
69@available(tvOS, unavailable)
70@available(watchOS, unavailable)
71extension FoundationModels.Generable {
72 public typealias PartiallyGenerated = Self
73}
74@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
75@available(tvOS, unavailable)
76@available(watchOS, unavailable)
77extension Swift.Optional where Wrapped : FoundationModels.Generable {
78 public typealias PartiallyGenerated = Wrapped.PartiallyGenerated
79}
80@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
81@available(tvOS, unavailable)
82@available(watchOS, unavailable)
83extension Swift.Optional : FoundationModels.ConvertibleToGeneratedContent, FoundationModels.PromptRepresentable, FoundationModels.InstructionsRepresentable where Wrapped : FoundationModels.ConvertibleToGeneratedContent {
84 public var generatedContent: FoundationModels.GeneratedContent {
85 get
86 }
87}
88@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
89@available(tvOS, unavailable)
90@available(watchOS, unavailable)
91extension Swift.Bool : FoundationModels.Generable {
92 public static var generationSchema: FoundationModels.GenerationSchema {
93 get
94 }
95 public init(_ content: FoundationModels.GeneratedContent) throws
96 public var generatedContent: FoundationModels.GeneratedContent {
97 get
98 }
99}
100@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
101@available(tvOS, unavailable)
102@available(watchOS, unavailable)
103extension Swift.String : FoundationModels.Generable {
104 public static var generationSchema: FoundationModels.GenerationSchema {
105 get
106 }
107 public init(_ content: FoundationModels.GeneratedContent) throws
108 public var generatedContent: FoundationModels.GeneratedContent {
109 get
110 }
111}
112@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
113@available(tvOS, unavailable)
114@available(watchOS, unavailable)
115extension Swift.Int : FoundationModels.Generable {
116 public static var generationSchema: FoundationModels.GenerationSchema {
117 get
118 }
119 public init(_ content: FoundationModels.GeneratedContent) throws
120 public var generatedContent: FoundationModels.GeneratedContent {
121 get
122 }
123}
124@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
125@available(tvOS, unavailable)
126@available(watchOS, unavailable)
127extension Swift.Float : FoundationModels.Generable {
128 public static var generationSchema: FoundationModels.GenerationSchema {
129 get
130 }
131 public init(_ content: FoundationModels.GeneratedContent) throws
132 public var generatedContent: FoundationModels.GeneratedContent {
133 get
134 }
135}
136@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
137@available(tvOS, unavailable)
138@available(watchOS, unavailable)
139extension Swift.Double : FoundationModels.Generable {
140 public static var generationSchema: FoundationModels.GenerationSchema {
141 get
142 }
143 public init(_ content: FoundationModels.GeneratedContent) throws
144 public var generatedContent: FoundationModels.GeneratedContent {
145 get
146 }
147}
148@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
149@available(tvOS, unavailable)
150@available(watchOS, unavailable)
151extension Foundation.Decimal : FoundationModels.Generable {
152 public static var generationSchema: FoundationModels.GenerationSchema {
153 get
154 }
155 public init(_ content: FoundationModels.GeneratedContent) throws
156 public var generatedContent: FoundationModels.GeneratedContent {
157 get
158 }
159}
160@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
161@available(tvOS, unavailable)
162@available(watchOS, unavailable)
163extension Swift.Array : FoundationModels.Generable where Element : FoundationModels.Generable {
164 public typealias PartiallyGenerated = [Element.PartiallyGenerated]
165 public static var generationSchema: FoundationModels.GenerationSchema {
166 get
167 }
168}
169@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
170@available(tvOS, unavailable)
171@available(watchOS, unavailable)
172extension Swift.Array : FoundationModels.ConvertibleToGeneratedContent where Element : FoundationModels.ConvertibleToGeneratedContent {
173 public var generatedContent: FoundationModels.GeneratedContent {
174 get
175 }
176}
177@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
178@available(tvOS, unavailable)
179@available(watchOS, unavailable)
180extension Swift.Array : FoundationModels.ConvertibleFromGeneratedContent where Element : FoundationModels.ConvertibleFromGeneratedContent {
181 public init(_ content: FoundationModels.GeneratedContent) throws
182}
183@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
184@available(tvOS, unavailable)
185@available(watchOS, unavailable)
186extension Swift.Never : FoundationModels.Generable {
187 public static var generationSchema: FoundationModels.GenerationSchema {
188 get
189 }
190 public init(_ content: FoundationModels.GeneratedContent) throws
191 public var generatedContent: FoundationModels.GeneratedContent {
192 get
193 }
194}
195@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
196@available(tvOS, unavailable)
197@available(watchOS, unavailable)
198public struct GeneratedContent : Swift.Sendable, Swift.Equatable, FoundationModels.Generable, Swift.CustomDebugStringConvertible {
199 public static var generationSchema: FoundationModels.GenerationSchema {
200 get
201 }
202 public var id: FoundationModels.GenerationID?
203 public init(_ content: FoundationModels.GeneratedContent) throws
204 public var generatedContent: FoundationModels.GeneratedContent {
205 get
206 }
207 public init(properties: Swift.KeyValuePairs<Swift.String, any FoundationModels.ConvertibleToGeneratedContent>, id: FoundationModels.GenerationID? = nil)
208 public init<S>(properties: S, id: FoundationModels.GenerationID? = nil, uniquingKeysWith combine: (FoundationModels.GeneratedContent, FoundationModels.GeneratedContent) throws -> some ConvertibleToGeneratedContent) rethrows where S : Swift.Sequence, S.Element == (Swift.String, any FoundationModels.ConvertibleToGeneratedContent)
209 public init<S>(elements: S, id: FoundationModels.GenerationID? = nil) where S : Swift.Sequence, S.Element == any FoundationModels.ConvertibleToGeneratedContent
210 public init(_ value: some ConvertibleToGeneratedContent)
211 public init(_ value: some ConvertibleToGeneratedContent, id: FoundationModels.GenerationID)
212 public init(json: Swift.String) throws
213 public var jsonString: Swift.String {
214 get
215 }
216 public func value<Value>(_ type: Value.Type = Value.self) throws -> Value where Value : FoundationModels.ConvertibleFromGeneratedContent
217 public func value<Value>(_ type: Value.Type = Value.self, forProperty property: Swift.String) throws -> Value where Value : FoundationModels.ConvertibleFromGeneratedContent
218 public func value<Value>(_ type: Value?.Type = Value?.self, forProperty property: Swift.String) throws -> Value? where Value : FoundationModels.ConvertibleFromGeneratedContent
219 public var debugDescription: Swift.String {
220 get
221 }
222 public var isComplete: Swift.Bool {
223 get
224 }
225 public static func == (a: FoundationModels.GeneratedContent, b: FoundationModels.GeneratedContent) -> Swift.Bool
226}
227@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
228@available(tvOS, unavailable)
229@available(watchOS, unavailable)
230extension FoundationModels.GeneratedContent {
231 public enum Kind : Swift.Equatable, Swift.Sendable {
232 case null
233 case bool(Swift.Bool)
234 case number(Swift.Double)
235 case string(Swift.String)
236 case array([FoundationModels.GeneratedContent])
237 case structure(properties: [Swift.String : FoundationModels.GeneratedContent], orderedKeys: [Swift.String])
238 public static func == (a: FoundationModels.GeneratedContent.Kind, b: FoundationModels.GeneratedContent.Kind) -> Swift.Bool
239 }
240 public init(kind: FoundationModels.GeneratedContent.Kind, id: FoundationModels.GenerationID? = nil)
241 public var kind: FoundationModels.GeneratedContent.Kind {
242 get
243 }
244}
245@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
246@available(tvOS, unavailable)
247@available(watchOS, unavailable)
248public struct GenerationGuide<Value> {
249}
250@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
251@available(tvOS, unavailable)
252@available(watchOS, unavailable)
253extension FoundationModels.GenerationGuide where Value == Swift.String {
254 public static func constant(_ value: Swift.String) -> FoundationModels.GenerationGuide<Swift.String>
255 public static func anyOf(_ values: [Swift.String]) -> FoundationModels.GenerationGuide<Swift.String>
256 public static func pattern<Output>(_ regex: _StringProcessing.Regex<Output>) -> FoundationModels.GenerationGuide<Swift.String>
257}
258@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
259@available(tvOS, unavailable)
260@available(watchOS, unavailable)
261extension FoundationModels.GenerationGuide where Value == Swift.Int {
262 public static func minimum(_ value: Swift.Int) -> FoundationModels.GenerationGuide<Swift.Int>
263 public static func maximum(_ value: Swift.Int) -> FoundationModels.GenerationGuide<Swift.Int>
264 public static func range(_ range: Swift.ClosedRange<Swift.Int>) -> FoundationModels.GenerationGuide<Swift.Int>
265}
266@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
267@available(tvOS, unavailable)
268@available(watchOS, unavailable)
269extension FoundationModels.GenerationGuide where Value == Swift.Float {
270 public static func minimum(_ value: Swift.Float) -> FoundationModels.GenerationGuide<Swift.Float>
271 public static func maximum(_ value: Swift.Float) -> FoundationModels.GenerationGuide<Swift.Float>
272 public static func range(_ range: Swift.ClosedRange<Swift.Float>) -> FoundationModels.GenerationGuide<Swift.Float>
273}
274@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
275@available(tvOS, unavailable)
276@available(watchOS, unavailable)
277extension FoundationModels.GenerationGuide where Value == Foundation.Decimal {
278 public static func minimum(_ value: Foundation.Decimal) -> FoundationModels.GenerationGuide<Foundation.Decimal>
279 public static func maximum(_ value: Foundation.Decimal) -> FoundationModels.GenerationGuide<Foundation.Decimal>
280 public static func range(_ range: Swift.ClosedRange<Foundation.Decimal>) -> FoundationModels.GenerationGuide<Foundation.Decimal>
281}
282@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
283@available(tvOS, unavailable)
284@available(watchOS, unavailable)
285extension FoundationModels.GenerationGuide where Value == Swift.Double {
286 public static func minimum(_ value: Swift.Double) -> FoundationModels.GenerationGuide<Swift.Double>
287 public static func maximum(_ value: Swift.Double) -> FoundationModels.GenerationGuide<Swift.Double>
288 public static func range(_ range: Swift.ClosedRange<Swift.Double>) -> FoundationModels.GenerationGuide<Swift.Double>
289}
290@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
291@available(tvOS, unavailable)
292@available(watchOS, unavailable)
293extension FoundationModels.GenerationGuide {
294 public static func minimumCount<Element>(_ count: Swift.Int) -> FoundationModels.GenerationGuide<[Element]> where Value == [Element]
295 public static func maximumCount<Element>(_ count: Swift.Int) -> FoundationModels.GenerationGuide<[Element]> where Value == [Element]
296 public static func count<Element>(_ range: Swift.ClosedRange<Swift.Int>) -> FoundationModels.GenerationGuide<[Element]> where Value == [Element]
297 public static func count<Element>(_ count: Swift.Int) -> FoundationModels.GenerationGuide<[Element]> where Value == [Element]
298 public static func element<Element>(_ guide: FoundationModels.GenerationGuide<Element>) -> FoundationModels.GenerationGuide<[Element]> where Value == [Element]
299}
300@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
301@available(tvOS, unavailable)
302@available(watchOS, unavailable)
303@_documentation(visibility: private) extension FoundationModels.GenerationGuide where Value == [Swift.Never] {
304 @_documentation(visibility: private) @_alwaysEmitIntoClient public static func minimumCount(_ count: Swift.Int) -> FoundationModels.GenerationGuide<Value> {
305 fatalError("GenerationGuide<[Never]>.\(#function) should not be called.")
306 }
307 @_documentation(visibility: private) @_alwaysEmitIntoClient public static func maximumCount(_ count: Swift.Int) -> FoundationModels.GenerationGuide<Value> {
308 fatalError("GenerationGuide<[Never]>.\(#function) should not be called.")
309 }
310 @_documentation(visibility: private) @_alwaysEmitIntoClient public static func count(_ range: Swift.ClosedRange<Swift.Int>) -> FoundationModels.GenerationGuide<Value> {
311 fatalError("GenerationGuide<[Never]>.\(#function) should not be called.")
312 }
313 @_documentation(visibility: private) @_disfavoredOverload @_alwaysEmitIntoClient public static func count(_ count: Swift.Int) -> FoundationModels.GenerationGuide<Value> {
314 fatalError("GenerationGuide<[Never]>.\(#function) should not be called.")
315 }
316}
317@_hasMissingDesignatedInitializers @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
318@available(tvOS, unavailable)
319@available(watchOS, unavailable)
320final public class LanguageModelSession {
321 final public var transcript: FoundationModels.Transcript {
322 get
323 }
324 @objc deinit
325}
326@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
327@available(tvOS, unavailable)
328@available(watchOS, unavailable)
329extension FoundationModels.LanguageModelSession : nonisolated Observation.Observable {
330}
331@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
332@available(tvOS, unavailable)
333@available(watchOS, unavailable)
334extension FoundationModels.LanguageModelSession {
335 final public var isResponding: Swift.Bool {
336 get
337 }
338 @_disfavoredOverload convenience public init(model: FoundationModels.SystemLanguageModel = .default, tools: [any FoundationModels.Tool] = [], instructions: Swift.String? = nil)
339 convenience public init(model: FoundationModels.SystemLanguageModel = .default, tools: [any FoundationModels.Tool] = [], @FoundationModels.InstructionsBuilder instructions: () throws -> FoundationModels.Instructions) rethrows
340 convenience public init(model: FoundationModels.SystemLanguageModel = .default, tools: [any FoundationModels.Tool] = [], instructions: FoundationModels.Instructions? = nil)
341 convenience public init(model: FoundationModels.SystemLanguageModel = .default, tools: [any FoundationModels.Tool] = [], transcript: FoundationModels.Transcript)
342 final public func prewarm(promptPrefix: FoundationModels.Prompt? = nil)
343 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
344 @available(tvOS, unavailable)
345 @available(watchOS, unavailable)
346 public struct Response<Content> where Content : FoundationModels.Generable {
347 public let content: Content
348 public let rawContent: FoundationModels.GeneratedContent
349 public let transcriptEntries: Swift.ArraySlice<FoundationModels.Transcript.Entry>
350 }
351 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
352 @discardableResult
353 nonisolated(nonsending) final public func respond(to prompt: FoundationModels.Prompt, options: FoundationModels.GenerationOptions = GenerationOptions()) async throws -> FoundationModels.LanguageModelSession.Response<Swift.String>
354 #endif
355 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
356 @discardableResult
357 @_disfavoredOverload nonisolated(nonsending) final public func respond(to prompt: Swift.String, options: FoundationModels.GenerationOptions = GenerationOptions()) async throws -> FoundationModels.LanguageModelSession.Response<Swift.String>
358 #endif
359 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
360 @discardableResult
361 nonisolated(nonsending) final public func respond(options: FoundationModels.GenerationOptions = GenerationOptions(), @FoundationModels.PromptBuilder prompt: () throws -> FoundationModels.Prompt) async throws -> FoundationModels.LanguageModelSession.Response<Swift.String>
362 #endif
363 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
364 @discardableResult
365 nonisolated(nonsending) final public func respond(to prompt: FoundationModels.Prompt, schema: FoundationModels.GenerationSchema, includeSchemaInPrompt: Swift.Bool = true, options: FoundationModels.GenerationOptions = GenerationOptions()) async throws -> FoundationModels.LanguageModelSession.Response<FoundationModels.GeneratedContent>
366 #endif
367 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
368 @discardableResult
369 @_disfavoredOverload nonisolated(nonsending) final public func respond(to prompt: Swift.String, schema: FoundationModels.GenerationSchema, includeSchemaInPrompt: Swift.Bool = true, options: FoundationModels.GenerationOptions = GenerationOptions()) async throws -> FoundationModels.LanguageModelSession.Response<FoundationModels.GeneratedContent>
370 #endif
371 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
372 @discardableResult
373 nonisolated(nonsending) final public func respond(schema: FoundationModels.GenerationSchema, includeSchemaInPrompt: Swift.Bool = true, options: FoundationModels.GenerationOptions = GenerationOptions(), @FoundationModels.PromptBuilder prompt: () throws -> FoundationModels.Prompt) async throws -> FoundationModels.LanguageModelSession.Response<FoundationModels.GeneratedContent>
374 #endif
375 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
376 @discardableResult
377 nonisolated(nonsending) final public func respond<Content>(to prompt: FoundationModels.Prompt, generating type: Content.Type = Content.self, includeSchemaInPrompt: Swift.Bool = true, options: FoundationModels.GenerationOptions = GenerationOptions()) async throws -> FoundationModels.LanguageModelSession.Response<Content> where Content : FoundationModels.Generable
378 #endif
379 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
380 @discardableResult
381 @_disfavoredOverload nonisolated(nonsending) final public func respond<Content>(to prompt: Swift.String, generating type: Content.Type = Content.self, includeSchemaInPrompt: Swift.Bool = true, options: FoundationModels.GenerationOptions = GenerationOptions()) async throws -> FoundationModels.LanguageModelSession.Response<Content> where Content : FoundationModels.Generable
382 #endif
383 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
384 @discardableResult
385 nonisolated(nonsending) final public func respond<Content>(generating type: Content.Type = Content.self, includeSchemaInPrompt: Swift.Bool = true, options: FoundationModels.GenerationOptions = GenerationOptions(), @FoundationModels.PromptBuilder prompt: () throws -> FoundationModels.Prompt) async throws -> FoundationModels.LanguageModelSession.Response<Content> where Content : FoundationModels.Generable
386 #endif
387 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
388 @available(tvOS, unavailable)
389 @available(watchOS, unavailable)
390 final public func streamResponse(to prompt: FoundationModels.Prompt, schema: FoundationModels.GenerationSchema, includeSchemaInPrompt: Swift.Bool = true, options: FoundationModels.GenerationOptions = GenerationOptions()) -> sending FoundationModels.LanguageModelSession.ResponseStream<FoundationModels.GeneratedContent>
391}
392@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
393@available(tvOS, unavailable)
394@available(watchOS, unavailable)
395extension FoundationModels.LanguageModelSession : @unchecked Swift.Sendable {
396}
397@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
398@available(tvOS, unavailable)
399@available(watchOS, unavailable)
400extension FoundationModels.LanguageModelSession {
401 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
402 @available(tvOS, unavailable)
403 @available(watchOS, unavailable)
404 public enum GenerationError : Swift.Error, Foundation.LocalizedError {
405 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
406 @available(tvOS, unavailable)
407 @available(watchOS, unavailable)
408 public struct Context : Swift.Sendable {
409 public let debugDescription: Swift.String
410 public init(debugDescription: Swift.String)
411 }
412 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
413 @available(tvOS, unavailable)
414 @available(watchOS, unavailable)
415 public struct Refusal : Swift.Sendable {
416 public init(transcriptEntries: [FoundationModels.Transcript.Entry])
417 public var explanation: FoundationModels.LanguageModelSession.Response<Swift.String> {
418 get async throws
419 }
420 public var explanationStream: FoundationModels.LanguageModelSession.ResponseStream<Swift.String> {
421 get
422 }
423 }
424 case exceededContextWindowSize(FoundationModels.LanguageModelSession.GenerationError.Context)
425 case assetsUnavailable(FoundationModels.LanguageModelSession.GenerationError.Context)
426 case guardrailViolation(FoundationModels.LanguageModelSession.GenerationError.Context)
427 case unsupportedGuide(FoundationModels.LanguageModelSession.GenerationError.Context)
428 case unsupportedLanguageOrLocale(FoundationModels.LanguageModelSession.GenerationError.Context)
429 case decodingFailure(FoundationModels.LanguageModelSession.GenerationError.Context)
430 case rateLimited(FoundationModels.LanguageModelSession.GenerationError.Context)
431 case concurrentRequests(FoundationModels.LanguageModelSession.GenerationError.Context)
432 case refusal(FoundationModels.LanguageModelSession.GenerationError.Refusal, FoundationModels.LanguageModelSession.GenerationError.Context)
433 public var errorDescription: Swift.String? {
434 get
435 }
436 public var recoverySuggestion: Swift.String? {
437 get
438 }
439 public var failureReason: Swift.String? {
440 get
441 }
442 }
443 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
444 @available(tvOS, unavailable)
445 @available(watchOS, unavailable)
446 public struct ToolCallError : Swift.Error, Foundation.LocalizedError {
447 public var tool: any FoundationModels.Tool
448 public var underlyingError: any Swift.Error
449 public init(tool: any FoundationModels.Tool, underlyingError: any Swift.Error)
450 public var errorDescription: Swift.String? {
451 get
452 }
453 }
454}
455@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
456@available(tvOS, unavailable)
457@available(watchOS, unavailable)
458extension FoundationModels.LanguageModelSession {
459 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
460 @available(tvOS, unavailable)
461 @available(watchOS, unavailable)
462 public struct ResponseStream<Content> where Content : FoundationModels.Generable {
463 public struct Snapshot {
464 public var content: Content.PartiallyGenerated
465 public var rawContent: FoundationModels.GeneratedContent
466 }
467 }
468}
469@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
470@available(tvOS, unavailable)
471@available(watchOS, unavailable)
472extension FoundationModels.LanguageModelSession.ResponseStream : _Concurrency.AsyncSequence {
473 public typealias Element = FoundationModels.LanguageModelSession.ResponseStream<Content>.Snapshot
474 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
475 @available(tvOS, unavailable)
476 @available(watchOS, unavailable)
477 public struct AsyncIterator : _Concurrency.AsyncIteratorProtocol {
478 public mutating func next(isolation actor: isolated (any _Concurrency.Actor)? = #isolation) async throws -> FoundationModels.LanguageModelSession.ResponseStream<Content>.Snapshot?
479 @available(iOS 26.0, visionOS 26.0, macOS 26.0, *)
480 @available(tvOS, unavailable)
481 @available(watchOS, unavailable)
482 public typealias Element = FoundationModels.LanguageModelSession.ResponseStream<Content>.Snapshot
483 @available(iOS 26.0, visionOS 26.0, macOS 26.0, *)
484 @available(tvOS, unavailable)
485 @available(watchOS, unavailable)
486 @_implements(_Concurrency.AsyncIteratorProtocol, Failure) public typealias __AsyncIteratorProtocol_Failure = any Swift.Error
487 }
488 public func makeAsyncIterator() -> FoundationModels.LanguageModelSession.ResponseStream<Content>.AsyncIterator
489 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
490 nonisolated(nonsending) public func collect() async throws -> sending FoundationModels.LanguageModelSession.Response<Content>
491 #endif
492 @available(iOS 26.0, visionOS 26.0, macOS 26.0, *)
493 @available(tvOS, unavailable)
494 @available(watchOS, unavailable)
495 @_implements(_Concurrency.AsyncSequence, Failure) public typealias __AsyncSequence_Failure = any Swift.Error
496}
497@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
498@available(tvOS, unavailable)
499@available(watchOS, unavailable)
500extension FoundationModels.LanguageModelSession {
501 @_disfavoredOverload final public func streamResponse(to prompt: Swift.String, schema: FoundationModels.GenerationSchema, includeSchemaInPrompt: Swift.Bool = true, options: FoundationModels.GenerationOptions = GenerationOptions()) -> sending FoundationModels.LanguageModelSession.ResponseStream<FoundationModels.GeneratedContent>
502 final public func streamResponse(schema: FoundationModels.GenerationSchema, includeSchemaInPrompt: Swift.Bool = true, options: FoundationModels.GenerationOptions = GenerationOptions(), @FoundationModels.PromptBuilder prompt: () throws -> FoundationModels.Prompt) rethrows -> sending FoundationModels.LanguageModelSession.ResponseStream<FoundationModels.GeneratedContent>
503 final public func streamResponse<Content>(to prompt: FoundationModels.Prompt, generating type: Content.Type = Content.self, includeSchemaInPrompt: Swift.Bool = true, options: FoundationModels.GenerationOptions = GenerationOptions()) -> sending FoundationModels.LanguageModelSession.ResponseStream<Content> where Content : FoundationModels.Generable
504 @_disfavoredOverload final public func streamResponse<Content>(to prompt: Swift.String, generating type: Content.Type = Content.self, includeSchemaInPrompt: Swift.Bool = true, options: FoundationModels.GenerationOptions = GenerationOptions()) -> sending FoundationModels.LanguageModelSession.ResponseStream<Content> where Content : FoundationModels.Generable
505 final public func streamResponse<Content>(generating type: Content.Type = Content.self, includeSchemaInPrompt: Swift.Bool = true, options: FoundationModels.GenerationOptions = GenerationOptions(), @FoundationModels.PromptBuilder prompt: () throws -> FoundationModels.Prompt) rethrows -> sending FoundationModels.LanguageModelSession.ResponseStream<Content> where Content : FoundationModels.Generable
506 final public func streamResponse(to prompt: FoundationModels.Prompt, options: FoundationModels.GenerationOptions = GenerationOptions()) -> sending FoundationModels.LanguageModelSession.ResponseStream<Swift.String>
507 @_disfavoredOverload final public func streamResponse(to prompt: Swift.String, options: FoundationModels.GenerationOptions = GenerationOptions()) -> sending FoundationModels.LanguageModelSession.ResponseStream<Swift.String>
508 final public func streamResponse(options: FoundationModels.GenerationOptions = GenerationOptions(), @FoundationModels.PromptBuilder prompt: () throws -> FoundationModels.Prompt) rethrows -> sending FoundationModels.LanguageModelSession.ResponseStream<Swift.String>
509}
510@_hasMissingDesignatedInitializers @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
511@available(tvOS, unavailable)
512@available(watchOS, unavailable)
513final public class SystemLanguageModel : Swift.Sendable {
514 final public var availability: FoundationModels.SystemLanguageModel.Availability {
515 get
516 }
517 final public var isAvailable: Swift.Bool {
518 get
519 }
520 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
521 @available(tvOS, unavailable)
522 @available(watchOS, unavailable)
523 public struct UseCase : Swift.Sendable, Swift.Equatable {
524 public static let general: FoundationModels.SystemLanguageModel.UseCase
525 public static let contentTagging: FoundationModels.SystemLanguageModel.UseCase
526 public static func == (a: FoundationModels.SystemLanguageModel.UseCase, b: FoundationModels.SystemLanguageModel.UseCase) -> Swift.Bool
527 }
528 @objc deinit
529}
530@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
531@available(tvOS, unavailable)
532@available(watchOS, unavailable)
533extension FoundationModels.SystemLanguageModel : nonisolated Observation.Observable {
534}
535@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
536@available(tvOS, unavailable)
537@available(watchOS, unavailable)
538extension FoundationModels.SystemLanguageModel {
539 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
540 @available(tvOS, unavailable)
541 @available(watchOS, unavailable)
542 public struct Guardrails : Swift.Sendable {
543 public static let `default`: FoundationModels.SystemLanguageModel.Guardrails
544 public static let permissiveContentTransformations: FoundationModels.SystemLanguageModel.Guardrails
545 }
546}
547@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
548@available(tvOS, unavailable)
549@available(watchOS, unavailable)
550extension FoundationModels.SystemLanguageModel {
551 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
552 @available(tvOS, unavailable)
553 @available(watchOS, unavailable)
554 @frozen public enum Availability : Swift.Equatable, Swift.Sendable {
555 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
556 @available(tvOS, unavailable)
557 @available(watchOS, unavailable)
558 public enum UnavailableReason : Swift.Equatable, Swift.Sendable {
559 case deviceNotEligible
560 case appleIntelligenceNotEnabled
561 case modelNotReady
562 public static func == (a: FoundationModels.SystemLanguageModel.Availability.UnavailableReason, b: FoundationModels.SystemLanguageModel.Availability.UnavailableReason) -> Swift.Bool
563 public func hash(into hasher: inout Swift.Hasher)
564 public var hashValue: Swift.Int {
565 get
566 }
567 }
568 case available
569 case unavailable(FoundationModels.SystemLanguageModel.Availability.UnavailableReason)
570 public static func == (a: FoundationModels.SystemLanguageModel.Availability, b: FoundationModels.SystemLanguageModel.Availability) -> Swift.Bool
571 }
572 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
573 @available(tvOS, unavailable)
574 @available(watchOS, unavailable)
575 public static var `default`: FoundationModels.SystemLanguageModel {
576 get
577 }
578 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
579 @available(tvOS, unavailable)
580 @available(watchOS, unavailable)
581 convenience public init(useCase: FoundationModels.SystemLanguageModel.UseCase = .general, guardrails: FoundationModels.SystemLanguageModel.Guardrails = Guardrails.default)
582 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
583 @available(tvOS, unavailable)
584 @available(watchOS, unavailable)
585 convenience public init(adapter: FoundationModels.SystemLanguageModel.Adapter, guardrails: FoundationModels.SystemLanguageModel.Guardrails = .default)
586 final public var supportedLanguages: Swift.Set<Foundation.Locale.Language> {
587 get
588 }
589 final public func supportsLocale(_ locale: Foundation.Locale = Locale.current) -> Swift.Bool
590}
591@available(iOS 26.4, macOS 26.4, visionOS 26.4, *)
592@available(tvOS, unavailable)
593@available(watchOS, unavailable)
594extension FoundationModels.SystemLanguageModel {
595 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
596 @available(iOS 26.4, macOS 26.4, visionOS 26.4, *)
597 @available(tvOS, unavailable)
598 @available(watchOS, unavailable)
599 nonisolated(nonsending) final public func tokenCount(for prompt: some PromptRepresentable) async throws -> Swift.Int
600 #endif
601 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
602 @available(iOS 26.4, macOS 26.4, visionOS 26.4, *)
603 @available(tvOS, unavailable)
604 @available(watchOS, unavailable)
605 nonisolated(nonsending) final public func tokenCount(for instructions: FoundationModels.Instructions) async throws -> Swift.Int
606 #endif
607 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
608 @available(iOS 26.4, macOS 26.4, visionOS 26.4, *)
609 @available(tvOS, unavailable)
610 @available(watchOS, unavailable)
611 nonisolated(nonsending) final public func tokenCount(for tools: [any FoundationModels.Tool]) async throws -> Swift.Int
612 #endif
613 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
614 @available(iOS 26.4, macOS 26.4, visionOS 26.4, *)
615 @available(tvOS, unavailable)
616 @available(watchOS, unavailable)
617 nonisolated(nonsending) final public func tokenCount(for schema: FoundationModels.GenerationSchema) async throws -> Swift.Int
618 #endif
619 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
620 @available(iOS 26.4, macOS 26.4, visionOS 26.4, *)
621 @available(tvOS, unavailable)
622 @available(watchOS, unavailable)
623 nonisolated(nonsending) final public func tokenCount(for transcriptEntries: some Collection<Transcript.Entry>) async throws -> Swift.Int
624 #endif
625}
626@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
627@available(tvOS, unavailable)
628@available(watchOS, unavailable)
629extension FoundationModels.SystemLanguageModel {
630 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
631 @backDeployed(before: iOS 26.4, macOS 26.4, visionOS 26.4)
632 @available(tvOS, unavailable)
633 @available(watchOS, unavailable)
634 final public var contextSize: Swift.Int {
635 get {
636
637
638
639
640
641 4096
642 }
643 }
644}
645@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
646@available(tvOS, unavailable)
647@available(watchOS, unavailable)
648extension FoundationModels.SystemLanguageModel {
649 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
650 @available(tvOS, unavailable)
651 @available(watchOS, unavailable)
652 public struct Adapter {
653 public var creatorDefinedMetadata: [Swift.String : Any] {
654 get
655 }
656 }
657}
658@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
659@available(tvOS, unavailable)
660@available(watchOS, unavailable)
661extension FoundationModels.SystemLanguageModel.Adapter {
662 public init(fileURL: Foundation.URL) throws
663 public init(name: Swift.String) throws
664 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
665 @concurrent public func compile() async throws
666 #endif
667 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
668 @available(tvOS, unavailable)
669 @available(watchOS, unavailable)
670 public static func compatibleAdapterIdentifiers(name: Swift.String) -> [Swift.String]
671 public static func removeObsoleteAdapters() throws
672}
673@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
674@available(watchOS, unavailable)
675@available(tvOS, unavailable)
676extension FoundationModels.SystemLanguageModel.Adapter {
677 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
678 @available(watchOS, unavailable)
679 @available(tvOS, unavailable)
680 public enum AssetError : Swift.Error, Foundation.LocalizedError {
681 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
682 @available(tvOS, unavailable)
683 @available(watchOS, unavailable)
684 public struct Context : Swift.Sendable {
685 public let debugDescription: Swift.String
686 public init(debugDescription: Swift.String)
687 }
688 case invalidAsset(FoundationModels.SystemLanguageModel.Adapter.AssetError.Context)
689 case invalidAdapterName(FoundationModels.SystemLanguageModel.Adapter.AssetError.Context)
690 case compatibleAdapterNotFound(FoundationModels.SystemLanguageModel.Adapter.AssetError.Context)
691 public var errorDescription: Swift.String? {
692 get
693 }
694 public var recoverySuggestion: Swift.String? {
695 get
696 }
697 }
698}
699@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
700@available(tvOS, unavailable)
701@available(watchOS, unavailable)
702public struct Transcript : Swift.Sendable, Swift.Equatable, Swift.RandomAccessCollection {
703 public typealias Index = Swift.Int
704 public subscript(index: FoundationModels.Transcript.Index) -> FoundationModels.Transcript.Entry {
705 get
706 set
707 }
708 public var startIndex: Swift.Int {
709 get
710 }
711 public var endIndex: Swift.Int {
712 get
713 }
714 public init(entries: some Sequence<Entry> = [])
715 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
716 @available(tvOS, unavailable)
717 @available(watchOS, unavailable)
718 public enum Entry : Swift.Sendable, Swift.Identifiable, Swift.Equatable {
719 case instructions(FoundationModels.Transcript.Instructions)
720 case prompt(FoundationModels.Transcript.Prompt)
721 case toolCalls(FoundationModels.Transcript.ToolCalls)
722 case toolOutput(FoundationModels.Transcript.ToolOutput)
723 case response(FoundationModels.Transcript.Response)
724 public var id: Swift.String {
725 get
726 }
727 public static func == (a: FoundationModels.Transcript.Entry, b: FoundationModels.Transcript.Entry) -> Swift.Bool
728 @available(iOS 26.0, visionOS 26.0, macOS 26.0, *)
729 @available(tvOS, unavailable)
730 @available(watchOS, unavailable)
731 public typealias ID = Swift.String
732 }
733 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
734 @available(tvOS, unavailable)
735 @available(watchOS, unavailable)
736 public enum Segment : Swift.Sendable, Swift.Identifiable, Swift.Equatable {
737 case text(FoundationModels.Transcript.TextSegment)
738 case structure(FoundationModels.Transcript.StructuredSegment)
739 public var id: Swift.String {
740 get
741 }
742 public static func == (a: FoundationModels.Transcript.Segment, b: FoundationModels.Transcript.Segment) -> Swift.Bool
743 @available(iOS 26.0, visionOS 26.0, macOS 26.0, *)
744 @available(tvOS, unavailable)
745 @available(watchOS, unavailable)
746 public typealias ID = Swift.String
747 }
748 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
749 @available(tvOS, unavailable)
750 @available(watchOS, unavailable)
751 public struct TextSegment : Swift.Sendable, Swift.Identifiable, Swift.Equatable {
752 public var id: Swift.String
753 public var content: Swift.String
754 public init(id: Swift.String = UUID().uuidString, content: Swift.String)
755 public static func == (a: FoundationModels.Transcript.TextSegment, b: FoundationModels.Transcript.TextSegment) -> Swift.Bool
756 @available(iOS 26.0, visionOS 26.0, macOS 26.0, *)
757 @available(tvOS, unavailable)
758 @available(watchOS, unavailable)
759 public typealias ID = Swift.String
760 }
761 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
762 @available(tvOS, unavailable)
763 @available(watchOS, unavailable)
764 public struct StructuredSegment : Swift.Sendable, Swift.Identifiable, Swift.Equatable {
765 public var id: Swift.String
766 public var source: Swift.String
767 public var content: FoundationModels.GeneratedContent {
768 get
769 set
770 }
771 public init(id: Swift.String = UUID().uuidString, source: Swift.String, content: FoundationModels.GeneratedContent)
772 public static func == (a: FoundationModels.Transcript.StructuredSegment, b: FoundationModels.Transcript.StructuredSegment) -> Swift.Bool
773 @available(iOS 26.0, visionOS 26.0, macOS 26.0, *)
774 @available(tvOS, unavailable)
775 @available(watchOS, unavailable)
776 public typealias ID = Swift.String
777 }
778 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
779 @available(tvOS, unavailable)
780 @available(watchOS, unavailable)
781 public struct Instructions : Swift.Sendable, Swift.Identifiable, Swift.Equatable {
782 public var id: Swift.String
783 public var segments: [FoundationModels.Transcript.Segment]
784 public var toolDefinitions: [FoundationModels.Transcript.ToolDefinition]
785 public init(id: Swift.String = UUID().uuidString, segments: [FoundationModels.Transcript.Segment], toolDefinitions: [FoundationModels.Transcript.ToolDefinition])
786 public static func == (a: FoundationModels.Transcript.Instructions, b: FoundationModels.Transcript.Instructions) -> Swift.Bool
787 @available(iOS 26.0, visionOS 26.0, macOS 26.0, *)
788 @available(tvOS, unavailable)
789 @available(watchOS, unavailable)
790 public typealias ID = Swift.String
791 }
792 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
793 @available(tvOS, unavailable)
794 @available(watchOS, unavailable)
795 public struct ToolDefinition : Swift.Sendable, Swift.Equatable {
796 public var name: Swift.String
797 public var description: Swift.String
798 public init(name: Swift.String, description: Swift.String, parameters: FoundationModels.GenerationSchema)
799 public init(tool: some Tool)
800 public static func == (lhs: FoundationModels.Transcript.ToolDefinition, rhs: FoundationModels.Transcript.ToolDefinition) -> Swift.Bool
801 }
802 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
803 @available(tvOS, unavailable)
804 @available(watchOS, unavailable)
805 public struct Prompt : Swift.Sendable, Swift.Identifiable, Swift.Equatable {
806 public var id: Swift.String
807 public var segments: [FoundationModels.Transcript.Segment]
808 public var options: FoundationModels.GenerationOptions
809 public var responseFormat: FoundationModels.Transcript.ResponseFormat?
810 public init(id: Swift.String = UUID().uuidString, segments: [FoundationModels.Transcript.Segment], options: FoundationModels.GenerationOptions = GenerationOptions(), responseFormat: FoundationModels.Transcript.ResponseFormat? = nil)
811 public static func == (a: FoundationModels.Transcript.Prompt, b: FoundationModels.Transcript.Prompt) -> Swift.Bool
812 @available(iOS 26.0, visionOS 26.0, macOS 26.0, *)
813 @available(tvOS, unavailable)
814 @available(watchOS, unavailable)
815 public typealias ID = Swift.String
816 }
817 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
818 @available(tvOS, unavailable)
819 @available(watchOS, unavailable)
820 public struct ResponseFormat : Swift.Sendable, Swift.Equatable {
821 public var name: Swift.String {
822 get
823 }
824 public init<Content>(type: Content.Type) where Content : FoundationModels.Generable
825 public init(schema: FoundationModels.GenerationSchema)
826 public static func == (a: FoundationModels.Transcript.ResponseFormat, b: FoundationModels.Transcript.ResponseFormat) -> Swift.Bool
827 }
828 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
829 @available(tvOS, unavailable)
830 @available(watchOS, unavailable)
831 public struct ToolCalls : Swift.Sendable, Swift.Identifiable, Swift.Equatable, Swift.RandomAccessCollection {
832 public var id: Swift.String
833 public init<S>(id: Swift.String = UUID().uuidString, _ calls: S) where S : Swift.Sequence, S.Element == FoundationModels.Transcript.ToolCall
834 public subscript(position: Swift.Int) -> FoundationModels.Transcript.ToolCall {
835 get
836 }
837 public var startIndex: Swift.Int {
838 get
839 }
840 public var endIndex: Swift.Int {
841 get
842 }
843 public static func == (a: FoundationModels.Transcript.ToolCalls, b: FoundationModels.Transcript.ToolCalls) -> Swift.Bool
844 @available(iOS 26.0, visionOS 26.0, macOS 26.0, *)
845 @available(tvOS, unavailable)
846 @available(watchOS, unavailable)
847 public typealias Element = FoundationModels.Transcript.ToolCall
848 @available(iOS 26.0, visionOS 26.0, macOS 26.0, *)
849 @available(tvOS, unavailable)
850 @available(watchOS, unavailable)
851 public typealias ID = Swift.String
852 @available(iOS 26.0, visionOS 26.0, macOS 26.0, *)
853 @available(tvOS, unavailable)
854 @available(watchOS, unavailable)
855 public typealias Index = Swift.Int
856 @available(iOS 26.0, visionOS 26.0, macOS 26.0, *)
857 @available(tvOS, unavailable)
858 @available(watchOS, unavailable)
859 public typealias Indices = Swift.Range<Swift.Int>
860 @available(iOS 26.0, visionOS 26.0, macOS 26.0, *)
861 @available(tvOS, unavailable)
862 @available(watchOS, unavailable)
863 public typealias Iterator = Swift.IndexingIterator<FoundationModels.Transcript.ToolCalls>
864 @available(iOS 26.0, visionOS 26.0, macOS 26.0, *)
865 @available(tvOS, unavailable)
866 @available(watchOS, unavailable)
867 public typealias SubSequence = Swift.Slice<FoundationModels.Transcript.ToolCalls>
868 }
869 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
870 @available(tvOS, unavailable)
871 @available(watchOS, unavailable)
872 public struct ToolCall : Swift.Sendable, Swift.Identifiable, Swift.Equatable {
873 public var id: Swift.String
874 public var toolName: Swift.String
875 public var arguments: FoundationModels.GeneratedContent {
876 get
877 set
878 }
879 public init(id: Swift.String, toolName: Swift.String, arguments: FoundationModels.GeneratedContent)
880 public static func == (a: FoundationModels.Transcript.ToolCall, b: FoundationModels.Transcript.ToolCall) -> Swift.Bool
881 @available(iOS 26.0, visionOS 26.0, macOS 26.0, *)
882 @available(tvOS, unavailable)
883 @available(watchOS, unavailable)
884 public typealias ID = Swift.String
885 }
886 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
887 @available(tvOS, unavailable)
888 @available(watchOS, unavailable)
889 public struct ToolOutput : Swift.Sendable, Swift.Identifiable, Swift.Equatable {
890 public var id: Swift.String
891 public var toolName: Swift.String
892 public var segments: [FoundationModels.Transcript.Segment]
893 public init(id: Swift.String, toolName: Swift.String, segments: [FoundationModels.Transcript.Segment])
894 public static func == (a: FoundationModels.Transcript.ToolOutput, b: FoundationModels.Transcript.ToolOutput) -> Swift.Bool
895 @available(iOS 26.0, visionOS 26.0, macOS 26.0, *)
896 @available(tvOS, unavailable)
897 @available(watchOS, unavailable)
898 public typealias ID = Swift.String
899 }
900 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
901 @available(tvOS, unavailable)
902 @available(watchOS, unavailable)
903 public struct Response : Swift.Sendable, Swift.Identifiable, Swift.Equatable {
904 public var id: Swift.String
905 public var assetIDs: [Swift.String]
906 public var segments: [FoundationModels.Transcript.Segment]
907 public init(id: Swift.String = UUID().uuidString, assetIDs: [Swift.String], segments: [FoundationModels.Transcript.Segment])
908 public static func == (a: FoundationModels.Transcript.Response, b: FoundationModels.Transcript.Response) -> Swift.Bool
909 @available(iOS 26.0, visionOS 26.0, macOS 26.0, *)
910 @available(tvOS, unavailable)
911 @available(watchOS, unavailable)
912 public typealias ID = Swift.String
913 }
914 public static func == (a: FoundationModels.Transcript, b: FoundationModels.Transcript) -> Swift.Bool
915 @available(iOS 26.0, visionOS 26.0, macOS 26.0, *)
916 @available(tvOS, unavailable)
917 @available(watchOS, unavailable)
918 public typealias Element = FoundationModels.Transcript.Entry
919 @available(iOS 26.0, visionOS 26.0, macOS 26.0, *)
920 @available(tvOS, unavailable)
921 @available(watchOS, unavailable)
922 public typealias Indices = Swift.Range<FoundationModels.Transcript.Index>
923 @available(iOS 26.0, visionOS 26.0, macOS 26.0, *)
924 @available(tvOS, unavailable)
925 @available(watchOS, unavailable)
926 public typealias Iterator = Swift.IndexingIterator<FoundationModels.Transcript>
927 @available(iOS 26.0, visionOS 26.0, macOS 26.0, *)
928 @available(tvOS, unavailable)
929 @available(watchOS, unavailable)
930 public typealias SubSequence = Swift.Slice<FoundationModels.Transcript>
931}
932@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
933@available(watchOS, unavailable)
934@available(tvOS, unavailable)
935extension FoundationModels.Transcript : Swift.Codable {
936 public init(from decoder: any Swift.Decoder) throws
937 public func encode(to encoder: any Swift.Encoder) throws
938}
939@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
940@available(watchOS, unavailable)
941@available(tvOS, unavailable)
942extension FoundationModels.Transcript.Entry : Swift.CustomStringConvertible {
943 public var description: Swift.String {
944 get
945 }
946}
947@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
948@available(watchOS, unavailable)
949@available(tvOS, unavailable)
950extension FoundationModels.Transcript.TextSegment : Swift.CustomStringConvertible {
951 public var description: Swift.String {
952 get
953 }
954}
955@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
956@available(watchOS, unavailable)
957@available(tvOS, unavailable)
958extension FoundationModels.Transcript.StructuredSegment : Swift.CustomStringConvertible {
959 public var description: Swift.String {
960 get
961 }
962}
963@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
964@available(watchOS, unavailable)
965@available(tvOS, unavailable)
966extension FoundationModels.Transcript.Segment : Swift.CustomStringConvertible {
967 public var description: Swift.String {
968 get
969 }
970}
971@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
972@available(watchOS, unavailable)
973@available(tvOS, unavailable)
974extension FoundationModels.Transcript.Instructions : Swift.CustomStringConvertible {
975 public var description: Swift.String {
976 get
977 }
978}
979@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
980@available(watchOS, unavailable)
981@available(tvOS, unavailable)
982extension FoundationModels.Transcript.Prompt : Swift.CustomStringConvertible {
983 public var description: Swift.String {
984 get
985 }
986}
987@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
988@available(watchOS, unavailable)
989@available(tvOS, unavailable)
990extension FoundationModels.Transcript.ResponseFormat : Swift.CustomStringConvertible {
991 public var description: Swift.String {
992 get
993 }
994}
995@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
996@available(watchOS, unavailable)
997@available(tvOS, unavailable)
998extension FoundationModels.Transcript.ToolCalls : Swift.CustomStringConvertible {
999 public var description: Swift.String {
1000 get
1001 }
1002}
1003@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1004@available(watchOS, unavailable)
1005@available(tvOS, unavailable)
1006extension FoundationModels.Transcript.ToolCall : Swift.CustomStringConvertible {
1007 public var description: Swift.String {
1008 get
1009 }
1010}
1011@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1012@available(watchOS, unavailable)
1013@available(tvOS, unavailable)
1014extension FoundationModels.Transcript.ToolOutput : Swift.CustomStringConvertible {
1015 public var description: Swift.String {
1016 get
1017 }
1018}
1019@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1020@available(watchOS, unavailable)
1021@available(tvOS, unavailable)
1022extension FoundationModels.Transcript.Response : Swift.CustomStringConvertible {
1023 public var description: Swift.String {
1024 get
1025 }
1026}
1027@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1028@available(tvOS, unavailable)
1029@available(watchOS, unavailable)
1030public struct Instructions : Swift.Sendable {
1031 public init(_ content: some InstructionsRepresentable)
1032 @usableFromInline
1033 internal init<each I>(_ components: repeat each I) where repeat each I : FoundationModels.InstructionsRepresentable
1034}
1035@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1036@available(tvOS, unavailable)
1037@available(watchOS, unavailable)
1038public protocol InstructionsRepresentable {
1039 @FoundationModels.InstructionsBuilder var instructionsRepresentation: FoundationModels.Instructions { get }
1040}
1041@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1042@available(tvOS, unavailable)
1043@available(watchOS, unavailable)
1044extension FoundationModels.Instructions : FoundationModels.InstructionsRepresentable {
1045 public var instructionsRepresentation: FoundationModels.Instructions {
1046 get
1047 }
1048}
1049@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1050@available(tvOS, unavailable)
1051@available(watchOS, unavailable)
1052extension Swift.String : FoundationModels.InstructionsRepresentable {
1053 public var instructionsRepresentation: FoundationModels.Instructions {
1054 get
1055 }
1056}
1057@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1058@available(tvOS, unavailable)
1059@available(watchOS, unavailable)
1060extension Swift.Array : FoundationModels.InstructionsRepresentable where Element : FoundationModels.InstructionsRepresentable {
1061 public var instructionsRepresentation: FoundationModels.Instructions {
1062 get
1063 }
1064}
1065@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1066@available(tvOS, unavailable)
1067@available(watchOS, unavailable)
1068@_functionBuilder public struct InstructionsBuilder {
1069 @_alwaysEmitIntoClient public static func buildBlock<each I>(_ components: repeat each I) -> FoundationModels.Instructions where repeat each I : FoundationModels.InstructionsRepresentable {
1070 Instructions(repeat each components)
1071 }
1072 @_alwaysEmitIntoClient public static func buildArray(_ instructions: [some InstructionsRepresentable]) -> FoundationModels.Instructions {
1073 Instructions(instructions)
1074 }
1075 @_alwaysEmitIntoClient public static func buildEither(first component: some InstructionsRepresentable) -> FoundationModels.Instructions {
1076 Instructions(component)
1077 }
1078 @_alwaysEmitIntoClient public static func buildEither(second component: some InstructionsRepresentable) -> FoundationModels.Instructions {
1079 Instructions(component)
1080 }
1081 @_alwaysEmitIntoClient public static func buildOptional(_ instructions: FoundationModels.Instructions?) -> FoundationModels.Instructions {
1082 instructions ?? Instructions()
1083 }
1084 @_alwaysEmitIntoClient public static func buildLimitedAvailability(_ instructions: some InstructionsRepresentable) -> FoundationModels.Instructions {
1085 Instructions(instructions)
1086 }
1087 @_disfavoredOverload @_alwaysEmitIntoClient public static func buildExpression<I>(_ expression: I) -> I where I : FoundationModels.InstructionsRepresentable {
1088 expression
1089 }
1090 @_alwaysEmitIntoClient public static func buildExpression(_ expression: FoundationModels.Instructions) -> FoundationModels.Instructions {
1091 expression
1092 }
1093 @available(*, unavailable, message: "Only `Instructions` and `InstructionsRepresentable` are supported.")
1094 @_alwaysEmitIntoClient public static func buildExpression<T>(_ expression: T) -> FoundationModels.Instructions {
1095 fatalError()
1096 }
1097}
1098@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1099@available(tvOS, unavailable)
1100@available(watchOS, unavailable)
1101extension FoundationModels.Instructions {
1102 public init(@FoundationModels.InstructionsBuilder _ content: () throws -> FoundationModels.Instructions) rethrows
1103}
1104@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1105@available(tvOS, unavailable)
1106@available(watchOS, unavailable)
1107public struct Prompt : Swift.Sendable {
1108 public init(_ content: some PromptRepresentable)
1109 @usableFromInline
1110 internal init<each P>(_ components: repeat each P) where repeat each P : FoundationModels.PromptRepresentable
1111}
1112@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1113@available(tvOS, unavailable)
1114@available(watchOS, unavailable)
1115public protocol PromptRepresentable {
1116 @FoundationModels.PromptBuilder var promptRepresentation: FoundationModels.Prompt { get }
1117}
1118@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1119@available(tvOS, unavailable)
1120@available(watchOS, unavailable)
1121extension FoundationModels.Prompt : FoundationModels.PromptRepresentable {
1122 public var promptRepresentation: FoundationModels.Prompt {
1123 get
1124 }
1125}
1126@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1127@available(tvOS, unavailable)
1128@available(watchOS, unavailable)
1129extension Swift.String : FoundationModels.PromptRepresentable {
1130 public var promptRepresentation: FoundationModels.Prompt {
1131 get
1132 }
1133}
1134@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1135@available(tvOS, unavailable)
1136@available(watchOS, unavailable)
1137extension Swift.Array : FoundationModels.PromptRepresentable where Element : FoundationModels.PromptRepresentable {
1138 public var promptRepresentation: FoundationModels.Prompt {
1139 get
1140 }
1141}
1142@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1143@available(tvOS, unavailable)
1144@available(watchOS, unavailable)
1145@_functionBuilder public struct PromptBuilder {
1146 @_alwaysEmitIntoClient public static func buildBlock<each P>(_ components: repeat each P) -> FoundationModels.Prompt where repeat each P : FoundationModels.PromptRepresentable {
1147 Prompt(repeat each components)
1148 }
1149 @_alwaysEmitIntoClient public static func buildArray(_ prompts: [some PromptRepresentable]) -> FoundationModels.Prompt {
1150 Prompt(prompts)
1151 }
1152 @_alwaysEmitIntoClient public static func buildEither(first component: some PromptRepresentable) -> FoundationModels.Prompt {
1153 Prompt(component)
1154 }
1155 @_alwaysEmitIntoClient public static func buildEither(second component: some PromptRepresentable) -> FoundationModels.Prompt {
1156 Prompt(component)
1157 }
1158 @_alwaysEmitIntoClient public static func buildOptional(_ component: FoundationModels.Prompt?) -> FoundationModels.Prompt {
1159 component ?? Prompt()
1160 }
1161 @_alwaysEmitIntoClient public static func buildLimitedAvailability(_ prompt: some PromptRepresentable) -> FoundationModels.Prompt {
1162 Prompt(prompt)
1163 }
1164 @_disfavoredOverload @_alwaysEmitIntoClient public static func buildExpression<P>(_ expression: P) -> P where P : FoundationModels.PromptRepresentable {
1165 expression
1166 }
1167 @_alwaysEmitIntoClient public static func buildExpression(_ expression: FoundationModels.Prompt) -> FoundationModels.Prompt {
1168 expression
1169 }
1170 @available(*, unavailable, message: "Only `Prompt` and `PromptRepresentable` are supported.")
1171 @_alwaysEmitIntoClient public static func buildExpression<T>(_ expression: T) -> FoundationModels.Prompt {
1172 fatalError()
1173 }
1174}
1175@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1176@available(tvOS, unavailable)
1177@available(watchOS, unavailable)
1178extension FoundationModels.Prompt {
1179 public init(@FoundationModels.PromptBuilder _ content: () throws -> FoundationModels.Prompt) rethrows
1180}
1181@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1182@available(tvOS, unavailable)
1183@available(watchOS, unavailable)
1184public protocol Tool<Arguments, Output> : Swift.Sendable {
1185 associatedtype Output : FoundationModels.PromptRepresentable
1186 associatedtype Arguments : FoundationModels.ConvertibleFromGeneratedContent
1187 var name: Swift.String { get }
1188 var description: Swift.String { get }
1189 var parameters: FoundationModels.GenerationSchema { get }
1190 var includesSchemaInInstructions: Swift.Bool { get }
1191 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
1192 @concurrent func call(arguments: Self.Arguments) async throws -> Self.Output
1193 #endif
1194}
1195@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1196@available(tvOS, unavailable)
1197@available(watchOS, unavailable)
1198extension FoundationModels.Tool {
1199 public var name: Swift.String {
1200 get
1201 }
1202 public var includesSchemaInInstructions: Swift.Bool {
1203 get
1204 }
1205}
1206@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1207@available(tvOS, unavailable)
1208@available(watchOS, unavailable)
1209extension FoundationModels.Tool where Self.Arguments : FoundationModels.Generable {
1210 public var parameters: FoundationModels.GenerationSchema {
1211 get
1212 }
1213}
1214@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1215@available(tvOS, unavailable)
1216@available(watchOS, unavailable)
1217extension FoundationModels.Tool where Self.Arguments == Swift.String {
1218 @available(*, unavailable, message: "'Tool' that uses 'String' as 'Arguments' type is unsupported. Use '@Generable' struct instead.")
1219 public var parameters: FoundationModels.GenerationSchema {
1220 get
1221 }
1222}
1223@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1224@available(tvOS, unavailable)
1225@available(watchOS, unavailable)
1226extension FoundationModels.Tool where Self.Arguments == Swift.Int {
1227 @available(*, unavailable, message: "'Tool' that uses 'Int' as 'Arguments' type is unsupported. Use '@Generable' struct instead.")
1228 public var parameters: FoundationModels.GenerationSchema {
1229 get
1230 }
1231}
1232@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1233@available(tvOS, unavailable)
1234@available(watchOS, unavailable)
1235extension FoundationModels.Tool where Self.Arguments == Swift.Double {
1236 @available(*, unavailable, message: "'Tool' that uses 'Double' as 'Arguments' type is unsupported. Use '@Generable' struct instead.")
1237 public var parameters: FoundationModels.GenerationSchema {
1238 get
1239 }
1240}
1241@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1242@available(tvOS, unavailable)
1243@available(watchOS, unavailable)
1244extension FoundationModels.Tool where Self.Arguments == Swift.Float {
1245 @available(*, unavailable, message: "'Tool' that uses 'Float' as 'Arguments' type is unsupported. Use '@Generable' struct instead.")
1246 public var parameters: FoundationModels.GenerationSchema {
1247 get
1248 }
1249}
1250@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1251@available(tvOS, unavailable)
1252@available(watchOS, unavailable)
1253extension FoundationModels.Tool where Self.Arguments == Foundation.Decimal {
1254 @available(*, unavailable, message: "'Tool' that uses 'Decimal' as 'Arguments' type is unsupported. Use '@Generable' struct instead.")
1255 public var parameters: FoundationModels.GenerationSchema {
1256 get
1257 }
1258}
1259@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1260@available(tvOS, unavailable)
1261@available(watchOS, unavailable)
1262extension FoundationModels.Tool where Self.Arguments == Swift.Bool {
1263 @available(*, unavailable, message: "'Tool' that uses 'Bool' as 'Arguments' type is unsupported. Use '@Generable' struct instead.")
1264 public var parameters: FoundationModels.GenerationSchema {
1265 get
1266 }
1267}
1268@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1269@available(tvOS, unavailable)
1270@available(watchOS, unavailable)
1271public struct DynamicGenerationSchema : Swift.Sendable {
1272 @available(iOS 26.4, macOS 26.4, visionOS 26.4, *)
1273 @available(tvOS, unavailable)
1274 @available(watchOS, unavailable)
1275 public static var null: FoundationModels.DynamicGenerationSchema {
1276 get
1277 }
1278 public init(name: Swift.String, description: Swift.String? = nil, properties: [FoundationModels.DynamicGenerationSchema.Property])
1279 @available(iOS 26.4, macOS 26.4, visionOS 26.4, *)
1280 @available(tvOS, unavailable)
1281 @available(watchOS, unavailable)
1282 public init(name: Swift.String, description: Swift.String? = nil, representNilExplicitlyInGeneratedContent explicitNil: Swift.Bool, properties: [FoundationModels.DynamicGenerationSchema.Property])
1283 public init(name: Swift.String, description: Swift.String? = nil, anyOf choices: [FoundationModels.DynamicGenerationSchema])
1284 public init(name: Swift.String, description: Swift.String? = nil, anyOf choices: [Swift.String])
1285 public init(arrayOf itemSchema: FoundationModels.DynamicGenerationSchema, minimumElements: Swift.Int? = nil, maximumElements: Swift.Int? = nil)
1286 public init<Value>(type: Value.Type, guides: [FoundationModels.GenerationGuide<Value>] = []) where Value : FoundationModels.Generable
1287 public init(referenceTo name: Swift.String)
1288 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1289 @available(tvOS, unavailable)
1290 @available(watchOS, unavailable)
1291 public struct Property {
1292 public init(name: Swift.String, description: Swift.String? = nil, schema: FoundationModels.DynamicGenerationSchema, isOptional: Swift.Bool = false)
1293 }
1294}
1295@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1296@available(tvOS, unavailable)
1297@available(watchOS, unavailable)
1298public struct GenerationID : Swift.Sendable, Swift.Hashable {
1299 public init()
1300 public static func == (a: FoundationModels.GenerationID, b: FoundationModels.GenerationID) -> Swift.Bool
1301 public func hash(into hasher: inout Swift.Hasher)
1302 public var hashValue: Swift.Int {
1303 get
1304 }
1305}
1306@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1307@available(tvOS, unavailable)
1308@available(watchOS, unavailable)
1309public struct GenerationOptions : Swift.Sendable, Swift.Equatable {
1310 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1311 @available(tvOS, unavailable)
1312 @available(watchOS, unavailable)
1313 public struct SamplingMode : Swift.Sendable, Swift.Equatable {
1314 public static var greedy: FoundationModels.GenerationOptions.SamplingMode {
1315 get
1316 }
1317 public static func random(top k: Swift.Int, seed: Swift.UInt64? = nil) -> FoundationModels.GenerationOptions.SamplingMode
1318 public static func random(probabilityThreshold: Swift.Double, seed: Swift.UInt64? = nil) -> FoundationModels.GenerationOptions.SamplingMode
1319 public static func == (a: FoundationModels.GenerationOptions.SamplingMode, b: FoundationModels.GenerationOptions.SamplingMode) -> Swift.Bool
1320 }
1321 public var sampling: FoundationModels.GenerationOptions.SamplingMode?
1322 public var temperature: Swift.Double?
1323 public var maximumResponseTokens: Swift.Int?
1324 public init(sampling: FoundationModels.GenerationOptions.SamplingMode? = nil, temperature: Swift.Double? = nil, maximumResponseTokens: Swift.Int? = nil)
1325 public static func == (a: FoundationModels.GenerationOptions, b: FoundationModels.GenerationOptions) -> Swift.Bool
1326}
1327@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1328@available(tvOS, unavailable)
1329@available(watchOS, unavailable)
1330public struct GenerationSchema : Swift.Sendable, Swift.Codable, Swift.CustomDebugStringConvertible {
1331 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1332 @available(tvOS, unavailable)
1333 @available(watchOS, unavailable)
1334 public struct Property : Swift.Sendable {
1335 public init<Value>(name: Swift.String, description: Swift.String? = nil, type: Value.Type, guides: [FoundationModels.GenerationGuide<Value>] = []) where Value : FoundationModels.Generable
1336 public init<Value>(name: Swift.String, description: Swift.String? = nil, type: Value?.Type, guides: [FoundationModels.GenerationGuide<Value>] = []) where Value : FoundationModels.Generable
1337 public init<RegexOutput>(name: Swift.String, description: Swift.String? = nil, type: Swift.String.Type, guides: [_StringProcessing.Regex<RegexOutput>] = [])
1338 public init<RegexOutput>(name: Swift.String, description: Swift.String? = nil, type: Swift.String?.Type, guides: [_StringProcessing.Regex<RegexOutput>] = [])
1339 }
1340 public var debugDescription: Swift.String {
1341 get
1342 }
1343 public init(type: any FoundationModels.Generable.Type, description: Swift.String? = nil, properties: [FoundationModels.GenerationSchema.Property])
1344 @available(iOS 26.4, macOS 26.4, visionOS 26.4, *)
1345 @available(tvOS, unavailable)
1346 @available(watchOS, unavailable)
1347 public init(type: any FoundationModels.Generable.Type, description: Swift.String? = nil, representNilExplicitlyInGeneratedContent explicitNil: Swift.Bool, properties: [FoundationModels.GenerationSchema.Property])
1348 public init(type: any FoundationModels.Generable.Type, description: Swift.String? = nil, anyOf choices: [Swift.String])
1349 public init(type: any FoundationModels.Generable.Type, description: Swift.String? = nil, anyOf types: [any FoundationModels.Generable.Type])
1350 public init(root: FoundationModels.DynamicGenerationSchema, dependencies: [FoundationModels.DynamicGenerationSchema]) throws
1351 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1352 @available(tvOS, unavailable)
1353 @available(watchOS, unavailable)
1354 public enum SchemaError : Swift.Error, Foundation.LocalizedError {
1355 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1356 @available(tvOS, unavailable)
1357 @available(watchOS, unavailable)
1358 public struct Context : Swift.Sendable {
1359 public let debugDescription: Swift.String
1360 public init(debugDescription: Swift.String)
1361 }
1362 case duplicateType(schema: Swift.String?, type: Swift.String, context: FoundationModels.GenerationSchema.SchemaError.Context)
1363 case duplicateProperty(schema: Swift.String, property: Swift.String, context: FoundationModels.GenerationSchema.SchemaError.Context)
1364 case emptyTypeChoices(schema: Swift.String, context: FoundationModels.GenerationSchema.SchemaError.Context)
1365 case undefinedReferences(schema: Swift.String?, references: [Swift.String], context: FoundationModels.GenerationSchema.SchemaError.Context)
1366 public var errorDescription: Swift.String? {
1367 get
1368 }
1369 public var recoverySuggestion: Swift.String? {
1370 get
1371 }
1372 }
1373 public init(from decoder: any Swift.Decoder) throws
1374 public func encode(to encoder: any Swift.Encoder) throws
1375}
1376@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1377@available(tvOS, unavailable)
1378@available(watchOS, unavailable)
1379public struct LanguageModelFeedback {
1380 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1381 @available(tvOS, unavailable)
1382 @available(watchOS, unavailable)
1383 public enum Sentiment : Swift.Sendable, Swift.CaseIterable {
1384 case positive
1385 case negative
1386 case neutral
1387 public static func == (a: FoundationModels.LanguageModelFeedback.Sentiment, b: FoundationModels.LanguageModelFeedback.Sentiment) -> Swift.Bool
1388 @available(iOS 26.0, visionOS 26.0, macOS 26.0, *)
1389 @available(tvOS, unavailable)
1390 @available(watchOS, unavailable)
1391 public typealias AllCases = [FoundationModels.LanguageModelFeedback.Sentiment]
1392 nonisolated public static var allCases: [FoundationModels.LanguageModelFeedback.Sentiment] {
1393 get
1394 }
1395 public func hash(into hasher: inout Swift.Hasher)
1396 public var hashValue: Swift.Int {
1397 get
1398 }
1399 }
1400 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1401 @available(tvOS, unavailable)
1402 @available(watchOS, unavailable)
1403 public struct Issue : Swift.Sendable {
1404 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1405 @available(tvOS, unavailable)
1406 @available(watchOS, unavailable)
1407 public enum Category : Swift.Sendable, Swift.CaseIterable {
1408 case unhelpful
1409 case tooVerbose
1410 case didNotFollowInstructions
15@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
16@available(tvOS, unavailable)
17@available(watchOS, unavailable)
18extension FoundationModels::LanguageModelSession.FoundationModels::GenerationError.FoundationModels::Refusal {
19 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
20 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
21 @available(tvOS, unavailable)
22 @available(watchOS, unavailable)
23 nonisolated(nonsending) public var explanation: FoundationModels::LanguageModelSession.FoundationModels::Response<Swift::String> {
24 get async throws
25 }
26 #endif
27 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
28 @available(tvOS, unavailable)
29 @available(watchOS, unavailable)
30 public var explanationStream: FoundationModels::LanguageModelSession.FoundationModels::ResponseStream<Swift::String> {
31 get
32 }
33}
34@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
35@available(tvOS, unavailable)
36@available(watchOS, unavailable)
37extension FoundationModels::LanguageModelSession {
38 @_disfavoredOverload convenience public init(model: FoundationModels::SystemLanguageModel = .default, tools: [any FoundationModels::Tool] = [], instructions: Swift::String? = nil)
39 convenience public init(model: FoundationModels::SystemLanguageModel = .default, tools: [any FoundationModels::Tool] = [], @FoundationModels::InstructionsBuilder instructions: () throws -> FoundationModels::Instructions) rethrows
40 convenience public init(model: FoundationModels::SystemLanguageModel = .default, tools: [any FoundationModels::Tool] = [], instructions: FoundationModels::Instructions? = nil)
41 convenience public init(model: FoundationModels::SystemLanguageModel = .default, tools: [any FoundationModels::Tool] = [], transcript: FoundationModels::Transcript)
42}
43@_hasMissingDesignatedInitializers @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
44@available(tvOS, unavailable)
45final public class PrivateCloudComputeLanguageModel : Swift::Sendable {
46 final public var availability: FoundationModels::PrivateCloudComputeLanguageModel.FoundationModels::Availability {
47 get
48 }
49 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
50 @available(tvOS, unavailable)
51 final public var quotaUsage: FoundationModels::PrivateCloudComputeLanguageModel.FoundationModels::QuotaUsage {
52 get
53 }
54 final public var isAvailable: Swift::Bool {
55 get
56 }
57 @objc deinit
58}
59@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
60@available(tvOS, unavailable)
61extension FoundationModels::PrivateCloudComputeLanguageModel {
62 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
63 @available(tvOS, unavailable)
64 convenience public init()
65}
66@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
67@available(tvOS, unavailable)
68extension FoundationModels::PrivateCloudComputeLanguageModel {
69 @frozen public enum Availability : Swift::Equatable, Swift::Sendable {
70 case available
71 case unavailable(FoundationModels::PrivateCloudComputeLanguageModel.FoundationModels::Availability.FoundationModels::UnavailableReason)
72 public enum UnavailableReason : Swift::Equatable, Swift::Sendable {
73 case deviceNotEligible
74 case systemNotReady
75 public static func == (a: FoundationModels::PrivateCloudComputeLanguageModel.FoundationModels::Availability.FoundationModels::UnavailableReason, b: FoundationModels::PrivateCloudComputeLanguageModel.FoundationModels::Availability.FoundationModels::UnavailableReason) -> Swift::Bool
76 public func hash(into hasher: inout Swift::Hasher)
77 public var hashValue: Swift::Int {
78 get
79 }
80 }
81 public static func == (a: FoundationModels::PrivateCloudComputeLanguageModel.FoundationModels::Availability, b: FoundationModels::PrivateCloudComputeLanguageModel.FoundationModels::Availability) -> Swift::Bool
82 }
83}
84@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
85@available(tvOS, unavailable)
86extension FoundationModels::PrivateCloudComputeLanguageModel : nonisolated Observation::Observable {
87}
88@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
89@available(tvOS, unavailable)
90extension FoundationModels::PrivateCloudComputeLanguageModel : FoundationModels::LanguageModel {
91 final public var capabilities: FoundationModels::LanguageModelCapabilities {
92 get
93 }
94 final public var executorConfiguration: FoundationModels::PrivateCloudComputeLanguageModel.FoundationModels::Executor.FoundationModels::Configuration {
95 get
96 }
97 public struct Executor : FoundationModels::LanguageModelExecutor {
98 public typealias Model = FoundationModels::PrivateCloudComputeLanguageModel
99 public init(configuration: FoundationModels::PrivateCloudComputeLanguageModel.FoundationModels::Executor.FoundationModels::Configuration)
100 public func prewarm(model: FoundationModels::PrivateCloudComputeLanguageModel.FoundationModels::Executor.FoundationModels::Model, transcript: FoundationModels::Transcript)
101 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
102 nonisolated(nonsending) public func respond(to request: FoundationModels::LanguageModelExecutorGenerationRequest, model: FoundationModels::PrivateCloudComputeLanguageModel, streamingInto channel: FoundationModels::LanguageModelExecutorGenerationChannel) async throws
103 #endif
104 }
105}
106@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
107@available(tvOS, unavailable)
108extension FoundationModels::PrivateCloudComputeLanguageModel.FoundationModels::Executor {
109 public struct Configuration : Swift::Hashable & Swift::Sendable {
110 public static func == (a: FoundationModels::PrivateCloudComputeLanguageModel.FoundationModels::Executor.FoundationModels::Configuration, b: FoundationModels::PrivateCloudComputeLanguageModel.FoundationModels::Executor.FoundationModels::Configuration) -> Swift::Bool
111 public func hash(into hasher: inout Swift::Hasher)
112 public var hashValue: Swift::Int {
113 get
114 }
115 }
116}
117@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
118@available(tvOS, unavailable)
119extension FoundationModels::PrivateCloudComputeLanguageModel {
120 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
121 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
122 @available(tvOS, unavailable)
123 nonisolated(nonsending) final public var contextSize: Swift::Int {
124 get async throws
125 }
126 #endif
127}
128@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
129@available(tvOS, unavailable)
130extension FoundationModels::PrivateCloudComputeLanguageModel {
131 final public var supportedLanguages: Swift::Set<Foundation::Locale.Foundation::Language> {
132 get
133 }
134 final public func supportsLocale(_ locale: Foundation::Locale = Locale.current) -> Swift::Bool
135}
136@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
137@available(tvOS, unavailable)
138extension FoundationModels::PrivateCloudComputeLanguageModel {
139 public enum Error : Swift::Error, Foundation::LocalizedError, Swift::CustomDebugStringConvertible {
140 case networkFailure(FoundationModels::PrivateCloudComputeLanguageModel.FoundationModels::Error.FoundationModels::NetworkFailure)
141 case quotaLimitReached(FoundationModels::PrivateCloudComputeLanguageModel.FoundationModels::Error.FoundationModels::QuotaLimitReached)
142 case serviceUnavailable(FoundationModels::PrivateCloudComputeLanguageModel.FoundationModels::Error.FoundationModels::ServiceUnavailable)
143 public var debugDescription: Swift::String {
144 get
145 }
146 public var errorDescription: Swift::String? {
147 get
148 }
149 public struct NetworkFailure : Swift::Sendable {
150 public var debugDescription: Swift::String
151 public init(debugDescription: Swift::String)
152 }
153 public struct QuotaLimitReached : Swift::Sendable {
154 public var limitIncreaseSuggestion: FoundationModels::PrivateCloudComputeLanguageModel.FoundationModels::QuotaUsage.FoundationModels::LimitIncreaseSuggestion?
155 public var resetDate: Foundation::Date?
156 public var debugDescription: Swift::String
157 public init(limitIncreaseSuggestion: FoundationModels::PrivateCloudComputeLanguageModel.FoundationModels::QuotaUsage.FoundationModels::LimitIncreaseSuggestion? = nil, resetDate: Foundation::Date? = nil, debugDescription: Swift::String)
158 }
159 public struct ServiceUnavailable : Swift::Sendable {
160 public var debugDescription: Swift::String
161 public init(debugDescription: Swift::String)
162 }
163 }
164}
165@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
166@available(tvOS, unavailable)
167extension FoundationModels::PrivateCloudComputeLanguageModel {
168 public struct QuotaUsage : Swift::Sendable {
169 public var status: FoundationModels::PrivateCloudComputeLanguageModel.FoundationModels::QuotaUsage.FoundationModels::Status
170 public var isLimitReached: Swift::Bool {
171 get
172 }
173 public var limitIncreaseSuggestion: FoundationModels::PrivateCloudComputeLanguageModel.FoundationModels::QuotaUsage.FoundationModels::LimitIncreaseSuggestion?
174 public var resetDate: Foundation::Date?
175 public enum Status : Swift::Sendable {
176 case belowLimit(FoundationModels::PrivateCloudComputeLanguageModel.FoundationModels::QuotaUsage.FoundationModels::Status.FoundationModels::BelowLimit)
177 case limitReached(FoundationModels::PrivateCloudComputeLanguageModel.FoundationModels::QuotaUsage.FoundationModels::Status.FoundationModels::LimitReached)
178 public struct BelowLimit : Swift::Sendable {
179 public var isApproachingLimit: Swift::Bool
180 }
181 public struct LimitReached : Swift::Sendable {
182 }
183 }
184 public struct LimitIncreaseSuggestion : Swift::Sendable {
185 public func show()
186 }
187 }
188}
189@_hasMissingDesignatedInitializers @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
190@available(tvOS, unavailable)
191@available(watchOS, unavailable)
192final public class SystemLanguageModel : Swift::Sendable {
193 final public var availability: FoundationModels::SystemLanguageModel.FoundationModels::Availability {
194 get
195 }
196 final public var isAvailable: Swift::Bool {
197 get
198 }
199 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
200 @available(tvOS, unavailable)
201 @available(watchOS, unavailable)
202 public struct UseCase : Swift::Sendable, Swift::Equatable {
203 public static let general: FoundationModels::SystemLanguageModel.FoundationModels::UseCase
204 public static let contentTagging: FoundationModels::SystemLanguageModel.FoundationModels::UseCase
205 public static func == (a: FoundationModels::SystemLanguageModel.FoundationModels::UseCase, b: FoundationModels::SystemLanguageModel.FoundationModels::UseCase) -> Swift::Bool
206 }
207 @objc deinit
208}
209@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
210@available(tvOS, unavailable)
211@available(watchOS, unavailable)
212extension FoundationModels::SystemLanguageModel : nonisolated Observation::Observable {
213}
214@available(iOS 27.0, macOS 27.0, visionOS 27.0, *)
215@available(watchOS, unavailable)
216@available(tvOS, unavailable)
217extension FoundationModels::SystemLanguageModel : FoundationModels::LanguageModel {
218 final public var capabilities: FoundationModels::LanguageModelCapabilities {
219 get
220 }
221 final public var executorConfiguration: FoundationModels::SystemLanguageModel.FoundationModels::Executor.FoundationModels::Configuration {
222 get
223 }
224 public struct Executor : FoundationModels::LanguageModelExecutor {
225 public typealias Model = FoundationModels::SystemLanguageModel
226 public init(configuration: FoundationModels::SystemLanguageModel.FoundationModels::Executor.FoundationModels::Configuration)
227 public func prewarm(model: FoundationModels::SystemLanguageModel.FoundationModels::Executor.FoundationModels::Model, transcript: FoundationModels::Transcript)
228 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
229 nonisolated(nonsending) public func respond(to request: FoundationModels::LanguageModelExecutorGenerationRequest, model: FoundationModels::SystemLanguageModel, streamingInto channel: FoundationModels::LanguageModelExecutorGenerationChannel) async throws
230 #endif
231 }
232}
233@available(iOS 27.0, macOS 27.0, visionOS 27.0, *)
234@available(watchOS, unavailable)
235@available(tvOS, unavailable)
236extension FoundationModels::SystemLanguageModel.FoundationModels::Executor {
237 public struct Configuration : Swift::Hashable & Swift::Sendable {
238 public static func == (a: FoundationModels::SystemLanguageModel.FoundationModels::Executor.FoundationModels::Configuration, b: FoundationModels::SystemLanguageModel.FoundationModels::Executor.FoundationModels::Configuration) -> Swift::Bool
239 public func hash(into hasher: inout Swift::Hasher)
240 public var hashValue: Swift::Int {
241 get
242 }
243 }
244}
245@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
246@available(tvOS, unavailable)
247@available(watchOS, unavailable)
248extension FoundationModels::SystemLanguageModel {
249 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
250 @available(tvOS, unavailable)
251 @available(watchOS, unavailable)
252 public struct Guardrails : Swift::Sendable {
253 public static let `default`: FoundationModels::SystemLanguageModel.FoundationModels::Guardrails
254 public static let permissiveContentTransformations: FoundationModels::SystemLanguageModel.FoundationModels::Guardrails
255 }
256}
257@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
258@available(tvOS, unavailable)
259@available(watchOS, unavailable)
260extension FoundationModels::SystemLanguageModel {
261 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
262 @available(tvOS, unavailable)
263 @available(watchOS, unavailable)
264 @frozen public enum Availability : Swift::Equatable, Swift::Sendable {
265 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
266 @available(tvOS, unavailable)
267 @available(watchOS, unavailable)
268 public enum UnavailableReason : Swift::Equatable, Swift::Sendable {
269 case deviceNotEligible
270 case appleIntelligenceNotEnabled
271 case modelNotReady
272 public static func == (a: FoundationModels::SystemLanguageModel.FoundationModels::Availability.FoundationModels::UnavailableReason, b: FoundationModels::SystemLanguageModel.FoundationModels::Availability.FoundationModels::UnavailableReason) -> Swift::Bool
273 public func hash(into hasher: inout Swift::Hasher)
274 public var hashValue: Swift::Int {
275 get
276 }
277 }
278 case available
279 case unavailable(FoundationModels::SystemLanguageModel.FoundationModels::Availability.FoundationModels::UnavailableReason)
280 public static func == (a: FoundationModels::SystemLanguageModel.FoundationModels::Availability, b: FoundationModels::SystemLanguageModel.FoundationModels::Availability) -> Swift::Bool
281 }
282 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
283 @available(tvOS, unavailable)
284 @available(watchOS, unavailable)
285 public static var `default`: FoundationModels::SystemLanguageModel {
286 get
287 }
288 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
289 @available(tvOS, unavailable)
290 @available(watchOS, unavailable)
291 convenience public init(useCase: FoundationModels::SystemLanguageModel.FoundationModels::UseCase = .general, guardrails: FoundationModels::SystemLanguageModel.FoundationModels::Guardrails = Guardrails.default)
292 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
293 @available(iOS, obsoleted: 27.0)
294 @available(macOS, obsoleted: 27.0)
295 @available(visionOS, obsoleted: 27.0)
296 @available(watchOS, unavailable)
297 @available(tvOS, unavailable)
298 convenience public init(adapter: FoundationModels::SystemLanguageModel.FoundationModels::Adapter, guardrails: FoundationModels::SystemLanguageModel.FoundationModels::Guardrails = .default)
299 final public var supportedLanguages: Swift::Set<Foundation::Locale.Foundation::Language> {
300 get
301 }
302 final public func supportsLocale(_ locale: Foundation::Locale = Locale.current) -> Swift::Bool
303}
304@available(iOS 26.4, macOS 26.4, visionOS 26.4, *)
305@available(tvOS, unavailable)
306@available(watchOS, unavailable)
307extension FoundationModels::SystemLanguageModel {
308 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
309 @available(iOS 26.4, macOS 26.4, visionOS 26.4, *)
310 @available(tvOS, unavailable)
311 @available(watchOS, unavailable)
312 nonisolated(nonsending) final public func tokenCount(for prompt: some PromptRepresentable) async throws -> Swift::Int
313 #endif
314 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
315 @available(iOS 26.4, macOS 26.4, visionOS 26.4, *)
316 @available(tvOS, unavailable)
317 @available(watchOS, unavailable)
318 nonisolated(nonsending) final public func tokenCount(for instructions: FoundationModels::Instructions) async throws -> Swift::Int
319 #endif
320 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
321 @available(iOS 26.4, macOS 26.4, visionOS 26.4, *)
322 @available(tvOS, unavailable)
323 @available(watchOS, unavailable)
324 nonisolated(nonsending) final public func tokenCount(for tools: [any FoundationModels::Tool]) async throws -> Swift::Int
325 #endif
326 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
327 @available(iOS 26.4, macOS 26.4, visionOS 26.4, *)
328 @available(tvOS, unavailable)
329 @available(watchOS, unavailable)
330 nonisolated(nonsending) final public func tokenCount(for schema: FoundationModels::GenerationSchema) async throws -> Swift::Int
331 #endif
332 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
333 @available(iOS 26.4, macOS 26.4, visionOS 26.4, *)
334 @available(tvOS, unavailable)
335 @available(watchOS, unavailable)
336 nonisolated(nonsending) final public func tokenCount(for transcriptEntries: some Collection<Transcript.Entry>) async throws -> Swift::Int
337 #endif
338}
339@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
340@available(tvOS, unavailable)
341@available(watchOS, unavailable)
342extension FoundationModels::SystemLanguageModel {
343 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
344 @backDeployed(before: iOS 26.4, macOS 26.4, visionOS 26.4)
345 @available(tvOS, unavailable)
346 @available(watchOS, unavailable)
347 final public var contextSize: Swift::Int {
348 get {
349 if #available(iOS 27.0, macOS 27.0, visionOS 27.0, tvOS 27.0, watchOS 27.0, *) {
350 return _contextSize
351 }
352
353
354
355
356
357 return 4096
358 }
359 }
360 @available(iOS 27.0, macOS 27.0, visionOS 27.0, *)
361 @usableFromInline
362 final internal var _contextSize: Swift::Int {
363 get
364 }
365}
366@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
367@available(watchOS, unavailable)
368@available(tvOS, unavailable)
369extension FoundationModels::SystemLanguageModel {
370 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
371 @available(iOS, deprecated: 26.4, obsoleted: 27.0)
372 @available(macOS, deprecated: 26.4, obsoleted: 27.0)
373 @available(visionOS, deprecated: 26.4, obsoleted: 27.0)
374 @available(watchOS, unavailable)
375 @available(tvOS, unavailable)
376 public struct Adapter {
377 public var creatorDefinedMetadata: [Swift::String : Any] {
378 get
379 }
380 }
381}
382@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
383@available(iOS, deprecated: 26.4, obsoleted: 27.0)
384@available(macOS, deprecated: 26.4, obsoleted: 27.0)
385@available(visionOS, deprecated: 26.4, obsoleted: 27.0)
386@available(watchOS, unavailable)
387@available(tvOS, unavailable)
388extension FoundationModels::SystemLanguageModel.FoundationModels::Adapter {
389 public init(fileURL: Foundation::URL) throws
390 public init(name: Swift::String) throws
391 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
392 @concurrent public func compile() async throws
393 #endif
394 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
395 @available(iOS, deprecated: 26.4, obsoleted: 27.0)
396 @available(macOS, deprecated: 26.4, obsoleted: 27.0)
397 @available(visionOS, deprecated: 26.4, obsoleted: 27.0)
398 @available(watchOS, unavailable)
399 @available(tvOS, unavailable)
400 public static func compatibleAdapterIdentifiers(name: Swift::String) -> [Swift::String]
401 public static func removeObsoleteAdapters() throws
402}
403@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
404@available(iOS, deprecated: 26.4)
405@available(macOS, deprecated: 26.4)
406@available(visionOS, deprecated: 26.4)
407@available(watchOS, unavailable)
408@available(tvOS, unavailable)
409extension FoundationModels::SystemLanguageModel.FoundationModels::Adapter {
410 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
411 @available(watchOS, unavailable)
412 @available(tvOS, unavailable)
413 public enum AssetError : Swift::Error, Foundation::LocalizedError {
414 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
415 @available(iOS, deprecated: 26.4)
416 @available(macOS, deprecated: 26.4)
417 @available(visionOS, deprecated: 26.4)
418 @available(watchOS, unavailable)
419 @available(tvOS, unavailable)
420 public struct Context : Swift::Sendable {
421 public let debugDescription: Swift::String
422 public init(debugDescription: Swift::String)
423 }
424 case invalidAsset(FoundationModels::SystemLanguageModel.FoundationModels::Adapter.FoundationModels::AssetError.FoundationModels::Context)
425 case invalidAdapterName(FoundationModels::SystemLanguageModel.FoundationModels::Adapter.FoundationModels::AssetError.FoundationModels::Context)
426 case compatibleAdapterNotFound(FoundationModels::SystemLanguageModel.FoundationModels::Adapter.FoundationModels::AssetError.FoundationModels::Context)
427 public var errorDescription: Swift::String? {
428 get
429 }
430 public var recoverySuggestion: Swift::String? {
431 get
432 }
433 }
434}
435@available(tvOS, unavailable)
436@available(watchOS, unavailable)
437extension FoundationModels::SystemLanguageModel {
438 @available(iOS 27.0, macOS 27.0, visionOS 27.0, *)
439 @available(tvOS, unavailable)
440 @available(watchOS, unavailable)
441 public enum Error : Foundation::LocalizedError, Swift::CustomDebugStringConvertible {
442 case assetsUnavailable(FoundationModels::SystemLanguageModel.FoundationModels::Error.FoundationModels::AssetsUnavailable)
443 public struct AssetsUnavailable : Swift::Sendable {
444 public var debugDescription: Swift::String
445 public init(debugDescription: Swift::String)
446 }
447 public var debugDescription: Swift::String {
448 get
449 }
450 public var errorDescription: Swift::String? {
451 get
452 }
453 }
454}
455@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
456@available(tvOS, unavailable)
457public struct _DynamicInstructionsInputs {
458}
459@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
460@available(tvOS, unavailable)
461public struct _DynamicInstructionsOutputs {
462}
463@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
464@available(tvOS, unavailable)
465public struct AnyDynamicInstructions : FoundationModels::DynamicInstructions {
466 public init(_ dynamicInstructions: any FoundationModels::DynamicInstructions)
467 @_alwaysEmitIntoClient public init(erasing dynamicInstructions: some DynamicInstructions) {
468 self.init(dynamicInstructions)
469 }
470 public var body: Swift::Never {
471 get
472 }
473 public static func _makeDynamicInstructions(_ value: FoundationModels::_DSLValue<FoundationModels::AnyDynamicInstructions>, _ inputs: FoundationModels::_DynamicInstructionsInputs) -> FoundationModels::_DynamicInstructionsOutputs
474 @available(macOS 27.0, iOS 27.0, watchOS 27.0, visionOS 27.0, *)
475 @available(tvOS, unavailable)
476 public typealias Body = Swift::Never
477}
478@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
479@available(tvOS, unavailable)
480@_typeEraser(AnyDynamicInstructions) public protocol DynamicInstructions {
481 associatedtype Body : FoundationModels::DynamicInstructions
482 @FoundationModels::DynamicInstructionsBuilder var body: Self.Body { get }
483}
484@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
485@available(tvOS, unavailable)
486public struct _DSLValue<T> {
487}
488@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
489@available(tvOS, unavailable)
490@_functionBuilder public struct DynamicInstructionsBuilder {
491 public static func buildExpression<T>(_ expression: T) -> some FoundationModels::DynamicInstructions where T : FoundationModels::Tool
492
493 public static func buildExpression<T>(_ expression: T) -> T where T : FoundationModels::DynamicInstructions
494 public static func buildExpression(_ tools: [any FoundationModels::Tool]) -> some FoundationModels::DynamicInstructions
495
496 @_disfavoredOverload public static func buildBlock<each Content>(_ contents: repeat each Content) -> FoundationModels::TupleDynamicInstructions<repeat each Content> where repeat each Content : FoundationModels::DynamicInstructions
497 public static func buildBlock<T>(_ content: T) -> T where T : FoundationModels::DynamicInstructions
498 public static func buildBlock() -> FoundationModels::EmptyDynamicInstructions
499 public static func buildEither<TrueContent, FalseContent>(first content: TrueContent) -> FoundationModels::ConditionalDynamicInstructions<TrueContent, FalseContent> where TrueContent : FoundationModels::DynamicInstructions, FalseContent : FoundationModels::DynamicInstructions
500 public static func buildEither<TrueContent, FalseContent>(second content: FalseContent) -> FoundationModels::ConditionalDynamicInstructions<TrueContent, FalseContent> where TrueContent : FoundationModels::DynamicInstructions, FalseContent : FoundationModels::DynamicInstructions
501 public static func buildOptional<Content>(_ content: Content?) -> Content? where Content : FoundationModels::DynamicInstructions
502}
503@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
504@available(tvOS, unavailable)
505public struct TupleDynamicInstructions<each Content> : FoundationModels::DynamicInstructions where repeat each Content : FoundationModels::DynamicInstructions {
506 public init(_ contents: repeat each Content)
507 public var body: Swift::Never {
508 get
509 }
510 @available(macOS 27.0, iOS 27.0, watchOS 27.0, visionOS 27.0, *)
511 @available(tvOS, unavailable)
512 public typealias Body = Swift::Never
513}
514@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
515@available(tvOS, unavailable)
516public struct ConditionalDynamicInstructions<TrueContent, FalseContent> : FoundationModels::DynamicInstructions where TrueContent : FoundationModels::DynamicInstructions, FalseContent : FoundationModels::DynamicInstructions {
517 public enum Branch {
518 case trueContent(TrueContent)
519 case falseContent(FalseContent)
520 }
521 public init(_ branch: FoundationModels::ConditionalDynamicInstructions<TrueContent, FalseContent>.FoundationModels::Branch)
522 public var body: Swift::Never {
523 get
524 }
525 @available(macOS 27.0, iOS 27.0, watchOS 27.0, visionOS 27.0, *)
526 @available(tvOS, unavailable)
527 public typealias Body = Swift::Never
528}
529@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
530@available(tvOS, unavailable)
531extension Swift::Optional : FoundationModels::DynamicInstructions where Wrapped : FoundationModels::DynamicInstructions {
532 public var body: Swift::Never {
533 get
534 }
535 @available(macOS 27.0, iOS 27.0, watchOS 27.0, visionOS 27.0, *)
536 @available(tvOS, unavailable)
537 public typealias Body = Swift::Never
538}
539@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
540@available(tvOS, unavailable)
541extension Swift::Never : FoundationModels::DynamicInstructions {
542 public var body: Swift::Never {
543 get
544 }
545 @available(macOS 27.0, iOS 27.0, watchOS 27.0, visionOS 27.0, *)
546 @available(tvOS, unavailable)
547 public typealias Body = Swift::Never
548}
549@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
550@available(tvOS, unavailable)
551public struct EmptyDynamicInstructions : FoundationModels::DynamicInstructions, Swift::Sendable {
552 public var body: Swift::Never {
553 get
554 }
555 public init()
556 @available(macOS 27.0, iOS 27.0, watchOS 27.0, visionOS 27.0, *)
557 @available(tvOS, unavailable)
558 public typealias Body = Swift::Never
559}
560@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
561@available(tvOS, unavailable)
562public struct _DynamicInstructionsForEach<Data, ID, Content> : FoundationModels::DynamicInstructions where Data : Swift::RandomAccessCollection, ID : Swift::Hashable, Content : FoundationModels::DynamicInstructions {
563 public var body: Swift::Never {
564 get
565 }
566 @available(macOS 27.0, iOS 27.0, watchOS 27.0, visionOS 27.0, *)
567 @available(tvOS, unavailable)
568 public typealias Body = Swift::Never
569}
570@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
571@available(tvOS, unavailable)
572extension FoundationModels::_DynamicInstructionsForEach {
573 public init(_ data: Data, id: Swift::KeyPath<Data.Element, ID>, @FoundationModels::DynamicInstructionsBuilder content: @escaping (Data.Element) -> Content)
574}
575@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
576@available(tvOS, unavailable)
577extension FoundationModels::_DynamicInstructionsForEach where ID == Data.Element.ID, Data.Element : Swift::Identifiable {
578 public init(_ data: Data, @FoundationModels::DynamicInstructionsBuilder content: @escaping (Data.Element) -> Content)
579}
580@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
581@available(tvOS, unavailable)
582extension FoundationModels::DynamicInstructions {
583 public typealias ForEach = FoundationModels::_DynamicInstructionsForEach
584}
585@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
586@available(tvOS, unavailable)
587extension FoundationModels::LanguageModelSession {
588 @available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
589 @available(tvOS, unavailable)
590 public protocol DynamicProfile {
591 associatedtype Body : FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile
592 @FoundationModels::LanguageModelSession.FoundationModels::DynamicProfileBuilder var body: Self.Body { get }
593 }
594 @available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
595 @available(tvOS, unavailable)
596 public struct Profile : FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile {
597 public init(@FoundationModels::DynamicInstructionsBuilder _ dynamicInstructions: () -> some DynamicInstructions)
598 public var body: Swift::Never {
599 get
600 }
601 @available(macOS 27.0, iOS 27.0, watchOS 27.0, visionOS 27.0, *)
602 @available(tvOS, unavailable)
603 public typealias Body = Swift::Never
604 }
605}
606@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
607@available(tvOS, unavailable)
608extension FoundationModels::LanguageModelSession {
609 @available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
610 @available(tvOS, unavailable)
611 public struct ConditionalDynamicProfile<TrueContent, FalseContent> : FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile where TrueContent : FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile, FalseContent : FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile {
612 @usableFromInline
613 internal enum Branch {
614 case trueContent(TrueContent)
615 case falseContent(FalseContent)
616 }
617 @usableFromInline
618 internal var branch: FoundationModels::LanguageModelSession.FoundationModels::ConditionalDynamicProfile<TrueContent, FalseContent>.FoundationModels::Branch
619 @usableFromInline
620 internal init(_ branch: FoundationModels::LanguageModelSession.FoundationModels::ConditionalDynamicProfile<TrueContent, FalseContent>.FoundationModels::Branch)
621 public var body: Swift::Never {
622 get
623 }
624 @available(macOS 27.0, iOS 27.0, watchOS 27.0, visionOS 27.0, *)
625 @available(tvOS, unavailable)
626 public typealias Body = Swift::Never
627 }
628 @available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
629 @available(tvOS, unavailable)
630 @_functionBuilder public struct DynamicProfileBuilder {
631 public static func buildBlock<T>(_ content: T) -> T where T : FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile
632 public static func buildEither<TrueContent, FalseContent>(first content: TrueContent) -> FoundationModels::LanguageModelSession.FoundationModels::ConditionalDynamicProfile<TrueContent, FalseContent> where TrueContent : FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile, FalseContent : FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile
633 public static func buildEither<TrueContent, FalseContent>(second content: FalseContent) -> FoundationModels::LanguageModelSession.FoundationModels::ConditionalDynamicProfile<TrueContent, FalseContent> where TrueContent : FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile, FalseContent : FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile
634 }
635}
636@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
637@available(tvOS, unavailable)
638extension FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile {
639 public typealias Profile = FoundationModels::LanguageModelSession.FoundationModels::Profile
640 public typealias DynamicProfile = FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile
641}
642@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
643@available(tvOS, unavailable)
644extension Swift::Never : FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile {
645}
646@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
647@available(tvOS, unavailable)
648extension FoundationModels::LanguageModelSession {
649 convenience public init(profile: sending some DynamicProfile, history: some Collection<Transcript.Entry> = [])
650}
651@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
652@available(tvOS, unavailable)
653extension FoundationModels::LanguageModelSession {
654 public struct _DynamicProfileInputs {
655 }
656 public struct _DynamicProfileOutputs {
657 }
658}
659@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
660@available(tvOS, unavailable)
661extension FoundationModels::LanguageModelSession {
662 @available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
663 @available(tvOS, unavailable)
664 public protocol DynamicProfileModifier {
665 associatedtype Body : FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile
666 @FoundationModels::LanguageModelSession.FoundationModels::DynamicProfileBuilder func body(content: Self.Content) -> Self.Body
667 typealias Content = FoundationModels::LanguageModelSession.FoundationModels::DynamicProfileModifierContent<Self>
668 }
669 @available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
670 @available(tvOS, unavailable)
671 public struct DynamicProfileModifierContent<Modifier> : FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile where Modifier : FoundationModels::LanguageModelSession.FoundationModels::DynamicProfileModifier {
672 public var body: Swift::Never {
673 get
674 }
675 @available(macOS 27.0, iOS 27.0, watchOS 27.0, visionOS 27.0, *)
676 @available(tvOS, unavailable)
677 public typealias Body = Swift::Never
678 }
679 @available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
680 @available(tvOS, unavailable)
681 public struct ModifiedDynamicProfile<Content, Modifier> : FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile where Content : FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile, Modifier : FoundationModels::LanguageModelSession.FoundationModels::DynamicProfileModifier {
682 public var body: Swift::Never {
683 get
684 }
685 @available(macOS 27.0, iOS 27.0, watchOS 27.0, visionOS 27.0, *)
686 @available(tvOS, unavailable)
687 public typealias Body = Swift::Never
688 }
689}
690@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
691@available(tvOS, unavailable)
692extension FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile {
693 public func modifier<Modifier>(_ modifier: Modifier) -> some FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile where Modifier : FoundationModels::LanguageModelSession.FoundationModels::DynamicProfileModifier
694
695}
696@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
697@available(tvOS, unavailable)
698extension FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile {
699 public func model(_ model: some LanguageModel) -> some FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile
700
701 public func temperature(_ temperature: Swift::Double?) -> some FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile
702
703 public func samplingMode(_ samplingMode: FoundationModels::GenerationOptions.FoundationModels::SamplingMode?) -> some FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile
704
705 public func maximumResponseTokens(_ maximumResponseTokens: Swift::Int?) -> some FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile
706
707 public func reasoningLevel(_ reasoningLevel: FoundationModels::ContextOptions.FoundationModels::ReasoningLevel?) -> some FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile
708
709 @available(*, deprecated, renamed: "toolCallingMode(_:)")
710 public func toolCalling(_ toolCallingMode: FoundationModels::GenerationOptions.FoundationModels::ToolCallingMode?) -> some FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile
711
712 public func toolCallingMode(_ toolCallingMode: FoundationModels::GenerationOptions.FoundationModels::ToolCallingMode?) -> some FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile
713
714 @available(*, deprecated, renamed: "historyTransform(_:)")
715 public func inputFilter(_ filter: @escaping ([FoundationModels::Transcript.FoundationModels::Entry]) -> [FoundationModels::Transcript.FoundationModels::Entry]) -> some FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile
716
717 public func historyTransform(_ transform: @escaping ([FoundationModels::Transcript.FoundationModels::Entry]) -> [FoundationModels::Transcript.FoundationModels::Entry]) -> some FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile
718
719 public func transcriptErrorHandlingPolicy(_ transcriptErrorHandlingPolicy: FoundationModels::TranscriptErrorHandlingPolicy?) -> some FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile
720
721 @_alwaysEmitIntoClient public func onPrompt(@_inheritActorContext perform action: nonisolated(nonsending) sending @escaping () async throws -> Swift::Void) -> some FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile {
722 onPrompt { _ in
723 try await action()
724 }
725 }
726
727 public func onPrompt(@_inheritActorContext perform action: nonisolated(nonsending) sending @escaping (FoundationModels::Transcript.FoundationModels::Prompt) async throws -> Swift::Void) -> some FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile
728
729 @_alwaysEmitIntoClient public func onResponse(@_inheritActorContext perform action: nonisolated(nonsending) sending @escaping () async throws -> Swift::Void) -> some FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile {
730 onResponse { _ in
731 try await action()
732 }
733 }
734
735 public func onResponse(@_inheritActorContext perform action: nonisolated(nonsending) sending @escaping (FoundationModels::Transcript.FoundationModels::Response) async throws -> Swift::Void) -> some FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile
736
737 @_alwaysEmitIntoClient public func onToolCall(@_inheritActorContext perform action: nonisolated(nonsending) sending @escaping () async throws -> Swift::Void) -> some FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile {
738 onToolCall { _ in
739 try await action()
740 }
741 }
742
743 public func onToolCall(@_inheritActorContext perform action: nonisolated(nonsending) sending @escaping (FoundationModels::Transcript.FoundationModels::ToolCall) async throws -> Swift::Void) -> some FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile
744
745 @_alwaysEmitIntoClient public func onToolOutput(@_inheritActorContext perform action: nonisolated(nonsending) sending @escaping () async throws -> Swift::Void) -> some FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile {
746 onToolOutput { _, _ in
747 try await action()
748 }
749 }
750
751 public func onToolOutput(@_inheritActorContext perform action: nonisolated(nonsending) sending @escaping (FoundationModels::Transcript.FoundationModels::ToolCall, FoundationModels::Transcript.FoundationModels::ToolOutput) async throws -> Swift::Void) -> some FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile
752
753 public func onActivate(@_inheritActorContext perform action: sending @escaping @isolated(any) () async -> Swift::Void) -> some FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile
754
755 public func onDeactivate(@_inheritActorContext perform action: sending @escaping @isolated(any) () async -> Swift::Void) -> some FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile
756
757}
758@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
759@available(tvOS, unavailable)
760extension FoundationModels::LanguageModelSession.FoundationModels::DynamicProfileModifier {
761 public typealias DynamicProfile = FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile
762}
763@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
764@available(tvOS, unavailable)
765extension FoundationModels::LanguageModelSession {
766 @propertyWrapper public struct SessionProperty<Value> {
767 public var wrappedValue: Value {
768 get
769 nonmutating set
770 }
771 public init(_ keyPath: Swift::ReferenceWritableKeyPath<FoundationModels::SessionPropertyValues, Value>)
772 }
773}
774@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
775@available(tvOS, unavailable)
776extension FoundationModels::LanguageModelSession.FoundationModels::SessionProperty : Swift::Sendable where Value : Swift::Sendable {
777}
778@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
779@available(tvOS, unavailable)
780extension FoundationModels::DynamicInstructions {
781 public typealias SessionProperty = FoundationModels::LanguageModelSession.FoundationModels::SessionProperty
782}
783@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
784@available(tvOS, unavailable)
785extension FoundationModels::Tool {
786 public typealias SessionProperty = FoundationModels::LanguageModelSession.FoundationModels::SessionProperty
787}
788@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
789@available(tvOS, unavailable)
790extension FoundationModels::LanguageModelSession.FoundationModels::DynamicProfile {
791 public typealias SessionProperty = FoundationModels::LanguageModelSession.FoundationModels::SessionProperty
792}
793@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
794@available(tvOS, unavailable)
795extension FoundationModels::LanguageModelSession.FoundationModels::DynamicProfileModifier {
796 public typealias SessionProperty = FoundationModels::LanguageModelSession.FoundationModels::SessionProperty
797}
798@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
799@available(tvOS, unavailable)
800extension FoundationModels::SessionPropertyValues {
801 final public var history: Swift::ArraySlice<FoundationModels::Transcript.FoundationModels::Entry> {
802 get
803 set
804 _modify
805 }
806 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
807 @available(tvOS, unavailable)
808 final public var rootDynamicInstructions: any FoundationModels::DynamicInstructions {
809 get
810 set
811 }
812}
813@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
814@available(tvOS, unavailable)
815public protocol SessionPropertyKey : Swift::SendableMetatype {
816 associatedtype Value
817 static var defaultValue: Self.Value { get }
818}
819@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
820@available(tvOS, unavailable)
821@attached(accessor) @attached(peer, names: prefixed(__Key_)) public macro SessionPropertyEntry() = #externalMacro(
822 module: "FoundationModelsMacros",
823 type: "EntryMacro"
824 )
825@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
826@available(tvOS, unavailable)
827@attached(accessor) public macro __SessionPropertyEntryDefaultValue() = #externalMacro(
828 module: "FoundationModelsMacros",
829 type: "SessionPropertyEntryDefaultValueMacro"
830 )
831@_hasMissingDesignatedInitializers @available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
832@available(tvOS, unavailable)
833final public class SessionPropertyValues : Swift::Sendable {
834 @inline(__always) final public subscript<K>(key: K.Type) -> K.Value where K : FoundationModels::SessionPropertyKey {
835 get
836 set
837 _modify
838 }
839 @objc deinit
840}
841@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
842@available(tvOS, unavailable)
843extension FoundationModels::SessionPropertyValues : nonisolated Observation::Observable {
844}
845@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
846@available(tvOS, unavailable)
847public struct AnyTool : FoundationModels::Tool {
848 public var name: Swift::String {
849 get
850 }
851 public var description: Swift::String {
852 get
853 }
854 public var parameters: FoundationModels::GenerationSchema {
855 get
856 }
857 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
858 nonisolated(nonsending) public func call(arguments: FoundationModels::GeneratedContent) async throws -> FoundationModels::Prompt
859 #endif
860 public init(_ tool: some Tool)
861 @available(macOS 27.0, iOS 27.0, watchOS 27.0, visionOS 27.0, *)
862 @available(tvOS, unavailable)
863 public typealias Arguments = FoundationModels::GeneratedContent
864 @available(macOS 27.0, iOS 27.0, watchOS 27.0, visionOS 27.0, *)
865 @available(tvOS, unavailable)
866 public typealias Output = FoundationModels::Prompt
867}
868@available(macOS 27.0, iOS 27.0, visionOS 27.0, watchOS 27.0, *)
869@available(tvOS, unavailable)
870extension FoundationModels::Instructions : FoundationModels::DynamicInstructions {
871 public var body: some FoundationModels::DynamicInstructions {
872 get
873 }
874 @available(macOS 27.0, iOS 27.0, watchOS 27.0, visionOS 27.0, *)
875 @available(tvOS, unavailable)
876 public typealias Body = @_opaqueReturnTypeOf("$s16FoundationModels12InstructionsV4bodyQrvp", 0) __
877}
878@available(macOS 27.0, iOS 27.0, visionOS 27.0, *)
879@available(watchOS, unavailable)
880@available(tvOS, unavailable)
881extension FoundationModels::LanguageModelSession {
882 convenience public init(model: some LanguageModel = SystemLanguageModel.default, dynamicInstructions: sending some DynamicInstructions, history: some Collection<Transcript.Entry> = [])
883 final public var properties: FoundationModels::SessionPropertyValues {
884 get
885 }
886}
887@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
888@available(tvOS, unavailable)
889@attached(extension, conformances: FoundationModels::Generable, names: named(init(_:)), named(generatedContent)) @attached(member, names: arbitrary) public macro Generable(description: Swift::String? = nil) = #externalMacro(module: "FoundationModelsMacros", type: "GenerableMacro")
890@available(iOS 26.4, macOS 26.4, visionOS 26.4, watchOS 27.0, *)
891@available(tvOS, unavailable)
892@attached(extension, conformances: FoundationModels::Generable, names: named(init(_:)), named(generatedContent)) @attached(member, names: arbitrary) public macro Generable(description: Swift::String? = nil, representNilExplicitlyInGeneratedContent: Swift::Bool) = #externalMacro(module: "FoundationModelsMacros", type: "GenerableMacro")
893@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
894@available(tvOS, unavailable)
895@attached(extension, conformances: FoundationModels::Generable, names: named(init(_:)), named(generatedContent)) @attached(member, names: arbitrary) public macro Generable(name: Swift::String, description: Swift::String? = nil, representNilExplicitlyInGeneratedContent: Swift::Bool = false) = #externalMacro(module: "FoundationModelsMacros", type: "GenerableMacro")
896@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
897@available(tvOS, unavailable)
898@attached(peer) public macro Guide<T>(description: Swift::String? = nil, _ guides: FoundationModels::GenerationGuide<T>...) = #externalMacro(module: "FoundationModelsMacros", type: "GuideMacro") where T : FoundationModels::Generable
899@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
900@available(tvOS, unavailable)
901@attached(peer) public macro Guide<RegexOutput>(description: Swift::String? = nil, _ guides: _StringProcessing::Regex<RegexOutput>) = #externalMacro(module: "FoundationModelsMacros", type: "GuideMacro")
902@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
903@available(tvOS, unavailable)
904@attached(peer) public macro Guide(description: Swift::String) = #externalMacro(module: "FoundationModelsMacros", type: "GuideMacro")
905@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
906@available(tvOS, unavailable)
907public protocol Generable : FoundationModels::ConvertibleFromGeneratedContent, FoundationModels::ConvertibleToGeneratedContent {
908 associatedtype PartiallyGenerated : FoundationModels::ConvertibleFromGeneratedContent = Self
909 static var generationSchema: FoundationModels::GenerationSchema { get }
910}
911@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
912@available(tvOS, unavailable)
913extension FoundationModels::Generable {
914 public func asPartiallyGenerated() -> Self.PartiallyGenerated
915}
916@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
917@available(tvOS, unavailable)
918public protocol ConvertibleFromGeneratedContent : Swift::SendableMetatype {
919 init(_ content: FoundationModels::GeneratedContent) throws
920}
921@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
922@available(tvOS, unavailable)
923public protocol ConvertibleToGeneratedContent : FoundationModels::InstructionsRepresentable, FoundationModels::PromptRepresentable {
924 var generatedContent: FoundationModels::GeneratedContent { get }
925}
926@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
927@available(tvOS, unavailable)
928extension FoundationModels::ConvertibleToGeneratedContent {
929 public var instructionsRepresentation: FoundationModels::Instructions {
930 get
931 }
932 public var promptRepresentation: FoundationModels::Prompt {
933 get
934 }
935}
936@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
937@available(tvOS, unavailable)
938extension FoundationModels::Generable {
939 public typealias PartiallyGenerated = Self
940}
941@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
942@available(tvOS, unavailable)
943extension Swift::Optional where Wrapped : FoundationModels::Generable {
944 public typealias PartiallyGenerated = Wrapped.PartiallyGenerated
945}
946@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
947@available(tvOS, unavailable)
948extension Swift::Optional : FoundationModels::ConvertibleToGeneratedContent, FoundationModels::PromptRepresentable, FoundationModels::InstructionsRepresentable where Wrapped : FoundationModels::ConvertibleToGeneratedContent {
949 public var generatedContent: FoundationModels::GeneratedContent {
950 get
951 }
952}
953@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
954@available(tvOS, unavailable)
955extension Swift::Bool : FoundationModels::Generable {
956 public static var generationSchema: FoundationModels::GenerationSchema {
957 get
958 }
959 public init(_ content: FoundationModels::GeneratedContent) throws
960 public var generatedContent: FoundationModels::GeneratedContent {
961 get
962 }
963}
964@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
965@available(tvOS, unavailable)
966extension Swift::String : FoundationModels::Generable {
967 public static var generationSchema: FoundationModels::GenerationSchema {
968 get
969 }
970 public init(_ content: FoundationModels::GeneratedContent) throws
971 public var generatedContent: FoundationModels::GeneratedContent {
972 get
973 }
974}
975@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
976@available(tvOS, unavailable)
977extension Swift::Int : FoundationModels::Generable {
978 public static var generationSchema: FoundationModels::GenerationSchema {
979 get
980 }
981 public init(_ content: FoundationModels::GeneratedContent) throws
982 public var generatedContent: FoundationModels::GeneratedContent {
983 get
984 }
985}
986@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
987@available(tvOS, unavailable)
988extension Swift::Float : FoundationModels::Generable {
989 public static var generationSchema: FoundationModels::GenerationSchema {
990 get
991 }
992 public init(_ content: FoundationModels::GeneratedContent) throws
993 public var generatedContent: FoundationModels::GeneratedContent {
994 get
995 }
996}
997@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
998@available(tvOS, unavailable)
999extension Swift::Double : FoundationModels::Generable {
1000 public static var generationSchema: FoundationModels::GenerationSchema {
1001 get
1002 }
1003 public init(_ content: FoundationModels::GeneratedContent) throws
1004 public var generatedContent: FoundationModels::GeneratedContent {
1005 get
1006 }
1007}
1008@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1009@available(tvOS, unavailable)
1010extension Foundation::Decimal : FoundationModels::Generable {
1011 public static var generationSchema: FoundationModels::GenerationSchema {
1012 get
1013 }
1014 public init(_ content: FoundationModels::GeneratedContent) throws
1015 public var generatedContent: FoundationModels::GeneratedContent {
1016 get
1017 }
1018}
1019@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1020@available(tvOS, unavailable)
1021extension Swift::Array : FoundationModels::Generable where Element : FoundationModels::Generable {
1022 public typealias PartiallyGenerated = [Element.PartiallyGenerated]
1023 public static var generationSchema: FoundationModels::GenerationSchema {
1024 get
1025 }
1026}
1027@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1028@available(tvOS, unavailable)
1029extension Swift::Array : FoundationModels::ConvertibleToGeneratedContent where Element : FoundationModels::ConvertibleToGeneratedContent {
1030 public var generatedContent: FoundationModels::GeneratedContent {
1031 get
1032 }
1033}
1034@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1035@available(tvOS, unavailable)
1036extension Swift::Array : FoundationModels::ConvertibleFromGeneratedContent where Element : FoundationModels::ConvertibleFromGeneratedContent {
1037 public init(_ content: FoundationModels::GeneratedContent) throws
1038}
1039@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1040@available(tvOS, unavailable)
1041extension Swift::Never : FoundationModels::Generable {
1042 public static var generationSchema: FoundationModels::GenerationSchema {
1043 get
1044 }
1045 public init(_ content: FoundationModels::GeneratedContent) throws
1046 public var generatedContent: FoundationModels::GeneratedContent {
1047 get
1048 }
1049}
1050@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1051@available(tvOS, unavailable)
1052public struct GeneratedContent : Swift::Sendable, Swift::Equatable, FoundationModels::Generable, Swift::CustomDebugStringConvertible {
1053 public static var generationSchema: FoundationModels::GenerationSchema {
1054 get
1055 }
1056 public var id: FoundationModels::GenerationID?
1057 public init(_ content: FoundationModels::GeneratedContent) throws
1058 public var generatedContent: FoundationModels::GeneratedContent {
1059 get
1060 }
1061 public init(properties: Swift::KeyValuePairs<Swift::String, any FoundationModels::ConvertibleToGeneratedContent>, id: FoundationModels::GenerationID? = nil)
1062 public init<S>(properties: S, id: FoundationModels::GenerationID? = nil, uniquingKeysWith combine: (FoundationModels::GeneratedContent, FoundationModels::GeneratedContent) throws -> some ConvertibleToGeneratedContent) rethrows where S : Swift::Sequence, S.Element == (Swift::String, any FoundationModels::ConvertibleToGeneratedContent)
1063 public init<S>(elements: S, id: FoundationModels::GenerationID? = nil) where S : Swift::Sequence, S.Element == any FoundationModels::ConvertibleToGeneratedContent
1064 public init(_ value: some ConvertibleToGeneratedContent)
1065 public init(_ value: some ConvertibleToGeneratedContent, id: FoundationModels::GenerationID)
1066 public init(json: Swift::String) throws
1067 public static let null: FoundationModels::GeneratedContent
1068 public var jsonString: Swift::String {
1069 get
1070 }
1071 public func value<Value>(_ type: Value.Type = Value.self) throws -> Value where Value : FoundationModels::ConvertibleFromGeneratedContent
1072 public func value<Value>(_ type: Value.Type = Value.self, forProperty property: Swift::String) throws -> Value where Value : FoundationModels::ConvertibleFromGeneratedContent
1073 public func value<Value>(_ type: Value?.Type = Value?.self, forProperty property: Swift::String) throws -> Value? where Value : FoundationModels::ConvertibleFromGeneratedContent
1074 public var debugDescription: Swift::String {
1075 get
1076 }
1077 public var isComplete: Swift::Bool {
1078 get
1079 }
1080 public static func == (a: FoundationModels::GeneratedContent, b: FoundationModels::GeneratedContent) -> Swift::Bool
1081}
1082@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1083@available(tvOS, unavailable)
1084extension FoundationModels::GeneratedContent {
1085 public enum Kind : Swift::Equatable, Swift::Sendable {
1086 case null
1087 case bool(Swift::Bool)
1088 case number(Swift::Double)
1089 case string(Swift::String)
1090 case array([FoundationModels::GeneratedContent])
1091 case structure(properties: [Swift::String : FoundationModels::GeneratedContent], orderedKeys: [Swift::String])
1092 public static func == (a: FoundationModels::GeneratedContent.FoundationModels::Kind, b: FoundationModels::GeneratedContent.FoundationModels::Kind) -> Swift::Bool
1093 }
1094 public init(kind: FoundationModels::GeneratedContent.FoundationModels::Kind, id: FoundationModels::GenerationID? = nil)
1095 public var kind: FoundationModels::GeneratedContent.FoundationModels::Kind {
1096 get
1097 }
1098}
1099@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1100@available(tvOS, unavailable)
1101extension FoundationModels::GeneratedContent {
1102 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1103 @available(tvOS, unavailable)
1104 public struct ParsingError : Foundation::LocalizedError, Swift::CustomDebugStringConvertible, Swift::Sendable {
1105 public var rawContent: Swift::String
1106 public var underlyingError: (any Swift::Error)?
1107 public var debugDescription: Swift::String
1108 public init(rawContent: Swift::String, underlyingError: (any Swift::Error)? = nil, debugDescription: Swift::String)
1109 public var errorDescription: Swift::String? {
1110 get
1111 }
1112 }
1113}
1114@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1115@available(tvOS, unavailable)
1116public struct GenerationGuide<Value> {
1117}
1118@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1119@available(tvOS, unavailable)
1120extension FoundationModels::GenerationGuide where Value == Swift::String {
1121 public static func constant(_ value: Swift::String) -> FoundationModels::GenerationGuide<Swift::String>
1122 public static func anyOf(_ values: [Swift::String]) -> FoundationModels::GenerationGuide<Swift::String>
1123 public static func pattern<Output>(_ regex: _StringProcessing::Regex<Output>) -> FoundationModels::GenerationGuide<Swift::String>
1124}
1125@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1126@available(tvOS, unavailable)
1127extension FoundationModels::GenerationGuide where Value == Swift::Int {
1128 public static func minimum(_ value: Swift::Int) -> FoundationModels::GenerationGuide<Swift::Int>
1129 public static func maximum(_ value: Swift::Int) -> FoundationModels::GenerationGuide<Swift::Int>
1130 public static func range(_ range: Swift::ClosedRange<Swift::Int>) -> FoundationModels::GenerationGuide<Swift::Int>
1131}
1132@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1133@available(tvOS, unavailable)
1134extension FoundationModels::GenerationGuide where Value == Swift::Float {
1135 public static func minimum(_ value: Swift::Float) -> FoundationModels::GenerationGuide<Swift::Float>
1136 public static func maximum(_ value: Swift::Float) -> FoundationModels::GenerationGuide<Swift::Float>
1137 public static func range(_ range: Swift::ClosedRange<Swift::Float>) -> FoundationModels::GenerationGuide<Swift::Float>
1138}
1139@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1140@available(tvOS, unavailable)
1141extension FoundationModels::GenerationGuide where Value == Foundation::Decimal {
1142 public static func minimum(_ value: Foundation::Decimal) -> FoundationModels::GenerationGuide<Foundation::Decimal>
1143 public static func maximum(_ value: Foundation::Decimal) -> FoundationModels::GenerationGuide<Foundation::Decimal>
1144 public static func range(_ range: Swift::ClosedRange<Foundation::Decimal>) -> FoundationModels::GenerationGuide<Foundation::Decimal>
1145}
1146@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1147@available(tvOS, unavailable)
1148extension FoundationModels::GenerationGuide where Value == Swift::Double {
1149 public static func minimum(_ value: Swift::Double) -> FoundationModels::GenerationGuide<Swift::Double>
1150 public static func maximum(_ value: Swift::Double) -> FoundationModels::GenerationGuide<Swift::Double>
1151 public static func range(_ range: Swift::ClosedRange<Swift::Double>) -> FoundationModels::GenerationGuide<Swift::Double>
1152}
1153@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1154@available(tvOS, unavailable)
1155extension FoundationModels::GenerationGuide {
1156 public static func minimumCount<Element>(_ count: Swift::Int) -> FoundationModels::GenerationGuide<[Element]> where Value == [Element]
1157 public static func maximumCount<Element>(_ count: Swift::Int) -> FoundationModels::GenerationGuide<[Element]> where Value == [Element]
1158 public static func count<Element>(_ range: Swift::ClosedRange<Swift::Int>) -> FoundationModels::GenerationGuide<[Element]> where Value == [Element]
1159 public static func count<Element>(_ count: Swift::Int) -> FoundationModels::GenerationGuide<[Element]> where Value == [Element]
1160 public static func element<Element>(_ guide: FoundationModels::GenerationGuide<Element>) -> FoundationModels::GenerationGuide<[Element]> where Value == [Element]
1161}
1162@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1163@available(tvOS, unavailable)
1164@_documentation(visibility: private) extension FoundationModels::GenerationGuide where Value == [Swift::Never] {
1165 @_documentation(visibility: private) @_alwaysEmitIntoClient public static func minimumCount(_ count: Swift::Int) -> FoundationModels::GenerationGuide<Value> {
1166 fatalError("GenerationGuide<[Never]>.\(#function) should not be called.")
1167 }
1168 @_documentation(visibility: private) @_alwaysEmitIntoClient public static func maximumCount(_ count: Swift::Int) -> FoundationModels::GenerationGuide<Value> {
1169 fatalError("GenerationGuide<[Never]>.\(#function) should not be called.")
1170 }
1171 @_documentation(visibility: private) @_alwaysEmitIntoClient public static func count(_ range: Swift::ClosedRange<Swift::Int>) -> FoundationModels::GenerationGuide<Value> {
1172 fatalError("GenerationGuide<[Never]>.\(#function) should not be called.")
1173 }
1174 @_documentation(visibility: private) @_disfavoredOverload @_alwaysEmitIntoClient public static func count(_ count: Swift::Int) -> FoundationModels::GenerationGuide<Value> {
1175 fatalError("GenerationGuide<[Never]>.\(#function) should not be called.")
1176 }
1177}
1178@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1179@available(tvOS, unavailable)
1180public protocol LanguageModel : Swift::Sendable {
1181 associatedtype Executor : FoundationModels::LanguageModelExecutor where Self == Self.Executor.Model
1182 var capabilities: FoundationModels::LanguageModelCapabilities { get }
1183 var executorConfiguration: Self.Executor.Configuration { get }
1184}
1185@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1186@available(tvOS, unavailable)
1187public struct LanguageModelCapabilities : Swift::Sendable {
1188 public func contains(_ capability: FoundationModels::LanguageModelCapabilities.FoundationModels::Capability) -> Swift::Bool
1189 public init(capabilities: [FoundationModels::LanguageModelCapabilities.FoundationModels::Capability])
1190 public struct Capability : Swift::Sendable, Swift::Hashable {
1191 public static var vision: FoundationModels::LanguageModelCapabilities.FoundationModels::Capability {
1192 get
1193 }
1194 public static var guidedGeneration: FoundationModels::LanguageModelCapabilities.FoundationModels::Capability {
1195 get
1196 }
1197 public static var reasoning: FoundationModels::LanguageModelCapabilities.FoundationModels::Capability {
1198 get
1199 }
1200 public static var toolCalling: FoundationModels::LanguageModelCapabilities.FoundationModels::Capability {
1201 get
1202 }
1203 public static func == (a: FoundationModels::LanguageModelCapabilities.FoundationModels::Capability, b: FoundationModels::LanguageModelCapabilities.FoundationModels::Capability) -> Swift::Bool
1204 public func hash(into hasher: inout Swift::Hasher)
1205 public var hashValue: Swift::Int {
1206 get
1207 }
1208 }
1209}
1210@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1211@available(tvOS, unavailable)
1212public enum LanguageModelError : Foundation::LocalizedError, Swift::CustomDebugStringConvertible {
1213 case contextSizeExceeded(FoundationModels::LanguageModelError.FoundationModels::ContextSizeExceeded)
1214 case rateLimited(FoundationModels::LanguageModelError.FoundationModels::RateLimited)
1215 case guardrailViolation(FoundationModels::LanguageModelError.FoundationModels::GuardrailViolation)
1216 case refusal(FoundationModels::LanguageModelError.FoundationModels::Refusal)
1217 case unsupportedCapability(FoundationModels::LanguageModelError.FoundationModels::UnsupportedCapability)
1218 case unsupportedTranscriptContent(FoundationModels::LanguageModelError.FoundationModels::UnsupportedTranscriptContent)
1219 case unsupportedGenerationGuide(FoundationModels::LanguageModelError.FoundationModels::UnsupportedGenerationGuide)
1220 case unsupportedLanguageOrLocale(FoundationModels::LanguageModelError.FoundationModels::UnsupportedLanguageOrLocale)
1221 case timeout(FoundationModels::LanguageModelError.FoundationModels::Timeout)
1222 public struct ContextSizeExceeded : Swift::Sendable {
1223 public var contextSize: Swift::Int
1224 public var tokenCount: Swift::Int
1225 public var debugDescription: Swift::String
1226 public var metadata: [Swift::String : any Swift::Sendable]
1227 public init(contextSize: Swift::Int, tokenCount: Swift::Int, debugDescription: Swift::String, metadata: [Swift::String : any Swift::Sendable] = [:])
1228 }
1229 public struct RateLimited : Swift::Sendable {
1230 public var resetDate: Foundation::Date?
1231 public var debugDescription: Swift::String
1232 public var metadata: [Swift::String : any Swift::Sendable]
1233 public init(resetDate: Foundation::Date?, debugDescription: Swift::String, metadata: [Swift::String : any Swift::Sendable] = [:])
1234 }
1235 public struct GuardrailViolation : Swift::Sendable {
1236 public var debugDescription: Swift::String
1237 public var metadata: [Swift::String : any Swift::Sendable]
1238 public init(debugDescription: Swift::String, metadata: [Swift::String : any Swift::Sendable] = [:])
1239 }
1240 public struct Refusal : Swift::Sendable {
1241 public var debugDescription: Swift::String
1242 public var metadata: [Swift::String : any Swift::Sendable]
1243 public init(debugDescription: Swift::String, metadata: [Swift::String : any Swift::Sendable] = [:])
1244 }
1245 public struct UnsupportedCapability : Swift::Sendable {
1246 public var capability: FoundationModels::LanguageModelCapabilities.FoundationModels::Capability
1247 public var debugDescription: Swift::String
1248 public var metadata: [Swift::String : any Swift::Sendable]
1249 public init(capability: FoundationModels::LanguageModelCapabilities.FoundationModels::Capability, debugDescription: Swift::String, metadata: [Swift::String : any Swift::Sendable] = [:])
1250 }
1251 public struct UnsupportedTranscriptContent : Swift::Sendable {
1252 public var unsupportedContent: [FoundationModels::Transcript.FoundationModels::Entry]
1253 public var debugDescription: Swift::String
1254 public var metadata: [Swift::String : any Swift::Sendable]
1255 public init(unsupportedContent: [FoundationModels::Transcript.FoundationModels::Entry], debugDescription: Swift::String, metadata: [Swift::String : any Swift::Sendable] = [:])
1256 }
1257 public struct UnsupportedGenerationGuide : Swift::Sendable {
1258 public var schemaName: Swift::String?
1259 public var debugDescription: Swift::String
1260 public var metadata: [Swift::String : any Swift::Sendable]
1261 public init(schemaName: Swift::String?, debugDescription: Swift::String, metadata: [Swift::String : any Swift::Sendable] = [:])
1262 }
1263 public struct UnsupportedLanguageOrLocale : Swift::Sendable {
1264 public var languageCode: Foundation::Locale.Foundation::LanguageCode
1265 public var debugDescription: Swift::String
1266 public var metadata: [Swift::String : any Swift::Sendable]
1267 public init(languageCode: Foundation::Locale.Foundation::LanguageCode, debugDescription: Swift::String, metadata: [Swift::String : any Swift::Sendable] = [:])
1268 }
1269 public struct Timeout : Swift::Sendable {
1270 public var debugDescription: Swift::String
1271 public var metadata: [Swift::String : any Swift::Sendable]
1272 public init(debugDescription: Swift::String, metadata: [Swift::String : any Swift::Sendable] = [:])
1273 }
1274 public var debugDescription: Swift::String {
1275 get
1276 }
1277 public var errorDescription: Swift::String? {
1278 get
1279 }
1280}
1281@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1282@available(tvOS, unavailable)
1283@available(watchOS, unavailable)
1284extension FoundationModels::LanguageModelSession {
1285 @available(iOS, introduced: 26.0, deprecated: 27.0)
1286 @available(macOS, introduced: 26.0, deprecated: 27.0)
1287 @available(visionOS, introduced: 26.0, deprecated: 27.0)
1288 @available(tvOS, unavailable)
1289 @available(watchOS, unavailable)
1290 public enum GenerationError : Swift::Error, Foundation::LocalizedError {
1291 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1292 @available(tvOS, unavailable)
1293 @available(watchOS, unavailable)
1294 public struct Context : Swift::Sendable {
1295 public let debugDescription: Swift::String
1296 public init(debugDescription: Swift::String)
1297 }
1298 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1299 @available(tvOS, unavailable)
1300 @available(watchOS, unavailable)
1301 public struct Refusal : Swift::Sendable {
1302 public init(transcriptEntries: [FoundationModels::Transcript.FoundationModels::Entry])
1303 }
1304 @available(iOS, deprecated: 27.0, message: "Use ``LanguageModelError/contextSizeExceeded(_:)`` instead.")
1305 @available(macOS, deprecated: 27.0, message: "Use ``LanguageModelError/contextSizeExceeded(_:)`` instead.")
1306 @available(visionOS, deprecated: 27.0, message: "Use ``LanguageModelError/contextSizeExceeded(_:)`` instead.")
1307 case exceededContextWindowSize(FoundationModels::LanguageModelSession.FoundationModels::GenerationError.FoundationModels::Context)
1308 @available(iOS, deprecated: 27.0, message: "Use ``SystemLanguageModel/Error/assetsUnavailable(_:)`` instead.")
1309 @available(macOS, deprecated: 27.0, message: "Use ``SystemLanguageModel/Error/assetsUnavailable(_:)`` instead.")
1310 @available(visionOS, deprecated: 27.0, message: "Use ``SystemLanguageModel/Error/assetsUnavailable(_:)`` instead.")
1311 case assetsUnavailable(FoundationModels::LanguageModelSession.FoundationModels::GenerationError.FoundationModels::Context)
1312 @available(iOS, deprecated: 27.0, message: "Use ``LanguageModelError/guardrailViolation(_:)`` instead.")
1313 @available(macOS, deprecated: 27.0, message: "Use ``LanguageModelError/guardrailViolation(_:)`` instead.")
1314 @available(visionOS, deprecated: 27.0, message: "Use ``LanguageModelError/guardrailViolation(_:)`` instead.")
1315 case guardrailViolation(FoundationModels::LanguageModelSession.FoundationModels::GenerationError.FoundationModels::Context)
1316 @available(iOS, deprecated: 27.0, message: "Use ``LanguageModelError/unsupportedGenerationGuide(_:)`` instead.")
1317 @available(macOS, deprecated: 27.0, message: "Use ``LanguageModelError/unsupportedGenerationGuide(_:)`` instead.")
1318 @available(visionOS, deprecated: 27.0, message: "Use ``LanguageModelError/unsupportedGenerationGuide(_:)`` instead.")
1319 case unsupportedGuide(FoundationModels::LanguageModelSession.FoundationModels::GenerationError.FoundationModels::Context)
1320 @available(iOS, deprecated: 27.0, message: "Use ``LanguageModelError/unsupportedLanguageOrLocale(_:)`` instead.")
1321 @available(macOS, deprecated: 27.0, message: "Use ``LanguageModelError/unsupportedLanguageOrLocale(_:)`` instead.")
1322 @available(visionOS, deprecated: 27.0, message: "Use ``LanguageModelError/unsupportedLanguageOrLocale(_:)`` instead.")
1323 case unsupportedLanguageOrLocale(FoundationModels::LanguageModelSession.FoundationModels::GenerationError.FoundationModels::Context)
1324 @available(iOS, deprecated: 27.0, message: "Use ``GeneratedContent/ParsingError`` instead.")
1325 @available(macOS, deprecated: 27.0, message: "Use ``GeneratedContent/ParsingError`` instead.")
1326 @available(visionOS, deprecated: 27.0, message: "Use ``GeneratedContent/ParsingError`` instead.")
1327 case decodingFailure(FoundationModels::LanguageModelSession.FoundationModels::GenerationError.FoundationModels::Context)
1328 @available(iOS, deprecated: 27.0, message: "Use ``LanguageModelError/rateLimited(_:)`` instead.")
1329 @available(macOS, deprecated: 27.0, message: "Use ``LanguageModelError/rateLimited(_:)`` instead.")
1330 @available(visionOS, deprecated: 27.0, message: "Use ``LanguageModelError/rateLimited(_:)`` instead.")
1331 case rateLimited(FoundationModels::LanguageModelSession.FoundationModels::GenerationError.FoundationModels::Context)
1332 @available(iOS, deprecated: 27.0, message: "Use ``LanguageModelSession/Error/concurrentRequests`` instead.")
1333 @available(macOS, deprecated: 27.0, message: "Use ``LanguageModelSession/Error/concurrentRequests`` instead.")
1334 @available(visionOS, deprecated: 27.0, message: "Use ``LanguageModelSession/Error/concurrentRequests`` instead.")
1335 case concurrentRequests(FoundationModels::LanguageModelSession.FoundationModels::GenerationError.FoundationModels::Context)
1336 @available(iOS, deprecated: 27.0, message: "Use ``LanguageModelError/refusal(_:)`` instead.")
1337 @available(macOS, deprecated: 27.0, message: "Use ``LanguageModelError/refusal(_:)`` instead.")
1338 @available(visionOS, deprecated: 27.0, message: "Use ``LanguageModelError/refusal(_:)`` instead.")
1339 case refusal(FoundationModels::LanguageModelSession.FoundationModels::GenerationError.FoundationModels::Refusal, FoundationModels::LanguageModelSession.FoundationModels::GenerationError.FoundationModels::Context)
1340 public var errorDescription: Swift::String? {
1341 get
1342 }
1343 public var recoverySuggestion: Swift::String? {
1344 get
1345 }
1346 public var failureReason: Swift::String? {
1347 get
1348 }
1349 }
1350 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1351 @available(tvOS, unavailable)
1352 @available(watchOS, unavailable)
1353 public struct ToolCallError : Swift::Error, Foundation::LocalizedError {
1354 public var tool: any FoundationModels::Tool
1355 public var underlyingError: any Swift::Error
1356 public init(tool: any FoundationModels::Tool, underlyingError: any Swift::Error)
1357 public var errorDescription: Swift::String? {
1358 get
1359 }
1360 }
1361}
1362@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1363@available(tvOS, unavailable)
1364public protocol LanguageModelExecutor : Swift::Sendable {
1365 associatedtype Configuration : Swift::Hashable, Swift::Sendable
1366 associatedtype Model : FoundationModels::LanguageModel
1367 func prewarm(model: Self.Model, transcript: FoundationModels::Transcript)
1368 init(configuration: Self.Configuration) throws
1369 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
1370 nonisolated(nonsending) func respond(to request: FoundationModels::LanguageModelExecutorGenerationRequest, model: Self.Model, streamingInto channel: FoundationModels::LanguageModelExecutorGenerationChannel) async throws
1371 #endif
1372}
1373@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1374@available(tvOS, unavailable)
1375public struct LanguageModelExecutorGenerationChannel : _Concurrency::AsyncSequence, Swift::Sendable {
1376 public typealias Element = any FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Event
1377 public struct AsyncIterator : _Concurrency::AsyncIteratorProtocol {
1378 public mutating func next(isolation actor: isolated (any _Concurrency::Actor)?) async throws -> (any FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Event)?
1379 @available(macOS 27.0, iOS 27.0, watchOS 27.0, visionOS 27.0, *)
1380 @available(tvOS, unavailable)
1381 public typealias Element = any FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Event
1382 @available(macOS 27.0, iOS 27.0, watchOS 27.0, visionOS 27.0, *)
1383 @available(tvOS, unavailable)
1384 @_implements(_Concurrency::AsyncIteratorProtocol, Failure) public typealias __AsyncIteratorProtocol_Failure = any Swift::Error
1385 }
1386 public func makeAsyncIterator() -> FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::AsyncIterator
1387 public init()
1388 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
1389 nonisolated(nonsending) public func send(_ event: some Event) async
1390 #endif
1391 public protocol Event : Swift::Sendable {
1392 var kind: FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::EventKind { get }
1393 }
1394 public struct EventKind : Swift::Sendable {
1395 }
1396 @available(macOS 27.0, iOS 27.0, watchOS 27.0, visionOS 27.0, *)
1397 @available(tvOS, unavailable)
1398 @_implements(_Concurrency::AsyncSequence, Failure) public typealias __AsyncSequence_Failure = any Swift::Error
1399}
1400@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1401@available(tvOS, unavailable)
1402extension FoundationModels::LanguageModelExecutorGenerationChannel {
1403 public struct Metadata : Swift::Sendable {
1404 public var values: [Swift::String : any Swift::Sendable & Swift::Codable & Swift::Equatable]
1405 }
1406 public struct Usage : Swift::Sendable {
1407 public var input: FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Usage.FoundationModels::Input
1408 public var output: FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Usage.FoundationModels::Output
1409 public struct Input : Swift::Sendable {
1410 public var totalTokenCount: Swift::Int
1411 public var cachedTokenCount: Swift::Int
1412 public init(totalTokenCount: Swift::Int, cachedTokenCount: Swift::Int)
1413 }
1414 public struct Output : Swift::Sendable {
1415 public var totalTokenCount: Swift::Int
1416 public var reasoningTokenCount: Swift::Int
1417 public init(totalTokenCount: Swift::Int, reasoningTokenCount: Swift::Int)
1418 }
1419 public init(input: FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Usage.FoundationModels::Input, output: FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Usage.FoundationModels::Output)
1420 }
1421 public struct TextFragment : Swift::Sendable {
1422 public var content: Swift::String
1423 public var segmentID: Swift::String?
1424 public var tokenCount: Swift::Int
1425 }
1426 public struct TextSegmentReplacement : Swift::Sendable {
1427 public var content: Swift::String
1428 public var segmentID: Swift::String?
1429 public var tokenCount: Swift::Int
1430 }
1431 public struct Response : FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Event {
1432 public var entryID: Swift::String?
1433 public var action: FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Response.FoundationModels::Action
1434 public var kind: FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::EventKind {
1435 get
1436 }
1437 public enum Action : Swift::Sendable {
1438 case appendText(FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::TextFragment)
1439 case replaceTextSegment(FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::TextSegmentReplacement)
1440 case updateCustomSegment(any FoundationModels::Transcript.FoundationModels::CustomSegment)
1441 case addAttachmentSegment(FoundationModels::Transcript.FoundationModels::AttachmentSegment)
1442 case removeAttachmentSegment(id: Swift::String)
1443 case updateMetadata(FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Metadata)
1444 case updateUsage(FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Usage)
1445 }
1446 }
1447 public struct Reasoning : FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Event {
1448 public var entryID: Swift::String?
1449 public var action: FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Reasoning.FoundationModels::Action
1450 public var kind: FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::EventKind {
1451 get
1452 }
1453 public enum Action : Swift::Sendable {
1454 case appendText(FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::TextFragment)
1455 case replaceTextSegment(FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::TextSegmentReplacement)
1456 case updateSignature(FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::ReasoningSignature)
1457 case updateMetadata(FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Metadata)
1458 case updateUsage(FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Usage)
1459 }
1460 }
1461 public struct ReasoningSignature : Swift::Sendable {
1462 public var signature: Foundation::Data
1463 public var tokenCount: Swift::Int
1464 }
1465 public struct ToolCalls : FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Event {
1466 public var entryID: Swift::String?
1467 public var action: FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::ToolCalls.FoundationModels::Action
1468 public var kind: FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::EventKind {
1469 get
1470 }
1471 public enum Action : Swift::Sendable {
1472 case toolCall(FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::ToolCalls.FoundationModels::ToolCall)
1473 case removeToolCall(id: Swift::String)
1474 case updateMetadata(FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Metadata)
1475 case updateUsage(FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Usage)
1476 }
1477 public struct ToolCall : Swift::Sendable {
1478 public var id: Swift::String
1479 public var name: Swift::String
1480 public var action: FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::ToolCalls.FoundationModels::ToolCall.FoundationModels::Action
1481 public enum Action : Swift::Sendable {
1482 case appendArguments(FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::ToolCalls.FoundationModels::ToolCall.FoundationModels::ArgumentsFragment)
1483 case updateMetadata(FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Metadata)
1484 }
1485 public struct ArgumentsFragment : Swift::Sendable {
1486 public var content: Swift::String
1487 public var tokenCount: Swift::Int
1488 }
1489 }
1490 }
1491}
1492@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1493@available(tvOS, unavailable)
1494extension FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Response.FoundationModels::Action {
1495 public static func appendText(_ text: Swift::String, segmentID: Swift::String? = nil, tokenCount: Swift::Int) -> FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Response.FoundationModels::Action
1496 public static func replaceTextSegment(_ text: Swift::String, segmentID: Swift::String? = nil, tokenCount: Swift::Int) -> FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Response.FoundationModels::Action
1497 public static func updateMetadata(_ values: [Swift::String : any Swift::Sendable & Swift::Codable & Swift::Equatable]) -> FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Response.FoundationModels::Action
1498 public static func updateUsage(input: FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Usage.FoundationModels::Input, output: FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Usage.FoundationModels::Output) -> FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Response.FoundationModels::Action
1499}
1500@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1501@available(tvOS, unavailable)
1502extension FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::ToolCalls.FoundationModels::Action {
1503 public static func toolCall(id: Swift::String, name: Swift::String, action: FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::ToolCalls.FoundationModels::ToolCall.FoundationModels::Action) -> FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::ToolCalls.FoundationModels::Action
1504 public static func updateMetadata(_ values: [Swift::String : any Swift::Sendable & Swift::Codable & Swift::Equatable]) -> FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::ToolCalls.FoundationModels::Action
1505 public static func updateUsage(input: FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Usage.FoundationModels::Input, output: FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Usage.FoundationModels::Output) -> FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::ToolCalls.FoundationModels::Action
1506}
1507@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1508@available(tvOS, unavailable)
1509extension FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::ToolCalls.FoundationModels::ToolCall.FoundationModels::Action {
1510 public static func appendArguments(_ content: Swift::String, tokenCount: Swift::Int) -> FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::ToolCalls.FoundationModels::ToolCall.FoundationModels::Action
1511 public static func updateMetadata(_ values: [Swift::String : any Swift::Sendable & Swift::Codable & Swift::Equatable]) -> FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::ToolCalls.FoundationModels::ToolCall.FoundationModels::Action
1512}
1513@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1514@available(tvOS, unavailable)
1515extension FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Reasoning.FoundationModels::Action {
1516 public static func appendText(_ text: Swift::String, segmentID: Swift::String? = nil, tokenCount: Swift::Int) -> FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Reasoning.FoundationModels::Action
1517 public static func replaceTextSegment(_ text: Swift::String, segmentID: Swift::String? = nil, tokenCount: Swift::Int) -> FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Reasoning.FoundationModels::Action
1518 public static func updateSignature(_ signature: Foundation::Data, tokenCount: Swift::Int) -> FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Reasoning.FoundationModels::Action
1519 public static func updateMetadata(_ values: [Swift::String : any Swift::Sendable & Swift::Codable & Swift::Equatable]) -> FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Reasoning.FoundationModels::Action
1520 public static func updateUsage(input: FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Usage.FoundationModels::Input, output: FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Usage.FoundationModels::Output) -> FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Reasoning.FoundationModels::Action
1521}
1522@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1523@available(tvOS, unavailable)
1524extension FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Event where Self == FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Response {
1525 public static func response(entryID: Swift::String? = nil, action: FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Response.FoundationModels::Action) -> Self
1526}
1527@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1528@available(tvOS, unavailable)
1529extension FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Event where Self == FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::ToolCalls {
1530 public static func toolCalls(entryID: Swift::String? = nil, action: FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::ToolCalls.FoundationModels::Action) -> Self
1531}
1532@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1533@available(tvOS, unavailable)
1534extension FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Event where Self == FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Reasoning {
1535 public static func reasoning(entryID: Swift::String? = nil, action: FoundationModels::LanguageModelExecutorGenerationChannel.FoundationModels::Reasoning.FoundationModels::Action) -> Self
1536}
1537@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1538@available(tvOS, unavailable)
1539public struct LanguageModelExecutorGenerationRequest : Swift::Sendable {
1540 public var id: Foundation::UUID
1541 public var transcript: FoundationModels::Transcript
1542 public var enabledToolDefinitions: [FoundationModels::Transcript.FoundationModels::ToolDefinition]
1543 public var schema: FoundationModels::GenerationSchema?
1544 public var generationOptions: FoundationModels::GenerationOptions
1545 public var contextOptions: FoundationModels::ContextOptions
1546 public var metadata: [Swift::String : any Swift::Sendable & Swift::Codable & Swift::Equatable]
1547 public init(id: Foundation::UUID, transcript: FoundationModels::Transcript, enabledTools: [FoundationModels::Transcript.FoundationModels::ToolDefinition], schema: FoundationModels::GenerationSchema? = nil, generationOptions: FoundationModels::GenerationOptions, contextOptions: FoundationModels::ContextOptions, metadata: [Swift::String : any Swift::Sendable & Swift::Codable & Swift::Equatable])
1548}
1549@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1550@available(tvOS, unavailable)
1551extension FoundationModels::LanguageModelExecutor {
1552 public func prewarm(model: Self.Model, transcript: FoundationModels::Transcript)
1553}
1554@_hasMissingDesignatedInitializers @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1555@available(tvOS, unavailable)
1556final public class LanguageModelSession {
1557 final public var transcript: FoundationModels::Transcript {
1558 get
1559 }
1560 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1561 @available(tvOS, unavailable)
1562 final public var transcriptErrorHandlingPolicy: FoundationModels::TranscriptErrorHandlingPolicy? {
1563 get
1564 set
1565 }
1566 @objc deinit
1567}
1568@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1569@available(tvOS, unavailable)
1570extension FoundationModels::LanguageModelSession : nonisolated Observation::Observable {
1571}
1572@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1573@available(tvOS, unavailable)
1574extension FoundationModels::LanguageModelSession {
1575 final public var isResponding: Swift::Bool {
1576 get
1577 }
1578 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1579 @available(tvOS, unavailable)
1580 final public var usage: FoundationModels::LanguageModelSession.FoundationModels::Usage {
1581 get
1582 }
1583}
1584@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1585@available(tvOS, unavailable)
1586extension FoundationModels::LanguageModelSession {
1587 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1588 @available(tvOS, unavailable)
1589 convenience public init<Failure>(model: some LanguageModel, tools: [any FoundationModels::Tool] = [], @FoundationModels::InstructionsBuilder instructions: () throws(Failure) -> FoundationModels::Instructions) throws(Failure) where Failure : Swift::Error
1590 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1591 @available(tvOS, unavailable)
1592 convenience public init(model: some LanguageModel, tools: [any FoundationModels::Tool] = [], transcript: FoundationModels::Transcript)
1593 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1594 @available(tvOS, unavailable)
1595 convenience public init(model: some LanguageModel, tools: [any FoundationModels::Tool] = [], instructions: FoundationModels::Instructions? = nil)
1596 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1597 @available(tvOS, unavailable)
1598 @_disfavoredOverload convenience public init(model: some LanguageModel, tools: [any FoundationModels::Tool] = [], instructions: Swift::String? = nil)
1599 final public func prewarm(promptPrefix: FoundationModels::Prompt? = nil)
1600 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1601 @available(tvOS, unavailable)
1602 public struct Response<Content> where Content : FoundationModels::Generable {
1603 public let content: Content
1604 public let rawContent: FoundationModels::GeneratedContent
1605 public let transcriptEntries: Swift::ArraySlice<FoundationModels::Transcript.FoundationModels::Entry>
1606 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1607 @available(tvOS, unavailable)
1608 public let usage: FoundationModels::LanguageModelSession.FoundationModels::Usage
1609 }
1610 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1611 @available(tvOS, unavailable)
1612 public struct Usage : Swift::Sendable {
1613 public var input: FoundationModels::LanguageModelSession.FoundationModels::Usage.FoundationModels::Input
1614 public var output: FoundationModels::LanguageModelSession.FoundationModels::Usage.FoundationModels::Output
1615 public var totalTokenCount: Swift::Int {
1616 get
1617 }
1618 public var metadata: [Swift::String : any Swift::Sendable & Swift::Codable & Swift::Equatable]
1619 public struct Input : Swift::Sendable {
1620 public var totalTokenCount: Swift::Int
1621 public var cachedTokenCount: Swift::Int
1622 public init(totalTokenCount: Swift::Int, cachedTokenCount: Swift::Int)
1623 }
1624 public struct Output : Swift::Sendable {
1625 public var totalTokenCount: Swift::Int
1626 public var reasoningTokenCount: Swift::Int
1627 public init(totalTokenCount: Swift::Int, reasoningTokenCount: Swift::Int)
1628 }
1629 public init(input: FoundationModels::LanguageModelSession.FoundationModels::Usage.FoundationModels::Input, output: FoundationModels::LanguageModelSession.FoundationModels::Usage.FoundationModels::Output, metadata: [Swift::String : any Swift::Sendable & Swift::Codable & Swift::Equatable] = [:])
1630 }
1631}
1632@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1633@available(tvOS, unavailable)
1634extension FoundationModels::LanguageModelSession : @unchecked Swift::Sendable {
1635}
1636@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1637@available(tvOS, unavailable)
1638extension FoundationModels::LanguageModelSession {
1639 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1640 @available(tvOS, unavailable)
1641 public enum Error : Foundation::LocalizedError, Swift::CustomDebugStringConvertible {
1642 case concurrentRequests
1643 case transcriptMutationWhileResponding
1644 public var debugDescription: Swift::String {
1645 get
1646 }
1647 public var errorDescription: Swift::String? {
1648 get
1649 }
1650 public static func == (a: FoundationModels::LanguageModelSession.FoundationModels::Error, b: FoundationModels::LanguageModelSession.FoundationModels::Error) -> Swift::Bool
1651 public func hash(into hasher: inout Swift::Hasher)
1652 public var hashValue: Swift::Int {
1653 get
1654 }
1655 }
1656}
1657@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1658@available(tvOS, unavailable)
1659extension FoundationModels::LanguageModelSession {
1660 final public func streamResponse(to prompt: FoundationModels::Prompt, options: FoundationModels::GenerationOptions = GenerationOptions()) -> sending FoundationModels::LanguageModelSession.FoundationModels::ResponseStream<Swift::String>
1661 @_disfavoredOverload final public func streamResponse(to prompt: Swift::String, options: FoundationModels::GenerationOptions = GenerationOptions()) -> sending FoundationModels::LanguageModelSession.FoundationModels::ResponseStream<Swift::String>
1662 final public func streamResponse(options: FoundationModels::GenerationOptions = GenerationOptions(), @FoundationModels::PromptBuilder prompt: () throws -> FoundationModels::Prompt) rethrows -> sending FoundationModels::LanguageModelSession.FoundationModels::ResponseStream<Swift::String>
1663 final public func streamResponse(to prompt: FoundationModels::Prompt, schema: FoundationModels::GenerationSchema, includeSchemaInPrompt: Swift::Bool = true, options: FoundationModels::GenerationOptions = GenerationOptions()) -> sending FoundationModels::LanguageModelSession.FoundationModels::ResponseStream<FoundationModels::GeneratedContent>
1664 @_disfavoredOverload final public func streamResponse(to prompt: Swift::String, schema: FoundationModels::GenerationSchema, includeSchemaInPrompt: Swift::Bool = true, options: FoundationModels::GenerationOptions = GenerationOptions()) -> sending FoundationModels::LanguageModelSession.FoundationModels::ResponseStream<FoundationModels::GeneratedContent>
1665 final public func streamResponse(schema: FoundationModels::GenerationSchema, includeSchemaInPrompt: Swift::Bool = true, options: FoundationModels::GenerationOptions = GenerationOptions(), @FoundationModels::PromptBuilder prompt: () throws -> FoundationModels::Prompt) rethrows -> sending FoundationModels::LanguageModelSession.FoundationModels::ResponseStream<FoundationModels::GeneratedContent>
1666 final public func streamResponse<Content>(to prompt: FoundationModels::Prompt, generating type: Content.Type = Content.self, includeSchemaInPrompt: Swift::Bool = true, options: FoundationModels::GenerationOptions = GenerationOptions()) -> sending FoundationModels::LanguageModelSession.FoundationModels::ResponseStream<Content> where Content : FoundationModels::Generable
1667 @_disfavoredOverload final public func streamResponse<Content>(to prompt: Swift::String, generating type: Content.Type = Content.self, includeSchemaInPrompt: Swift::Bool = true, options: FoundationModels::GenerationOptions = GenerationOptions()) -> sending FoundationModels::LanguageModelSession.FoundationModels::ResponseStream<Content> where Content : FoundationModels::Generable
1668 final public func streamResponse<Content>(generating type: Content.Type = Content.self, includeSchemaInPrompt: Swift::Bool = true, options: FoundationModels::GenerationOptions = GenerationOptions(), @FoundationModels::PromptBuilder prompt: () throws -> FoundationModels::Prompt) rethrows -> sending FoundationModels::LanguageModelSession.FoundationModels::ResponseStream<Content> where Content : FoundationModels::Generable
1669 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1670 @available(tvOS, unavailable)
1671 final public func streamResponse(to prompt: FoundationModels::Prompt, options: FoundationModels::GenerationOptions = GenerationOptions(), contextOptions: FoundationModels::ContextOptions = ContextOptions(), metadata: [Swift::String : any Swift::Sendable & Swift::Codable & Swift::Equatable] = [:]) -> sending FoundationModels::LanguageModelSession.FoundationModels::ResponseStream<Swift::String>
1672 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1673 @available(tvOS, unavailable)
1674 @_disfavoredOverload final public func streamResponse(to prompt: Swift::String, options: FoundationModels::GenerationOptions = GenerationOptions(), contextOptions: FoundationModels::ContextOptions = ContextOptions(), metadata: [Swift::String : any Swift::Sendable & Swift::Codable & Swift::Equatable] = [:]) -> sending FoundationModels::LanguageModelSession.FoundationModels::ResponseStream<Swift::String>
1675 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1676 @available(tvOS, unavailable)
1677 final public func streamResponse(options: FoundationModels::GenerationOptions = GenerationOptions(), contextOptions: FoundationModels::ContextOptions = ContextOptions(), metadata: [Swift::String : any Swift::Sendable & Swift::Codable & Swift::Equatable] = [:], @FoundationModels::PromptBuilder prompt: () throws -> FoundationModels::Prompt) rethrows -> sending FoundationModels::LanguageModelSession.FoundationModels::ResponseStream<Swift::String>
1678 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1679 @available(tvOS, unavailable)
1680 @_disfavoredOverload final public func streamResponse(to prompt: FoundationModels::Prompt, schema: FoundationModels::GenerationSchema, options: FoundationModels::GenerationOptions = GenerationOptions(), contextOptions: FoundationModels::ContextOptions = ContextOptions(includeSchemaInPrompt: true), metadata: [Swift::String : any Swift::Sendable & Swift::Codable & Swift::Equatable] = [:]) -> sending FoundationModels::LanguageModelSession.FoundationModels::ResponseStream<FoundationModels::GeneratedContent>
1681 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1682 @available(tvOS, unavailable)
1683 @_disfavoredOverload final public func streamResponse(to prompt: Swift::String, schema: FoundationModels::GenerationSchema, options: FoundationModels::GenerationOptions = GenerationOptions(), contextOptions: FoundationModels::ContextOptions = ContextOptions(includeSchemaInPrompt: true), metadata: [Swift::String : any Swift::Sendable & Swift::Codable & Swift::Equatable] = [:]) -> sending FoundationModels::LanguageModelSession.FoundationModels::ResponseStream<FoundationModels::GeneratedContent>
1684 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1685 @available(tvOS, unavailable)
1686 @_disfavoredOverload final public func streamResponse(schema: FoundationModels::GenerationSchema, options: FoundationModels::GenerationOptions = GenerationOptions(), contextOptions: FoundationModels::ContextOptions = ContextOptions(includeSchemaInPrompt: true), metadata: [Swift::String : any Swift::Sendable & Swift::Codable & Swift::Equatable] = [:], @FoundationModels::PromptBuilder prompt: () throws -> FoundationModels::Prompt) rethrows -> sending FoundationModels::LanguageModelSession.FoundationModels::ResponseStream<FoundationModels::GeneratedContent>
1687 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1688 @available(tvOS, unavailable)
1689 final public func streamResponse<Content>(to prompt: FoundationModels::Prompt, generating type: Content.Type = Content.self, options: FoundationModels::GenerationOptions = GenerationOptions(), contextOptions: FoundationModels::ContextOptions = ContextOptions(includeSchemaInPrompt: true), metadata: [Swift::String : any Swift::Sendable & Swift::Codable & Swift::Equatable] = [:]) -> sending FoundationModels::LanguageModelSession.FoundationModels::ResponseStream<Content> where Content : FoundationModels::Generable
1690 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1691 @available(tvOS, unavailable)
1692 @_disfavoredOverload final public func streamResponse<Content>(to prompt: Swift::String, generating type: Content.Type = Content.self, options: FoundationModels::GenerationOptions = GenerationOptions(), contextOptions: FoundationModels::ContextOptions = ContextOptions(includeSchemaInPrompt: true), metadata: [Swift::String : any Swift::Sendable & Swift::Codable & Swift::Equatable] = [:]) -> sending FoundationModels::LanguageModelSession.FoundationModels::ResponseStream<Content> where Content : FoundationModels::Generable
1693 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1694 @available(tvOS, unavailable)
1695 final public func streamResponse<Content>(generating type: Content.Type = Content.self, options: FoundationModels::GenerationOptions = GenerationOptions(), contextOptions: FoundationModels::ContextOptions = ContextOptions(includeSchemaInPrompt: true), metadata: [Swift::String : any Swift::Sendable & Swift::Codable & Swift::Equatable] = [:], @FoundationModels::PromptBuilder prompt: () throws -> FoundationModels::Prompt) rethrows -> sending FoundationModels::LanguageModelSession.FoundationModels::ResponseStream<Content> where Content : FoundationModels::Generable
1696 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
1697 @discardableResult
1698 nonisolated(nonsending) final public func respond(to prompt: FoundationModels::Prompt, options: FoundationModels::GenerationOptions = GenerationOptions()) async throws -> FoundationModels::LanguageModelSession.FoundationModels::Response<Swift::String>
1699 #endif
1700 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
1701 @discardableResult
1702 @_disfavoredOverload nonisolated(nonsending) final public func respond(to prompt: Swift::String, options: FoundationModels::GenerationOptions = GenerationOptions()) async throws -> FoundationModels::LanguageModelSession.FoundationModels::Response<Swift::String>
1703 #endif
1704 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
1705 @discardableResult
1706 nonisolated(nonsending) final public func respond(options: FoundationModels::GenerationOptions = GenerationOptions(), @FoundationModels::PromptBuilder prompt: () throws -> FoundationModels::Prompt) async throws -> FoundationModels::LanguageModelSession.FoundationModels::Response<Swift::String>
1707 #endif
1708 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
1709 @discardableResult
1710 nonisolated(nonsending) final public func respond(to prompt: FoundationModels::Prompt, schema: FoundationModels::GenerationSchema, includeSchemaInPrompt: Swift::Bool = true, options: FoundationModels::GenerationOptions = GenerationOptions()) async throws -> FoundationModels::LanguageModelSession.FoundationModels::Response<FoundationModels::GeneratedContent>
1711 #endif
1712 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
1713 @discardableResult
1714 @_disfavoredOverload nonisolated(nonsending) final public func respond(to prompt: Swift::String, schema: FoundationModels::GenerationSchema, includeSchemaInPrompt: Swift::Bool = true, options: FoundationModels::GenerationOptions = GenerationOptions()) async throws -> FoundationModels::LanguageModelSession.FoundationModels::Response<FoundationModels::GeneratedContent>
1715 #endif
1716 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
1717 @discardableResult
1718 nonisolated(nonsending) final public func respond(schema: FoundationModels::GenerationSchema, includeSchemaInPrompt: Swift::Bool = true, options: FoundationModels::GenerationOptions = GenerationOptions(), @FoundationModels::PromptBuilder prompt: () throws -> FoundationModels::Prompt) async throws -> FoundationModels::LanguageModelSession.FoundationModels::Response<FoundationModels::GeneratedContent>
1719 #endif
1720 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
1721 @discardableResult
1722 nonisolated(nonsending) final public func respond<Content>(to prompt: FoundationModels::Prompt, generating type: Content.Type = Content.self, includeSchemaInPrompt: Swift::Bool = true, options: FoundationModels::GenerationOptions = GenerationOptions()) async throws -> FoundationModels::LanguageModelSession.FoundationModels::Response<Content> where Content : FoundationModels::Generable
1723 #endif
1724 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
1725 @discardableResult
1726 @_disfavoredOverload nonisolated(nonsending) final public func respond<Content>(to prompt: Swift::String, generating type: Content.Type = Content.self, includeSchemaInPrompt: Swift::Bool = true, options: FoundationModels::GenerationOptions = GenerationOptions()) async throws -> FoundationModels::LanguageModelSession.FoundationModels::Response<Content> where Content : FoundationModels::Generable
1727 #endif
1728 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
1729 @discardableResult
1730 nonisolated(nonsending) final public func respond<Content>(generating type: Content.Type = Content.self, includeSchemaInPrompt: Swift::Bool = true, options: FoundationModels::GenerationOptions = GenerationOptions(), @FoundationModels::PromptBuilder prompt: () throws -> FoundationModels::Prompt) async throws -> FoundationModels::LanguageModelSession.FoundationModels::Response<Content> where Content : FoundationModels::Generable
1731 #endif
1732 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
1733 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1734 @available(tvOS, unavailable)
1735 @discardableResult
1736 nonisolated(nonsending) final public func respond(to prompt: FoundationModels::Prompt, options: FoundationModels::GenerationOptions = GenerationOptions(), contextOptions: FoundationModels::ContextOptions = ContextOptions(), metadata: [Swift::String : any Swift::Sendable & Swift::Codable & Swift::Equatable] = [:]) async throws -> FoundationModels::LanguageModelSession.FoundationModels::Response<Swift::String>
1737 #endif
1738 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
1739 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1740 @available(tvOS, unavailable)
1741 @discardableResult
1742 @_disfavoredOverload nonisolated(nonsending) final public func respond(to prompt: Swift::String, options: FoundationModels::GenerationOptions = GenerationOptions(), contextOptions: FoundationModels::ContextOptions = ContextOptions(), metadata: [Swift::String : any Swift::Sendable & Swift::Codable & Swift::Equatable] = [:]) async throws -> FoundationModels::LanguageModelSession.FoundationModels::Response<Swift::String>
1743 #endif
1744 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
1745 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1746 @available(tvOS, unavailable)
1747 @discardableResult
1748 nonisolated(nonsending) final public func respond(options: FoundationModels::GenerationOptions = GenerationOptions(), contextOptions: FoundationModels::ContextOptions = ContextOptions(), metadata: [Swift::String : any Swift::Sendable & Swift::Codable & Swift::Equatable] = [:], @FoundationModels::PromptBuilder prompt: () throws -> FoundationModels::Prompt) async throws -> FoundationModels::LanguageModelSession.FoundationModels::Response<Swift::String>
1749 #endif
1750 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
1751 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1752 @available(tvOS, unavailable)
1753 @discardableResult
1754 @_disfavoredOverload nonisolated(nonsending) final public func respond(to prompt: FoundationModels::Prompt, schema: FoundationModels::GenerationSchema, options: FoundationModels::GenerationOptions = GenerationOptions(), contextOptions: FoundationModels::ContextOptions = ContextOptions(includeSchemaInPrompt: true), metadata: [Swift::String : any Swift::Sendable & Swift::Codable & Swift::Equatable] = [:]) async throws -> FoundationModels::LanguageModelSession.FoundationModels::Response<FoundationModels::GeneratedContent>
1755 #endif
1756 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
1757 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1758 @available(tvOS, unavailable)
1759 @discardableResult
1760 @_disfavoredOverload nonisolated(nonsending) final public func respond(to prompt: Swift::String, schema: FoundationModels::GenerationSchema, options: FoundationModels::GenerationOptions = GenerationOptions(), contextOptions: FoundationModels::ContextOptions = ContextOptions(includeSchemaInPrompt: true), metadata: [Swift::String : any Swift::Sendable & Swift::Codable & Swift::Equatable] = [:]) async throws -> FoundationModels::LanguageModelSession.FoundationModels::Response<FoundationModels::GeneratedContent>
1761 #endif
1762 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
1763 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1764 @available(tvOS, unavailable)
1765 @discardableResult
1766 @_disfavoredOverload nonisolated(nonsending) final public func respond(schema: FoundationModels::GenerationSchema, options: FoundationModels::GenerationOptions = GenerationOptions(), contextOptions: FoundationModels::ContextOptions = ContextOptions(includeSchemaInPrompt: true), metadata: [Swift::String : any Swift::Sendable & Swift::Codable & Swift::Equatable] = [:], @FoundationModels::PromptBuilder prompt: () throws -> FoundationModels::Prompt) async throws -> FoundationModels::LanguageModelSession.FoundationModels::Response<FoundationModels::GeneratedContent>
1767 #endif
1768 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
1769 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1770 @available(tvOS, unavailable)
1771 @discardableResult
1772 nonisolated(nonsending) final public func respond<Content>(to prompt: FoundationModels::Prompt, generating type: Content.Type = Content.self, options: FoundationModels::GenerationOptions = GenerationOptions(), contextOptions: FoundationModels::ContextOptions = ContextOptions(includeSchemaInPrompt: true), metadata: [Swift::String : any Swift::Sendable & Swift::Codable & Swift::Equatable] = [:]) async throws -> FoundationModels::LanguageModelSession.FoundationModels::Response<Content> where Content : FoundationModels::Generable
1773 #endif
1774 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
1775 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1776 @available(tvOS, unavailable)
1777 @discardableResult
1778 @_disfavoredOverload nonisolated(nonsending) final public func respond<Content>(to prompt: Swift::String, generating type: Content.Type = Content.self, options: FoundationModels::GenerationOptions = GenerationOptions(), contextOptions: FoundationModels::ContextOptions = ContextOptions(includeSchemaInPrompt: true), metadata: [Swift::String : any Swift::Sendable & Swift::Codable & Swift::Equatable] = [:]) async throws -> FoundationModels::LanguageModelSession.FoundationModels::Response<Content> where Content : FoundationModels::Generable
1779 #endif
1780 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
1781 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1782 @available(tvOS, unavailable)
1783 @discardableResult
1784 nonisolated(nonsending) final public func respond<Content>(generating type: Content.Type = Content.self, options: FoundationModels::GenerationOptions = GenerationOptions(), contextOptions: FoundationModels::ContextOptions = ContextOptions(includeSchemaInPrompt: true), metadata: [Swift::String : any Swift::Sendable & Swift::Codable & Swift::Equatable] = [:], @FoundationModels::PromptBuilder prompt: () throws -> FoundationModels::Prompt) async throws -> FoundationModels::LanguageModelSession.FoundationModels::Response<Content> where Content : FoundationModels::Generable
1785 #endif
1786}
1787@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1788@available(tvOS, unavailable)
1789extension FoundationModels::LanguageModelSession {
1790 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1791 @available(tvOS, unavailable)
1792 public struct ResponseStream<Content> where Content : FoundationModels::Generable {
1793 public struct Snapshot {
1794 public var content: Content.PartiallyGenerated
1795 public var rawContent: FoundationModels::GeneratedContent
1796 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1797 @available(tvOS, unavailable)
1798 public var transcriptEntries: Swift::ArraySlice<FoundationModels::Transcript.FoundationModels::Entry>
1799 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1800 @available(tvOS, unavailable)
1801 public var usage: FoundationModels::LanguageModelSession.FoundationModels::Usage
1802 }
1803 }
1804}
1805@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1806@available(tvOS, unavailable)
1807extension FoundationModels::LanguageModelSession.FoundationModels::ResponseStream : _Concurrency::AsyncSequence {
1808 public typealias Element = FoundationModels::LanguageModelSession.FoundationModels::ResponseStream<Content>.FoundationModels::Snapshot
1809 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1810 @available(tvOS, unavailable)
1811 public struct AsyncIterator : _Concurrency::AsyncIteratorProtocol {
1812 public mutating func next(isolation actor: isolated (any _Concurrency::Actor)? = #isolation) async throws -> FoundationModels::LanguageModelSession.FoundationModels::ResponseStream<Content>.FoundationModels::Snapshot?
1813 @available(macOS 26.0, iOS 26.0, watchOS 27.0, visionOS 26.0, *)
1814 @available(tvOS, unavailable)
1815 public typealias Element = FoundationModels::LanguageModelSession.FoundationModels::ResponseStream<Content>.FoundationModels::Snapshot
1816 @available(macOS 26.0, iOS 26.0, watchOS 27.0, visionOS 26.0, *)
1817 @available(tvOS, unavailable)
1818 @_implements(_Concurrency::AsyncIteratorProtocol, Failure) public typealias __AsyncIteratorProtocol_Failure = any Swift::Error
1819 }
1820 public func makeAsyncIterator() -> FoundationModels::LanguageModelSession.FoundationModels::ResponseStream<Content>.FoundationModels::AsyncIterator
1821 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
1822 nonisolated(nonsending) public func collect() async throws -> sending FoundationModels::LanguageModelSession.FoundationModels::Response<Content>
1823 #endif
1824 @available(macOS 26.0, iOS 26.0, watchOS 27.0, visionOS 26.0, *)
1825 @available(tvOS, unavailable)
1826 @_implements(_Concurrency::AsyncSequence, Failure) public typealias __AsyncSequence_Failure = any Swift::Error
1827}
1828@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1829@available(tvOS, unavailable)
1830public struct Transcript : Swift::Sendable, Swift::Equatable, Swift::RandomAccessCollection {
1831 public typealias Index = Swift::Int
1832 public subscript(index: FoundationModels::Transcript.FoundationModels::Index) -> FoundationModels::Transcript.FoundationModels::Entry {
1833 get
1834 set
1835 }
1836 public var startIndex: Swift::Int {
1837 get
1838 }
1839 public var endIndex: Swift::Int {
1840 get
1841 }
1842 public init(entries: some Sequence<Entry> = [])
1843 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1844 @available(tvOS, unavailable)
1845 public enum Entry : Swift::Sendable, Swift::Identifiable, Swift::Equatable {
1846 case instructions(FoundationModels::Transcript.FoundationModels::Instructions)
1847 case prompt(FoundationModels::Transcript.FoundationModels::Prompt)
1848 case toolCalls(FoundationModels::Transcript.FoundationModels::ToolCalls)
1849 case toolOutput(FoundationModels::Transcript.FoundationModels::ToolOutput)
1850 case response(FoundationModels::Transcript.FoundationModels::Response)
1851 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1852 @available(tvOS, unavailable)
1853 case reasoning(FoundationModels::Transcript.FoundationModels::Reasoning)
1854 public var id: Swift::String {
1855 get
1856 }
1857 public static func == (a: FoundationModels::Transcript.FoundationModels::Entry, b: FoundationModels::Transcript.FoundationModels::Entry) -> Swift::Bool
1858 @available(macOS 26.0, iOS 26.0, watchOS 27.0, visionOS 26.0, *)
1859 @available(tvOS, unavailable)
1860 public typealias ID = Swift::String
1861 }
1862 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1863 @available(tvOS, unavailable)
1864 public enum Segment : Swift::Sendable, Swift::Identifiable, Swift::Equatable {
1865 case text(FoundationModels::Transcript.FoundationModels::TextSegment)
1866 case structure(FoundationModels::Transcript.FoundationModels::StructuredSegment)
1867 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1868 @available(tvOS, unavailable)
1869 case attachment(FoundationModels::Transcript.FoundationModels::AttachmentSegment)
1870 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1871 @available(tvOS, unavailable)
1872 case custom(any FoundationModels::Transcript.FoundationModels::CustomSegment)
1873 public var id: Swift::String {
1874 get
1875 }
1876 public static func == (lhs: FoundationModels::Transcript.FoundationModels::Segment, rhs: FoundationModels::Transcript.FoundationModels::Segment) -> Swift::Bool
1877 @available(macOS 26.0, iOS 26.0, watchOS 27.0, visionOS 26.0, *)
1878 @available(tvOS, unavailable)
1879 public typealias ID = Swift::String
1880 }
1881 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1882 @available(tvOS, unavailable)
1883 public struct TextSegment : Swift::Sendable, Swift::Identifiable, Swift::Equatable {
1884 public var id: Swift::String
1885 public var content: Swift::String
1886 public init(id: Swift::String = UUID().uuidString, content: Swift::String)
1887 public static func == (a: FoundationModels::Transcript.FoundationModels::TextSegment, b: FoundationModels::Transcript.FoundationModels::TextSegment) -> Swift::Bool
1888 @available(macOS 26.0, iOS 26.0, watchOS 27.0, visionOS 26.0, *)
1889 @available(tvOS, unavailable)
1890 public typealias ID = Swift::String
1891 }
1892 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1893 @available(tvOS, unavailable)
1894 public struct StructuredSegment : Swift::Sendable, Swift::Identifiable, Swift::Equatable {
1895 public var id: Swift::String
1896 @available(iOS, deprecated: 27.0, renamed: "schemaName")
1897 @available(macOS, deprecated: 27.0, renamed: "schemaName")
1898 @available(visionOS, deprecated: 27.0, renamed: "schemaName")
1899 public var source: Swift::String
1900 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1901 @backDeployed(before: iOS 27.0, macOS 27.0, visionOS 27.0)
1902 @available(tvOS, unavailable)
1903 public var schemaName: Swift::String {
1904 get { source }
1905 set { source = newValue }
1906 }
1907 public var content: FoundationModels::GeneratedContent {
1908 get
1909 set
1910 }
1911 @available(iOS, deprecated: 27.0, renamed: "init(id:schemaName:content:)")
1912 @available(macOS, deprecated: 27.0, renamed: "init(id:schemaName:content:)")
1913 @available(visionOS, deprecated: 27.0, renamed: "init(id:schemaName:content:)")
1914 public init(id: Swift::String = UUID().uuidString, source: Swift::String, content: FoundationModels::GeneratedContent)
1915 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1916 @available(tvOS, unavailable)
1917 public init(id: Swift::String = UUID().uuidString, schemaName: Swift::String, content: FoundationModels::GeneratedContent)
1918 public static func == (a: FoundationModels::Transcript.FoundationModels::StructuredSegment, b: FoundationModels::Transcript.FoundationModels::StructuredSegment) -> Swift::Bool
1919 @available(macOS 26.0, iOS 26.0, watchOS 27.0, visionOS 26.0, *)
1920 @available(tvOS, unavailable)
1921 public typealias ID = Swift::String
1922 }
1923 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1924 @available(tvOS, unavailable)
1925 public struct AttachmentSegment : Swift::Sendable, Swift::Identifiable, Swift::Equatable {
1926 public var id: Swift::String
1927 public var content: FoundationModels::Transcript.FoundationModels::Attachment
1928 public var label: Swift::String?
1929 public init(id: Swift::String = UUID().uuidString, content: FoundationModels::Transcript.FoundationModels::Attachment, label: Swift::String? = nil)
1930 public static func == (a: FoundationModels::Transcript.FoundationModels::AttachmentSegment, b: FoundationModels::Transcript.FoundationModels::AttachmentSegment) -> Swift::Bool
1931 @available(macOS 27.0, iOS 27.0, watchOS 27.0, visionOS 27.0, *)
1932 @available(tvOS, unavailable)
1933 public typealias ID = Swift::String
1934 }
1935 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1936 @available(tvOS, unavailable)
1937 public enum Attachment : Swift::Sendable, Swift::Equatable {
1938 case image(FoundationModels::Transcript.FoundationModels::ImageAttachment)
1939 public static func == (a: FoundationModels::Transcript.FoundationModels::Attachment, b: FoundationModels::Transcript.FoundationModels::Attachment) -> Swift::Bool
1940 }
1941 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1942 @available(tvOS, unavailable)
1943 public struct ImageAttachment : Swift::Sendable, Swift::Equatable {
1944 public var cgImage: CoreGraphics::CGImage {
1945 get
1946 }
1947 public var ciImage: CoreImage::CIImage {
1948 get
1949 }
1950 public func pixelBuffer(resolution: CoreFoundation::CGSize? = nil, pixelFormat: Darwin::OSType? = nil) throws -> CoreVideo::CVReadOnlyPixelBuffer
1951 public var orientation: ImageIO::CGImagePropertyOrientation {
1952 get
1953 }
1954 public var url: Foundation::URL? {
1955 get
1956 }
1957 public init(_ cgImage: CoreGraphics::CGImage, orientation: ImageIO::CGImagePropertyOrientation? = nil)
1958 public init(_ ciImage: CoreImage::CIImage, orientation: ImageIO::CGImagePropertyOrientation? = nil)
1959 public init(_ pixelBuffer: CoreVideo::CVPixelBuffer, orientation: ImageIO::CGImagePropertyOrientation? = nil)
1960 public init(imageURL: Foundation::URL, orientation: ImageIO::CGImagePropertyOrientation? = nil)
1961 public static func == (a: FoundationModels::Transcript.FoundationModels::ImageAttachment, b: FoundationModels::Transcript.FoundationModels::ImageAttachment) -> Swift::Bool
1962 }
1963 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1964 @available(tvOS, unavailable)
1965 public struct Instructions : Swift::Sendable, Swift::Identifiable, Swift::Equatable {
1966 public var id: Swift::String
1967 public var segments: [FoundationModels::Transcript.FoundationModels::Segment]
1968 public var toolDefinitions: [FoundationModels::Transcript.FoundationModels::ToolDefinition]
1969 public init(id: Swift::String = UUID().uuidString, segments: [FoundationModels::Transcript.FoundationModels::Segment], toolDefinitions: [FoundationModels::Transcript.FoundationModels::ToolDefinition])
1970 public static func == (a: FoundationModels::Transcript.FoundationModels::Instructions, b: FoundationModels::Transcript.FoundationModels::Instructions) -> Swift::Bool
1971 @available(macOS 26.0, iOS 26.0, watchOS 27.0, visionOS 26.0, *)
1972 @available(tvOS, unavailable)
1973 public typealias ID = Swift::String
1974 }
1975 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1976 @available(tvOS, unavailable)
1977 public struct ToolDefinition : Swift::Sendable, Swift::Equatable {
1978 public var name: Swift::String
1979 public var description: Swift::String
1980 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1981 @available(tvOS, unavailable)
1982 public var parameters: FoundationModels::GenerationSchema {
1983 get
1984 set
1985 }
1986 public init(name: Swift::String, description: Swift::String, parameters: FoundationModels::GenerationSchema)
1987 public init(tool: some Tool)
1988 public static func == (lhs: FoundationModels::Transcript.FoundationModels::ToolDefinition, rhs: FoundationModels::Transcript.FoundationModels::ToolDefinition) -> Swift::Bool
1989 }
1990 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
1991 @available(tvOS, unavailable)
1992 public struct Prompt : Swift::Sendable, Swift::Identifiable, Swift::Equatable {
1993 public var id: Swift::String
1994 public var segments: [FoundationModels::Transcript.FoundationModels::Segment]
1995 public var options: FoundationModels::GenerationOptions
1996 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
1997 @available(tvOS, unavailable)
1998 public var contextOptions: FoundationModels::ContextOptions
1999 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
2000 @available(tvOS, unavailable)
2001 public var metadata: [Swift::String : any Swift::Codable & Swift::Sendable & Swift::Equatable]
2002 public var responseFormat: FoundationModels::Transcript.FoundationModels::ResponseFormat?
2003 public init(id: Swift::String = UUID().uuidString, segments: [FoundationModels::Transcript.FoundationModels::Segment], options: FoundationModels::GenerationOptions = GenerationOptions(), responseFormat: FoundationModels::Transcript.FoundationModels::ResponseFormat? = nil)
2004 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
2005 @available(tvOS, unavailable)
2006 public init(id: Swift::String = UUID().uuidString, metadata: [Swift::String : any Swift::Codable & Swift::Sendable & Swift::Equatable] = [:], segments: [FoundationModels::Transcript.FoundationModels::Segment], options: FoundationModels::GenerationOptions = GenerationOptions(), responseFormat: FoundationModels::Transcript.FoundationModels::ResponseFormat? = nil, contextOptions: FoundationModels::ContextOptions = ContextOptions())
2007 public static func == (lhs: FoundationModels::Transcript.FoundationModels::Prompt, rhs: FoundationModels::Transcript.FoundationModels::Prompt) -> Swift::Bool
2008 @available(macOS 26.0, iOS 26.0, watchOS 27.0, visionOS 26.0, *)
2009 @available(tvOS, unavailable)
2010 public typealias ID = Swift::String
2011 }
2012 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2013 @available(tvOS, unavailable)
2014 public struct ResponseFormat : Swift::Sendable, Swift::Equatable {
2015 public var name: Swift::String {
2016 get
2017 }
2018 public init<Content>(type: Content.Type) where Content : FoundationModels::Generable
2019 public init(schema: FoundationModels::GenerationSchema)
2020 public static func == (a: FoundationModels::Transcript.FoundationModels::ResponseFormat, b: FoundationModels::Transcript.FoundationModels::ResponseFormat) -> Swift::Bool
2021 }
2022 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2023 @available(tvOS, unavailable)
2024 public struct ToolCalls : Swift::Sendable, Swift::Identifiable, Swift::Equatable, Swift::RandomAccessCollection {
2025 public var id: Swift::String
2026 public init<S>(id: Swift::String = UUID().uuidString, _ calls: S) where S : Swift::Sequence, S.Element == FoundationModels::Transcript.FoundationModels::ToolCall
2027 public subscript(position: Swift::Int) -> FoundationModels::Transcript.FoundationModels::ToolCall {
2028 get
2029 }
2030 public var startIndex: Swift::Int {
2031 get
2032 }
2033 public var endIndex: Swift::Int {
2034 get
2035 }
2036 public static func == (a: FoundationModels::Transcript.FoundationModels::ToolCalls, b: FoundationModels::Transcript.FoundationModels::ToolCalls) -> Swift::Bool
2037 @available(macOS 26.0, iOS 26.0, watchOS 27.0, visionOS 26.0, *)
2038 @available(tvOS, unavailable)
2039 public typealias Element = FoundationModels::Transcript.FoundationModels::ToolCall
2040 @available(macOS 26.0, iOS 26.0, watchOS 27.0, visionOS 26.0, *)
2041 @available(tvOS, unavailable)
2042 public typealias ID = Swift::String
2043 @available(macOS 26.0, iOS 26.0, watchOS 27.0, visionOS 26.0, *)
2044 @available(tvOS, unavailable)
2045 public typealias Index = Swift::Int
2046 @available(macOS 26.0, iOS 26.0, watchOS 27.0, visionOS 26.0, *)
2047 @available(tvOS, unavailable)
2048 public typealias Indices = Swift::Range<Swift::Int>
2049 @available(macOS 26.0, iOS 26.0, watchOS 27.0, visionOS 26.0, *)
2050 @available(tvOS, unavailable)
2051 public typealias Iterator = Swift::IndexingIterator<FoundationModels::Transcript.FoundationModels::ToolCalls>
2052 @available(macOS 26.0, iOS 26.0, watchOS 27.0, visionOS 26.0, *)
2053 @available(tvOS, unavailable)
2054 public typealias SubSequence = Swift::Slice<FoundationModels::Transcript.FoundationModels::ToolCalls>
2055 }
2056 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2057 @available(tvOS, unavailable)
2058 public struct ToolCall : Swift::Sendable, Swift::Identifiable, Swift::Equatable {
2059 public var id: Swift::String
2060 public var toolName: Swift::String
2061 public var arguments: FoundationModels::GeneratedContent {
2062 get
2063 set
2064 }
2065 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
2066 @available(tvOS, unavailable)
2067 public var metadata: [Swift::String : any Swift::Codable & Swift::Sendable & Swift::Equatable]
2068 public init(id: Swift::String, toolName: Swift::String, arguments: FoundationModels::GeneratedContent)
2069 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
2070 @available(tvOS, unavailable)
2071 public init(id: Swift::String, metadata: [Swift::String : any Swift::Codable & Swift::Sendable & Swift::Equatable], toolName: Swift::String, arguments: FoundationModels::GeneratedContent)
2072 public static func == (lhs: FoundationModels::Transcript.FoundationModels::ToolCall, rhs: FoundationModels::Transcript.FoundationModels::ToolCall) -> Swift::Bool
2073 @available(macOS 26.0, iOS 26.0, watchOS 27.0, visionOS 26.0, *)
2074 @available(tvOS, unavailable)
2075 public typealias ID = Swift::String
2076 }
2077 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2078 @available(tvOS, unavailable)
2079 public struct ToolOutput : Swift::Sendable, Swift::Identifiable, Swift::Equatable {
2080 public var id: Swift::String
2081 public var toolName: Swift::String
2082 public var segments: [FoundationModels::Transcript.FoundationModels::Segment]
2083 public init(id: Swift::String, toolName: Swift::String, segments: [FoundationModels::Transcript.FoundationModels::Segment])
2084 public static func == (a: FoundationModels::Transcript.FoundationModels::ToolOutput, b: FoundationModels::Transcript.FoundationModels::ToolOutput) -> Swift::Bool
2085 @available(macOS 26.0, iOS 26.0, watchOS 27.0, visionOS 26.0, *)
2086 @available(tvOS, unavailable)
2087 public typealias ID = Swift::String
2088 }
2089 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2090 @available(tvOS, unavailable)
2091 public struct Response : Swift::Sendable, Swift::Identifiable, Swift::Equatable {
2092 public var id: Swift::String
2093 public var assetIDs: [Swift::String]
2094 @available(iOS 27.0, macOS 27.0, visionOS 27.0, *)
2095 @usableFromInline
2096 internal var _metadata: [Swift::String : any Swift::Codable & Swift::Sendable & Swift::Equatable]
2097 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2098 @backDeployed(before: iOS 27.0, macOS 27.0, visionOS 27.0)
2099 @available(tvOS, unavailable)
2100 public var metadata: [Swift::String : any Swift::Codable & Swift::Sendable & Swift::Equatable] {
2101 get {
2102 if #available(iOS 27.0, macOS 27.0, visionOS 27.0, *) {
2103 _metadata
2104 } else {
2105 ["assetIDs": assetIDs]
2106 }
2107 }
2108 }
2109 public var segments: [FoundationModels::Transcript.FoundationModels::Segment]
2110 public init(id: Swift::String = UUID().uuidString, assetIDs: [Swift::String], segments: [FoundationModels::Transcript.FoundationModels::Segment])
2111 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
2112 @available(tvOS, unavailable)
2113 public init(id: Swift::String = UUID().uuidString, metadata: [Swift::String : any Swift::Sendable & Swift::Codable & Swift::Equatable] = [:], segments: [FoundationModels::Transcript.FoundationModels::Segment])
2114 public static func == (lhs: FoundationModels::Transcript.FoundationModels::Response, rhs: FoundationModels::Transcript.FoundationModels::Response) -> Swift::Bool
2115 @available(macOS 26.0, iOS 26.0, watchOS 27.0, visionOS 26.0, *)
2116 @available(tvOS, unavailable)
2117 public typealias ID = Swift::String
2118 }
2119 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
2120 @available(tvOS, unavailable)
2121 public protocol CustomSegment : FoundationModels::InstructionsRepresentable, FoundationModels::PromptRepresentable, Swift::CustomStringConvertible, Swift::Equatable, Swift::Identifiable, Swift::Sendable {
2122 associatedtype Content : Swift::Decodable, Swift::Encodable, Swift::Equatable, Swift::Sendable
2123 var id: Swift::String { get }
2124 var content: Self.Content { get }
2125 }
2126 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
2127 @available(tvOS, unavailable)
2128 public struct Reasoning : Swift::Sendable, Swift::Identifiable, Swift::Equatable {
2129 public var id: Swift::String
2130 public var segments: [FoundationModels::Transcript.FoundationModels::Segment]
2131 public var signature: Foundation::Data?
2132 public var metadata: [Swift::String : any Swift::Codable & Swift::Sendable & Swift::Equatable]
2133 public init(id: Swift::String = UUID().uuidString, metadata: [Swift::String : any Swift::Sendable & Swift::Codable & Swift::Equatable] = [:], segments: [FoundationModels::Transcript.FoundationModels::Segment], signature: Foundation::Data? = nil)
2134 public static func == (lhs: FoundationModels::Transcript.FoundationModels::Reasoning, rhs: FoundationModels::Transcript.FoundationModels::Reasoning) -> Swift::Bool
2135 @available(macOS 27.0, iOS 27.0, watchOS 27.0, visionOS 27.0, *)
2136 @available(tvOS, unavailable)
2137 public typealias ID = Swift::String
2138 }
2139 public static func == (a: FoundationModels::Transcript, b: FoundationModels::Transcript) -> Swift::Bool
2140 @available(macOS 26.0, iOS 26.0, watchOS 27.0, visionOS 26.0, *)
2141 @available(tvOS, unavailable)
2142 public typealias Indices = Swift::Range<FoundationModels::Transcript.FoundationModels::Index>
2143 @available(macOS 26.0, iOS 26.0, watchOS 27.0, visionOS 26.0, *)
2144 @available(tvOS, unavailable)
2145 public typealias Iterator = Swift::IndexingIterator<FoundationModels::Transcript>
2146}
2147@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
2148@available(tvOS, unavailable)
2149extension FoundationModels::Transcript : Swift::MutableCollection {
2150 @available(macOS 27.0, iOS 27.0, watchOS 27.0, visionOS 27.0, *)
2151 @available(tvOS, unavailable)
2152 public typealias Element = FoundationModels::Transcript.FoundationModels::Entry
2153 @available(macOS 27.0, iOS 27.0, watchOS 27.0, visionOS 27.0, *)
2154 @available(tvOS, unavailable)
2155 public typealias SubSequence = Swift::Slice<FoundationModels::Transcript>
2156}
2157@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
2158@available(tvOS, unavailable)
2159extension FoundationModels::Transcript : Swift::RangeReplaceableCollection {
2160 public init()
2161 public mutating func replaceSubrange<C>(_ subrange: Swift::Range<Swift::Int>, with newElements: consuming C) where C : Swift::Collection, C.Element == FoundationModels::Transcript.FoundationModels::Entry
2162}
2163@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
2164@available(tvOS, unavailable)
2165extension FoundationModels::Transcript.FoundationModels::CustomSegment {
2166 public var promptRepresentation: FoundationModels::Prompt {
2167 get
2168 }
2169}
2170@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
2171@available(tvOS, unavailable)
2172extension FoundationModels::Transcript.FoundationModels::CustomSegment {
2173 public func isEqual(to other: some Transcript.CustomSegment) -> Swift::Bool
2174}
2175@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
2176@available(tvOS, unavailable)
2177extension FoundationModels::Transcript {
2178 public var history: Swift::ArraySlice<FoundationModels::Transcript.FoundationModels::Entry> {
2179 _read
2180 set
2181 _modify
2182 }
2183}
2184@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2185@available(tvOS, unavailable)
2186extension FoundationModels::Transcript : Swift::Codable {
2187 public init(from decoder: any Swift::Decoder) throws
2188 public func encode(to encoder: any Swift::Encoder) throws
2189}
2190@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2191@available(tvOS, unavailable)
2192extension FoundationModels::Transcript.FoundationModels::Entry : Swift::CustomStringConvertible {
2193 public var description: Swift::String {
2194 get
2195 }
2196}
2197@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2198@available(tvOS, unavailable)
2199extension FoundationModels::Transcript.FoundationModels::TextSegment : Swift::CustomStringConvertible {
2200 public var description: Swift::String {
2201 get
2202 }
2203}
2204@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2205@available(tvOS, unavailable)
2206extension FoundationModels::Transcript.FoundationModels::StructuredSegment : Swift::CustomStringConvertible {
2207 public var description: Swift::String {
2208 get
2209 }
2210}
2211@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
2212@available(tvOS, unavailable)
2213extension FoundationModels::Transcript.FoundationModels::AttachmentSegment : Swift::CustomStringConvertible {
2214 public var description: Swift::String {
2215 get
2216 }
2217}
2218@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
2219@available(tvOS, unavailable)
2220extension FoundationModels::Transcript.FoundationModels::CustomSegment {
2221 public var description: Swift::String {
2222 get
2223 }
2224}
2225@available(iOS 27.0, macOS 27.0, visionOS 27.0, *)
2226@available(watchOS, unavailable)
2227@available(tvOS, unavailable)
2228extension FoundationModels::Transcript.FoundationModels::Reasoning {
2229 public var description: Swift::String {
2230 get
2231 }
2232}
2233@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2234@available(tvOS, unavailable)
2235extension FoundationModels::Transcript.FoundationModels::Segment : Swift::CustomStringConvertible {
2236 public var description: Swift::String {
2237 get
2238 }
2239}
2240@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2241@available(tvOS, unavailable)
2242extension FoundationModels::Transcript.FoundationModels::Instructions : Swift::CustomStringConvertible {
2243 public var description: Swift::String {
2244 get
2245 }
2246}
2247@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2248@available(tvOS, unavailable)
2249extension FoundationModels::Transcript.FoundationModels::Prompt : Swift::CustomStringConvertible {
2250 public var description: Swift::String {
2251 get
2252 }
2253}
2254@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2255@available(tvOS, unavailable)
2256extension FoundationModels::Transcript.FoundationModels::ResponseFormat : Swift::CustomStringConvertible {
2257 public var description: Swift::String {
2258 get
2259 }
2260}
2261@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2262@available(tvOS, unavailable)
2263extension FoundationModels::Transcript.FoundationModels::ToolCalls : Swift::CustomStringConvertible {
2264 public var description: Swift::String {
2265 get
2266 }
2267}
2268@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2269@available(tvOS, unavailable)
2270extension FoundationModels::Transcript.FoundationModels::ToolCall : Swift::CustomStringConvertible {
2271 public var description: Swift::String {
2272 get
2273 }
2274}
2275@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2276@available(tvOS, unavailable)
2277extension FoundationModels::Transcript.FoundationModels::ToolOutput : Swift::CustomStringConvertible {
2278 public var description: Swift::String {
2279 get
2280 }
2281}
2282@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2283@available(tvOS, unavailable)
2284extension FoundationModels::Transcript.FoundationModels::Response : Swift::CustomStringConvertible {
2285 public var description: Swift::String {
2286 get
2287 }
2288}
2289@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
2290@available(tvOS, unavailable)
2291public struct TranscriptErrorHandlingPolicy : Swift::Sendable {
2292 public static let revertTranscript: FoundationModels::TranscriptErrorHandlingPolicy
2293 public static let preserveTranscript: FoundationModels::TranscriptErrorHandlingPolicy
2294}
2295@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
2296@available(tvOS, unavailable)
2297public protocol AttachmentContent {
2298}
2299@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
2300@available(tvOS, unavailable)
2301public struct Attachment<Content> where Content : FoundationModels::AttachmentContent {
2302 public func label(_ label: Swift::String) -> FoundationModels::Attachment<Content>
2303}
2304@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
2305@available(tvOS, unavailable)
2306public struct ImageAttachmentContent : FoundationModels::AttachmentContent, Swift::Sendable, Swift::Equatable {
2307 public static func == (a: FoundationModels::ImageAttachmentContent, b: FoundationModels::ImageAttachmentContent) -> Swift::Bool
2308}
2309@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
2310@available(tvOS, unavailable)
2311extension FoundationModels::Attachment : FoundationModels::PromptRepresentable, FoundationModels::InstructionsRepresentable where Content == FoundationModels::ImageAttachmentContent {
2312 public var promptRepresentation: FoundationModels::Prompt {
2313 get
2314 }
2315 public var instructionsRepresentation: FoundationModels::Instructions {
2316 get
2317 }
2318}
2319@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
2320@available(tvOS, unavailable)
2321extension FoundationModels::Attachment where Content == FoundationModels::ImageAttachmentContent {
2322 public init(_ cgImage: CoreGraphics::CGImage, orientation: ImageIO::CGImagePropertyOrientation? = nil)
2323 public init(_ ciImage: CoreImage::CIImage, orientation: ImageIO::CGImagePropertyOrientation? = nil)
2324 public init(_ pixelBuffer: CoreVideo::CVPixelBuffer, orientation: ImageIO::CGImagePropertyOrientation? = nil)
2325 public init(imageURL: Foundation::URL, orientation: ImageIO::CGImagePropertyOrientation? = nil)
2326}
2327@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2328@available(tvOS, unavailable)
2329public struct Instructions : Swift::Sendable {
2330 public init(_ content: some InstructionsRepresentable)
2331 @usableFromInline
2332 internal init<each I>(_ components: repeat each I) where repeat each I : FoundationModels::InstructionsRepresentable
2333}
2334@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2335@available(tvOS, unavailable)
2336public protocol InstructionsRepresentable {
2337 @FoundationModels::InstructionsBuilder var instructionsRepresentation: FoundationModels::Instructions { get }
2338}
2339@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2340@available(tvOS, unavailable)
2341extension FoundationModels::Instructions : FoundationModels::InstructionsRepresentable {
2342 public var instructionsRepresentation: FoundationModels::Instructions {
2343 get
2344 }
2345}
2346@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2347@available(tvOS, unavailable)
2348extension Swift::String : FoundationModels::InstructionsRepresentable {
2349 public var instructionsRepresentation: FoundationModels::Instructions {
2350 get
2351 }
2352}
2353@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2354@available(tvOS, unavailable)
2355extension Swift::Array : FoundationModels::InstructionsRepresentable where Element : FoundationModels::InstructionsRepresentable {
2356 public var instructionsRepresentation: FoundationModels::Instructions {
2357 get
2358 }
2359}
2360@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
2361@available(tvOS, unavailable)
2362extension FoundationModels::Transcript.FoundationModels::CustomSegment {
2363 public var instructionsRepresentation: FoundationModels::Instructions {
2364 get
2365 }
2366}
2367@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2368@available(tvOS, unavailable)
2369@_functionBuilder public struct InstructionsBuilder {
2370 @_alwaysEmitIntoClient public static func buildBlock<each I>(_ components: repeat each I) -> FoundationModels::Instructions where repeat each I : FoundationModels::InstructionsRepresentable {
2371 Instructions(repeat each components)
2372 }
2373 @_alwaysEmitIntoClient public static func buildArray(_ instructions: [some InstructionsRepresentable]) -> FoundationModels::Instructions {
2374 Instructions(instructions)
2375 }
2376 @_alwaysEmitIntoClient public static func buildEither(first component: some InstructionsRepresentable) -> FoundationModels::Instructions {
2377 Instructions(component)
2378 }
2379 @_alwaysEmitIntoClient public static func buildEither(second component: some InstructionsRepresentable) -> FoundationModels::Instructions {
2380 Instructions(component)
2381 }
2382 @_alwaysEmitIntoClient public static func buildOptional(_ instructions: FoundationModels::Instructions?) -> FoundationModels::Instructions {
2383 instructions ?? Instructions()
2384 }
2385 @_alwaysEmitIntoClient public static func buildLimitedAvailability(_ instructions: some InstructionsRepresentable) -> FoundationModels::Instructions {
2386 Instructions(instructions)
2387 }
2388 @_disfavoredOverload @_alwaysEmitIntoClient public static func buildExpression<I>(_ expression: I) -> I where I : FoundationModels::InstructionsRepresentable {
2389 expression
2390 }
2391 @_alwaysEmitIntoClient public static func buildExpression(_ expression: FoundationModels::Instructions) -> FoundationModels::Instructions {
2392 expression
2393 }
2394 @available(*, unavailable, message: "Only `Instructions` and `InstructionsRepresentable` are supported.")
2395 @_alwaysEmitIntoClient public static func buildExpression<T>(_ expression: T) -> FoundationModels::Instructions {
2396 fatalError()
2397 }
2398}
2399@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2400@available(tvOS, unavailable)
2401extension FoundationModels::Instructions {
2402 public init(@FoundationModels::InstructionsBuilder _ content: () throws -> FoundationModels::Instructions) rethrows
2403}
2404@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2405@available(tvOS, unavailable)
2406public struct Prompt : Swift::Sendable {
2407 public init(_ content: some PromptRepresentable)
2408 @usableFromInline
2409 internal init<each P>(_ components: repeat each P) where repeat each P : FoundationModels::PromptRepresentable
2410}
2411@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2412@available(tvOS, unavailable)
2413public protocol PromptRepresentable {
2414 @FoundationModels::PromptBuilder var promptRepresentation: FoundationModels::Prompt { get }
2415}
2416@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2417@available(tvOS, unavailable)
2418extension FoundationModels::Prompt : FoundationModels::PromptRepresentable {
2419 public var promptRepresentation: FoundationModels::Prompt {
2420 get
2421 }
2422}
2423@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2424@available(tvOS, unavailable)
2425extension Swift::String : FoundationModels::PromptRepresentable {
2426 public var promptRepresentation: FoundationModels::Prompt {
2427 get
2428 }
2429}
2430@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2431@available(tvOS, unavailable)
2432extension Swift::Array : FoundationModels::PromptRepresentable where Element : FoundationModels::PromptRepresentable {
2433 public var promptRepresentation: FoundationModels::Prompt {
2434 get
2435 }
2436}
2437@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2438@available(tvOS, unavailable)
2439@_functionBuilder public struct PromptBuilder {
2440 @_alwaysEmitIntoClient public static func buildBlock<each P>(_ components: repeat each P) -> FoundationModels::Prompt where repeat each P : FoundationModels::PromptRepresentable {
2441 Prompt(repeat each components)
2442 }
2443 @_alwaysEmitIntoClient public static func buildArray(_ prompts: [some PromptRepresentable]) -> FoundationModels::Prompt {
2444 Prompt(prompts)
2445 }
2446 @_alwaysEmitIntoClient public static func buildEither(first component: some PromptRepresentable) -> FoundationModels::Prompt {
2447 Prompt(component)
2448 }
2449 @_alwaysEmitIntoClient public static func buildEither(second component: some PromptRepresentable) -> FoundationModels::Prompt {
2450 Prompt(component)
2451 }
2452 @_alwaysEmitIntoClient public static func buildOptional(_ component: FoundationModels::Prompt?) -> FoundationModels::Prompt {
2453 component ?? Prompt()
2454 }
2455 @_alwaysEmitIntoClient public static func buildLimitedAvailability(_ prompt: some PromptRepresentable) -> FoundationModels::Prompt {
2456 Prompt(prompt)
2457 }
2458 @_disfavoredOverload @_alwaysEmitIntoClient public static func buildExpression<P>(_ expression: P) -> P where P : FoundationModels::PromptRepresentable {
2459 expression
2460 }
2461 @_alwaysEmitIntoClient public static func buildExpression(_ expression: FoundationModels::Prompt) -> FoundationModels::Prompt {
2462 expression
2463 }
2464 @available(*, unavailable, message: "Only `Prompt` and `PromptRepresentable` are supported.")
2465 @_alwaysEmitIntoClient public static func buildExpression<T>(_ expression: T) -> FoundationModels::Prompt {
2466 fatalError()
2467 }
2468}
2469@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2470@available(tvOS, unavailable)
2471extension FoundationModels::Prompt {
2472 public init(@FoundationModels::PromptBuilder _ content: () throws -> FoundationModels::Prompt) rethrows
2473}
2474@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
2475@available(tvOS, unavailable)
2476public struct ImageReference : Swift::Sendable, Swift::Equatable {
2477 public let attachmentLabel: Swift::String
2478 public func resolve(in transcript: FoundationModels::Transcript) -> FoundationModels::Transcript.FoundationModels::ImageAttachment?
2479 nonisolated public static var generationSchema: FoundationModels::GenerationSchema {
2480 get
2481 }
2482 nonisolated public var generatedContent: FoundationModels::GeneratedContent {
2483 get
2484 }
2485 nonisolated public struct PartiallyGenerated : Swift::Identifiable, nonisolated FoundationModels::ConvertibleFromGeneratedContent, Swift::Equatable {
2486 public var id: FoundationModels::GenerationID
2487 public var attachmentLabel: Swift::String.FoundationModels::PartiallyGenerated?
2488 nonisolated public init(_ content: FoundationModels::GeneratedContent) throws
2489 public static func == (a: FoundationModels::ImageReference.FoundationModels::PartiallyGenerated, b: FoundationModels::ImageReference.FoundationModels::PartiallyGenerated) -> Swift::Bool
2490 @available(macOS 27.0, iOS 27.0, watchOS 27.0, visionOS 27.0, *)
2491 @available(tvOS, unavailable)
2492 public typealias ID = FoundationModels::GenerationID
2493 }
2494 public static func == (a: FoundationModels::ImageReference, b: FoundationModels::ImageReference) -> Swift::Bool
2495}
2496@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
2497@available(tvOS, unavailable)
2498extension FoundationModels::ImageReference : nonisolated FoundationModels::Generable {
2499 nonisolated public init(_ content: FoundationModels::GeneratedContent) throws
2500}
2501@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2502@available(tvOS, unavailable)
2503public protocol Tool<Arguments, Output> : Swift::Sendable {
2504 associatedtype Output : FoundationModels::PromptRepresentable
2505 associatedtype Arguments : FoundationModels::ConvertibleFromGeneratedContent
2506 var name: Swift::String { get }
2507 var description: Swift::String { get }
2508 var parameters: FoundationModels::GenerationSchema { get }
2509 var includesSchemaInInstructions: Swift::Bool { get }
2510 #if compiler(>=5.3) && $AsyncExecutionBehaviorAttributes
2511 @concurrent func call(arguments: Self.Arguments) async throws -> Self.Output
2512 #endif
2513}
2514@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2515@available(tvOS, unavailable)
2516extension FoundationModels::Tool {
2517 public var name: Swift::String {
2518 get
2519 }
2520 public var includesSchemaInInstructions: Swift::Bool {
2521 get
2522 }
2523}
2524@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2525@available(tvOS, unavailable)
2526extension FoundationModels::Tool where Self.Arguments : FoundationModels::Generable {
2527 public var parameters: FoundationModels::GenerationSchema {
2528 get
2529 }
2530}
2531@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2532@available(tvOS, unavailable)
2533extension FoundationModels::Tool where Self.Arguments == Swift::String {
2534 @available(*, unavailable, message: "'Tool' that uses 'String' as 'Arguments' type is unsupported. Use '@Generable' struct instead.")
2535 public var parameters: FoundationModels::GenerationSchema {
2536 get
2537 }
2538}
2539@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2540@available(tvOS, unavailable)
2541extension FoundationModels::Tool where Self.Arguments == Swift::Int {
2542 @available(*, unavailable, message: "'Tool' that uses 'Int' as 'Arguments' type is unsupported. Use '@Generable' struct instead.")
2543 public var parameters: FoundationModels::GenerationSchema {
2544 get
2545 }
2546}
2547@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2548@available(tvOS, unavailable)
2549extension FoundationModels::Tool where Self.Arguments == Swift::Double {
2550 @available(*, unavailable, message: "'Tool' that uses 'Double' as 'Arguments' type is unsupported. Use '@Generable' struct instead.")
2551 public var parameters: FoundationModels::GenerationSchema {
2552 get
2553 }
2554}
2555@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2556@available(tvOS, unavailable)
2557extension FoundationModels::Tool where Self.Arguments == Swift::Float {
2558 @available(*, unavailable, message: "'Tool' that uses 'Float' as 'Arguments' type is unsupported. Use '@Generable' struct instead.")
2559 public var parameters: FoundationModels::GenerationSchema {
2560 get
2561 }
2562}
2563@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2564@available(tvOS, unavailable)
2565extension FoundationModels::Tool where Self.Arguments == Foundation::Decimal {
2566 @available(*, unavailable, message: "'Tool' that uses 'Decimal' as 'Arguments' type is unsupported. Use '@Generable' struct instead.")
2567 public var parameters: FoundationModels::GenerationSchema {
2568 get
2569 }
2570}
2571@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2572@available(tvOS, unavailable)
2573extension FoundationModels::Tool where Self.Arguments == Swift::Bool {
2574 @available(*, unavailable, message: "'Tool' that uses 'Bool' as 'Arguments' type is unsupported. Use '@Generable' struct instead.")
2575 public var parameters: FoundationModels::GenerationSchema {
2576 get
2577 }
2578}
2579@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
2580@available(tvOS, unavailable)
2581public struct _ResolvedToolList {
2582}
2583@available(iOS 26.4, macOS 26.4, visionOS 26.4, watchOS 27.0, *)
2584@available(tvOS, unavailable)
2585extension Swift::Result : FoundationModels::PromptRepresentable where Success : FoundationModels::PromptRepresentable, Failure : FoundationModels::PromptRepresentable {
2586 public var promptRepresentation: FoundationModels::Prompt {
2587 get
2588 }
2589}
2590@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
2591@available(tvOS, unavailable)
2592public struct ContextOptions : Swift::Sendable, Swift::Equatable {
2593 public enum ReasoningLevel : Swift::Sendable, Swift::Equatable {
2594 case light
2595 case moderate
2596 case deep
2597 case custom(Swift::String)
2598 public static func == (a: FoundationModels::ContextOptions.FoundationModels::ReasoningLevel, b: FoundationModels::ContextOptions.FoundationModels::ReasoningLevel) -> Swift::Bool
2599 }
2600 public var includeSchemaInPrompt: Swift::Bool?
2601 public var reasoningLevel: FoundationModels::ContextOptions.FoundationModels::ReasoningLevel?
2602 public init(includeSchemaInPrompt: Swift::Bool? = nil, reasoningLevel: FoundationModels::ContextOptions.FoundationModels::ReasoningLevel? = nil)
2603 public static func == (a: FoundationModels::ContextOptions, b: FoundationModels::ContextOptions) -> Swift::Bool
2604}
2605@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2606@available(tvOS, unavailable)
2607public struct DynamicGenerationSchema : Swift::Sendable {
2608 @available(iOS 26.4, macOS 26.4, visionOS 26.4, watchOS 27.0, *)
2609 @available(tvOS, unavailable)
2610 public static var null: FoundationModels::DynamicGenerationSchema {
2611 get
2612 }
2613 public init(name: Swift::String, description: Swift::String? = nil, properties: [FoundationModels::DynamicGenerationSchema.FoundationModels::Property])
2614 @available(iOS 26.4, macOS 26.4, visionOS 26.4, watchOS 27.0, *)
2615 @available(tvOS, unavailable)
2616 public init(name: Swift::String, description: Swift::String? = nil, representNilExplicitlyInGeneratedContent explicitNil: Swift::Bool, properties: [FoundationModels::DynamicGenerationSchema.FoundationModels::Property])
2617 public init(name: Swift::String, description: Swift::String? = nil, anyOf choices: [FoundationModels::DynamicGenerationSchema])
2618 public init(name: Swift::String, description: Swift::String? = nil, anyOf choices: [Swift::String])
2619 public init(arrayOf itemSchema: FoundationModels::DynamicGenerationSchema, minimumElements: Swift::Int? = nil, maximumElements: Swift::Int? = nil)
2620 public init<Value>(type: Value.Type, guides: [FoundationModels::GenerationGuide<Value>] = []) where Value : FoundationModels::Generable
2621 public init(referenceTo name: Swift::String)
2622 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2623 @available(tvOS, unavailable)
2624 public struct Property : Swift::Sendable {
2625 public init(name: Swift::String, description: Swift::String? = nil, schema: FoundationModels::DynamicGenerationSchema, isOptional: Swift::Bool = false)
2626 }
2627}
2628@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2629@available(tvOS, unavailable)
2630public struct GenerationID : Swift::Sendable, Swift::Hashable {
2631 public init()
2632 public static func == (a: FoundationModels::GenerationID, b: FoundationModels::GenerationID) -> Swift::Bool
2633 public func hash(into hasher: inout Swift::Hasher)
2634 public var hashValue: Swift::Int {
2635 get
2636 }
2637}
2638@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2639@available(tvOS, unavailable)
2640public struct GenerationOptions : Swift::Sendable, Swift::Equatable {
2641 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
2642 @available(*, deprecated, renamed: "samplingMode")
2643 @available(tvOS, unavailable)
2644 @available(watchOS, unavailable)
2645 public var sampling: FoundationModels::GenerationOptions.FoundationModels::SamplingMode?
2646 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2647 @backDeployed(before: iOS 27.0, macOS 27.0, visionOS 27.0)
2648 @available(tvOS, unavailable)
2649 public var samplingMode: FoundationModels::GenerationOptions.FoundationModels::SamplingMode? {
2650 get {
2651 sampling
2652 }
2653 set {
2654 sampling = newValue
2655 }
2656 }
2657 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2658 @available(tvOS, unavailable)
2659 public var temperature: Swift::Double?
2660 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2661 @available(tvOS, unavailable)
2662 public var maximumResponseTokens: Swift::Int?
2663 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
2664 @available(tvOS, unavailable)
2665 public var toolCallingMode: FoundationModels::GenerationOptions.FoundationModels::ToolCallingMode?
2666 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
2667 @available(*, deprecated, renamed: "init(samplingMode:temperature:maximumResponseTokens:)")
2668 @available(tvOS, unavailable)
2669 @available(watchOS, unavailable)
2670 public init(sampling: FoundationModels::GenerationOptions.FoundationModels::SamplingMode?, temperature: Swift::Double? = nil, maximumResponseTokens: Swift::Int? = nil)
2671 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2672 @backDeployed(before: iOS 27.0, macOS 27.0, visionOS 27.0)
2673 @available(tvOS, unavailable)
2674 public init(samplingMode: FoundationModels::GenerationOptions.FoundationModels::SamplingMode? = nil, temperature: Swift::Double? = nil, maximumResponseTokens: Swift::Int? = nil) {
2675 self.init(
2676 sampling: samplingMode,
2677 temperature: temperature,
2678 maximumResponseTokens: maximumResponseTokens
2679 )
2680 }
2681 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
2682 @available(tvOS, unavailable)
2683 public init(samplingMode: FoundationModels::GenerationOptions.FoundationModels::SamplingMode? = nil, temperature: Swift::Double? = nil, maximumResponseTokens: Swift::Int? = nil, toolCallingMode: FoundationModels::GenerationOptions.FoundationModels::ToolCallingMode?)
2684 public static func == (a: FoundationModels::GenerationOptions, b: FoundationModels::GenerationOptions) -> Swift::Bool
2685}
2686@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2687@available(tvOS, unavailable)
2688extension FoundationModels::GenerationOptions {
2689 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2690 @available(tvOS, unavailable)
2691 public struct SamplingMode : Swift::Sendable, Swift::Equatable {
2692 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2693 @available(tvOS, unavailable)
2694 public static var greedy: FoundationModels::GenerationOptions.FoundationModels::SamplingMode {
2695 get
2696 }
2697 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2698 @available(tvOS, unavailable)
2699 public static func random(top k: Swift::Int, seed: Swift::UInt64? = nil) -> FoundationModels::GenerationOptions.FoundationModels::SamplingMode
2700 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2701 @available(tvOS, unavailable)
2702 public static func random(probabilityThreshold: Swift::Double, seed: Swift::UInt64? = nil) -> FoundationModels::GenerationOptions.FoundationModels::SamplingMode
2703 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
2704 @available(tvOS, unavailable)
2705 public let kind: FoundationModels::GenerationOptions.FoundationModels::SamplingMode.FoundationModels::Kind
2706 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
2707 @available(tvOS, unavailable)
2708 public enum Kind : Swift::Sendable, Swift::Equatable {
2709 case greedy
2710 case top(k: Swift::Int, seed: Swift::UInt64?)
2711 case nucleus(threshold: Swift::Double, seed: Swift::UInt64?)
2712 public static func == (a: FoundationModels::GenerationOptions.FoundationModels::SamplingMode.FoundationModels::Kind, b: FoundationModels::GenerationOptions.FoundationModels::SamplingMode.FoundationModels::Kind) -> Swift::Bool
2713 }
2714 public static func == (a: FoundationModels::GenerationOptions.FoundationModels::SamplingMode, b: FoundationModels::GenerationOptions.FoundationModels::SamplingMode) -> Swift::Bool
2715 }
2716 @available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
2717 @available(tvOS, unavailable)
2718 public struct ToolCallingMode : Swift::Sendable, Swift::Equatable {
2719 public static let allowed: FoundationModels::GenerationOptions.FoundationModels::ToolCallingMode
2720 public static let required: FoundationModels::GenerationOptions.FoundationModels::ToolCallingMode
2721 public static let disallowed: FoundationModels::GenerationOptions.FoundationModels::ToolCallingMode
2722 public enum Kind : Swift::Sendable, Swift::Equatable {
2723 case allowed
2724 case required
2725 case disallowed
2726 public static func == (a: FoundationModels::GenerationOptions.FoundationModels::ToolCallingMode.FoundationModels::Kind, b: FoundationModels::GenerationOptions.FoundationModels::ToolCallingMode.FoundationModels::Kind) -> Swift::Bool
2727 public func hash(into hasher: inout Swift::Hasher)
2728 public var hashValue: Swift::Int {
2729 get
2730 }
2731 }
2732 public var kind: FoundationModels::GenerationOptions.FoundationModels::ToolCallingMode.FoundationModels::Kind
2733 public static func == (a: FoundationModels::GenerationOptions.FoundationModels::ToolCallingMode, b: FoundationModels::GenerationOptions.FoundationModels::ToolCallingMode) -> Swift::Bool
2734 }
2735}
2736@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2737@available(tvOS, unavailable)
2738public struct GenerationSchema : Swift::Sendable, Swift::Codable, Swift::CustomDebugStringConvertible {
2739 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2740 @available(tvOS, unavailable)
2741 public struct Property : Swift::Sendable {
2742 public init<Value>(name: Swift::String, description: Swift::String? = nil, type: Value.Type, guides: [FoundationModels::GenerationGuide<Value>] = []) where Value : FoundationModels::Generable
2743 public init<Value>(name: Swift::String, description: Swift::String? = nil, type: Value?.Type, guides: [FoundationModels::GenerationGuide<Value>] = []) where Value : FoundationModels::Generable
2744 public init<RegexOutput>(name: Swift::String, description: Swift::String? = nil, type: Swift::String.Type, guides: [_StringProcessing::Regex<RegexOutput>] = [])
2745 public init<RegexOutput>(name: Swift::String, description: Swift::String? = nil, type: Swift::String?.Type, guides: [_StringProcessing::Regex<RegexOutput>] = [])
2746 }
2747 public init(type: any FoundationModels::Generable.Type, description: Swift::String? = nil, properties: [FoundationModels::GenerationSchema.FoundationModels::Property])
2748 public init(from decoder: any Swift::Decoder) throws
2749 public func encode(to encoder: any Swift::Encoder) throws
2750 public var debugDescription: Swift::String {
2751 get
2752 }
2753 @available(iOS 26.4, macOS 26.4, visionOS 26.4, watchOS 27.0, *)
2754 @available(tvOS, unavailable)
2755 public init(type: any FoundationModels::Generable.Type, description: Swift::String? = nil, representNilExplicitlyInGeneratedContent explicitNil: Swift::Bool, properties: [FoundationModels::GenerationSchema.FoundationModels::Property])
2756 public init(type: any FoundationModels::Generable.Type, description: Swift::String? = nil, anyOf choices: [Swift::String])
2757 public init(type: any FoundationModels::Generable.Type, description: Swift::String? = nil, anyOf types: [any FoundationModels::Generable.Type])
2758 public init(root: FoundationModels::DynamicGenerationSchema, dependencies: [FoundationModels::DynamicGenerationSchema]) throws
2759 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2760 @available(tvOS, unavailable)
2761 public enum SchemaError : Swift::Error, Foundation::LocalizedError {
2762 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2763 @available(tvOS, unavailable)
2764 public struct Context : Swift::Sendable {
2765 public let debugDescription: Swift::String
2766 public init(debugDescription: Swift::String)
2767 }
2768 case duplicateType(schema: Swift::String?, type: Swift::String, context: FoundationModels::GenerationSchema.FoundationModels::SchemaError.FoundationModels::Context)
2769 case duplicateProperty(schema: Swift::String, property: Swift::String, context: FoundationModels::GenerationSchema.FoundationModels::SchemaError.FoundationModels::Context)
2770 case emptyTypeChoices(schema: Swift::String, context: FoundationModels::GenerationSchema.FoundationModels::SchemaError.FoundationModels::Context)
2771 case undefinedReferences(schema: Swift::String?, references: [Swift::String], context: FoundationModels::GenerationSchema.FoundationModels::SchemaError.FoundationModels::Context)
2772 public var errorDescription: Swift::String? {
2773 get
2774 }
2775 public var recoverySuggestion: Swift::String? {
2776 get
2777 }
2778 }
2779}
2780@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2781@available(tvOS, unavailable)
2782public struct LanguageModelFeedback {
2783 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2784 @available(tvOS, unavailable)
2785 public enum Sentiment : Swift::Sendable, Swift::CaseIterable {
2786 case positive
2787 case negative
2788 case neutral
2789 public static func == (a: FoundationModels::LanguageModelFeedback.FoundationModels::Sentiment, b: FoundationModels::LanguageModelFeedback.FoundationModels::Sentiment) -> Swift::Bool
2790 @available(macOS 26.0, iOS 26.0, watchOS 27.0, visionOS 26.0, *)
2791 @available(tvOS, unavailable)
2792 public typealias AllCases = [FoundationModels::LanguageModelFeedback.FoundationModels::Sentiment]
2793 nonisolated public static var allCases: [FoundationModels::LanguageModelFeedback.FoundationModels::Sentiment] {
2794 get
2795 }
2796 public func hash(into hasher: inout Swift::Hasher)
2797 public var hashValue: Swift::Int {
2798 get
2799 }
2800 }
2801 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2802 @available(tvOS, unavailable)
2803 public struct Issue : Swift::Sendable {
2804 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2805 @available(tvOS, unavailable)
2806 public enum Category : Swift::Sendable, Swift::CaseIterable {
2807 case unhelpful
2808 case tooVerbose
2809 case didNotFollowInstructions
… 2 unchanged lines …
1413 case suggestiveOrSexual
1414 case vulgarOrOffensive
1415 case triggeredGuardrailUnexpectedly
1416 public static func == (a: FoundationModels.LanguageModelFeedback.Issue.Category, b: FoundationModels.LanguageModelFeedback.Issue.Category) -> Swift.Bool
1417 @available(iOS 26.0, visionOS 26.0, macOS 26.0, *)
1418 @available(tvOS, unavailable)
1419 @available(watchOS, unavailable)
1420 public typealias AllCases = [FoundationModels.LanguageModelFeedback.Issue.Category]
1421 nonisolated public static var allCases: [FoundationModels.LanguageModelFeedback.Issue.Category] {
1422 get
1423 }
1424 public func hash(into hasher: inout Swift.Hasher)
1425 public var hashValue: Swift.Int {
1426 get
1427 }
1428 }
1429 public init(category: FoundationModels.LanguageModelFeedback.Issue.Category, explanation: Swift.String? = nil)
1430 }
1431}
1432@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1433@available(tvOS, unavailable)
1434@available(watchOS, unavailable)
1435extension FoundationModels.LanguageModelSession {
1436 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1437 @available(tvOS, unavailable)
1438 @available(watchOS, unavailable)
1439 @discardableResult
1440 final public func logFeedbackAttachment(sentiment: FoundationModels.LanguageModelFeedback.Sentiment?, issues: [FoundationModels.LanguageModelFeedback.Issue] = [], desiredOutput: FoundationModels.Transcript.Entry? = nil) -> Foundation.Data
1441 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1442 @backDeployed(before: iOS 26.1, macOS 26.1, visionOS 26.1)
1443 @available(tvOS, unavailable)
1444 @available(watchOS, unavailable)
1445 @discardableResult
1446 final public func logFeedbackAttachment(sentiment: FoundationModels.LanguageModelFeedback.Sentiment?, issues: [FoundationModels.LanguageModelFeedback.Issue] = [], desiredResponseText: Swift.String?) -> Foundation.Data {
1447 let entry = desiredResponseText.map { content in
1448 let text = Transcript.TextSegment(content: content)
1449 let segment = Transcript.Segment.text(text)
2812 case suggestiveOrSexual
2813 case vulgarOrOffensive
2814 case triggeredGuardrailUnexpectedly
2815 public static func == (a: FoundationModels::LanguageModelFeedback.FoundationModels::Issue.FoundationModels::Category, b: FoundationModels::LanguageModelFeedback.FoundationModels::Issue.FoundationModels::Category) -> Swift::Bool
2816 @available(macOS 26.0, iOS 26.0, watchOS 27.0, visionOS 26.0, *)
2817 @available(tvOS, unavailable)
2818 public typealias AllCases = [FoundationModels::LanguageModelFeedback.FoundationModels::Issue.FoundationModels::Category]
2819 nonisolated public static var allCases: [FoundationModels::LanguageModelFeedback.FoundationModels::Issue.FoundationModels::Category] {
2820 get
2821 }
2822 public func hash(into hasher: inout Swift::Hasher)
2823 public var hashValue: Swift::Int {
2824 get
2825 }
2826 }
2827 public init(category: FoundationModels::LanguageModelFeedback.FoundationModels::Issue.FoundationModels::Category, explanation: Swift::String? = nil)
2828 }
2829}
2830@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2831@available(tvOS, unavailable)
2832extension FoundationModels::LanguageModelSession {
2833 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2834 @available(tvOS, unavailable)
2835 @discardableResult
2836 final public func logFeedbackAttachment(sentiment: FoundationModels::LanguageModelFeedback.FoundationModels::Sentiment?, issues: [FoundationModels::LanguageModelFeedback.FoundationModels::Issue] = [], desiredOutput: FoundationModels::Transcript.FoundationModels::Entry? = nil) -> Foundation::Data
2837 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2838 @backDeployed(before: iOS 26.1, macOS 26.1, visionOS 26.1)
2839 @available(tvOS, unavailable)
2840 @discardableResult
2841 final public func logFeedbackAttachment(sentiment: FoundationModels::LanguageModelFeedback.FoundationModels::Sentiment?, issues: [FoundationModels::LanguageModelFeedback.FoundationModels::Issue] = [], desiredResponseText: Swift::String?) -> Foundation::Data {
2842 let entry = desiredResponseText.map { content in
2843 let text = Transcript.TextSegment(content: content)
2844 let segment = Transcript.Segment.text(text)
… 7 unchanged lines …
1457 desiredOutput: entry
1458 )
1459 }
1460 @available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1461 @backDeployed(before: iOS 26.1, macOS 26.1, visionOS 26.1)
1462 @available(tvOS, unavailable)
1463 @available(watchOS, unavailable)
1464 @discardableResult
1465 final public func logFeedbackAttachment(sentiment: FoundationModels.LanguageModelFeedback.Sentiment?, issues: [FoundationModels.LanguageModelFeedback.Issue] = [], desiredResponseContent: (any FoundationModels.ConvertibleToGeneratedContent)?) -> Foundation.Data {
1466 let entry = desiredResponseContent.map { desiredContent in
1467 let source = String(describing: type(of: desiredResponseContent))
1468 let content = desiredContent.generatedContent
1469 let structure = Transcript.StructuredSegment(source: source, content: content)
1470 let segment = Transcript.Segment.structure(structure)
1471 let response = Transcript.Response(assetIDs: [], segments: [segment])
1472 let entry = Transcript.Entry.response(response)
2852 desiredOutput: entry
2853 )
2854 }
2855 @available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2856 @backDeployed(before: iOS 26.1, macOS 26.1, visionOS 26.1)
2857 @available(tvOS, unavailable)
2858 @discardableResult
2859 final public func logFeedbackAttachment(sentiment: FoundationModels::LanguageModelFeedback.FoundationModels::Sentiment?, issues: [FoundationModels::LanguageModelFeedback.FoundationModels::Issue] = [], desiredResponseContent: (any FoundationModels::ConvertibleToGeneratedContent)?) -> Foundation::Data {
2860 let entry = desiredResponseContent.map { desiredContent in
2861 let source = String(describing: type(of: desiredResponseContent))
2862 let content = desiredContent.generatedContent
2863 let structure = Transcript.StructuredSegment(schemaName: source, content: content)
2864 let segment = Transcript.Segment.structure(structure)
2865 let response = Transcript.Response(assetIDs: [], segments: [segment])
2866 let entry = Transcript.Entry.response(response)
… 6 unchanged lines …
1479 )
1480 }
1481}
1482@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1483@available(tvOS, unavailable)
1484@available(watchOS, unavailable)
1485extension FoundationModels.SystemLanguageModel.Availability.UnavailableReason : Swift.Hashable {}
1486@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1487@available(tvOS, unavailable)
1488@available(watchOS, unavailable)
1489extension FoundationModels.LanguageModelFeedback.Sentiment : Swift.Equatable {}
1490@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1491@available(tvOS, unavailable)
1492@available(watchOS, unavailable)
1493extension FoundationModels.LanguageModelFeedback.Sentiment : Swift.Hashable {}
1494@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1495@available(tvOS, unavailable)
1496@available(watchOS, unavailable)
1497extension FoundationModels.LanguageModelFeedback.Issue.Category : Swift.Equatable {}
1498@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1499@available(tvOS, unavailable)
1500@available(watchOS, unavailable)
1501extension FoundationModels.LanguageModelFeedback.Issue.Category : Swift.Hashable {}
2873 )
2874 }
2875}
2876@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
2877@available(tvOS, unavailable)
2878extension FoundationModels::PrivateCloudComputeLanguageModel.FoundationModels::Availability.FoundationModels::UnavailableReason : Swift::Hashable {}
2879@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
2880@available(tvOS, unavailable)
2881@available(watchOS, unavailable)
2882extension FoundationModels::SystemLanguageModel.FoundationModels::Availability.FoundationModels::UnavailableReason : Swift::Hashable {}
2883@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
2884@available(tvOS, unavailable)
2885extension FoundationModels::LanguageModelSession.FoundationModels::Error : Swift::Equatable {}
2886@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
2887@available(tvOS, unavailable)
2888extension FoundationModels::LanguageModelSession.FoundationModels::Error : Swift::Hashable {}
2889@available(iOS 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, *)
2890@available(tvOS, unavailable)
2891extension FoundationModels::GenerationOptions.FoundationModels::ToolCallingMode.FoundationModels::Kind : Swift::Hashable {}
2892@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2893@available(tvOS, unavailable)
2894extension FoundationModels::LanguageModelFeedback.FoundationModels::Sentiment : Swift::Equatable {}
2895@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2896@available(tvOS, unavailable)
2897extension FoundationModels::LanguageModelFeedback.FoundationModels::Sentiment : Swift::Hashable {}
2898@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2899@available(tvOS, unavailable)
2900extension FoundationModels::LanguageModelFeedback.FoundationModels::Issue.FoundationModels::Category : Swift::Equatable {}
2901@available(iOS 26.0, macOS 26.0, visionOS 26.0, watchOS 27.0, *)
2902@available(tvOS, unavailable)
2903extension FoundationModels::LanguageModelFeedback.FoundationModels::Issue.FoundationModels::Category : Swift::Hashable {}