@ai-sdk/google
Advanced tools
+6
-0
@@ -35,2 +35,8 @@ import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils'; | ||
| imageSize?: "1K" | "2K" | "4K" | "512" | undefined; | ||
| personGeneration?: "PERSON_GENERATION_UNSPECIFIED" | "ALLOW_ALL" | "ALLOW_ADULT" | "ALLOW_NONE" | undefined; | ||
| prominentPeople?: "PROMINENT_PEOPLE_UNSPECIFIED" | "ALLOW_PROMINENT_PEOPLE" | "BLOCK_PROMINENT_PEOPLE" | undefined; | ||
| imageOutputOptions?: { | ||
| mimeType?: "image/jpeg" | "image/png" | undefined; | ||
| compressionQuality?: number | undefined; | ||
| } | undefined; | ||
| } | undefined; | ||
@@ -37,0 +43,0 @@ retrievalConfig?: { |
+6
-0
@@ -35,2 +35,8 @@ import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils'; | ||
| imageSize?: "1K" | "2K" | "4K" | "512" | undefined; | ||
| personGeneration?: "PERSON_GENERATION_UNSPECIFIED" | "ALLOW_ALL" | "ALLOW_ADULT" | "ALLOW_NONE" | undefined; | ||
| prominentPeople?: "PROMINENT_PEOPLE_UNSPECIFIED" | "ALLOW_PROMINENT_PEOPLE" | "BLOCK_PROMINENT_PEOPLE" | undefined; | ||
| imageOutputOptions?: { | ||
| mimeType?: "image/jpeg" | "image/png" | undefined; | ||
| compressionQuality?: number | undefined; | ||
| } | undefined; | ||
| } | undefined; | ||
@@ -37,0 +43,0 @@ retrievalConfig?: { |
+1
-1
| { | ||
| "name": "@ai-sdk/google", | ||
| "version": "3.0.93", | ||
| "version": "3.0.94", | ||
| "license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
@@ -202,2 +202,31 @@ import type { | ||
| // personGeneration, prominentPeople and imageOutputOptions are only | ||
| // supported by the Vertex AI API, the Gemini API rejects them. | ||
| let imageConfig = googleOptions?.imageConfig; | ||
| if (imageConfig != null && !isVertexProvider) { | ||
| const { | ||
| personGeneration, | ||
| prominentPeople, | ||
| imageOutputOptions, | ||
| ...geminiApiImageConfig | ||
| } = imageConfig; | ||
| const droppedImageConfigFields = Object.entries({ | ||
| personGeneration, | ||
| prominentPeople, | ||
| imageOutputOptions, | ||
| }) | ||
| .filter(([, value]) => value != null) | ||
| .map(([key]) => `'imageConfig.${key}'`); | ||
| if (droppedImageConfigFields.length > 0) { | ||
| warnings.push({ | ||
| type: 'other', | ||
| message: | ||
| `${droppedImageConfigFields.join(', ')} ` + | ||
| `${droppedImageConfigFields.length === 1 ? 'is a Vertex AI option and is' : 'are Vertex AI options and are'} ` + | ||
| `ignored with the current Google provider (${this.config.provider}).`, | ||
| }); | ||
| imageConfig = geminiApiImageConfig; | ||
| } | ||
| } | ||
| const isGemmaModel = this.modelId.toLowerCase().startsWith('gemma-'); | ||
@@ -297,5 +326,3 @@ const isGemini3Model = /^gemini-3[.-]/.test(this.modelId); | ||
| }), | ||
| ...(googleOptions?.imageConfig && { | ||
| imageConfig: googleOptions.imageConfig, | ||
| }), | ||
| ...(imageConfig && { imageConfig }), | ||
| }, | ||
@@ -302,0 +329,0 @@ contents, |
@@ -177,2 +177,42 @@ import { | ||
| imageSize: z.enum(['1K', '2K', '4K', '512']).optional(), | ||
| /** | ||
| * Optional. Controls the generation of people in images. | ||
| * Vertex AI only. | ||
| */ | ||
| personGeneration: z | ||
| .enum([ | ||
| 'PERSON_GENERATION_UNSPECIFIED', | ||
| 'ALLOW_ALL', | ||
| 'ALLOW_ADULT', | ||
| 'ALLOW_NONE', | ||
| ]) | ||
| .optional(), | ||
| /** | ||
| * Optional. Controls whether generation of prominent people | ||
| * (celebrities) is allowed. When set together with | ||
| * `personGeneration`, `personGeneration` takes precedence. | ||
| * Vertex AI only. | ||
| * | ||
| * https://docs.cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerationConfig | ||
| */ | ||
| prominentPeople: z | ||
| .enum([ | ||
| 'PROMINENT_PEOPLE_UNSPECIFIED', | ||
| 'ALLOW_PROMINENT_PEOPLE', | ||
| 'BLOCK_PROMINENT_PEOPLE', | ||
| ]) | ||
| .optional(), | ||
| /** | ||
| * Optional. The image output format for generated images. | ||
| * Vertex AI only. | ||
| */ | ||
| imageOutputOptions: z | ||
| .object({ | ||
| mimeType: z.enum(['image/jpeg', 'image/png']).optional(), | ||
| compressionQuality: z.number().optional(), | ||
| }) | ||
| .optional(), | ||
| }) | ||
@@ -179,0 +219,0 @@ .optional(), |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
3103292
0.78%33969
0.8%