@ai-sdk/google 3.0.0-beta.20 → 3.0.0-beta.22

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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @ai-sdk/google
2
2
 
3
+ ## 3.0.0-beta.22
4
+
5
+ ### Patch Changes
6
+
7
+ - 09ba2dd: Support `imageConfig.aspectRatio` configuration for Gemini models
8
+
9
+ ## 3.0.0-beta.21
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [6306603]
14
+ - @ai-sdk/provider-utils@4.0.0-beta.16
15
+
3
16
  ## 3.0.0-beta.20
4
17
 
5
18
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
2
- import { InferValidator, FetchFunction } from '@ai-sdk/provider-utils';
2
+ import { InferSchema, FetchFunction } from '@ai-sdk/provider-utils';
3
3
  import { ProviderV3, LanguageModelV3, ImageModelV3, EmbeddingModelV3 } from '@ai-sdk/provider';
4
4
 
5
5
  declare const googleErrorDataSchema: _ai_sdk_provider_utils.LazySchema<{
@@ -9,7 +9,7 @@ declare const googleErrorDataSchema: _ai_sdk_provider_utils.LazySchema<{
9
9
  status: string;
10
10
  };
11
11
  }>;
12
- type GoogleErrorData = InferValidator<typeof googleErrorDataSchema>;
12
+ type GoogleErrorData = InferSchema<typeof googleErrorDataSchema>;
13
13
 
14
14
  type GoogleGenerativeAIModelId = 'gemini-1.5-flash' | 'gemini-1.5-flash-latest' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-flash-8b' | 'gemini-1.5-flash-8b-latest' | 'gemini-1.5-flash-8b-001' | 'gemini-1.5-pro' | 'gemini-1.5-pro-latest' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-live-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-thinking-exp-01-21' | 'gemini-2.0-flash-exp' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image-preview' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-preview-04-17' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-pro-latest' | 'gemini-flash-latest' | 'gemini-flash-lite-latest' | 'gemini-2.5-pro-exp-03-25' | 'gemini-exp-1206' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
15
15
  declare const googleGenerativeAIProviderOptions: _ai_sdk_provider_utils.LazySchema<{
@@ -28,8 +28,11 @@ declare const googleGenerativeAIProviderOptions: _ai_sdk_provider_utils.LazySche
28
28
  audioTimestamp?: boolean | undefined;
29
29
  labels?: Record<string, string> | undefined;
30
30
  mediaResolution?: "MEDIA_RESOLUTION_UNSPECIFIED" | "MEDIA_RESOLUTION_LOW" | "MEDIA_RESOLUTION_MEDIUM" | "MEDIA_RESOLUTION_HIGH" | undefined;
31
+ imageConfig?: {
32
+ aspectRatio?: "1:1" | "2:3" | "3:2" | "3:4" | "4:3" | "4:5" | "5:4" | "9:16" | "16:9" | "21:9" | undefined;
33
+ } | undefined;
31
34
  }>;
32
- type GoogleGenerativeAIProviderOptions = InferValidator<typeof googleGenerativeAIProviderOptions>;
35
+ type GoogleGenerativeAIProviderOptions = InferSchema<typeof googleGenerativeAIProviderOptions>;
33
36
 
34
37
  declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
35
38
  candidates: {
@@ -126,9 +129,9 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
126
129
  }[] | null | undefined;
127
130
  } | null | undefined;
128
131
  }>;
129
- type GroundingMetadataSchema = NonNullable<InferValidator<typeof responseSchema>['candidates'][number]['groundingMetadata']>;
130
- type UrlContextMetadataSchema = NonNullable<InferValidator<typeof responseSchema>['candidates'][number]['urlContextMetadata']>;
131
- type SafetyRatingSchema = NonNullable<InferValidator<typeof responseSchema>['candidates'][number]['safetyRatings']>[number];
132
+ type GroundingMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['groundingMetadata']>;
133
+ type UrlContextMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['urlContextMetadata']>;
134
+ type SafetyRatingSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['safetyRatings']>[number];
132
135
 
133
136
  type GoogleGenerativeAIGroundingMetadata = GroundingMetadataSchema;
134
137
  type GoogleGenerativeAIUrlContextMetadata = UrlContextMetadataSchema;
@@ -151,14 +154,14 @@ declare const googleImageProviderOptionsSchema: _ai_sdk_provider_utils.LazySchem
151
154
  personGeneration?: "dont_allow" | "allow_adult" | "allow_all" | null | undefined;
