@@ -40,7 +40,6 @@ final class ImageGenerationParametersTests: XCTestCase {
40
40
let parameters = ImagenModel . imageGenerationParameters (
41
41
storageURI: nil ,
42
42
generationConfig: nil ,
43
- modelConfig: nil ,
44
43
safetySettings: nil
45
44
)
46
45
@@ -64,37 +63,6 @@ final class ImageGenerationParametersTests: XCTestCase {
64
63
let parameters = ImagenModel . imageGenerationParameters (
65
64
storageURI: storageURI,
66
65
generationConfig: nil ,
67
- modelConfig: nil ,
68
- safetySettings: nil
69
- )
70
-
71
- XCTAssertEqual ( parameters, expectedParameters)
72
- }
73
-
74
- func testParameters_includeModelConfig( ) throws {
75
- let compressionQuality = 80
76
- let imageFormat = ImagenImageFormat . jpeg ( compressionQuality: compressionQuality)
77
- let addWatermark = true
78
- let modelConfig = ImagenModelConfig ( imageFormat: imageFormat, addWatermark: addWatermark)
79
- let expectedParameters = ImageGenerationParameters (
80
- sampleCount: 1 ,
81
- storageURI: nil ,
82
- negativePrompt: nil ,
83
- aspectRatio: nil ,
84
- safetyFilterLevel: nil ,
85
- personGeneration: nil ,
86
- outputOptions: ImageGenerationOutputOptions (
87
- mimeType: imageFormat. mimeType,
88
- compressionQuality: imageFormat. compressionQuality
89
- ) ,
90
- addWatermark: addWatermark,
91
- includeResponsibleAIFilterReason: true
92
- )
93
-
94
- let parameters = ImagenModel . imageGenerationParameters (
95
- storageURI: nil ,
96
- generationConfig: nil ,
97
- modelConfig: modelConfig,
98
66
safetySettings: nil
99
67
)
100
68
@@ -104,11 +72,16 @@ final class ImageGenerationParametersTests: XCTestCase {
104
72
func testParameters_includeGenerationConfig( ) throws {
105
73
let sampleCount = 2
106
74
let negativePrompt = " test-negative-prompt "
75
+ let compressionQuality = 80
76
+ let imageFormat = ImagenImageFormat . jpeg ( compressionQuality: compressionQuality)
107
77
let aspectRatio = ImagenAspectRatio . landscape16x9
78
+ let addWatermark = true
108
79
let generationConfig = ImagenGenerationConfig (
109
80
numberOfImages: sampleCount,
110
81
negativePrompt: negativePrompt,
111
- aspectRatio: aspectRatio
82
+ imageFormat: imageFormat,
83
+ aspectRatio: aspectRatio,
84
+ addWatermark: addWatermark
112
85
)
113
86
let expectedParameters = ImageGenerationParameters (
114
87
sampleCount: sampleCount,
@@ -117,15 +90,17 @@ final class ImageGenerationParametersTests: XCTestCase {
117
90
aspectRatio: aspectRatio. rawValue,
118
91
safetyFilterLevel: nil ,
119
92
personGeneration: nil ,
120
- outputOptions: nil ,
121
- addWatermark: nil ,
93
+ outputOptions: ImageGenerationOutputOptions (
94
+ mimeType: imageFormat. mimeType,
95
+ compressionQuality: imageFormat. compressionQuality
96
+ ) ,
97
+ addWatermark: addWatermark,
122
98
includeResponsibleAIFilterReason: true
123
99
)
124
100
125
101
let parameters = ImagenModel . imageGenerationParameters (
126
102
storageURI: nil ,
127
103
generationConfig: generationConfig,
128
- modelConfig: nil ,
129
104
safetySettings: nil
130
105
)
131
106
@@ -155,7 +130,6 @@ final class ImageGenerationParametersTests: XCTestCase {
155
130
let parameters = ImagenModel . imageGenerationParameters (
156
131
storageURI: nil ,
157
132
generationConfig: nil ,
158
- modelConfig: nil ,
159
133
safetySettings: safetySettings
160
134
)
161
135
@@ -168,15 +142,16 @@ final class ImageGenerationParametersTests: XCTestCase {
168
142
let storageURI = " gs://test-bucket/path "
169
143
let sampleCount = 4
170
144
let negativePrompt = " test-negative-prompt "
145
+ let imageFormat = ImagenImageFormat . png ( )
171
146
let aspectRatio = ImagenAspectRatio . portrait3x4
147
+ let addWatermark = false
172
148
let generationConfig = ImagenGenerationConfig (
173
149
numberOfImages: sampleCount,
174
150
negativePrompt: negativePrompt,
175
- aspectRatio: aspectRatio
151
+ imageFormat: imageFormat,
152
+ aspectRatio: aspectRatio,
153
+ addWatermark: addWatermark
176
154
)
177
- let imageFormat = ImagenImageFormat . png ( )
178
- let addWatermark = false
179
- let modelConfig = ImagenModelConfig ( imageFormat: imageFormat, addWatermark: addWatermark)
180
155
let safetyFilterLevel = ImagenSafetyFilterLevel . blockNone
181
156
let personFilterLevel = ImagenPersonFilterLevel . blockAll
182
157
let safetySettings = ImagenSafetySettings (
@@ -201,7 +176,6 @@ final class ImageGenerationParametersTests: XCTestCase {
201
176
let parameters = ImagenModel . imageGenerationParameters (
202
177
storageURI: storageURI,
203
178
generationConfig: generationConfig,
204
- modelConfig: modelConfig,
205
179
safetySettings: safetySettings
206
180
)
207
181
0 commit comments