@@ -97,17 +97,17 @@ public final class GenerativeModel {
97
97
}
98
98
99
99
/// 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.
101
101
///
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
104
103
/// [zero-shot](https://developers.google.com/machine-learning/glossary/generative#zero-shot-prompting)
105
104
/// or "direct" prompts. For
106
105
/// [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])`.
108
107
///
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).
111
111
/// - Returns: The content generated by the model.
112
112
/// - Throws: A ``GenerateContentError`` if the request failed.
113
113
public func generateContent( _ parts: any PartsRepresentable ... )
@@ -153,17 +153,17 @@ public final class GenerativeModel {
153
153
}
154
154
155
155
/// 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.
157
157
///
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
160
159
/// [zero-shot](https://developers.google.com/machine-learning/glossary/generative#zero-shot-prompting)
161
160
/// or "direct" prompts. For
162
161
/// [few-shot](https://developers.google.com/machine-learning/glossary/generative#few-shot-prompting)
163
162
/// prompts, see `generateContentStream(_ content: @autoclosure () throws -> [ModelContent])`.
164
163
///
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).
167
167
/// - Returns: A stream wrapping content generated by the model or a ``GenerateContentError``
168
168
/// error if an error occurred.
169
169
@available ( macOS 12 . 0 , * )
@@ -228,21 +228,20 @@ public final class GenerativeModel {
228
228
}
229
229
230
230
/// 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.
232
232
///
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
234
234
/// [zero-shot](https://developers.google.com/machine-learning/glossary/generative#zero-shot-prompting)
235
235
/// or "direct" prompts. For
236
236
/// [few-shot](https://developers.google.com/machine-learning/glossary/generative#few-shot-prompting)
237
237
/// input, see `countTokens(_ content: @autoclosure () throws -> [ModelContent])`.
238
238
///
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).
241
242
/// - Returns: The results of running the model's tokenizer on the input; contains
242
243
/// ``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 {
246
245
return try await countTokens ( [ ModelContent ( parts: parts) ] )
247
246
}
248
247
@@ -251,10 +250,7 @@ public final class GenerativeModel {
251
250
/// - Parameter content: The input given to the model as a prompt.
252
251
/// - Returns: The results of running the model's tokenizer on the input; contains
253
252
/// ``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 {
258
254
let countTokensRequest = CountTokensRequest (
259
255
model: modelResourceName,
260
256
contents: content,
0 commit comments