File tree 2 files changed +13
-1
lines changed
2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ public struct GenerateContentResponse {
51
51
}
52
52
53
53
/// Initializer for SwiftUI previews or tests.
54
- public init ( candidates: [ CandidateResponse ] , promptFeedback: PromptFeedback ? ) {
54
+ public init ( candidates: [ CandidateResponse ] , promptFeedback: PromptFeedback ? = nil ) {
55
55
self . candidates = candidates
56
56
self . promptFeedback = promptFeedback
57
57
}
Original file line number Diff line number Diff line change @@ -149,6 +149,18 @@ final class GoogleGenerativeAITests: XCTestCase {
149
149
_ = genAI. startChat ( history: [ ModelContent ( parts: " abc " ) ] )
150
150
}
151
151
152
+ // Public API tests for GenerateContentResponse.
153
+ func generateContentResponseAPI( ) {
154
+ let response = GenerateContentResponse ( candidates: [ ] )
155
+
156
+ let _: [ CandidateResponse ] = response. candidates
157
+ let _: PromptFeedback ? = response. promptFeedback
158
+
159
+ // Computed Properties
160
+ let _: String ? = response. text
161
+ let _: [ FunctionCall ] = response. functionCalls
162
+ }
163
+
152
164
// Result builder alternative
153
165
154
166
/*
You can’t perform that action at this time.
0 commit comments