@ai-sdk/google 3.0.92 → 3.0.94

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.92",
3
+ "version": "3.0.94",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -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
 
@@ -75,7 +75,7 @@ export class GoogleInteractionsLanguageModel implements LanguageModelV3 {
75
75
 
76
76
  /**
77
77
  * Optional agent name. When provided, the request body sends `agent:` instead
78
- * of `model:` and rejects `tools` / `generation_config` (warned, not thrown).
78
+ * of `model:` and rejects `generation_config` (warned, not thrown).
79
79
  */
80
80
  readonly agent: string | undefined;
81
81
 
@@ -134,13 +134,7 @@ export class GoogleInteractionsLanguageModel implements LanguageModelV3 {
134
134
  let toolsForBody: Array<GoogleInteractionsTool> | undefined;
135
135
  let toolChoiceForBody: GoogleInteractionsToolChoice | undefined;
136
136
 
137
- if (hasTools && isAgent) {
138
- warnings.push({
139
- type: 'other',
140
- message:
141
- 'google.interactions: tools are not supported when an agent is set; tools will be omitted from the request body.',
142
- });
143
- } else if (hasTools) {
137
+ if (hasTools) {
144
138
  const prepared = prepareGoogleInteractionsTools({
145
139
  tools: options.tools,
146
140
  toolChoice: options.toolChoice,