@ai-sdk/google 3.0.23 → 3.0.25
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.d.mts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +48 -42
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +48 -42
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +41 -35
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +41 -35
- package/dist/internal/index.mjs.map +1 -1
- package/docs/15-google-generative-ai.mdx +18 -16
- package/package.json +1 -1
- package/src/google-generative-ai-embedding-model.ts +2 -2
- package/src/google-generative-ai-embedding-options.ts +3 -3
- package/src/google-generative-ai-image-model.ts +4 -4
- package/src/google-generative-ai-language-model.ts +50 -52
- package/src/google-generative-ai-options.ts +3 -3
- package/src/google-generative-ai-video-model.ts +5 -5
- package/src/index.ts +20 -4
package/dist/internal/index.mjs
CHANGED
|
@@ -372,7 +372,7 @@ var googleFailedResponseHandler = createJsonErrorResponseHandler({
|
|
|
372
372
|
// src/google-generative-ai-options.ts
|
|
373
373
|
import { lazySchema as lazySchema2, zodSchema as zodSchema2 } from "@ai-sdk/provider-utils";
|
|
374
374
|
import { z as z2 } from "zod/v4";
|
|
375
|
-
var
|
|
375
|
+
var googleLanguageModelOptions = lazySchema2(
|
|
376
376
|
() => zodSchema2(
|
|
377
377
|
z2.object({
|
|
378
378
|
responseModalities: z2.array(z2.enum(["TEXT", "IMAGE"])).optional(),
|
|
@@ -756,13 +756,13 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
756
756
|
let googleOptions = await parseProviderOptions({
|
|
757
757
|
provider: providerOptionsName,
|
|
758
758
|
providerOptions,
|
|
759
|
-
schema:
|
|
759
|
+
schema: googleLanguageModelOptions
|
|
760
760
|
});
|
|
761
761
|
if (googleOptions == null && providerOptionsName !== "google") {
|
|
762
762
|
googleOptions = await parseProviderOptions({
|
|
763
763
|
provider: "google",
|
|
764
764
|
providerOptions,
|
|
765
|
-
schema:
|
|
765
|
+
schema: googleLanguageModelOptions
|
|
766
766
|
});
|
|
767
767
|
}
|
|
768
768
|
if ((tools == null ? void 0 : tools.some(
|
|
@@ -883,16 +883,24 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
883
883
|
}
|
|
884
884
|
});
|
|
885
885
|
lastCodeExecutionToolCallId = void 0;
|
|
886
|
-
} else if ("text" in part && part.text != null
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
886
|
+
} else if ("text" in part && part.text != null) {
|
|
887
|
+
const thoughtSignatureMetadata = part.thoughtSignature ? {
|
|
888
|
+
[providerOptionsName]: {
|
|
889
|
+
thoughtSignature: part.thoughtSignature
|
|
890
|
+
}
|
|
891
|
+
} : void 0;
|
|
892
|
+
if (part.text.length === 0) {
|
|
893
|
+
if (thoughtSignatureMetadata != null && content.length > 0) {
|
|
894
|
+
const lastContent = content[content.length - 1];
|
|
895
|
+
lastContent.providerMetadata = thoughtSignatureMetadata;
|
|
896
|
+
}
|
|
897
|
+
} else {
|
|
898
|
+
content.push({
|
|
899
|
+
type: part.thought === true ? "reasoning" : "text",
|
|
900
|
+
text: part.text,
|
|
901
|
+
providerMetadata: thoughtSignatureMetadata
|
|
902
|
+
});
|
|
903
|
+
}
|
|
896
904
|
} else if ("functionCall" in part) {
|
|
897
905
|
content.push({
|
|
898
906
|
type: "tool-call",
|
|
@@ -1050,8 +1058,22 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1050
1058
|
});
|
|
1051
1059
|
lastCodeExecutionToolCallId = void 0;
|
|
1052
1060
|
}
|
|
1053
|
-
} else if ("text" in part && part.text != null
|
|
1054
|
-
|
|
1061
|
+
} else if ("text" in part && part.text != null) {
|
|
1062
|
+
const thoughtSignatureMetadata = part.thoughtSignature ? {
|
|
1063
|
+
[providerOptionsName]: {
|
|
1064
|
+
thoughtSignature: part.thoughtSignature
|
|
1065
|
+
}
|
|
1066
|
+
} : void 0;
|
|
1067
|
+
if (part.text.length === 0) {
|
|
1068
|
+
if (thoughtSignatureMetadata != null && currentTextBlockId !== null) {
|
|
1069
|
+
controller.enqueue({
|
|
1070
|
+
type: "text-delta",
|
|
1071
|
+
id: currentTextBlockId,
|
|
1072
|
+
delta: "",
|
|
1073
|
+
providerMetadata: thoughtSignatureMetadata
|
|
1074
|
+
});
|
|
1075
|
+
}
|
|
1076
|
+
} else if (part.thought === true) {
|
|
1055
1077
|
if (currentTextBlockId !== null) {
|
|
1056
1078
|
controller.enqueue({
|
|
1057
1079
|
type: "text-end",
|
|
@@ -1064,22 +1086,14 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1064
1086
|
controller.enqueue({
|
|
1065
1087
|
type: "reasoning-start",
|
|
1066
1088
|
id: currentReasoningBlockId,
|
|
1067
|
-
providerMetadata:
|
|
1068
|
-
[providerOptionsName]: {
|
|
1069
|
-
thoughtSignature: part.thoughtSignature
|
|
1070
|
-
}
|
|
1071
|
-
} : void 0
|
|
1089
|
+
providerMetadata: thoughtSignatureMetadata
|
|
1072
1090
|
});
|
|
1073
1091
|
}
|
|
1074
1092
|
controller.enqueue({
|
|
1075
1093
|
type: "reasoning-delta",
|
|
1076
1094
|
id: currentReasoningBlockId,
|
|
1077
1095
|
delta: part.text,
|
|
1078
|
-
providerMetadata:
|
|
1079
|
-
[providerOptionsName]: {
|
|
1080
|
-
thoughtSignature: part.thoughtSignature
|
|
1081
|
-
}
|
|
1082
|
-
} : void 0
|
|
1096
|
+
providerMetadata: thoughtSignatureMetadata
|
|
1083
1097
|
});
|
|
1084
1098
|
} else {
|
|
1085
1099
|
if (currentReasoningBlockId !== null) {
|
|
@@ -1094,22 +1108,14 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1094
1108
|
controller.enqueue({
|
|
1095
1109
|
type: "text-start",
|
|
1096
1110
|
id: currentTextBlockId,
|
|
1097
|
-
providerMetadata:
|
|
1098
|
-
[providerOptionsName]: {
|
|
1099
|
-
thoughtSignature: part.thoughtSignature
|
|
1100
|
-
}
|
|
1101
|
-
} : void 0
|
|
1111
|
+
providerMetadata: thoughtSignatureMetadata
|
|
1102
1112
|
});
|
|
1103
1113
|
}
|
|
1104
1114
|
controller.enqueue({
|
|
1105
1115
|
type: "text-delta",
|
|
1106
1116
|
id: currentTextBlockId,
|
|
1107
1117
|
delta: part.text,
|
|
1108
|
-
providerMetadata:
|
|
1109
|
-
[providerOptionsName]: {
|
|
1110
|
-
thoughtSignature: part.thoughtSignature
|
|
1111
|
-
}
|
|
1112
|
-
} : void 0
|
|
1118
|
+
providerMetadata: thoughtSignatureMetadata
|
|
1113
1119
|
});
|
|
1114
1120
|
}
|
|
1115
1121
|
} else if ("inlineData" in part) {
|