@ai-sdk/google 2.0.52 → 2.0.54
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 +15 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +37 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +37 -25
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +1 -1
- package/dist/internal/index.d.ts +1 -1
- package/dist/internal/index.js +36 -24
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +36 -24
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -3,7 +3,7 @@ import { Resolvable, FetchFunction, InferValidator } from '@ai-sdk/provider-util
|
|
|
3
3
|
import { LanguageModelV2 } from '@ai-sdk/provider';
|
|
4
4
|
import { z } from 'zod/v4';
|
|
5
5
|
|
|
6
|
-
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-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | '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 & {});
|
|
6
|
+
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-3.1-pro-preview' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | '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 & {});
|
|
7
7
|
|
|
8
8
|
type GoogleGenerativeAIConfig = {
|
|
9
9
|
provider: string;
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Resolvable, FetchFunction, InferValidator } from '@ai-sdk/provider-util
|
|
|
3
3
|
import { LanguageModelV2 } from '@ai-sdk/provider';
|
|
4
4
|
import { z } from 'zod/v4';
|
|
5
5
|
|
|
6
|
-
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-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | '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 & {});
|
|
6
|
+
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-3.1-pro-preview' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | '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 & {});
|
|
7
7
|
|
|
8
8
|
type GoogleGenerativeAIConfig = {
|
|
9
9
|
provider: string;
|
package/dist/internal/index.js
CHANGED
|
@@ -848,12 +848,22 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
848
848
|
providerExecuted: true
|
|
849
849
|
});
|
|
850
850
|
lastCodeExecutionToolCallId = void 0;
|
|
851
|
-
} else if ("text" in part && part.text != null
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
851
|
+
} else if ("text" in part && part.text != null) {
|
|
852
|
+
const thoughtSignatureMetadata = part.thoughtSignature ? { google: { thoughtSignature: part.thoughtSignature } } : void 0;
|
|
853
|
+
if (part.text.length === 0) {
|
|
854
|
+
if (thoughtSignatureMetadata != null && content.length > 0) {
|
|
855
|
+
const lastContent = content[content.length - 1];
|
|
856
|
+
if (lastContent.type !== "file") {
|
|
857
|
+
lastContent.providerMetadata = thoughtSignatureMetadata;
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
} else {
|
|
861
|
+
content.push({
|
|
862
|
+
type: part.thought === true ? "reasoning" : "text",
|
|
863
|
+
text: part.text,
|
|
864
|
+
providerMetadata: thoughtSignatureMetadata
|
|
865
|
+
});
|
|
866
|
+
}
|
|
857
867
|
} else if ("functionCall" in part) {
|
|
858
868
|
content.push({
|
|
859
869
|
type: "tool-call",
|
|
@@ -1010,8 +1020,22 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1010
1020
|
});
|
|
1011
1021
|
lastCodeExecutionToolCallId = void 0;
|
|
1012
1022
|
}
|
|
1013
|
-
} else if ("text" in part && part.text != null
|
|
1014
|
-
|
|
1023
|
+
} else if ("text" in part && part.text != null) {
|
|
1024
|
+
const thoughtSignatureMetadata = part.thoughtSignature ? {
|
|
1025
|
+
google: {
|
|
1026
|
+
thoughtSignature: part.thoughtSignature
|
|
1027
|
+
}
|
|
1028
|
+
} : void 0;
|
|
1029
|
+
if (part.text.length === 0) {
|
|
1030
|
+
if (thoughtSignatureMetadata != null && currentTextBlockId !== null) {
|
|
1031
|
+
controller.enqueue({
|
|
1032
|
+
type: "text-delta",
|
|
1033
|
+
id: currentTextBlockId,
|
|
1034
|
+
delta: "",
|
|
1035
|
+
providerMetadata: thoughtSignatureMetadata
|
|
1036
|
+
});
|
|
1037
|
+
}
|
|
1038
|
+
} else if (part.thought === true) {
|
|
1015
1039
|
if (currentTextBlockId !== null) {
|
|
1016
1040
|
controller.enqueue({
|
|
1017
1041
|
type: "text-end",
|
|
@@ -1024,20 +1048,14 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1024
1048
|
controller.enqueue({
|
|
1025
1049
|
type: "reasoning-start",
|
|
1026
1050
|
id: currentReasoningBlockId,
|
|
1027
|
-
providerMetadata:
|
|
1028
|
-
google: {
|
|
1029
|
-
thoughtSignature: part.thoughtSignature
|
|
1030
|
-
}
|
|
1031
|
-
} : void 0
|
|
1051
|
+
providerMetadata: thoughtSignatureMetadata
|
|
1032
1052
|
});
|
|
1033
1053
|
}
|
|
1034
1054
|
controller.enqueue({
|
|
1035
1055
|
type: "reasoning-delta",
|
|
1036
1056
|
id: currentReasoningBlockId,
|
|
1037
1057
|
delta: part.text,
|
|
1038
|
-
providerMetadata:
|
|
1039
|
-
google: { thoughtSignature: part.thoughtSignature }
|
|
1040
|
-
} : void 0
|
|
1058
|
+
providerMetadata: thoughtSignatureMetadata
|
|
1041
1059
|
});
|
|
1042
1060
|
} else {
|
|
1043
1061
|
if (currentReasoningBlockId !== null) {
|
|
@@ -1052,20 +1070,14 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1052
1070
|
controller.enqueue({
|
|
1053
1071
|
type: "text-start",
|
|
1054
1072
|
id: currentTextBlockId,
|
|
1055
|
-
providerMetadata:
|
|
1056
|
-
google: {
|
|
1057
|
-
thoughtSignature: part.thoughtSignature
|
|
1058
|
-
}
|
|
1059
|
-
} : void 0
|
|
1073
|
+
providerMetadata: thoughtSignatureMetadata
|
|
1060
1074
|
});
|
|
1061
1075
|
}
|
|
1062
1076
|
controller.enqueue({
|
|
1063
1077
|
type: "text-delta",
|
|
1064
1078
|
id: currentTextBlockId,
|
|
1065
1079
|
delta: part.text,
|
|
1066
|
-
providerMetadata:
|
|
1067
|
-
google: { thoughtSignature: part.thoughtSignature }
|
|
1068
|
-
} : void 0
|
|
1080
|
+
providerMetadata: thoughtSignatureMetadata
|
|
1069
1081
|
});
|
|
1070
1082
|
}
|
|
1071
1083
|
} else if ("inlineData" in part) {
|