Skip to content

Commit

Permalink
update doc comments (google-gemini#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
morganchen12 authored and G.Dev.Ssomsak committed Jun 21, 2024
1 parent 25e222a commit 6facef6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
11 changes: 9 additions & 2 deletions Sources/GoogleAI/Chat.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ public class Chat {
/// model. This will be provided to the model for each message sent as context for the discussion.
public var history: [ModelContent]

/// See ``sendMessage(_:)-3ify5``.
/// Sends a message using the existing history of this chat as context. If successful, the message
/// and response will be added to the history. If unsuccessful, history will remain unchanged.
/// - Parameter parts: The new content to send as a single chat message.
/// - Returns: The model's response if no error occurred.
/// - Throws: A ``GenerateContentError`` if an error occurred.
public func sendMessage(_ parts: any ThrowingPartsRepresentable...) async throws
-> GenerateContentResponse {
return try await sendMessage([ModelContent(parts: parts)])
Expand Down Expand Up @@ -98,7 +102,10 @@ public class Chat {
return try await sendMessage([functionResponseContent])
}

/// See ``sendMessageStream(_:)-4abs3``.
/// Sends a message using the existing history of this chat as context. If successful, the message
/// and response will be added to the history. If unsuccessful, history will remain unchanged.
/// - Parameter parts: The new content to send as a single chat message.
/// - Returns: A stream containing the model's response or an error if an error occurred.
@available(macOS 12.0, *)
public func sendMessageStream(_ parts: any ThrowingPartsRepresentable...)
-> AsyncThrowingStream<GenerateContentResponse, Error> {
Expand Down
3 changes: 2 additions & 1 deletion Sources/GoogleAI/GenerativeAISwift.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ import Foundation
#warning("Only iOS, macOS, and Catalyst targets are currently fully supported.")
#endif

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

0 comments on commit 6facef6

Please sign in to comment.