Skip to content

Commit bc4ab28

Browse files
committed
doc updates
1 parent a11c20c commit bc4ab28

File tree

4 files changed

+34
-2
lines changed

4 files changed

+34
-2
lines changed

FirebaseAI/Sources/TemplateChatSession.swift

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
import Foundation
1616

1717
/// A chat session that allows for conversation with a model.
18+
///
19+
/// **Public Preview**: This API is a public preview and may be subject to change.
1820
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
1921
public final class TemplateChatSession: Sendable {
2022
private let model: TemplateGenerativeModel
@@ -37,6 +39,15 @@ public final class TemplateChatSession: Sendable {
3739
}
3840

3941
/// Sends a message to the model and returns the response.
42+
///
43+
/// **Public Preview**: This API is a public preview and may be subject to change.
44+
///
45+
/// - Parameters:
46+
/// - message: The message to send to the model.
47+
/// - inputs: A dictionary of variables to substitute into the template.
48+
/// - options: The ``RequestOptions`` for the request, currently used to override default request timeout.
49+
/// - Returns: The content generated by the model.
50+
/// - Throws: A ``GenerateContentError`` if the request failed.
4051
public func sendMessage(_ message: any PartsRepresentable,
4152
inputs: [String: Any],
4253
options: RequestOptions = RequestOptions()) async throws
@@ -56,6 +67,16 @@ public final class TemplateChatSession: Sendable {
5667
return response
5768
}
5869

70+
/// Sends a message to the model and returns the response as a stream of `GenerateContentResponse`s.
71+
///
72+
/// **Public Preview**: This API is a public preview and may be subject to change.
73+
///
74+
/// - Parameters:
75+
/// - message: The message to send to the model.
76+
/// - inputs: A dictionary of variables to substitute into the template.
77+
/// - options: The ``RequestOptions`` for the request, currently used to override default request timeout.
78+
/// - Returns: An `AsyncThrowingStream` that yields `GenerateContentResponse` objects.
79+
/// - Throws: A ``GenerateContentError`` if the request failed.
5980
public func sendMessageStream(_ message: any PartsRepresentable,
6081
inputs: [String: Any],
6182
options: RequestOptions = RequestOptions()) throws

FirebaseAI/Sources/TemplateGenerativeModel.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import Foundation
1616

1717
/// A type that represents a remote multimodal model (like Gemini), with the ability to generate
1818
/// content based on various input types.
19+
///
20+
/// **Public Preview**: This API is a public preview and may be subject to change.
1921
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
2022
public final class TemplateGenerativeModel: Sendable {
2123
let generativeAIService: GenerativeAIService
@@ -28,9 +30,12 @@ public final class TemplateGenerativeModel: Sendable {
2830

2931
/// Generates content from a prompt template and inputs.
3032
///
33+
/// **Public Preview**: This API is a public preview and may be subject to change.
34+
///
3135
/// - Parameters:
3236
/// - templateID: The ID of the prompt template to use.
3337
/// - inputs: A dictionary of variables to substitute into the template.
38+
/// - options: The ``RequestOptions`` for the request, currently used to override default request timeout.
3439
/// - Returns: The content generated by the model.
3540
/// - Throws: A ``GenerateContentError`` if the request failed.
3641
public func generateContent(templateID: String,
@@ -74,9 +79,12 @@ public final class TemplateGenerativeModel: Sendable {
7479

7580
/// Generates content from a prompt template and inputs, with streaming responses.
7681
///
82+
/// **Public Preview**: This API is a public preview and may be subject to change.
83+
///
7784
/// - Parameters:
7885
/// - templateID: The ID of the prompt template to use.
7986
/// - inputs: A dictionary of variables to substitute into the template.
87+
/// - options: The ``RequestOptions`` for the request, currently used to override default request timeout.
8088
/// - Returns: An `AsyncThrowingStream` that yields `GenerateContentResponse` objects.
8189
/// - Throws: A ``GenerateContentError`` if the request failed.
8290
public func generateContentStream(templateID: String,

FirebaseAI/Sources/TemplateImagenModel.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import Foundation
1717
/// A type that represents a remote image generation model (like Imagen), with the ability to
1818
/// generate
1919
/// images based on various input types.
20+
///
21+
/// **Public Preview**: This API is a public preview and may be subject to change.
2022
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
2123
public final class TemplateImagenModel: Sendable {
2224
let generativeAIService: GenerativeAIService
@@ -32,6 +34,7 @@ public final class TemplateImagenModel: Sendable {
3234
/// - Parameters:
3335
/// - template: The prompt template to use.
3436
/// - variables: A dictionary of variables to substitute into the template.
37+
/// - options: The ``RequestOptions`` for the request, currently used to override default request timeout.
3538
/// - Returns: The images generated by the model.
3639
/// - Throws: An error if the request failed.
3740
public func generateImages(templateID: String,

FirebaseAI/Tests/TestApp/Tests/Integration/ServerPromptTemplateIntegrationTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ struct ServerPromptTemplateIntegrationTests {
7575
let imagenPrompt = "A cat picture"
7676
let response = try await imagenModel.generateImages(
7777
templateID: "generate-images2",
78-
variables: [
78+
inputs: [
7979
"prompt": imagenPrompt,
8080
]
8181
)
@@ -157,7 +157,7 @@ struct ServerPromptTemplateIntegrationTests {
157157

158158
let response = try await chatSession.sendMessage(
159159
userMessage,
160-
variables: ["message": userMessage]
160+
inputs: ["message": userMessage]
161161
)
162162
let text = try #require(response.text)
163163
#expect(!text.isEmpty)

0 commit comments

Comments
 (0)