@ai-sdk/google 3.0.0-beta.21 → 3.0.0-beta.23

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,17 @@
1
1
  # @ai-sdk/google
2
2
 
3
+ ## 3.0.0-beta.23
4
+
5
+ ### Patch Changes
6
+
7
+ - f8c981f: Fix adding google search along with url context in vertex ai
8
+
9
+ ## 3.0.0-beta.22
10
+
11
+ ### Patch Changes
12
+
13
+ - 09ba2dd: Support `imageConfig.aspectRatio` configuration for Gemini models
14
+
3
15
  ## 3.0.0-beta.21
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -28,6 +28,9 @@ 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
35
  type GoogleGenerativeAIProviderOptions = InferSchema<typeof googleGenerativeAIProviderOptions>;
33
36
 
package/dist/index.d.ts CHANGED
@@ -28,6 +28,9 @@ 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
35
  type GoogleGenerativeAIProviderOptions = InferSchema<typeof googleGenerativeAIProviderOptions>;
33
36
 
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.21" : "0.0.0-test";
33
+ var VERSION = true ? "3.0.0-beta.23" : "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
  );
@@ -590,7 +609,7 @@ function prepareTools({
590
609
  });
591
610
  }
592
611
  if (hasProviderDefinedTools) {
593
- const googleTools2 = {};
612
+ const googleTools2 = [];
594
613
  const providerDefinedTools = tools.filter(
595
614
  (tool) => tool.type === "provider-defined"
596
615
  );
@@ -598,21 +617,23 @@ function prepareTools({
598
617
  switch (tool.id) {
599
618
  case "google.google_search":
600
619
  if (isGemini2) {
601
- googleTools2.googleSearch = {};
620
+ googleTools2.push({ googleSearch: {} });
602
621
  } else if (supportsDynamicRetrieval) {
603
- googleTools2.googleSearchRetrieval = {
604
- dynamicRetrievalConfig: {
605
- mode: tool.args.mode,
606
- dynamicThreshold: tool.args.dynamicThreshold
622
+ googleTools2.push({
623
+ googleSearchRetrieval: {
624
+ dynamicRetrievalConfig: {
625
+ mode: tool.args.mode,
626
+ dynamicThreshold: tool.args.dynamicThreshold
627
+ }
607
628
  }
608
- };
629
+ });
609
630
  } else {
610
- googleTools2.googleSearchRetrieval = {};
631
+ googleTools2.push({ googleSearchRetrieval: {} });
611
632
  }
612
633
  break;
613
634
  case "google.url_context":
614
635
  if (isGemini2) {
615
- googleTools2.urlContext = {};
636
+ googleTools2.push({ urlContext: {} });
616
637
  } else {
617
638
  toolWarnings.push({
618
639
  type: "unsupported-tool",
@@ -623,7 +644,7 @@ function prepareTools({
623
644
  break;
624
645
  case "google.code_execution":
625
646
  if (isGemini2) {
626
- googleTools2.codeExecution = {};
647
+ googleTools2.push({ codeExecution: {} });
627
648
  } else {
628
649
  toolWarnings.push({
629
650
  type: "unsupported-tool",
@@ -638,7 +659,7 @@ function prepareTools({
638
659
  }
639
660
  });
640
661
  return {
641
- tools: Object.keys(googleTools2).length > 0 ? googleTools2 : void 0,
662
+ tools: googleTools2.length > 0 ? googleTools2 : void 0,
642
663
  toolConfig: void 0,
643
664
  toolWarnings
644
665
  };
@@ -816,6 +837,9 @@ var GoogleGenerativeAILanguageModel = class {
816
837
  thinkingConfig: googleOptions == null ? void 0 : googleOptions.thinkingConfig,
817
838
  ...(googleOptions == null ? void 0 : googleOptions.mediaResolution) && {
818
839
  mediaResolution: googleOptions.mediaResolution
840
+ },
841
+ ...(googleOptions == null ? void 0 : googleOptions.imageConfig) && {
842
+ imageConfig: googleOptions.imageConfig
819
843
  }
820
844
  },
821
845
  contents,