@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/internal/index.js
CHANGED
|
@@ -187,6 +187,11 @@ function convertJSONSchemaDefinition(jsonSchema, isRoot, referenceContext) {
|
|
|
187
187
|
const nonNullTypes = type.filter((t) => t !== "null");
|
|
188
188
|
if (nonNullTypes.length === 0) {
|
|
189
189
|
result.type = "null";
|
|
190
|
+
} else if (nonNullTypes.length === 1) {
|
|
191
|
+
result.type = nonNullTypes[0];
|
|
192
|
+
if (hasNull) {
|
|
193
|
+
result.nullable = true;
|
|
194
|
+
}
|
|
190
195
|
} else {
|
|
191
196
|
result.anyOf = nonNullTypes.map((t) => ({ type: t }));
|
|
192
197
|
if (hasNull) {
|
|
@@ -1992,13 +1997,13 @@ var getSafetyRatingSchema = () => import_v43.z.object({
|
|
|
1992
1997
|
severityScore: import_v43.z.number().nullish(),
|
|
1993
1998
|
blocked: import_v43.z.boolean().nullish()
|
|
1994
1999
|
});
|
|
1995
|
-
var tokenDetailsSchema = import_v43.z.array(
|
|
2000
|
+
var tokenDetailsSchema = () => import_v43.z.array(
|
|
1996
2001
|
import_v43.z.object({
|
|
1997
2002
|
modality: import_v43.z.string(),
|
|
1998
2003
|
tokenCount: import_v43.z.number()
|
|
1999
2004
|
})
|
|
2000
2005
|
).nullish();
|
|
2001
|
-
var usageSchema = import_v43.z.object({
|
|
2006
|
+
var usageSchema = () => import_v43.z.object({
|
|
2002
2007
|
cachedContentTokenCount: import_v43.z.number().nullish(),
|
|
2003
2008
|
thoughtsTokenCount: import_v43.z.number().nullish(),
|
|
2004
2009
|
promptTokenCount: import_v43.z.number().nullish(),
|
|
@@ -2007,8 +2012,8 @@ var usageSchema = import_v43.z.object({
|
|
|
2007
2012
|
// https://cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerateContentResponse#TrafficType
|
|
2008
2013
|
trafficType: import_v43.z.string().nullish(),
|
|
2009
2014
|
// https://ai.google.dev/api/generate-content#Modality
|
|
2010
|
-
promptTokensDetails: tokenDetailsSchema,
|
|
2011
|
-
candidatesTokensDetails: tokenDetailsSchema
|
|
2015
|
+
promptTokensDetails: tokenDetailsSchema(),
|
|
2016
|
+
candidatesTokensDetails: tokenDetailsSchema()
|
|
2012
2017
|
});
|
|
2013
2018
|
var getUrlContextMetadataSchema = () => import_v43.z.object({
|
|
2014
2019
|
urlMetadata: import_v43.z.array(
|
|
@@ -2031,7 +2036,7 @@ var responseSchema = (0, import_provider_utils4.lazySchema)(
|
|
|
2031
2036
|
urlContextMetadata: getUrlContextMetadataSchema().nullish()
|
|
2032
2037
|
})
|
|
2033
2038
|
).nullish(),
|
|
2034
|
-
usageMetadata: usageSchema.nullish(),
|
|
2039
|
+
usageMetadata: usageSchema().nullish(),
|
|
2035
2040
|
promptFeedback: import_v43.z.object({
|
|
2036
2041
|
blockReason: import_v43.z.string().nullish(),
|
|
2037
2042
|
safetyRatings: import_v43.z.array(getSafetyRatingSchema()).nullish()
|
|
@@ -2053,7 +2058,7 @@ var chunkSchema = (0, import_provider_utils4.lazySchema)(
|
|
|
2053
2058
|
urlContextMetadata: getUrlContextMetadataSchema().nullish()
|
|
2054
2059
|
})
|
|
2055
2060
|
).nullish(),
|
|
2056
|
-
usageMetadata: usageSchema.nullish(),
|
|
2061
|
+
usageMetadata: usageSchema().nullish(),
|
|
2057
2062
|
promptFeedback: import_v43.z.object({
|
|
2058
2063
|
blockReason: import_v43.z.string().nullish(),
|
|
2059
2064
|
safetyRatings: import_v43.z.array(getSafetyRatingSchema()).nullish()
|
|
@@ -2091,7 +2096,7 @@ var enterpriseWebSearch = (0, import_provider_utils6.createProviderDefinedToolFa
|
|
|
2091
2096
|
// src/tool/file-search.ts
|
|
2092
2097
|
var import_provider_utils7 = require("@ai-sdk/provider-utils");
|
|
2093
2098
|
var import_v46 = require("zod/v4");
|
|
2094
|
-
var fileSearchArgsBaseSchema = import_v46.z.object({
|
|
2099
|
+
var fileSearchArgsBaseSchema = () => import_v46.z.object({
|
|
2095
2100
|
/** The names of the file_search_stores to retrieve from.
|
|
2096
2101
|
* Example: `fileSearchStores/my-file-search-store-123`
|
|
2097
2102
|
*/
|
|
@@ -2108,7 +2113,7 @@ var fileSearchArgsBaseSchema = import_v46.z.object({
|
|
|
2108
2113
|
).optional()
|
|
2109
2114
|
}).passthrough();
|
|
2110
2115
|
var fileSearchArgsSchema = (0, import_provider_utils7.lazySchema)(
|
|
2111
|
-
() => (0, import_provider_utils7.zodSchema)(fileSearchArgsBaseSchema)
|
|
2116
|
+
() => (0, import_provider_utils7.zodSchema)(fileSearchArgsBaseSchema())
|
|
2112
2117
|
);
|
|
2113
2118
|
var fileSearch = (0, import_provider_utils7.createProviderDefinedToolFactory)({
|
|
2114
2119
|
id: "google.file_search",
|
|
@@ -2128,7 +2133,7 @@ var googleMaps = (0, import_provider_utils8.createProviderDefinedToolFactory)({
|
|
|
2128
2133
|
// src/tool/google-search.ts
|
|
2129
2134
|
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
|
2130
2135
|
var import_v48 = require("zod/v4");
|
|
2131
|
-
var googleSearchToolArgsBaseSchema = import_v48.z.object({
|
|
2136
|
+
var googleSearchToolArgsBaseSchema = () => import_v48.z.object({
|
|
2132
2137
|
searchTypes: import_v48.z.object({
|
|
2133
2138
|
webSearch: import_v48.z.object({}).optional(),
|
|
2134
2139
|
imageSearch: import_v48.z.object({}).optional()
|
|
@@ -2139,7 +2144,7 @@ var googleSearchToolArgsBaseSchema = import_v48.z.object({
|
|
|
2139
2144
|
}).optional()
|
|
2140
2145
|
}).passthrough();
|
|
2141
2146
|
var googleSearchToolArgsSchema = (0, import_provider_utils9.lazySchema)(
|
|
2142
|
-
() => (0, import_provider_utils9.zodSchema)(googleSearchToolArgsBaseSchema)
|
|
2147
|
+
() => (0, import_provider_utils9.zodSchema)(googleSearchToolArgsBaseSchema())
|
|
2143
2148
|
);
|
|
2144
2149
|
var googleSearch = (0, import_provider_utils9.createProviderDefinedToolFactory)({
|
|
2145
2150
|
id: "google.google_search",
|