Skip to content

Commit 334be7c

Browse files
morganchen12andrewheard
authored andcommitted
Add docsgen podspec for VertexAI and clean up some doc comments (#12912)
1 parent e4aec30 commit 334be7c

File tree

6 files changed

+76
-13
lines changed

6 files changed

+76
-13
lines changed

FirebaseVertexAI-Docs.podspec

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
Pod::Spec.new do |s|
2+
s.name = 'FirebaseVertexAI'
3+
s.version = '10.26.0'
4+
s.summary = 'Firebase VertexAI'
5+
6+
s.description = <<-DESC
7+
Placeholder podspec for docsgen only. Do not use this pod.
8+
DESC
9+
10+
s.homepage = 'https://firebase.google.com'
11+
s.license = { :type => 'Apache-2.0', :file => 'LICENSE' }
12+
s.authors = 'Google, Inc.'
13+
14+
s.source = {
15+
:git => 'https://github.com/firebase/firebase-ios-sdk.git',
16+
# TODO: this should be `'CocoaPods-' + s.version.to_s` (after May 14 2024)
17+
:tag => 'release-10.26'
18+
}
19+
20+
s.social_media_url = 'https://twitter.com/Firebase'
21+
22+
ios_deployment_target = '15.0'
23+
osx_deployment_target = '10.14'
24+
25+
s.ios.deployment_target = ios_deployment_target
26+
s.osx.deployment_target = osx_deployment_target
27+
28+
s.cocoapods_version = '>= 1.12.0'
29+
s.prefix_header_file = false
30+
31+
s.source_files = [
32+
'FirebaseVertexAI/Sources/**/*.swift',
33+
'FirebaseCore/Extension/*.h',
34+
'FirebaseAuth/Interop/*.h',
35+
]
36+
37+
s.swift_version = '5.3'
38+
39+
s.framework = 'Foundation'
40+
s.ios.framework = 'UIKit'
41+
s.osx.framework = 'AppKit'
42+
s.tvos.framework = 'UIKit'
43+
s.watchos.framework = 'WatchKit'
44+
45+
s.dependency 'FirebaseCore', '~> 10.0'
46+
s.dependency 'FirebaseCoreExtension'
47+
s.dependency 'FirebaseAuthInterop'
48+
s.dependency 'FirebaseAppCheckInterop', '~> 10.17'
49+
50+
s.pod_target_xcconfig = {
51+
'GCC_C_LANGUAGE_STANDARD' => 'c99',
52+
'HEADER_SEARCH_PATHS' => '"${PODS_TARGET_SRCROOT}"',
53+
'OTHER_CFLAGS' => '-fno-autolink'
54+
}
55+
end

FirebaseVertexAI/Sources/Chat.swift

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ public class Chat {
3030
/// model. This will be provided to the model for each message sent as context for the discussion.
3131
public var history: [ModelContent]
3232

33-
/// See ``sendMessage(_:)-3ify5``.
33+
/// Sends a message using the existing history of this chat as context. If successful, the message
34+
/// and response will be added to the history. If unsuccessful, history will remain unchanged.
35+
/// - Parameter parts: The new content to send as a single chat message.
36+
/// - Returns: The model's response if no error occurred.
37+
/// - Throws: A ``GenerateContentError`` if an error occurred.
3438
public func sendMessage(_ parts: any ThrowingPartsRepresentable...) async throws
3539
-> GenerateContentResponse {
3640
return try await sendMessage([ModelContent(parts: parts)])
@@ -76,7 +80,10 @@ public class Chat {
7680
return result
7781
}
7882

79-
/// See ``sendMessageStream(_:)-4abs3``.
83+
/// Sends a message using the existing history of this chat as context. If successful, the message
84+
/// and response will be added to the history. If unsuccessful, history will remain unchanged.
85+
/// - Parameter parts: The new content to send as a single chat message.
86+
/// - Returns: A stream containing the model's response or an error if an error occurred.
8087
@available(macOS 12.0, *)
8188
public func sendMessageStream(_ parts: any ThrowingPartsRepresentable...)
8289
-> AsyncThrowingStream<GenerateContentResponse, Error> {

FirebaseVertexAI/Sources/GenerativeAIService.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ import Foundation
1919

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

25-
/// The Firebase SDK version in the format "fire/<version>".
25+
/// The Firebase SDK version in the format `fire/<version>`.
2626
static let firebaseVersionTag = "fire/\(FirebaseVersion())"
2727

2828
/// Gives permission to talk to the backend.

FirebaseVertexAI/Sources/GenerativeAISwift.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ import Foundation
1818
#warning("Only iOS, macOS, and Catalyst targets are currently fully supported.")
1919
#endif
2020

21-
/// Constants associated with the GenerativeAISwift SDK
21+
/// Constants associated with the GenerativeAISwift SDK.
2222
@available(iOS 15.0, macOS 11.0, macCatalyst 15.0, *)
2323
public enum GenerativeAISwift {
24+
/// The Vertex AI backend endpoint URL.
2425
static let baseURL = "https://firebaseml.googleapis.com"
2526
}

FirebaseVertexAI/Sources/GenerativeModel.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public final class GenerativeModel {
5050
/// Initializes a new remote model with the given parameters.
5151
///
5252
/// - Parameters:
53-
/// - name: The name of the model to use, e.g., `"gemini-1.0-pro"`; see
53+
/// - name: The name of the model to use, for example `"gemini-1.0-pro"`; see
5454
/// [Gemini models](https://ai.google.dev/models/gemini) for a list of supported model names.
5555
/// - apiKey: The API key for your project.
5656
/// - generationConfig: The content generation parameters your model should use.
@@ -104,7 +104,7 @@ public final class GenerativeModel {
104104
/// [zero-shot](https://developers.google.com/machine-learning/glossary/generative#zero-shot-prompting)
105105
/// or "direct" prompts. For
106106
/// [few-shot](https://developers.google.com/machine-learning/glossary/generative#few-shot-prompting)
107-
/// prompts, see ``generateContent(_:)-58rm0``.
107+
/// prompts, see `generateContent(_ content: @autoclosure () throws -> [ModelContent])`.
108108
///
109109
/// - Parameter content: The input(s) given to the model as a prompt (see
110110
/// ``ThrowingPartsRepresentable``
@@ -163,7 +163,7 @@ public final class GenerativeModel {
163163
/// [zero-shot](https://developers.google.com/machine-learning/glossary/generative#zero-shot-prompting)
164164
/// or "direct" prompts. For
165165
/// [few-shot](https://developers.google.com/machine-learning/glossary/generative#few-shot-prompting)
166-
/// prompts, see ``generateContent(_:)-58rm0``.
166+
/// prompts, see `generateContentStream(_ content: @autoclosure () throws -> [ModelContent])`.
167167
///
168168
/// - Parameter content: The input(s) given to the model as a prompt (see
169169
/// ``ThrowingPartsRepresentable``
@@ -252,7 +252,7 @@ public final class GenerativeModel {
252252
/// [zero-shot](https://developers.google.com/machine-learning/glossary/generative#zero-shot-prompting)
253253
/// or "direct" prompts. For
254254
/// [few-shot](https://developers.google.com/machine-learning/glossary/generative#few-shot-prompting)
255-
/// input, see ``countTokens(_:)-9spwl``.
255+
/// input, see `countTokens(_ content: @autoclosure () throws -> [ModelContent])`.
256256
///
257257
/// - Parameter content: The input(s) given to the model as a prompt (see
258258
/// ``ThrowingPartsRepresentable``
@@ -306,7 +306,7 @@ public final class GenerativeModel {
306306
}
307307
}
308308

309-
/// See ``GenerativeModel/countTokens(_:)-9spwl``.
309+
/// An error thrown in `GenerativeModel.countTokens(_:)`.
310310
@available(iOS 15.0, macOS 11.0, macCatalyst 15.0, *)
311311
public enum CountTokensError: Error {
312312
case internalError(underlying: Error)

FirebaseVertexAI/Sources/VertexAI.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import Foundation
2020
// Avoids exposing internal FirebaseCore APIs to Swift users.
2121
@_implementationOnly import FirebaseCoreExtension
2222

23+
/// The Vertex AI service for Firebase.
2324
@available(iOS 15.0, macOS 11.0, macCatalyst 15.0, *)
2425
public class VertexAI: NSObject {
2526
// MARK: - Public APIs
@@ -59,9 +60,8 @@ public class VertexAI: NSObject {
5960
/// Initializes a generative model with the given parameters.
6061
///
6162
/// - Parameters:
62-
/// - modelName: The name of the model to use, e.g., `"gemini-1.0-pro"`; see
63-
/// [Gemini
64-
/// models](https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models#gemini-models)
63+
/// - modelName: The name of the model to use, for example `"gemini-1.0-pro"`; see
64+
/// [Gemini models](https://firebase.google.com/docs/vertex-ai/gemini-model#available-models)
6565
/// for a list of supported model names.
6666
/// - generationConfig: The content generation parameters your model should use.
6767
/// - safetySettings: A value describing what types of harmful content your model should allow.

0 commit comments

Comments
 (0)