@ai-sdk/google 3.0.93 → 3.0.95

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/google",
3
- "version": "3.0.93",
3
+ "version": "3.0.95",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@ai-sdk/provider": "3.0.14",
40
- "@ai-sdk/provider-utils": "4.0.39"
40
+ "@ai-sdk/provider-utils": "4.0.40"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/node": "20.17.24",
@@ -199,6 +199,35 @@ export class GoogleGenerativeAILanguageModel implements LanguageModelV3 {
199
199
  ? undefined
200
200
  : googleOptions?.serviceTier;
201
201
 
202
+ // personGeneration, prominentPeople and imageOutputOptions are only
203
+ // supported by the Vertex AI API, the Gemini API rejects them.
204
+ let imageConfig = googleOptions?.imageConfig;
205
+ if (imageConfig != null && !isVertexProvider) {
206
+ const {
207
+ personGeneration,
208
+ prominentPeople,
209
+ imageOutputOptions,
210
+ ...geminiApiImageConfig
211
+ } = imageConfig;
212
+ const droppedImageConfigFields = Object.entries({
213
+ personGeneration,
214
+ prominentPeople,
215
+ imageOutputOptions,
216
+ })
217
+ .filter(([, value]) => value != null)
218
+ .map(([key]) => `'imageConfig.${key}'`);
219
+ if (droppedImageConfigFields.length > 0) {
220
+ warnings.push({
221
+ type: 'other',
222
+ message:
223
+ `${droppedImageConfigFields.join(', ')} ` +
224
+ `${droppedImageConfigFields.length === 1 ? 'is a Vertex AI option and is' : 'are Vertex AI options and are'} ` +
225
+ `ignored with the current Google provider (${this.config.provider}).`,
226
+ });
227
+ imageConfig = geminiApiImageConfig;
228
+ }
229
+ }
230
+
202
231
  const isGemmaModel = this.modelId.toLowerCase().startsWith('gemma-');
203
232
  const isGemini3Model = /^gemini-3[.-]/.test(this.modelId);
204
233
  const supportsFunctionResponseParts = isGemini3Model;
@@ -293,9 +322,7 @@ export class GoogleGenerativeAILanguageModel implements LanguageModelV3 {
293
322
  ...(googleOptions?.mediaResolution && {
294
323
  mediaResolution: googleOptions.mediaResolution,
295
324
  }),
296
- ...(googleOptions?.imageConfig && {
297
- imageConfig: googleOptions.imageConfig,
298
- }),
325
+ ...(imageConfig && { imageConfig }),
299
326
  },
300
327
  contents,
301
328
  systemInstruction: isGemmaModel ? undefined : systemInstruction,
@@ -174,6 +174,46 @@ export const googleLanguageModelOptions = lazySchema(() =>
174
174
  ])
175
175
  .optional(),
176
176
  imageSize: z.enum(['1K', '2K', '4K', '512']).optional(),
177
+
178
+ /**
179
+ * Optional. Controls the generation of people in images.
180
+ * Vertex AI only.
181
+ */
182
+ personGeneration: z
183
+ .enum([
184
+ 'PERSON_GENERATION_UNSPECIFIED',
185
+ 'ALLOW_ALL',
186
+ 'ALLOW_ADULT',
187
+ 'ALLOW_NONE',
188
+ ])
189
+ .optional(),
190
+
191
+ /**
192
+ * Optional. Controls whether generation of prominent people
193
+ * (celebrities) is allowed. When set together with
194
+ * `personGeneration`, `personGeneration` takes precedence.
195
+ * Vertex AI only.
196
+ *
197
+ * https://docs.cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerationConfig
198
+ */
199
+ prominentPeople: z
200
+ .enum([
201
+ 'PROMINENT_PEOPLE_UNSPECIFIED',
202
+ 'ALLOW_PROMINENT_PEOPLE',
203
+ 'BLOCK_PROMINENT_PEOPLE',
204
+ ])
205
+ .optional(),
206
+
207
+ /**
208
+ * Optional. The image output format for generated images.
209
+ * Vertex AI only.
210
+ */
211
+ imageOutputOptions: z
212
+ .object({
213
+ mimeType: z.enum(['image/jpeg', 'image/png']).optional(),
214
+ compressionQuality: z.number().optional(),
215
+ })
216
+ .optional(),
177
217
  })
178
218
  .optional(),
179
219