152
155
  aspectRatio?: "1:1" | "3:4" | "4:3" | "9:16" | "16:9" | null | undefined;
153
156
  }>;
154
- type GoogleGenerativeAIImageProviderOptions = InferValidator<typeof googleImageProviderOptionsSchema>;
157
+ type GoogleGenerativeAIImageProviderOptions = InferSchema<typeof googleImageProviderOptionsSchema>;
155
158
 
156
159
  type GoogleGenerativeAIEmbeddingModelId = 'gemini-embedding-001' | 'text-embedding-004' | (string & {});
157
160
  declare const googleGenerativeAIEmbeddingProviderOptions: _ai_sdk_provider_utils.LazySchema<{
158
161
  outputDimensionality?: number | undefined;
159
162
  taskType?: "SEMANTIC_SIMILARITY" | "CLASSIFICATION" | "CLUSTERING" | "RETRIEVAL_DOCUMENT" | "RETRIEVAL_QUERY" | "QUESTION_ANSWERING" | "FACT_VERIFICATION" | "CODE_RETRIEVAL_QUERY" | undefined;
160
163
  }>;
161
- type GoogleGenerativeAIEmbeddingProviderOptions = InferValidator<typeof googleGenerativeAIEmbeddingProviderOptions>;
164
+ type GoogleGenerativeAIEmbeddingProviderOptions = InferSchema<typeof googleGenerativeAIEmbeddingProviderOptions>;
162
165
 
