@@ -12,7 +12,7 @@ import Generation
1212import Hub
1313import Tokenizers
1414
15- @available ( macOS 15 . 0 , iOS 18 . 0 , * )
15+ @available ( macOS 15 . 0 , iOS 18 . 0 , tvOS 18 . 0 , visionOS 2 . 0 , watchOS 11 . 0 , * )
1616/// A high-level interface for language model inference using CoreML.
1717///
1818/// `LanguageModel` provides a convenient way to load and interact with pre-trained
@@ -72,7 +72,7 @@ public class LanguageModel {
7272 }
7373}
7474
75- @available ( macOS 15 . 0 , iOS 18 . 0 , * )
75+ @available ( macOS 15 . 0 , iOS 18 . 0 , tvOS 18 . 0 , visionOS 2 . 0 , watchOS 11 . 0 , * )
7676private extension LanguageModel {
7777 static func contextRange( from model: MLModel ) -> ( min: Int , max: Int ) {
7878 contextRange ( from: model, inputKey: Keys . inputIds)
@@ -109,7 +109,7 @@ private extension LanguageModel {
109109 }
110110}
111111
112- @available ( macOS 15 . 0 , iOS 18 . 0 , * )
112+ @available ( macOS 15 . 0 , iOS 18 . 0 , tvOS 18 . 0 , visionOS 2 . 0 , watchOS 11 . 0 , * )
113113extension LanguageModel {
114114 struct Configurations {
115115 var modelConfig : Config
@@ -118,7 +118,7 @@ extension LanguageModel {
118118 }
119119}
120120
121- @available ( macOS 15 . 0 , iOS 18 . 0 , * )
121+ @available ( macOS 15 . 0 , iOS 18 . 0 , tvOS 18 . 0 , visionOS 2 . 0 , watchOS 11 . 0 , * )
122122extension LanguageModel {
123123 enum Keys {
124124 // Input keys
@@ -135,7 +135,7 @@ extension LanguageModel {
135135 }
136136}
137137
138- @available ( macOS 15 . 0 , iOS 18 . 0 , * )
138+ @available ( macOS 15 . 0 , iOS 18 . 0 , tvOS 18 . 0 , visionOS 2 . 0 , watchOS 11 . 0 , * )
139139public extension LanguageModel {
140140 /// Loads a compiled CoreML model from disk.
141141 ///
@@ -155,7 +155,7 @@ public extension LanguageModel {
155155 }
156156}
157157
158- @available ( macOS 15 . 0 , iOS 18 . 0 , * )
158+ @available ( macOS 15 . 0 , iOS 18 . 0 , tvOS 18 . 0 , visionOS 2 . 0 , watchOS 11 . 0 , * )
159159extension LanguageModel {
160160 enum KVCacheAvailability {
161161 /// Language models that support KV cache via state. Implementation details for handling state
@@ -167,7 +167,7 @@ extension LanguageModel {
167167 }
168168}
169169
170- @available ( macOS 15 . 0 , iOS 18 . 0 , * )
170+ @available ( macOS 15 . 0 , iOS 18 . 0 , tvOS 18 . 0 , visionOS 2 . 0 , watchOS 11 . 0 , * )
171171public extension LanguageModel {
172172 /// Metadata fields associated to the Core ML model.
173173 var metadata : [ MLModelMetadataKey : Any ] {
@@ -296,7 +296,7 @@ public extension LanguageModel {
296296// MARK: - Configuration Properties
297297
298298/// Asynchronous properties that are downloaded from the Hugging Face Hub configuration.
299- @available ( macOS 15 . 0 , iOS 18 . 0 , * )
299+ @available ( macOS 15 . 0 , iOS 18 . 0 , tvOS 18 . 0 , visionOS 2 . 0 , watchOS 11 . 0 , * )
300300public extension LanguageModel {
301301 /// The model configuration dictionary.
302302 ///
@@ -402,7 +402,7 @@ public extension LanguageModel {
402402
403403// MARK: - TextGenerationModel Conformance
404404
405- @available ( macOS 15 . 0 , iOS 18 . 0 , * )
405+ @available ( macOS 15 . 0 , iOS 18 . 0 , tvOS 18 . 0 , visionOS 2 . 0 , watchOS 11 . 0 , * )
406406extension LanguageModel : TextGenerationModel {
407407 /// The default generation configuration for this model.
408408 ///
@@ -424,7 +424,7 @@ extension LanguageModel: TextGenerationModel {
424424///
425425/// Maintains a KV Cache as sequence generation progresses,
426426/// using stateful Core ML buffers to minimize latency.
427- @available ( macOS 15 . 0 , iOS 18 . 0 , * )
427+ @available ( macOS 15 . 0 , iOS 18 . 0 , tvOS 18 . 0 , visionOS 2 . 0 , watchOS 11 . 0 , * )
428428public class LanguageModelWithStatefulKVCache : LanguageModel {
429429 private enum Mode {
430430 case prefilling
0 commit comments