@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/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 ? "3.0.
|
|
10
|
+
var VERSION = true ? "3.0.25" : "0.0.0-test";
|
|
11
11
|
|
|
12
12
|
// src/google-generative-ai-embedding-model.ts
|
|
13
13
|
import {
|
|
@@ -53,7 +53,7 @@ import {
|
|
|
53
53
|
zodSchema as zodSchema2
|
|
54
54
|
} from "@ai-sdk/provider-utils";
|
|
55
55
|
import { z as z2 } from "zod/v4";
|
|
56
|
-
var
|
|
56
|
+
var googleEmbeddingModelOptions = lazySchema2(
|
|
57
57
|
() => zodSchema2(
|
|
58
58
|
z2.object({
|
|
59
59
|
/**
|
|
@@ -108,7 +108,7 @@ var GoogleGenerativeAIEmbeddingModel = class {
|
|
|
108
108
|
const googleOptions = await parseProviderOptions({
|
|
109
109
|
provider: "google",
|
|
110
110
|
providerOptions,
|
|
111
|
-
schema:
|
|
111
|
+
schema: googleEmbeddingModelOptions
|
|
112
112
|
});
|
|
113
113
|
if (values.length > this.maxEmbeddingsPerCall) {
|
|
114
114
|
throw new TooManyEmbeddingValuesForCallError({
|
|
@@ -548,7 +548,7 @@ function getModelPath(modelId) {
|
|
|
548
548
|
// src/google-generative-ai-options.ts
|
|
549
549
|
import { lazySchema as lazySchema4, zodSchema as zodSchema4 } from "@ai-sdk/provider-utils";
|
|
550
550
|
import { z as z4 } from "zod/v4";
|
|
551
|
-
var
|
|
551
|
+
var googleLanguageModelOptions = lazySchema4(
|
|
552
552
|
() => zodSchema4(
|
|
553
553
|
z4.object({
|
|
554
554
|
responseModalities: z4.array(z4.enum(["TEXT", "IMAGE"])).optional(),
|
|
@@ -932,13 +932,13 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
932
932
|
let googleOptions = await parseProviderOptions2({
|
|
933
933
|
provider: providerOptionsName,
|
|
934
934
|
providerOptions,
|
|
935
|
-
schema:
|
|
935
|
+
schema: googleLanguageModelOptions
|
|
936
936
|
});
|
|
937
937
|
if (googleOptions == null && providerOptionsName !== "google") {
|
|
938
938
|
googleOptions = await parseProviderOptions2({
|
|
939
939
|
provider: "google",
|
|
940
940
|
providerOptions,
|
|
941
|
-
schema:
|
|
941
|
+
schema: googleLanguageModelOptions
|
|
942
942
|
});
|
|
943
943
|
}
|
|
944
944
|
if ((tools == null ? void 0 : tools.some(
|
|
@@ -1059,16 +1059,24 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1059
1059
|
}
|
|
1060
1060
|
});
|
|
1061
1061
|
lastCodeExecutionToolCallId = void 0;
|
|
1062
|
-
} else if ("text" in part && part.text != null
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1062
|
+
} else if ("text" in part && part.text != null) {
|
|
1063
|
+
const thoughtSignatureMetadata = part.thoughtSignature ? {
|
|
1064
|
+
[providerOptionsName]: {
|
|
1065
|
+
thoughtSignature: part.thoughtSignature
|
|
1066
|
+
}
|
|
1067
|
+
} : void 0;
|
|
1068
|
+
if (part.text.length === 0) {
|
|
1069
|
+
if (thoughtSignatureMetadata != null && content.length > 0) {
|
|
1070
|
+
const lastContent = content[content.length - 1];
|
|
1071
|
+
lastContent.providerMetadata = thoughtSignatureMetadata;
|
|
1072
|
+
}
|
|
1073
|
+
} else {
|
|
1074
|
+
content.push({
|
|
1075
|
+
type: part.thought === true ? "reasoning" : "text",
|
|
1076
|
+
text: part.text,
|
|
1077
|
+
providerMetadata: thoughtSignatureMetadata
|
|
1078
|
+
});
|
|
1079
|
+
}
|
|
1072
1080
|
} else if ("functionCall" in part) {
|
|
1073
1081
|
content.push({
|
|
1074
1082
|
type: "tool-call",
|
|
@@ -1226,8 +1234,22 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1226
1234
|
});
|
|
1227
1235
|
lastCodeExecutionToolCallId = void 0;
|
|
1228
1236
|
}
|
|
1229
|
-
} else if ("text" in part && part.text != null
|
|
1230
|
-
|
|
1237
|
+
} else if ("text" in part && part.text != null) {
|
|
1238
|
+
const thoughtSignatureMetadata = part.thoughtSignature ? {
|
|
1239
|
+
[providerOptionsName]: {
|
|
1240
|
+
thoughtSignature: part.thoughtSignature
|
|
1241
|
+
}
|
|
1242
|
+
} : void 0;
|
|
1243
|
+
if (part.text.length === 0) {
|
|
1244
|
+
if (thoughtSignatureMetadata != null && currentTextBlockId !== null) {
|
|
1245
|
+
controller.enqueue({
|
|
1246
|
+
type: "text-delta",
|
|
1247
|
+
id: currentTextBlockId,
|
|
1248
|
+
delta: "",
|
|
1249
|
+
providerMetadata: thoughtSignatureMetadata
|
|
1250
|
+
});
|
|
1251
|
+
}
|
|
1252
|
+
} else if (part.thought === true) {
|
|
1231
1253
|
if (currentTextBlockId !== null) {
|
|
1232
1254
|
controller.enqueue({
|
|
1233
1255
|
type: "text-end",
|
|
@@ -1240,22 +1262,14 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1240
1262
|
controller.enqueue({
|
|
1241
1263
|
type: "reasoning-start",
|
|
1242
1264
|
id: currentReasoningBlockId,
|
|
1243
|
-
providerMetadata:
|
|
1244
|
-
[providerOptionsName]: {
|
|
1245
|
-
thoughtSignature: part.thoughtSignature
|
|
1246
|
-
}
|
|
1247
|
-
} : void 0
|
|
1265
|
+
providerMetadata: thoughtSignatureMetadata
|
|
1248
1266
|
});
|
|
1249
1267
|
}
|
|
1250
1268
|
controller.enqueue({
|
|
1251
1269
|
type: "reasoning-delta",
|
|
1252
1270
|
id: currentReasoningBlockId,
|
|
1253
1271
|
delta: part.text,
|
|
1254
|
-
providerMetadata:
|
|
1255
|
-
[providerOptionsName]: {
|
|
1256
|
-
thoughtSignature: part.thoughtSignature
|
|
1257
|
-
}
|
|
1258
|
-
} : void 0
|
|
1272
|
+
providerMetadata: thoughtSignatureMetadata
|
|
1259
1273
|
});
|
|
1260
1274
|
} else {
|
|
1261
1275
|
if (currentReasoningBlockId !== null) {
|
|
@@ -1270,22 +1284,14 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1270
1284
|
controller.enqueue({
|
|
1271
1285
|
type: "text-start",
|
|
1272
1286
|
id: currentTextBlockId,
|
|
1273
|
-
providerMetadata:
|
|
1274
|
-
[providerOptionsName]: {
|
|
1275
|
-
thoughtSignature: part.thoughtSignature
|
|
1276
|
-
}
|
|
1277
|
-
} : void 0
|
|
1287
|
+
providerMetadata: thoughtSignatureMetadata
|
|
1278
1288
|
});
|
|
1279
1289
|
}
|
|
1280
1290
|
controller.enqueue({
|
|
1281
1291
|
type: "text-delta",
|
|
1282
1292
|
id: currentTextBlockId,
|
|
1283
1293
|
delta: part.text,
|
|
1284
|
-
providerMetadata:
|
|
1285
|
-
[providerOptionsName]: {
|
|
1286
|
-
thoughtSignature: part.thoughtSignature
|
|
1287
|
-
}
|
|
1288
|
-
} : void 0
|
|
1294
|
+
providerMetadata: thoughtSignatureMetadata
|
|
1289
1295
|
});
|
|
1290
1296
|
}
|
|
1291
1297
|
} else if ("inlineData" in part) {
|
|
@@ -1864,7 +1870,7 @@ var GoogleGenerativeAIImageModel = class {
|
|
|
1864
1870
|
const googleOptions = await parseProviderOptions3({
|
|
1865
1871
|
provider: "google",
|
|
1866
1872
|
providerOptions,
|
|
1867
|
-
schema:
|
|
1873
|
+
schema: googleImageModelOptionsSchema
|
|
1868
1874
|
});
|
|
1869
1875
|
const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
|
|
1870
1876
|
const parameters = {
|
|
@@ -1918,7 +1924,7 @@ var googleImageResponseSchema = lazySchema11(
|
|
|
1918
1924
|
})
|
|
1919
1925
|
)
|
|
1920
1926
|
);
|
|
1921
|
-
var
|
|
1927
|
+
var googleImageModelOptionsSchema = lazySchema11(
|
|
1922
1928
|
() => zodSchema11(
|
|
1923
1929
|
z13.object({
|
|
1924
1930
|
personGeneration: z13.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
|
|
@@ -1963,7 +1969,7 @@ var GoogleGenerativeAIVideoModel = class {
|
|
|
1963
1969
|
const googleOptions = await parseProviderOptions4({
|
|
1964
1970
|
provider: "google",
|
|
1965
1971
|
providerOptions: options.providerOptions,
|
|
1966
|
-
schema:
|
|
1972
|
+
schema: googleVideoModelOptionsSchema
|
|
1967
1973
|
});
|
|
1968
1974
|
const instances = [{}];
|
|
1969
1975
|
const instance = instances[0];
|
|
@@ -2175,7 +2181,7 @@ var googleOperationSchema = z14.object({
|
|
|
2175
2181
|
}).nullish()
|
|
2176
2182
|
}).nullish()
|
|
2177
2183
|
});
|
|
2178
|
-
var
|
|
2184
|
+
var googleVideoModelOptionsSchema = lazySchema12(
|
|
2179
2185
|
() => zodSchema12(
|
|
2180
2186
|
z14.object({
|
|
2181
2187
|
pollIntervalMs: z14.number().positive().nullish(),
|