163
166
  declare const googleTools: {
164
167
  /**
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
2
- import { InferValidator, FetchFunction } from '@ai-sdk/provider-utils';
2
+ import { InferSchema, FetchFunction } from '@ai-sdk/provider-utils';
3
3
  import { ProviderV3, LanguageModelV3, ImageModelV3, EmbeddingModelV3 } from '@ai-sdk/provider';
4
4
 
5
5
  declare const googleErrorDataSchema: _ai_sdk_provider_utils.LazySchema<{
@@ -9,7 +9,7 @@ declare const googleErrorDataSchema: _ai_sdk_provider_utils.LazySchema<{
9
9
  status: string;
10
10
  };
11
11
  }>;
12
- type GoogleErrorData = InferValidator<typeof googleErrorDataSchema>;
12
+ type GoogleErrorData = InferSchema<typeof googleErrorDataSchema>;
13
13
 
14
14
  type GoogleGenerativeAIModelId = 'gemini-1.5-flash' | 'gemini-1.5-flash-latest' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-flash-8b' | 'gemini-1.5-flash-8b-latest' | 'gemini-1.5-flash-8b-001' | 'gemini-1.5-pro' | 'gemini-1.5-pro-latest' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-live-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-thinking-exp-01-21' | 'gemini-2.0-flash-exp' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image-preview' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-preview-04-17' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-pro-latest' | 'gemini-flash-latest' | 'gemini-flash-lite-latest' | 'gemini-2.5-pro-exp-03-25' | 'gemini-exp-1206' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
15
15
  declare const googleGenerativeAIProviderOptions: _ai_sdk_provider_utils.LazySchema<{
@@ -28,8 +28,11 @@ declare const googleGenerativeAIProviderOptions: _ai_sdk_provider_utils.LazySche
28
28
  audioTimestamp?: boolean | undefined;
29
29
  labels?: Record<string, string> | undefined;
30
30
  mediaResolution?: "MEDIA_RESOLUTION_UNSPECIFIED" | "MEDIA_RESOLUTION_LOW" | "MEDIA_RESOLUTION_MEDIUM" | "MEDIA_RESOLUTION_HIGH" | undefined;
31
+ imageConfig?: {
32
+ aspectRatio?: "1:1" | "2:3" | "3:2" | "3:4" | "4:3" | "4:5" | "5:4" | "9:16" | "16:9" | "21:9" | undefined;
33
+ } | undefined;
31
34
  }>;
32
- type GoogleGenerativeAIProviderOptions = InferValidator<typeof googleGenerativeAIProviderOptions>;
35
+ type GoogleGenerativeAIProviderOptions = InferSchema<typeof googleGenerativeAIProviderOptions>;
33
36
 
34
37
  declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
35
38
  candidates: {
@@ -126,9 +129,9 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
126
129
  }[] | null | undefined;
127
130
  } | null | undefined;
128
131
  }>;
129
- type GroundingMetadataSchema = NonNullable<InferValidator<typeof responseSchema>['candidates'][number]['groundingMetadata']>;
130
- type UrlContextMetadataSchema = NonNullable<InferValidator<typeof responseSchema>['candidates'][number]['urlContextMetadata']>;
131
- type SafetyRatingSchema = NonNullable<InferValidator<typeof responseSchema>['candidates'][number]['safetyRatings']>[number];
132
+ type GroundingMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['groundingMetadata']>;
133
+ type UrlContextMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['urlContextMetadata']>;
134
+ type SafetyRatingSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['safetyRatings']>[number];
132
135
 
133
136
  type GoogleGenerativeAIGroundingMetadata = GroundingMetadataSchema;
134
137
  type GoogleGenerativeAIUrlContextMetadata = UrlContextMetadataSchema;
@@ -151,14 +154,14 @@ declare const googleImageProviderOptionsSchema: _ai_sdk_provider_utils.LazySchem
151
154
  personGeneration?: "dont_allow" | "allow_adult" | "allow_all" | null | undefined;
152
155
  aspectRatio?: "1:1" | "3:4" | "4:3" | "9:16" | "16:9" | null | undefined;
153
156
  }>;
154
- type GoogleGenerativeAIImageProviderOptions = InferValidator<typeof googleImageProviderOptionsSchema>;
157
+ type GoogleGenerativeAIImageProviderOptions = InferSchema<typeof googleImageProviderOptionsSchema>;
155
158
 
156
159
  type GoogleGenerativeAIEmbeddingModelId = 'gemini-embedding-001' | 'text-embedding-004' | (string & {});
157
160
  declare const googleGenerativeAIEmbeddingProviderOptions: _ai_sdk_provider_utils.LazySchema<{
158
161
  outputDimensionality?: number | undefined;
159
162
  taskType?: "SEMANTIC_SIMILARITY" | "CLASSIFICATION" | "CLUSTERING" | "RETRIEVAL_DOCUMENT" | "RETRIEVAL_QUERY" | "QUESTION_ANSWERING" | "FACT_VERIFICATION" | "CODE_RETRIEVAL_QUERY" | undefined;
160
163
  }>;
161
- type GoogleGenerativeAIEmbeddingProviderOptions = InferValidator<typeof googleGenerativeAIEmbeddingProviderOptions>;
164
+ type GoogleGenerativeAIEmbeddingProviderOptions = InferSchema<typeof googleGenerativeAIEmbeddingProviderOptions>;
162
165
 
163
166
  declare const googleTools: {
164
167
  /**
package/dist/index.js CHANGED
@@ -30,7 +30,7 @@ module.exports = __toCommonJS(src_exports);
30
30
  var import_provider_utils11 = require("@ai-sdk/provider-utils");
31
31
 
32
32
  // src/version.ts
33
- var VERSION = true ? "3.0.0-beta.20" : "0.0.0-test";
33
+ var VERSION = true ? "3.0.0-beta.22" : "0.0.0-test";
34
34
 
35
35
  // src/google-generative-ai-embedding-model.ts
36
36
  var import_provider = require("@ai-sdk/provider");
@@ -553,7 +553,26 @@ var googleGenerativeAIProviderOptions = (0, import_provider_utils5.lazySchema)(
553
553
  "MEDIA_RESOLUTION_LOW",
554
554
  "MEDIA_RESOLUTION_MEDIUM",
555
555
  "MEDIA_RESOLUTION_HIGH"
556
- ]).optional()
556
+ ]).optional(),
557
+ /**
558
+ * Optional. Configures the image generation aspect ratio for Gemini models.
559
+ *
560
+ * https://ai.google.dev/gemini-api/docs/image-generation#aspect_ratios
561
+ */
562
+ imageConfig: import_v44.z.object({
563
+ aspectRatio: import_v44.z.enum([
564
+ "1:1",
565
+ "2:3",
566
+ "3:2",
567
+ "3:4",
568
+ "4:3",
569
+ "4:5",
570
+ "5:4",
571
+ "9:16",
572
+ "16:9",
573
+ "21:9"
574
+ ]).optional()
575
+ }).optional()
557
576
  })
558
577
  )
559
578
  );
@@ -816,6 +835,9 @@ var GoogleGenerativeAILanguageModel = class {
816
835
  thinkingConfig: googleOptions == null ? void 0 : googleOptions.thinkingConfig,
817
836
  ...(googleOptions == null ? void 0 : googleOptions.mediaResolution) && {
818
837
  mediaResolution: googleOptions.mediaResolution
838
+ },
839
+ ...(googleOptions == null ? void 0 : googleOptions.imageConfig) && {
840
+ imageConfig: googleOptions.imageConfig
819
841
  }
820
842
  },
821
843
  contents,