@ai-sdk/google 2.0.35 → 2.0.37
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 +12 -0
- package/dist/index.js +13 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -14
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +12 -13
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +12 -13
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ai-sdk/google
|
|
2
2
|
|
|
3
|
+
## 2.0.37
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 6de29ca: Prepare search tool for gemini-3-pro-preview
|
|
8
|
+
|
|
9
|
+
## 2.0.36
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 9df7698: fix(provider/google): remove includethoughts warning
|
|
14
|
+
|
|
3
15
|
## 2.0.35
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
30
30
|
var import_provider_utils13 = require("@ai-sdk/provider-utils");
|
|
31
31
|
|
|
32
32
|
// src/version.ts
|
|
33
|
-
var VERSION = true ? "2.0.
|
|
33
|
+
var VERSION = true ? "2.0.37" : "0.0.0-test";
|
|
34
34
|
|
|
35
35
|
// src/google-generative-ai-embedding-model.ts
|
|
36
36
|
var import_provider = require("@ai-sdk/provider");
|
|
@@ -587,7 +587,12 @@ function prepareTools({
|
|
|
587
587
|
var _a;
|
|
588
588
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
589
589
|
const toolWarnings = [];
|
|
590
|
-
const
|
|
590
|
+
const isLatest = [
|
|
591
|
+
"gemini-flash-latest",
|
|
592
|
+
"gemini-flash-lite-latest",
|
|
593
|
+
"gemini-pro-latest"
|
|
594
|
+
].some((id) => id === modelId);
|
|
595
|
+
const isGemini2orNewer = modelId.includes("gemini-2") || modelId.includes("gemini-3") || isLatest;
|
|
591
596
|
const supportsDynamicRetrieval = modelId.includes("gemini-1.5-flash") && !modelId.includes("-8b");
|
|
592
597
|
const supportsFileSearch = modelId.includes("gemini-2.5");
|
|
593
598
|
if (tools == null) {
|
|
@@ -613,7 +618,7 @@ function prepareTools({
|
|
|
613
618
|
providerDefinedTools.forEach((tool) => {
|
|
614
619
|
switch (tool.id) {
|
|
615
620
|
case "google.google_search":
|
|
616
|
-
if (
|
|
621
|
+
if (isGemini2orNewer) {
|
|
617
622
|
googleTools2.push({ googleSearch: {} });
|
|
618
623
|
} else if (supportsDynamicRetrieval) {
|
|
619
624
|
googleTools2.push({
|
|
@@ -629,7 +634,7 @@ function prepareTools({
|
|
|
629
634
|
}
|
|
630
635
|
break;
|
|
631
636
|
case "google.url_context":
|
|
632
|
-
if (
|
|
637
|
+
if (isGemini2orNewer) {
|
|
633
638
|
googleTools2.push({ urlContext: {} });
|
|
634
639
|
} else {
|
|
635
640
|
toolWarnings.push({
|
|
@@ -640,7 +645,7 @@ function prepareTools({
|
|
|
640
645
|
}
|
|
641
646
|
break;
|
|
642
647
|
case "google.code_execution":
|
|
643
|
-
if (
|
|
648
|
+
if (isGemini2orNewer) {
|
|
644
649
|
googleTools2.push({ codeExecution: {} });
|
|
645
650
|
} else {
|
|
646
651
|
toolWarnings.push({
|
|
@@ -662,7 +667,7 @@ function prepareTools({
|
|
|
662
667
|
}
|
|
663
668
|
break;
|
|
664
669
|
case "google.vertex_rag_store":
|
|
665
|
-
if (
|
|
670
|
+
if (isGemini2orNewer) {
|
|
666
671
|
googleTools2.push({
|
|
667
672
|
retrieval: {
|
|
668
673
|
vertex_rag_store: {
|
|
@@ -812,19 +817,13 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
812
817
|
toolChoice,
|
|
813
818
|
providerOptions
|
|
814
819
|
}) {
|
|
815
|
-
var _a
|
|
820
|
+
var _a;
|
|
816
821
|
const warnings = [];
|
|
817
822
|
const googleOptions = await (0, import_provider_utils6.parseProviderOptions)({
|
|
818
823
|
provider: "google",
|
|
819
824
|
providerOptions,
|
|
820
825
|
schema: googleGenerativeAIProviderOptions
|
|
821
826
|
});
|
|
822
|
-
if (((_a = googleOptions == null ? void 0 : googleOptions.thinkingConfig) == null ? void 0 : _a.includeThoughts) === true && !this.config.provider.startsWith("google.vertex.")) {
|
|
823
|
-
warnings.push({
|
|
824
|
-
type: "other",
|
|
825
|
-
message: `The 'includeThoughts' option is only supported with the Google Vertex provider and might not be supported or could behave unexpectedly with the current Google provider (${this.config.provider}).`
|
|
826
|
-
});
|
|
827
|
-
}
|
|
828
827
|
if ((tools == null ? void 0 : tools.some(
|
|
829
828
|
(tool) => tool.type === "provider-defined" && tool.id === "google.vertex_rag_store"
|
|
830
829
|
)) && !this.config.provider.startsWith("google.vertex.")) {
|
|
@@ -864,7 +863,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
864
863
|
responseSchema: (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && // Google GenAI does not support all OpenAPI Schema features,
|
|
865
864
|
// so this is needed as an escape hatch:
|
|
866
865
|
// TODO convert into provider option
|
|
867
|
-
((
|
|
866
|
+
((_a = googleOptions == null ? void 0 : googleOptions.structuredOutputs) != null ? _a : true) ? convertJSONSchemaToOpenAPISchema(responseFormat.schema) : void 0,
|
|
868
867
|
...(googleOptions == null ? void 0 : googleOptions.audioTimestamp) && {
|
|
869
868
|
audioTimestamp: googleOptions.audioTimestamp
|
|
870
869
|
},
|