@ai-sdk/google 2.0.104 → 2.0.106
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 -0
- package/dist/index.js +18 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -13
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +15 -10
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +15 -10
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +2 -2
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.106" : "0.0.0-test";
|
|
11
11
|
|
|
12
12
|
// src/google-generative-ai-embedding-model.ts
|
|
13
13
|
import {
|
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
zodSchema as zodSchema2
|
|
55
55
|
} from "@ai-sdk/provider-utils";
|
|
56
56
|
import { z as z2 } from "zod/v4";
|
|
57
|
-
var googleEmbeddingContentPartSchema = z2.union([
|
|
57
|
+
var googleEmbeddingContentPartSchema = () => z2.union([
|
|
58
58
|
z2.object({ text: z2.string() }),
|
|
59
59
|
z2.object({
|
|
60
60
|
inlineData: z2.object({
|
|
@@ -102,7 +102,7 @@ var googleGenerativeAIEmbeddingProviderOptions = lazySchema2(
|
|
|
102
102
|
* The array length must match the number of values being embedded. In
|
|
103
103
|
* the case of a single embedding, the array length must be 1.
|
|
104
104
|
*/
|
|
105
|
-
content: z2.array(z2.array(googleEmbeddingContentPartSchema).min(1).nullable()).optional()
|
|
105
|
+
content: z2.array(z2.array(googleEmbeddingContentPartSchema()).min(1).nullable()).optional()
|
|
106
106
|
})
|
|
107
107
|
)
|
|
108
108
|
);
|
|
@@ -403,6 +403,11 @@ function convertJSONSchemaDefinition(jsonSchema, isRoot, referenceContext) {
|
|
|
403
403
|
const nonNullTypes = type.filter((t) => t !== "null");
|
|
404
404
|
if (nonNullTypes.length === 0) {
|
|
405
405
|
result.type = "null";
|
|
406
|
+
} else if (nonNullTypes.length === 1) {
|
|
407
|
+
result.type = nonNullTypes[0];
|
|
408
|
+
if (hasNull) {
|
|
409
|
+
result.nullable = true;
|
|
410
|
+
}
|
|
406
411
|
} else {
|
|
407
412
|
result.anyOf = nonNullTypes.map((t) => ({ type: t }));
|
|
408
413
|
if (hasNull) {
|
|
@@ -2195,13 +2200,13 @@ var getSafetyRatingSchema = () => z5.object({
|
|
|
2195
2200
|
severityScore: z5.number().nullish(),
|
|
2196
2201
|
blocked: z5.boolean().nullish()
|
|
2197
2202
|
});
|
|
2198
|
-
var tokenDetailsSchema = z5.array(
|
|
2203
|
+
var tokenDetailsSchema = () => z5.array(
|
|
2199
2204
|
z5.object({
|
|
2200
2205
|
modality: z5.string(),
|
|
2201
2206
|
tokenCount: z5.number()
|
|
2202
2207
|
})
|
|
2203
2208
|
).nullish();
|
|
2204
|
-
var usageSchema = z5.object({
|
|
2209
|
+
var usageSchema = () => z5.object({
|
|
2205
2210
|
cachedContentTokenCount: z5.number().nullish(),
|
|
2206
2211
|
thoughtsTokenCount: z5.number().nullish(),
|
|
2207
2212
|
promptTokenCount: z5.number().nullish(),
|
|
@@ -2210,8 +2215,8 @@ var usageSchema = z5.object({
|
|
|
2210
2215
|
// https://cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerateContentResponse#TrafficType
|
|
2211
2216
|
trafficType: z5.string().nullish(),
|
|
2212
2217
|
// https://ai.google.dev/api/generate-content#Modality
|
|
2213
|
-
promptTokensDetails: tokenDetailsSchema,
|
|
2214
|
-
candidatesTokensDetails: tokenDetailsSchema
|
|
2218
|
+
promptTokensDetails: tokenDetailsSchema(),
|
|
2219
|
+
candidatesTokensDetails: tokenDetailsSchema()
|
|
2215
2220
|
});
|
|
2216
2221
|
var getUrlContextMetadataSchema = () => z5.object({
|
|
2217
2222
|
urlMetadata: z5.array(
|
|
@@ -2234,7 +2239,7 @@ var responseSchema = lazySchema5(
|
|
|
2234
2239
|
urlContextMetadata: getUrlContextMetadataSchema().nullish()
|
|
2235
2240
|
})
|
|
2236
2241
|
).nullish(),
|
|
2237
|
-
usageMetadata: usageSchema.nullish(),
|
|
2242
|
+
usageMetadata: usageSchema().nullish(),
|
|
2238
2243
|
promptFeedback: z5.object({
|
|
2239
2244
|
blockReason: z5.string().nullish(),
|
|
2240
2245
|
safetyRatings: z5.array(getSafetyRatingSchema()).nullish()
|
|
@@ -2256,7 +2261,7 @@ var chunkSchema = lazySchema5(
|
|
|
2256
2261
|
urlContextMetadata: getUrlContextMetadataSchema().nullish()
|
|
2257
2262
|
})
|
|
2258
2263
|
).nullish(),
|
|
2259
|
-
usageMetadata: usageSchema.nullish(),
|
|
2264
|
+
usageMetadata: usageSchema().nullish(),
|
|
2260
2265
|
promptFeedback: z5.object({
|
|
2261
2266
|
blockReason: z5.string().nullish(),
|
|
2262
2267
|
safetyRatings: z5.array(getSafetyRatingSchema()).nullish()
|
|
@@ -2302,7 +2307,7 @@ import {
|
|
|
2302
2307
|
zodSchema as zodSchema7
|
|
2303
2308
|
} from "@ai-sdk/provider-utils";
|
|
2304
2309
|
import { z as z8 } from "zod/v4";
|
|
2305
|
-
var fileSearchArgsBaseSchema = z8.object({
|
|
2310
|
+
var fileSearchArgsBaseSchema = () => z8.object({
|
|
2306
2311
|
/** The names of the file_search_stores to retrieve from.
|
|
2307
2312
|
* Example: `fileSearchStores/my-file-search-store-123`
|
|
2308
2313
|
*/
|
|
@@ -2319,7 +2324,7 @@ var fileSearchArgsBaseSchema = z8.object({
|
|
|
2319
2324
|
).optional()
|
|
2320
2325
|
}).passthrough();
|
|
2321
2326
|
var fileSearchArgsSchema = lazySchema7(
|
|
2322
|
-
() => zodSchema7(fileSearchArgsBaseSchema)
|
|
2327
|
+
() => zodSchema7(fileSearchArgsBaseSchema())
|
|
2323
2328
|
);
|
|
2324
2329
|
var fileSearch = createProviderDefinedToolFactory2({
|
|
2325
2330
|
id: "google.file_search",
|
|
@@ -2347,7 +2352,7 @@ import {
|
|
|
2347
2352
|
zodSchema as zodSchema9
|
|
2348
2353
|
} from "@ai-sdk/provider-utils";
|
|
2349
2354
|
import { z as z10 } from "zod/v4";
|
|
2350
|
-
var googleSearchToolArgsBaseSchema = z10.object({
|
|
2355
|
+
var googleSearchToolArgsBaseSchema = () => z10.object({
|
|
2351
2356
|
searchTypes: z10.object({
|
|
2352
2357
|
webSearch: z10.object({}).optional(),
|
|
2353
2358
|
imageSearch: z10.object({}).optional()
|
|
@@ -2358,7 +2363,7 @@ var googleSearchToolArgsBaseSchema = z10.object({
|
|
|
2358
2363
|
}).optional()
|
|
2359
2364
|
}).passthrough();
|
|
2360
2365
|
var googleSearchToolArgsSchema = lazySchema9(
|
|
2361
|
-
() => zodSchema9(googleSearchToolArgsBaseSchema)
|
|
2366
|
+
() => zodSchema9(googleSearchToolArgsBaseSchema())
|
|
2362
2367
|
);
|
|
2363
2368
|
var googleSearch = createProviderDefinedToolFactory4({
|
|
2364
2369
|
id: "google.google_search",
|