15
15
import Foundation
16
16
17
17
/// The model's response to a generate content request.
18
- @available ( iOS 15 . 0 , macOS 11 . 0 , macCatalyst 15 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
18
+ @available ( iOS 15 . 0 , macOS 12 . 0 , macCatalyst 15 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
19
19
public struct GenerateContentResponse : Sendable {
20
20
/// Token usage metadata for processing the generate content request.
21
+ @available ( iOS 15 . 0 , macOS 12 . 0 , macCatalyst 15 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
21
22
public struct UsageMetadata : Sendable {
22
23
/// The number of tokens in the request prompt.
23
24
public let promptTokenCount : Int
@@ -92,7 +93,7 @@ public struct GenerateContentResponse: Sendable {
92
93
93
94
/// A struct representing a possible reply to a content generation prompt. Each content generation
94
95
/// prompt may produce multiple candidate responses.
95
- @available ( iOS 15 . 0 , macOS 11 . 0 , macCatalyst 15 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
96
+ @available ( iOS 15 . 0 , macOS 12 . 0 , macCatalyst 15 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
96
97
public struct Candidate : Sendable {
97
98
/// The response's content.
98
99
public let content : ModelContent
@@ -118,14 +119,14 @@ public struct Candidate: Sendable {
118
119
}
119
120
120
121
/// A collection of source attributions for a piece of content.
121
- @available ( iOS 15 . 0 , macOS 11 . 0 , macCatalyst 15 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
122
+ @available ( iOS 15 . 0 , macOS 12 . 0 , macCatalyst 15 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
122
123
public struct CitationMetadata : Sendable {
123
124
/// A list of individual cited sources and the parts of the content to which they apply.
124
125
public let citations : [ Citation ]
125
126
}
126
127
127
128
/// A struct describing a source attribution.
128
- @available ( iOS 15 . 0 , macOS 11 . 0 , macCatalyst 15 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
129
+ @available ( iOS 15 . 0 , macOS 12 . 0 , macCatalyst 15 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
129
130
public struct Citation : Sendable {
130
131
/// The inclusive beginning of a sequence in a model response that derives from a cited source.
131
132
public let startIndex : Int
@@ -149,7 +150,7 @@ public struct Citation: Sendable {
149
150
}
150
151
151
152
/// A value enumerating possible reasons for a model to terminate a content generation request.
152
- @available ( iOS 15 . 0 , macOS 11 . 0 , macCatalyst 15 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
153
+ @available ( iOS 15 . 0 , macOS 12 . 0 , macCatalyst 15 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
153
154
public struct FinishReason : DecodableProtoEnum , Hashable , Sendable {
154
155
enum Kind : String {
155
156
case stop = " STOP "
@@ -204,9 +205,10 @@ public struct FinishReason: DecodableProtoEnum, Hashable, Sendable {
204
205
}
205
206
206
207
/// A metadata struct containing any feedback the model had on the prompt it was provided.
207
- @available ( iOS 15 . 0 , macOS 11 . 0 , macCatalyst 15 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
208
+ @available ( iOS 15 . 0 , macOS 12 . 0 , macCatalyst 15 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
208
209
public struct PromptFeedback : Sendable {
209
210
/// A type describing possible reasons to block a prompt.
211
+ @available ( iOS 15 . 0 , macOS 12 . 0 , macCatalyst 15 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
210
212
public struct BlockReason : DecodableProtoEnum , Hashable , Sendable {
211
213
enum Kind : String {
212
214
case safety = " SAFETY "
@@ -257,7 +259,7 @@ public struct PromptFeedback: Sendable {
257
259
258
260
// MARK: - Codable Conformances
259
261
260
- @available ( iOS 15 . 0 , macOS 11 . 0 , macCatalyst 15 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
262
+ @available ( iOS 15 . 0 , macOS 12 . 0 , macCatalyst 15 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
261
263
extension GenerateContentResponse : Decodable {
262
264
enum CodingKeys : CodingKey {
263
265
case candidates
@@ -291,7 +293,7 @@ extension GenerateContentResponse: Decodable {
291
293
}
292
294
}
293
295
294
- @available ( iOS 15 . 0 , macOS 11 . 0 , macCatalyst 15 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
296
+ @available ( iOS 15 . 0 , macOS 12 . 0 , macCatalyst 15 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
295
297
extension GenerateContentResponse . UsageMetadata : Decodable {
296
298
enum CodingKeys : CodingKey {
297
299
case promptTokenCount
@@ -308,7 +310,7 @@ extension GenerateContentResponse.UsageMetadata: Decodable {
308
310
}
309
311
}
310
312
311
- @available ( iOS 15 . 0 , macOS 11 . 0 , macCatalyst 15 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
313
+ @available ( iOS 15 . 0 , macOS 12 . 0 , macCatalyst 15 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
312
314
extension Candidate : Decodable {
313
315
enum CodingKeys : CodingKey {
314
316
case content
@@ -357,10 +359,10 @@ extension Candidate: Decodable {
357
359
}
358
360
}
359
361
360
- @available ( iOS 15 . 0 , macOS 11 . 0 , macCatalyst 15 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
362
+ @available ( iOS 15 . 0 , macOS 12 . 0 , macCatalyst 15 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
361
363
extension CitationMetadata : Decodable { }
362
364
363
- @available ( iOS 15 . 0 , macOS 11 . 0 , macCatalyst 15 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
365
+ @available ( iOS 15 . 0 , macOS 12 . 0 , macCatalyst 15 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
364
366
extension Citation : Decodable {
365
367
enum CodingKeys : CodingKey {
366
368
case startIndex
@@ -412,7 +414,7 @@ extension Citation: Decodable {
412
414
}
413
415
}
414
416
415
- @available ( iOS 15 . 0 , macOS 11 . 0 , macCatalyst 15 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
417
+ @available ( iOS 15 . 0 , macOS 12 . 0 , macCatalyst 15 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
416
418
extension PromptFeedback : Decodable {
417
419
enum CodingKeys : CodingKey {
418
420
case blockReason
0 commit comments