Skip to content

Commit 78a181d

Browse files
authored
[Vertex AI] Increase macOS minimum to 12.0 (#13903)
1 parent 4b96944 commit 78a181d

26 files changed

+93
-65
lines changed

FirebaseVertexAI/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@
5252
`any(allowedFunctionNames:)`, or `none()` to create a config. (#13873)
5353
- [changed] **Breaking Change**: The `CandidateResponse` type is now named
5454
`Candidate`. (#13897)
55+
- [changed] **Breaking Change**: The minimum deployment target for the SDK is
56+
now macOS 12.0; all other platform minimums remain the same at iOS 15.0,
57+
macCatalyst 15.0, tvOS 15.0, and watchOS 8.0. (#13903)
5558
- [changed] The default request timeout is now 180 seconds instead of the
5659
platform-default value of 60 seconds for a `URLRequest`; this timeout may
5760
still be customized in `RequestOptions`. (#13722)

FirebaseVertexAI/Sources/Chat.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import Foundation
1616

1717
/// An object that represents a back-and-forth chat with a model, capturing the history and saving
1818
/// the context in memory between each message sent.
19-
@available(iOS 15.0, macOS 11.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
19+
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
2020
public class Chat {
2121
private let model: GenerativeModel
2222

FirebaseVertexAI/Sources/CountTokensRequest.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import Foundation
1616

17-
@available(iOS 15.0, macOS 11.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
17+
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
1818
struct CountTokensRequest {
1919
let model: String
2020

@@ -26,7 +26,7 @@ struct CountTokensRequest {
2626
let options: RequestOptions
2727
}
2828

29-
@available(iOS 15.0, macOS 11.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
29+
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
3030
extension CountTokensRequest: GenerativeAIRequest {
3131
typealias Response = CountTokensResponse
3232

@@ -36,7 +36,7 @@ extension CountTokensRequest: GenerativeAIRequest {
3636
}
3737

3838
/// The model's response to a count tokens request.
39-
@available(iOS 15.0, macOS 11.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
39+
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
4040
public struct CountTokensResponse {
4141
/// The total number of tokens in the input given to the model as a prompt.
4242
public let totalTokens: Int
@@ -50,7 +50,7 @@ public struct CountTokensResponse {
5050

5151
// MARK: - Codable Conformances
5252

53-
@available(iOS 15.0, macOS 11.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
53+
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
5454
extension CountTokensRequest: Encodable {
5555
enum CodingKeys: CodingKey {
5656
case contents
@@ -60,5 +60,5 @@ extension CountTokensRequest: Encodable {
6060
}
6161
}
6262

63-
@available(iOS 15.0, macOS 11.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
63+
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
6464
extension CountTokensResponse: Decodable {}

FirebaseVertexAI/Sources/FunctionCalling.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import Foundation
1818
///
1919
/// This `FunctionDeclaration` is a representation of a block of code that can be used as a ``Tool``
2020
/// by the model and executed by the client.
21+
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
2122
public struct FunctionDeclaration {
2223
/// The name of the function.
2324
let name: String
@@ -53,6 +54,7 @@ public struct FunctionDeclaration {
5354
///
5455
/// A `Tool` is a piece of code that enables the system to interact with external systems to perform
5556
/// an action, or set of actions, outside of knowledge and scope of the model.
57+
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
5658
public struct Tool {
5759
/// A list of `FunctionDeclarations` available to the model.
5860
let functionDeclarations: [FunctionDeclaration]?
@@ -86,6 +88,7 @@ public struct Tool {
8688
}
8789

8890
/// Configuration for specifying function calling behavior.
91+
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
8992
public struct FunctionCallingConfig {
9093
/// Defines the execution behavior for function calling by defining the execution mode.
9194
enum Mode: String {
@@ -131,6 +134,7 @@ public struct FunctionCallingConfig {
131134
}
132135

133136
/// Tool configuration for any `Tool` specified in the request.
137+
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
134138
public struct ToolConfig {
135139
let functionCallingConfig: FunctionCallingConfig?
136140

@@ -141,6 +145,7 @@ public struct ToolConfig {
141145

142146
// MARK: - Codable Conformance
143147

148+
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
144149
extension FunctionDeclaration: Encodable {
145150
enum CodingKeys: String, CodingKey {
146151
case name
@@ -156,10 +161,14 @@ extension FunctionDeclaration: Encodable {
156161
}
157162
}
158163

164+
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
159165
extension Tool: Encodable {}
160166

167+
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
161168
extension FunctionCallingConfig: Encodable {}
162169

170+
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
163171
extension FunctionCallingConfig.Mode: Encodable {}
164172

173+
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
165174
extension ToolConfig: Encodable {}

FirebaseVertexAI/Sources/GenerateContentError.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import Foundation
1616

1717
/// Errors that occur when generating content from a model.
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, *)
1919
public enum GenerateContentError: Error {
2020
/// An internal error occurred. See the underlying error for more context.
2121
case internalError(underlying: Error)

FirebaseVertexAI/Sources/GenerateContentRequest.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import Foundation
1616

17-
@available(iOS 15.0, macOS 11.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
17+
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
1818
struct GenerateContentRequest {
1919
/// Model name.
2020
let model: String
@@ -28,7 +28,7 @@ struct GenerateContentRequest {
2828
let options: RequestOptions
2929
}
3030

31-
@available(iOS 15.0, macOS 11.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
31+
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
3232
extension GenerateContentRequest: Encodable {
3333
enum CodingKeys: String, CodingKey {
3434
case contents
@@ -40,7 +40,7 @@ extension GenerateContentRequest: Encodable {
4040
}
4141
}
4242

43-
@available(iOS 15.0, macOS 11.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
43+
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
4444
extension GenerateContentRequest: GenerativeAIRequest {
4545
typealias Response = GenerateContentResponse
4646

FirebaseVertexAI/Sources/GenerateContentResponse.swift

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
import Foundation
1616

1717
/// 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, *)
1919
public struct GenerateContentResponse: Sendable {
2020
/// 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, *)
2122
public struct UsageMetadata: Sendable {
2223
/// The number of tokens in the request prompt.
2324
public let promptTokenCount: Int
@@ -92,7 +93,7 @@ public struct GenerateContentResponse: Sendable {
9293

9394
/// A struct representing a possible reply to a content generation prompt. Each content generation
9495
/// 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, *)
9697
public struct Candidate: Sendable {
9798
/// The response's content.
9899
public let content: ModelContent
@@ -118,14 +119,14 @@ public struct Candidate: Sendable {
118119
}
119120

120121
/// 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, *)
122123
public struct CitationMetadata: Sendable {
123124
/// A list of individual cited sources and the parts of the content to which they apply.
124125
public let citations: [Citation]
125126
}
126127

127128
/// 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, *)
129130
public struct Citation: Sendable {
130131
/// The inclusive beginning of a sequence in a model response that derives from a cited source.
131132
public let startIndex: Int
@@ -149,7 +150,7 @@ public struct Citation: Sendable {
149150
}
150151

151152
/// 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, *)
153154
public struct FinishReason: DecodableProtoEnum, Hashable, Sendable {
154155
enum Kind: String {
155156
case stop = "STOP"
@@ -204,9 +205,10 @@ public struct FinishReason: DecodableProtoEnum, Hashable, Sendable {
204205
}
205206

206207
/// 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, *)
208209
public struct PromptFeedback: Sendable {
209210
/// 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, *)
210212
public struct BlockReason: DecodableProtoEnum, Hashable, Sendable {
211213
enum Kind: String {
212214
case safety = "SAFETY"
@@ -257,7 +259,7 @@ public struct PromptFeedback: Sendable {
257259

258260
// MARK: - Codable Conformances
259261

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, *)
261263
extension GenerateContentResponse: Decodable {
262264
enum CodingKeys: CodingKey {
263265
case candidates
@@ -291,7 +293,7 @@ extension GenerateContentResponse: Decodable {
291293
}
292294
}
293295

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, *)
295297
extension GenerateContentResponse.UsageMetadata: Decodable {
296298
enum CodingKeys: CodingKey {
297299
case promptTokenCount
@@ -308,7 +310,7 @@ extension GenerateContentResponse.UsageMetadata: Decodable {
308310
}
309311
}
310312

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, *)
312314
extension Candidate: Decodable {
313315
enum CodingKeys: CodingKey {
314316
case content
@@ -357,10 +359,10 @@ extension Candidate: Decodable {
357359
}
358360
}
359361

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, *)
361363
extension CitationMetadata: Decodable {}
362364

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, *)
364366
extension Citation: Decodable {
365367
enum CodingKeys: CodingKey {
366368
case startIndex
@@ -412,7 +414,7 @@ extension Citation: Decodable {
412414
}
413415
}
414416

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, *)
416418
extension PromptFeedback: Decodable {
417419
enum CodingKeys: CodingKey {
418420
case blockReason

FirebaseVertexAI/Sources/GenerationConfig.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import Foundation
1616

1717
/// A struct defining model parameters to be used when sending generative AI
1818
/// requests to the backend model.
19-
@available(iOS 15.0, macOS 11.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
19+
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
2020
public struct GenerationConfig {
2121
/// A parameter controlling the degree of randomness in token selection. A
2222
/// temperature of zero is deterministic, always choosing the
@@ -143,5 +143,5 @@ public struct GenerationConfig {
143143

144144
// MARK: - Codable Conformances
145145

146-
@available(iOS 15.0, macOS 11.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
146+
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
147147
extension GenerationConfig: Encodable {}

FirebaseVertexAI/Sources/GenerativeAIRequest.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import Foundation
1616

17-
@available(iOS 15.0, macOS 11.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
17+
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
1818
protocol GenerativeAIRequest: Encodable {
1919
associatedtype Response: Decodable
2020

@@ -24,7 +24,7 @@ protocol GenerativeAIRequest: Encodable {
2424
}
2525

2626
/// Configuration parameters for sending requests to the backend.
27-
@available(iOS 15.0, macOS 11.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
27+
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
2828
public struct RequestOptions {
2929
/// The request’s timeout interval in seconds; if not specified uses the default value for a
3030
/// `URLRequest`.

FirebaseVertexAI/Sources/GenerativeAIService.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import FirebaseCore
1818
import Foundation
1919
import os.log
2020

21-
@available(iOS 15.0, macOS 11.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
21+
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
2222
struct GenerativeAIService {
2323
/// The language of the SDK in the format `gl-<language>/<version>`.
2424
static let languageTag = "gl-swift/5"

0 commit comments

Comments
 (0)