Skip to content

Commit 74f6d8b

Browse files
authored
update doc comments (#166)
1 parent da0eba3 commit 74f6d8b

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

Sources/GoogleAI/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> {

Sources/GoogleAI/GenerativeAISwift.swift

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

20-
/// Constants associated with the GenerativeAISwift SDK
20+
/// Constants associated with the GenerativeAISwift SDK.
2121
@available(iOS 15.0, macOS 11.0, macCatalyst 15.0, *)
2222
public enum GenerativeAISwift {
2323
/// String value of the SDK version
2424
public static let version = "0.5.2"
25+
/// The Google AI backend endpoint URL.
2526
static let baseURL = "https://generativelanguage.googleapis.com"
2627
}

Sources/GoogleAI/GenerativeModel.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ public final class GenerativeModel {
4848
/// Initializes a new remote model with the given parameters.
4949
///
5050
/// - Parameters:
51-
/// - name: The name of the model to use, e.g., `"gemini-1.5-pro-latest"`; see
51+
/// - name: The name of the model to use, for example `"gemini-1.5-pro-latest"`; see
5252
/// [Gemini models](https://ai.google.dev/models/gemini) for a list of supported model names.
5353
/// - apiKey: The API key for your project.
5454
/// - generationConfig: The content generation parameters your model should use.
5555
/// - safetySettings: A value describing what types of harmful content your model should allow.
5656
/// - tools: A list of ``Tool`` objects that the model may use to generate the next response.
5757
/// - systemInstruction: Instructions that direct the model to behave a certain way; currently
58-
/// only text content is supported, e.g.,
58+
/// only text content is supported, for example
5959
/// `ModelContent(role: "system", parts: "You are a cat. Your name is Neko.")`.
6060
/// - toolConfig: Tool configuration for any `Tool` specified in the request.
6161
/// - requestOptions Configuration parameters for sending requests to the backend.
@@ -154,7 +154,7 @@ public final class GenerativeModel {
154154
/// [zero-shot](https://developers.google.com/machine-learning/glossary/generative#zero-shot-prompting)
155155
/// or "direct" prompts. For
156156
/// [few-shot](https://developers.google.com/machine-learning/glossary/generative#few-shot-prompting)
157-
/// prompts, see ``generateContent(_:)-58rm0``.
157+
/// prompts, see `generateContent(_ content: @autoclosure () throws -> [ModelContent])`.
158158
///
159159
/// - Parameter content: The input(s) given to the model as a prompt (see
160160
/// ``ThrowingPartsRepresentable``
@@ -213,7 +213,7 @@ public final class GenerativeModel {
213213
/// [zero-shot](https://developers.google.com/machine-learning/glossary/generative#zero-shot-prompting)
214214
/// or "direct" prompts. For
215215
/// [few-shot](https://developers.google.com/machine-learning/glossary/generative#few-shot-prompting)
216-
/// prompts, see ``generateContent(_:)-58rm0``.
216+
/// prompts, see `generateContent(_ content: @autoclosure () throws -> [ModelContent])`.
217217
///
218218
/// - Parameter content: The input(s) given to the model as a prompt (see
219219
/// ``ThrowingPartsRepresentable``
@@ -302,7 +302,7 @@ public final class GenerativeModel {
302302
/// [zero-shot](https://developers.google.com/machine-learning/glossary/generative#zero-shot-prompting)
303303
/// or "direct" prompts. For
304304
/// [few-shot](https://developers.google.com/machine-learning/glossary/generative#few-shot-prompting)
305-
/// input, see ``countTokens(_:)-9spwl``.
305+
/// input, see `countTokens(_ content: @autoclosure () throws -> [ModelContent])`.
306306
///
307307
/// - Parameter content: The input(s) given to the model as a prompt (see
308308
/// ``ThrowingPartsRepresentable``
@@ -360,7 +360,7 @@ public final class GenerativeModel {
360360
}
361361
}
362362

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

0 commit comments

Comments
 (0)