@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/dist/index.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "@ai-sdk/provider-utils";
|
|
8
8
|
|
|
9
9
|
// src/version.ts
|
|
10
|
-
var VERSION = true ? "2.0.
|
|
10
|
+
var VERSION = true ? "2.0.37" : "0.0.0-test";
|
|
11
11
|
|
|
12
12
|
// src/google-generative-ai-embedding-model.ts
|
|
13
13
|
import {
|
|
@@ -598,7 +598,12 @@ function prepareTools({
|
|
|
598
598
|
var _a;
|
|
599
599
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
600
600
|
const toolWarnings = [];
|
|
601
|
-
const
|
|
601
|
+
const isLatest = [
|
|
602
|
+
"gemini-flash-latest",
|
|
603
|
+
"gemini-flash-lite-latest",
|
|
604
|
+
"gemini-pro-latest"
|
|
605
|
+
].some((id) => id === modelId);
|
|
606
|
+
const isGemini2orNewer = modelId.includes("gemini-2") || modelId.includes("gemini-3") || isLatest;
|
|
602
607
|
const supportsDynamicRetrieval = modelId.includes("gemini-1.5-flash") && !modelId.includes("-8b");
|
|
603
608
|
const supportsFileSearch = modelId.includes("gemini-2.5");
|
|
604
609
|
if (tools == null) {
|
|
@@ -624,7 +629,7 @@ function prepareTools({
|
|
|
624
629
|
providerDefinedTools.forEach((tool) => {
|
|
625
630
|
switch (tool.id) {
|
|
626
631
|
case "google.google_search":
|
|
627
|
-
if (
|
|
632
|
+
if (isGemini2orNewer) {
|
|
628
633
|
googleTools2.push({ googleSearch: {} });
|
|
629
634
|
} else if (supportsDynamicRetrieval) {
|
|
630
635
|
googleTools2.push({
|
|
@@ -640,7 +645,7 @@ function prepareTools({
|
|
|
640
645
|
}
|
|
641
646
|
break;
|
|
642
647
|
case "google.url_context":
|
|
643
|
-
if (
|
|
648
|
+
if (isGemini2orNewer) {
|
|
644
649
|
googleTools2.push({ urlContext: {} });
|
|
645
650
|
} else {
|
|
646
651
|
toolWarnings.push({
|
|
@@ -651,7 +656,7 @@ function prepareTools({
|
|
|
651
656
|
}
|
|
652
657
|
break;
|
|
653
658
|
case "google.code_execution":
|
|
654
|
-
if (
|
|
659
|
+
if (isGemini2orNewer) {
|
|
655
660
|
googleTools2.push({ codeExecution: {} });
|
|
656
661
|
} else {
|
|
657
662
|
toolWarnings.push({
|
|
@@ -673,7 +678,7 @@ function prepareTools({
|
|
|
673
678
|
}
|
|
674
679
|
break;
|
|
675
680
|
case "google.vertex_rag_store":
|
|
676
|
-
if (
|
|
681
|
+
if (isGemini2orNewer) {
|
|
677
682
|
googleTools2.push({
|
|
678
683
|
retrieval: {
|
|
679
684
|
vertex_rag_store: {
|
|
@@ -823,19 +828,13 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
823
828
|
toolChoice,
|
|
824
829
|
providerOptions
|
|
825
830
|
}) {
|
|
826
|
-
var _a
|
|
831
|
+
var _a;
|
|
827
832
|
const warnings = [];
|
|
828
833
|
const googleOptions = await parseProviderOptions2({
|
|
829
834
|
provider: "google",
|
|
830
835
|
providerOptions,
|
|
831
836
|
schema: googleGenerativeAIProviderOptions
|
|
832
837
|
});
|
|
833
|
-
if (((_a = googleOptions == null ? void 0 : googleOptions.thinkingConfig) == null ? void 0 : _a.includeThoughts) === true && !this.config.provider.startsWith("google.vertex.")) {
|
|
834
|
-
warnings.push({
|
|
835
|
-
type: "other",
|
|
836
|
-
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}).`
|
|
837
|
-
});
|
|
838
|
-
}
|
|
839
838
|
if ((tools == null ? void 0 : tools.some(
|
|
840
839
|
(tool) => tool.type === "provider-defined" && tool.id === "google.vertex_rag_store"
|
|
841
840
|
)) && !this.config.provider.startsWith("google.vertex.")) {
|
|
@@ -875,7 +874,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
875
874
|
responseSchema: (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && // Google GenAI does not support all OpenAPI Schema features,
|
|
876
875
|
// so this is needed as an escape hatch:
|
|
877
876
|
// TODO convert into provider option
|
|
878
|
-
((
|
|
877
|
+
((_a = googleOptions == null ? void 0 : googleOptions.structuredOutputs) != null ? _a : true) ? convertJSONSchemaToOpenAPISchema(responseFormat.schema) : void 0,
|
|
879
878
|
...(googleOptions == null ? void 0 : googleOptions.audioTimestamp) && {
|
|
880
879
|
audioTimestamp: googleOptions.audioTimestamp
|
|
881
880
|
},
|