Skip to content

Commit b99e3d7

Browse files
authored
[Vertex AI] Fix invalid DocC links and missing docs (#13896)
1 parent b5aee64 commit b99e3d7

File tree

4 files changed

+23
-25
lines changed

4 files changed

+23
-25
lines changed

FirebaseVertexAI/Sources/FunctionCalling.swift

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ public struct FunctionDeclaration {
3535
/// with a maximum length of 63.
3636
/// - description: A brief description of the function.
3737
/// - parameters: Describes the parameters to this function.
38+
/// - optionalParameters: The names of parameters that may be omitted by the model in function
39+
/// calls; by default, all parameters are considered required.
3840
public init(name: String, description: String, parameters: [String: Schema],
3941
optionalParameters: [String] = []) {
4042
self.name = name

FirebaseVertexAI/Sources/GenerativeModel.swift

+18-22
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,17 @@ public final class GenerativeModel {
9797
}
9898

9999
/// Generates content from String and/or image inputs, given to the model as a prompt, that are
100-
/// representable as one or more ``ModelContent/Part``s.
100+
/// representable as one or more ``Part``s.
101101
///
102-
/// Since ``ModelContent/Part``s do not specify a role, this method is intended for generating
103-
/// content from
102+
/// Since ``Part``s do not specify a role, this method is intended for generating content from
104103
/// [zero-shot](https://developers.google.com/machine-learning/glossary/generative#zero-shot-prompting)
105104
/// or "direct" prompts. For
106105
/// [few-shot](https://developers.google.com/machine-learning/glossary/generative#few-shot-prompting)
107-
/// prompts, see `generateContent(_ content: @autoclosure () throws -> [ModelContent])`.
106+
/// prompts, see `generateContent(_ content: [ModelContent])`.
108107
///
109-
/// - Parameter content: The input(s) given to the model as a prompt (see ``PartsRepresentable``
110-
/// for conforming types).
108+
/// - Parameters:
109+
/// - parts: The input(s) given to the model as a prompt (see ``PartsRepresentable`` for
110+
/// conforming types).
111111
/// - Returns: The content generated by the model.
112112
/// - Throws: A ``GenerateContentError`` if the request failed.
113113
public func generateContent(_ parts: any PartsRepresentable...)
@@ -153,17 +153,17 @@ public final class GenerativeModel {
153153
}
154154

155155
/// Generates content from String and/or image inputs, given to the model as a prompt, that are
156-
/// representable as one or more ``ModelContent/Part``s.
156+
/// representable as one or more ``Part``s.
157157
///
158-
/// Since ``ModelContent/Part``s do not specify a role, this method is intended for generating
159-
/// content from
158+
/// Since ``Part``s do not specify a role, this method is intended for generating content from
160159
/// [zero-shot](https://developers.google.com/machine-learning/glossary/generative#zero-shot-prompting)
161160
/// or "direct" prompts. For
162161
/// [few-shot](https://developers.google.com/machine-learning/glossary/generative#few-shot-prompting)
163162
/// prompts, see `generateContentStream(_ content: @autoclosure () throws -> [ModelContent])`.
164163
///
165-
/// - Parameter content: The input(s) given to the model as a prompt (see
166-
/// ``PartsRepresentable`` for conforming types).
164+
/// - Parameters:
165+
/// - parts: The input(s) given to the model as a prompt (see ``PartsRepresentable`` for
166+
/// conforming types).
167167
/// - Returns: A stream wrapping content generated by the model or a ``GenerateContentError``
168168
/// error if an error occurred.
169169
@available(macOS 12.0, *)
@@ -228,21 +228,20 @@ public final class GenerativeModel {
228228
}
229229

230230
/// Runs the model's tokenizer on String and/or image inputs that are representable as one or more
231-
/// ``ModelContent/Part``s.
231+
/// ``Part``s.
232232
///
233-
/// Since ``ModelContent/Part``s do not specify a role, this method is intended for tokenizing
233+
/// Since ``Part``s do not specify a role, this method is intended for tokenizing
234234
/// [zero-shot](https://developers.google.com/machine-learning/glossary/generative#zero-shot-prompting)
235235
/// or "direct" prompts. For
236236
/// [few-shot](https://developers.google.com/machine-learning/glossary/generative#few-shot-prompting)
237237
/// input, see `countTokens(_ content: @autoclosure () throws -> [ModelContent])`.
238238
///
239-
/// - Parameter content: The input(s) given to the model as a prompt (see ``PartsRepresentable``
240-
/// for conforming types).
239+
/// - Parameters:
240+
/// - parts: The input(s) given to the model as a prompt (see ``PartsRepresentable`` for
241+
/// conforming types).
241242
/// - Returns: The results of running the model's tokenizer on the input; contains
242243
/// ``CountTokensResponse/totalTokens``.
243-
/// - Throws: A ``CountTokensError`` if the tokenization request failed.
244-
public func countTokens(_ parts: any PartsRepresentable...) async throws
245-
-> CountTokensResponse {
244+
public func countTokens(_ parts: any PartsRepresentable...) async throws -> CountTokensResponse {
246245
return try await countTokens([ModelContent(parts: parts)])
247246
}
248247

@@ -251,10 +250,7 @@ public final class GenerativeModel {
251250
/// - Parameter content: The input given to the model as a prompt.
252251
/// - Returns: The results of running the model's tokenizer on the input; contains
253252
/// ``CountTokensResponse/totalTokens``.
254-
/// - Throws: A ``CountTokensError`` if the tokenization request failed or the input content was
255-
/// invalid.
256-
public func countTokens(_ content: [ModelContent]) async throws
257-
-> CountTokensResponse {
253+
public func countTokens(_ content: [ModelContent]) async throws -> CountTokensResponse {
258254
let countTokensRequest = CountTokensRequest(
259255
model: modelResourceName,
260256
contents: content,

FirebaseVertexAI/Sources/ModelContent.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ extension [ModelContent] {
3333

3434
/// A type describing data in media formats interpretable by an AI model. Each generative AI
3535
/// request or response contains an `Array` of ``ModelContent``s, and each ``ModelContent`` value
36-
/// may comprise multiple heterogeneous ``ModelContent/Part``s.
36+
/// may comprise multiple heterogeneous ``Part``s.
3737
@available(iOS 15.0, macOS 11.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
3838
public struct ModelContent: Equatable, Sendable {
3939
enum InternalPart: Equatable, Sendable {

FirebaseVertexAI/Sources/Types/Public/Part.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,11 @@ public struct FunctionCallPart: Part {
104104
}
105105
}
106106

107-
/// Result output from a ``FunctionCall``.
107+
/// Result output from a function call.
108108
///
109109
/// Contains a string representing the `FunctionDeclaration.name` and a structured JSON object
110110
/// containing any output from the function is used as context to the model. This should contain the
111-
/// result of a ``FunctionCall`` made based on model prediction.
111+
/// result of a ``FunctionCallPart`` made based on model prediction.
112112
@available(iOS 15.0, macOS 11.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
113113
public struct FunctionResponsePart: Part {
114114
let functionResponse: FunctionResponse

0 commit comments

Comments
 (0)