@ai-sdk/google 4.0.47 → 4.0.49
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.ts +18 -18
- package/dist/index.js +528 -556
- package/dist/index.js.map +1 -1
- package/dist/internal/index.js +101 -12
- package/dist/internal/index.js.map +1 -1
- package/docs/15-google.mdx +7 -60
- package/package.json +1 -1
- package/src/convert-json-schema-to-openapi-schema.ts +171 -14
- package/src/google-image-model-options.ts +12 -16
- package/src/google-image-model.ts +25 -166
- package/src/google-image-settings.ts +1 -5
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "@ai-sdk/provider-utils";
|
|
8
8
|
|
|
9
9
|
// src/version.ts
|
|
10
|
-
var VERSION = true ? "4.0.
|
|
10
|
+
var VERSION = true ? "4.0.49" : "0.0.0-test";
|
|
11
11
|
|
|
12
12
|
// src/google-embedding-model.ts
|
|
13
13
|
import {
|
|
@@ -303,21 +303,37 @@ import {
|
|
|
303
303
|
UnsupportedFunctionalityError
|
|
304
304
|
} from "@ai-sdk/provider";
|
|
305
305
|
function convertJSONSchemaToOpenAPISchema(jsonSchema, isRoot = true) {
|
|
306
|
+
const rootSchema = typeof jsonSchema === "object" ? jsonSchema : void 0;
|
|
307
|
+
return convertJSONSchemaDefinition(jsonSchema, isRoot, {
|
|
308
|
+
definitions: rootSchema == null ? void 0 : rootSchema.definitions,
|
|
309
|
+
dollarDefinitions: rootSchema == null ? void 0 : rootSchema.$defs,
|
|
310
|
+
resolvingReferences: /* @__PURE__ */ new Set()
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
function convertJSONSchemaDefinition(jsonSchema, isRoot, referenceContext) {
|
|
306
314
|
if (jsonSchema == null) {
|
|
307
315
|
return void 0;
|
|
308
316
|
}
|
|
317
|
+
if (typeof jsonSchema === "boolean") {
|
|
318
|
+
return { type: "boolean", properties: {} };
|
|
319
|
+
}
|
|
320
|
+
if (jsonSchema.$ref != null) {
|
|
321
|
+
return convertJSONSchemaReference({
|
|
322
|
+
jsonSchema,
|
|
323
|
+
reference: jsonSchema.$ref,
|
|
324
|
+
isRoot,
|
|
325
|
+
referenceContext
|
|
326
|
+
});
|
|
327
|
+
}
|
|
309
328
|
if (isEmptyObjectSchema(jsonSchema)) {
|
|
310
329
|
if (isRoot) {
|
|
311
330
|
return void 0;
|
|
312
331
|
}
|
|
313
|
-
if (
|
|
332
|
+
if (jsonSchema.description) {
|
|
314
333
|
return { type: "object", description: jsonSchema.description };
|
|
315
334
|
}
|
|
316
335
|
return { type: "object" };
|
|
317
336
|
}
|
|
318
|
-
if (typeof jsonSchema === "boolean") {
|
|
319
|
-
return { type: "boolean", properties: {} };
|
|
320
|
-
}
|
|
321
337
|
const {
|
|
322
338
|
type,
|
|
323
339
|
description,
|
|
@@ -359,18 +375,20 @@ function convertJSONSchemaToOpenAPISchema(jsonSchema, isRoot = true) {
|
|
|
359
375
|
if (properties != null) {
|
|
360
376
|
result.properties = Object.entries(properties).reduce(
|
|
361
377
|
(acc, [key, value]) => {
|
|
362
|
-
acc[key] =
|
|
378
|
+
acc[key] = convertJSONSchemaDefinition(value, false, referenceContext);
|
|
363
379
|
return acc;
|
|
364
380
|
},
|
|
365
381
|
{}
|
|
366
382
|
);
|
|
367
383
|
}
|
|
368
384
|
if (items) {
|
|
369
|
-
result.items = Array.isArray(items) ? items.map(
|
|
385
|
+
result.items = Array.isArray(items) ? items.map(
|
|
386
|
+
(item) => convertJSONSchemaDefinition(item, false, referenceContext)
|
|
387
|
+
) : convertJSONSchemaDefinition(items, false, referenceContext);
|
|
370
388
|
}
|
|
371
389
|
if (allOf) {
|
|
372
390
|
result.allOf = allOf.map(
|
|
373
|
-
(item) =>
|
|
391
|
+
(item) => convertJSONSchemaDefinition(item, false, referenceContext)
|
|
374
392
|
);
|
|
375
393
|
}
|
|
376
394
|
if (anyOf) {
|
|
@@ -381,9 +399,10 @@ function convertJSONSchemaToOpenAPISchema(jsonSchema, isRoot = true) {
|
|
|
381
399
|
(schema) => !(typeof schema === "object" && (schema == null ? void 0 : schema.type) === "null")
|
|
382
400
|
);
|
|
383
401
|
if (nonNullSchemas.length === 1) {
|
|
384
|
-
const converted =
|
|
402
|
+
const converted = convertJSONSchemaDefinition(
|
|
385
403
|
nonNullSchemas[0],
|
|
386
|
-
false
|
|
404
|
+
false,
|
|
405
|
+
referenceContext
|
|
387
406
|
);
|
|
388
407
|
if (typeof converted === "object") {
|
|
389
408
|
result.nullable = true;
|
|
@@ -391,19 +410,19 @@ function convertJSONSchemaToOpenAPISchema(jsonSchema, isRoot = true) {
|
|
|
391
410
|
}
|
|
392
411
|
} else {
|
|
393
412
|
result.anyOf = nonNullSchemas.map(
|
|
394
|
-
(item) =>
|
|
413
|
+
(item) => convertJSONSchemaDefinition(item, false, referenceContext)
|
|
395
414
|
);
|
|
396
415
|
result.nullable = true;
|
|
397
416
|
}
|
|
398
417
|
} else {
|
|
399
418
|
result.anyOf = anyOf.map(
|
|
400
|
-
(item) =>
|
|
419
|
+
(item) => convertJSONSchemaDefinition(item, false, referenceContext)
|
|
401
420
|
);
|
|
402
421
|
}
|
|
403
422
|
}
|
|
404
423
|
if (oneOf) {
|
|
405
424
|
result.oneOf = oneOf.map(
|
|
406
|
-
(item) =>
|
|
425
|
+
(item) => convertJSONSchemaDefinition(item, false, referenceContext)
|
|
407
426
|
);
|
|
408
427
|
}
|
|
409
428
|
if (minLength !== void 0) {
|
|
@@ -411,6 +430,76 @@ function convertJSONSchemaToOpenAPISchema(jsonSchema, isRoot = true) {
|
|
|
411
430
|
}
|
|
412
431
|
return result;
|
|
413
432
|
}
|
|
433
|
+
function convertJSONSchemaReference({
|
|
434
|
+
jsonSchema,
|
|
435
|
+
reference,
|
|
436
|
+
isRoot,
|
|
437
|
+
referenceContext
|
|
438
|
+
}) {
|
|
439
|
+
const { definition, referenceKey } = getReferencedDefinition(
|
|
440
|
+
reference,
|
|
441
|
+
referenceContext
|
|
442
|
+
);
|
|
443
|
+
if (referenceContext.resolvingReferences.has(referenceKey)) {
|
|
444
|
+
throw new UnsupportedFunctionalityError({
|
|
445
|
+
functionality: `recursive JSON Schema reference: ${reference}`,
|
|
446
|
+
message: "Google schema conversion does not support recursive JSON Schema references."
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
const resolvingReferences = new Set(referenceContext.resolvingReferences);
|
|
450
|
+
resolvingReferences.add(referenceKey);
|
|
451
|
+
const { $ref: _reference, ...siblingSchema } = jsonSchema;
|
|
452
|
+
const resolvedSchema = typeof definition === "boolean" ? definition ? siblingSchema : false : { ...definition, ...siblingSchema };
|
|
453
|
+
return convertJSONSchemaDefinition(resolvedSchema, isRoot, {
|
|
454
|
+
...referenceContext,
|
|
455
|
+
resolvingReferences
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
function getReferencedDefinition(reference, referenceContext) {
|
|
459
|
+
const definitionSources = [
|
|
460
|
+
{
|
|
461
|
+
prefix: "#/$defs/",
|
|
462
|
+
definitions: referenceContext.dollarDefinitions
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
prefix: "#/definitions/",
|
|
466
|
+
definitions: referenceContext.definitions
|
|
467
|
+
}
|
|
468
|
+
];
|
|
469
|
+
const source = definitionSources.find(
|
|
470
|
+
({ prefix }) => reference.startsWith(prefix)
|
|
471
|
+
);
|
|
472
|
+
const encodedDefinitionName = source ? reference.slice(source.prefix.length) : void 0;
|
|
473
|
+
if (source == null || encodedDefinitionName == null || encodedDefinitionName.length === 0 || encodedDefinitionName.includes("/")) {
|
|
474
|
+
throwUnsupportedReference(reference);
|
|
475
|
+
}
|
|
476
|
+
let decodedDefinitionName;
|
|
477
|
+
try {
|
|
478
|
+
decodedDefinitionName = decodeURIComponent(encodedDefinitionName);
|
|
479
|
+
} catch (e) {
|
|
480
|
+
throwUnsupportedReference(reference);
|
|
481
|
+
}
|
|
482
|
+
if (decodedDefinitionName.includes("/") || /~(?![01])/u.test(decodedDefinitionName) || source.definitions == null) {
|
|
483
|
+
throwUnsupportedReference(reference);
|
|
484
|
+
}
|
|
485
|
+
const definitionName = decodedDefinitionName.replace(
|
|
486
|
+
/~[01]/g,
|
|
487
|
+
(match) => match === "~1" ? "/" : "~"
|
|
488
|
+
);
|
|
489
|
+
if (!Object.prototype.hasOwnProperty.call(source.definitions, definitionName)) {
|
|
490
|
+
throwUnsupportedReference(reference);
|
|
491
|
+
}
|
|
492
|
+
return {
|
|
493
|
+
definition: source.definitions[definitionName],
|
|
494
|
+
referenceKey: `${source.prefix}${definitionName}`
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
function throwUnsupportedReference(reference) {
|
|
498
|
+
throw new UnsupportedFunctionalityError({
|
|
499
|
+
functionality: `JSON Schema reference: ${reference}`,
|
|
500
|
+
message: "Google schema conversion only supports references to direct children of root-level $defs or definitions."
|
|
501
|
+
});
|
|
502
|
+
}
|
|
414
503
|
function addEnumToSchema({
|
|
415
504
|
values,
|
|
416
505
|
type,
|
|
@@ -1143,13 +1232,13 @@ function isKnownPreGemini2Model(modelId) {
|
|
|
1143
1232
|
return gemini1ModelPattern.test(modelId) || /(^|\/)gemini-pro(?:-vision)?$/i.test(modelId) || /(^|\/)gemini-robotics-er-1\.5(?:[.-]|$)/i.test(modelId);
|
|
1144
1233
|
}
|
|
1145
1234
|
function getGoogleModelCapabilities(modelId) {
|
|
1146
|
-
const
|
|
1235
|
+
const isGeminiModel = geminiModelPattern.test(modelId);
|
|
1147
1236
|
const isGemini2Model = gemini2ModelPattern.test(modelId);
|
|
1148
1237
|
const isKnownPreGemini2 = isKnownPreGemini2Model(modelId);
|
|
1149
1238
|
const isKnownOlderModel = isKnownPreGemini2 || isGemini2Model;
|
|
1150
|
-
const usesGemini3Features =
|
|
1239
|
+
const usesGemini3Features = isGeminiModel && !isKnownOlderModel;
|
|
1151
1240
|
return {
|
|
1152
|
-
supportsGemini2Tools:
|
|
1241
|
+
supportsGemini2Tools: isGeminiModel && !isKnownPreGemini2 || modelId.toLowerCase().includes("nano-banana"),
|
|
1153
1242
|
supportsFileSearch: gemini25ModelPattern.test(modelId) || usesGemini3Features,
|
|
1154
1243
|
usesGemini3Features
|
|
1155
1244
|
};
|
|
@@ -3017,32 +3106,20 @@ var googleTools = {
|
|
|
3017
3106
|
|
|
3018
3107
|
// src/google-image-model.ts
|
|
3019
3108
|
import {
|
|
3020
|
-
combineHeaders as combineHeaders3,
|
|
3021
3109
|
convertToBase64 as convertToBase642,
|
|
3022
|
-
createJsonResponseHandler as createJsonResponseHandler3,
|
|
3023
3110
|
generateId as defaultGenerateId,
|
|
3024
|
-
lazySchema as lazySchema13,
|
|
3025
3111
|
parseProviderOptions as parseProviderOptions3,
|
|
3026
|
-
postJsonToApi as postJsonToApi3,
|
|
3027
|
-
resolve as resolve3,
|
|
3028
3112
|
serializeModelOptions as serializeModelOptions3,
|
|
3029
3113
|
WORKFLOW_SERIALIZE as WORKFLOW_SERIALIZE3,
|
|
3030
|
-
WORKFLOW_DESERIALIZE as WORKFLOW_DESERIALIZE3
|
|
3031
|
-
zodSchema as zodSchema13
|
|
3114
|
+
WORKFLOW_DESERIALIZE as WORKFLOW_DESERIALIZE3
|
|
3032
3115
|
} from "@ai-sdk/provider-utils";
|
|
3033
|
-
import { z as z14 } from "zod/v4";
|
|
3034
3116
|
|
|
3035
3117
|
// src/google-image-model-options.ts
|
|
3036
|
-
import {
|
|
3037
|
-
lazySchema as lazySchema12,
|
|
3038
|
-
zodSchema as zodSchema12
|
|
3039
|
-
} from "@ai-sdk/provider-utils";
|
|
3118
|
+
import { lazySchema as lazySchema12, zodSchema as zodSchema12 } from "@ai-sdk/provider-utils";
|
|
3040
3119
|
import { z as z13 } from "zod/v4";
|
|
3041
3120
|
var googleImageModelOptionsSchema = lazySchema12(
|
|
3042
3121
|
() => zodSchema12(
|
|
3043
3122
|
z13.object({
|
|
3044
|
-
personGeneration: z13.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
|
|
3045
|
-
aspectRatio: z13.enum(["1:1", "3:4", "4:3", "9:16", "16:9"]).nullish(),
|
|
3046
3123
|
/**
|
|
3047
3124
|
* Enable Google Search grounding for Gemini image models. The value is
|
|
3048
3125
|
* forwarded as the args of the `google.tools.googleSearch` provider
|
|
@@ -3078,121 +3155,18 @@ var GoogleImageModel = class _GoogleImageModel {
|
|
|
3078
3155
|
if (this.settings.maxImagesPerCall != null) {
|
|
3079
3156
|
return this.settings.maxImagesPerCall;
|
|
3080
3157
|
}
|
|
3081
|
-
|
|
3082
|
-
return 10;
|
|
3083
|
-
}
|
|
3084
|
-
return 4;
|
|
3158
|
+
return 10;
|
|
3085
3159
|
}
|
|
3086
3160
|
get provider() {
|
|
3087
3161
|
return this.config.provider;
|
|
3088
3162
|
}
|
|
3089
3163
|
async doGenerate(options) {
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
}
|
|
3093
|
-
return this.doGenerateImagen(options);
|
|
3094
|
-
}
|
|
3095
|
-
async doGenerateImagen(options) {
|
|
3096
|
-
var _a, _b, _c;
|
|
3097
|
-
const {
|
|
3098
|
-
prompt,
|
|
3099
|
-
n = 1,
|
|
3100
|
-
size,
|
|
3101
|
-
aspectRatio = "1:1",
|
|
3102
|
-
seed,
|
|
3103
|
-
providerOptions,
|
|
3104
|
-
headers,
|
|
3105
|
-
abortSignal,
|
|
3106
|
-
files,
|
|
3107
|
-
mask
|
|
3108
|
-
} = options;
|
|
3109
|
-
const warnings = [];
|
|
3110
|
-
if (files != null && files.length > 0) {
|
|
3111
|
-
throw new Error(
|
|
3112
|
-
"Google Gemini API does not support image editing with Imagen models. Use Google Vertex AI (@ai-sdk/google-vertex) for image editing capabilities."
|
|
3113
|
-
);
|
|
3114
|
-
}
|
|
3115
|
-
if (mask != null) {
|
|
3164
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
3165
|
+
if (!this.modelId.startsWith("gemini-")) {
|
|
3116
3166
|
throw new Error(
|
|
3117
|
-
"Google
|
|
3167
|
+
"Google image models other than Gemini are no longer supported. Use a model ID that starts with `gemini-`."
|
|
3118
3168
|
);
|
|
3119
3169
|
}
|
|
3120
|
-
if (size != null) {
|
|
3121
|
-
warnings.push({
|
|
3122
|
-
type: "unsupported",
|
|
3123
|
-
feature: "size",
|
|
3124
|
-
details: "This model does not support the `size` option. Use `aspectRatio` instead."
|
|
3125
|
-
});
|
|
3126
|
-
}
|
|
3127
|
-
if (seed != null) {
|
|
3128
|
-
warnings.push({
|
|
3129
|
-
type: "unsupported",
|
|
3130
|
-
feature: "seed",
|
|
3131
|
-
details: "This model does not support the `seed` option through this provider."
|
|
3132
|
-
});
|
|
3133
|
-
}
|
|
3134
|
-
const googleOptions = await parseProviderOptions3({
|
|
3135
|
-
provider: "google",
|
|
3136
|
-
providerOptions,
|
|
3137
|
-
schema: googleImageModelOptionsSchema
|
|
3138
|
-
});
|
|
3139
|
-
const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
|
|
3140
|
-
const parameters = {
|
|
3141
|
-
sampleCount: n
|
|
3142
|
-
};
|
|
3143
|
-
if (aspectRatio != null) {
|
|
3144
|
-
parameters.aspectRatio = aspectRatio;
|
|
3145
|
-
}
|
|
3146
|
-
if (googleOptions) {
|
|
3147
|
-
const { googleSearch: imagenGoogleSearch, ...imagenOptions } = googleOptions;
|
|
3148
|
-
if (imagenGoogleSearch != null) {
|
|
3149
|
-
warnings.push({
|
|
3150
|
-
type: "unsupported",
|
|
3151
|
-
feature: "googleSearch",
|
|
3152
|
-
details: "Google Search grounding is only supported on Gemini image models."
|
|
3153
|
-
});
|
|
3154
|
-
}
|
|
3155
|
-
Object.assign(parameters, imagenOptions);
|
|
3156
|
-
}
|
|
3157
|
-
const body = {
|
|
3158
|
-
instances: [{ prompt }],
|
|
3159
|
-
parameters
|
|
3160
|
-
};
|
|
3161
|
-
const { responseHeaders, value: response } = await postJsonToApi3({
|
|
3162
|
-
url: `${this.config.baseURL}/models/${this.modelId}:predict`,
|
|
3163
|
-
headers: combineHeaders3(
|
|
3164
|
-
this.config.headers ? await resolve3(this.config.headers) : void 0,
|
|
3165
|
-
headers
|
|
3166
|
-
),
|
|
3167
|
-
body,
|
|
3168
|
-
failedResponseHandler: googleFailedResponseHandler,
|
|
3169
|
-
successfulResponseHandler: createJsonResponseHandler3(
|
|
3170
|
-
googleImageResponseSchema
|
|
3171
|
-
),
|
|
3172
|
-
abortSignal,
|
|
3173
|
-
fetch: this.config.fetch
|
|
3174
|
-
});
|
|
3175
|
-
return {
|
|
3176
|
-
images: response.predictions.map(
|
|
3177
|
-
(p) => p.bytesBase64Encoded
|
|
3178
|
-
),
|
|
3179
|
-
warnings,
|
|
3180
|
-
providerMetadata: {
|
|
3181
|
-
google: {
|
|
3182
|
-
images: response.predictions.map(() => ({
|
|
3183
|
-
// Add any prediction-specific metadata here
|
|
3184
|
-
}))
|
|
3185
|
-
}
|
|
3186
|
-
},
|
|
3187
|
-
response: {
|
|
3188
|
-
timestamp: currentDate,
|
|
3189
|
-
modelId: this.modelId,
|
|
3190
|
-
headers: responseHeaders
|
|
3191
|
-
}
|
|
3192
|
-
};
|
|
3193
|
-
}
|
|
3194
|
-
async doGenerateGemini(options) {
|
|
3195
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
3196
3170
|
const {
|
|
3197
3171
|
prompt,
|
|
3198
3172
|
n,
|
|
@@ -3255,7 +3229,12 @@ var GoogleImageModel = class _GoogleImageModel {
|
|
|
3255
3229
|
providerOptions,
|
|
3256
3230
|
schema: googleImageModelOptionsSchema
|
|
3257
3231
|
});
|
|
3258
|
-
const {
|
|
3232
|
+
const {
|
|
3233
|
+
googleSearch: _strippedGoogleSearch,
|
|
3234
|
+
responseModalities: _strippedResponseModalities,
|
|
3235
|
+
imageConfig: userImageConfig,
|
|
3236
|
+
...passthroughGoogleOptions
|
|
3237
|
+
} = (_a = providerOptions == null ? void 0 : providerOptions.google) != null ? _a : {};
|
|
3259
3238
|
const languageModel = new GoogleLanguageModel(this.modelId, {
|
|
3260
3239
|
provider: this.config.provider,
|
|
3261
3240
|
baseURL: this.config.baseURL,
|
|
@@ -3268,11 +3247,14 @@ var GoogleImageModel = class _GoogleImageModel {
|
|
|
3268
3247
|
seed,
|
|
3269
3248
|
providerOptions: {
|
|
3270
3249
|
google: {
|
|
3250
|
+
...passthroughGoogleOptions,
|
|
3271
3251
|
responseModalities: ["IMAGE"],
|
|
3272
|
-
imageConfig: aspectRatio ? {
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3252
|
+
imageConfig: aspectRatio != null || userImageConfig != null ? {
|
|
3253
|
+
...userImageConfig,
|
|
3254
|
+
...aspectRatio != null ? {
|
|
3255
|
+
aspectRatio
|
|
3256
|
+
} : {}
|
|
3257
|
+
} : void 0
|
|
3276
3258
|
}
|
|
3277
3259
|
},
|
|
3278
3260
|
tools: (googleImageOptions == null ? void 0 : googleImageOptions.googleSearch) != null ? [
|
|
@@ -3316,32 +3298,22 @@ var GoogleImageModel = class _GoogleImageModel {
|
|
|
3316
3298
|
};
|
|
3317
3299
|
}
|
|
3318
3300
|
};
|
|
3319
|
-
function isGeminiModel(modelId) {
|
|
3320
|
-
return modelId.startsWith("gemini-");
|
|
3321
|
-
}
|
|
3322
|
-
var googleImageResponseSchema = lazySchema13(
|
|
3323
|
-
() => zodSchema13(
|
|
3324
|
-
z14.object({
|
|
3325
|
-
predictions: z14.array(z14.object({ bytesBase64Encoded: z14.string() })).default([])
|
|
3326
|
-
})
|
|
3327
|
-
)
|
|
3328
|
-
);
|
|
3329
3301
|
|
|
3330
3302
|
// src/google-files.ts
|
|
3331
3303
|
import {
|
|
3332
3304
|
AISDKError
|
|
3333
3305
|
} from "@ai-sdk/provider";
|
|
3334
3306
|
import {
|
|
3335
|
-
combineHeaders as
|
|
3307
|
+
combineHeaders as combineHeaders3,
|
|
3336
3308
|
convertInlineFileDataToUint8Array,
|
|
3337
|
-
createJsonResponseHandler as
|
|
3309
|
+
createJsonResponseHandler as createJsonResponseHandler3,
|
|
3338
3310
|
delay,
|
|
3339
|
-
lazySchema as
|
|
3311
|
+
lazySchema as lazySchema13,
|
|
3340
3312
|
parseProviderOptions as parseProviderOptions4,
|
|
3341
|
-
zodSchema as
|
|
3313
|
+
zodSchema as zodSchema13,
|
|
3342
3314
|
getFromApi
|
|
3343
3315
|
} from "@ai-sdk/provider-utils";
|
|
3344
|
-
import { z as
|
|
3316
|
+
import { z as z14 } from "zod/v4";
|
|
3345
3317
|
var GoogleFiles = class {
|
|
3346
3318
|
constructor(config) {
|
|
3347
3319
|
this.config = config;
|
|
@@ -3428,8 +3400,8 @@ var GoogleFiles = class {
|
|
|
3428
3400
|
const { value: fileStatus } = await getFromApi({
|
|
3429
3401
|
url: `${this.config.baseURL}/${file.name}`,
|
|
3430
3402
|
validateUrl: false,
|
|
3431
|
-
headers:
|
|
3432
|
-
successfulResponseHandler:
|
|
3403
|
+
headers: combineHeaders3(resolvedHeaders),
|
|
3404
|
+
successfulResponseHandler: createJsonResponseHandler3(
|
|
3433
3405
|
googleFileResponseSchema
|
|
3434
3406
|
),
|
|
3435
3407
|
failedResponseHandler: googleFailedResponseHandler,
|
|
@@ -3464,28 +3436,28 @@ var GoogleFiles = class {
|
|
|
3464
3436
|
};
|
|
3465
3437
|
}
|
|
3466
3438
|
};
|
|
3467
|
-
var googleFileResponseSchema =
|
|
3468
|
-
() =>
|
|
3469
|
-
|
|
3470
|
-
name:
|
|
3471
|
-
displayName:
|
|
3472
|
-
mimeType:
|
|
3473
|
-
sizeBytes:
|
|
3474
|
-
createTime:
|
|
3475
|
-
updateTime:
|
|
3476
|
-
expirationTime:
|
|
3477
|
-
sha256Hash:
|
|
3478
|
-
uri:
|
|
3479
|
-
state:
|
|
3439
|
+
var googleFileResponseSchema = lazySchema13(
|
|
3440
|
+
() => zodSchema13(
|
|
3441
|
+
z14.object({
|
|
3442
|
+
name: z14.string(),
|
|
3443
|
+
displayName: z14.string().nullish(),
|
|
3444
|
+
mimeType: z14.string(),
|
|
3445
|
+
sizeBytes: z14.string().nullish(),
|
|
3446
|
+
createTime: z14.string().nullish(),
|
|
3447
|
+
updateTime: z14.string().nullish(),
|
|
3448
|
+
expirationTime: z14.string().nullish(),
|
|
3449
|
+
sha256Hash: z14.string().nullish(),
|
|
3450
|
+
uri: z14.string(),
|
|
3451
|
+
state: z14.string()
|
|
3480
3452
|
})
|
|
3481
3453
|
)
|
|
3482
3454
|
);
|
|
3483
|
-
var googleFilesUploadOptionsSchema =
|
|
3484
|
-
() =>
|
|
3485
|
-
|
|
3486
|
-
displayName:
|
|
3487
|
-
pollIntervalMs:
|
|
3488
|
-
pollTimeoutMs:
|
|
3455
|
+
var googleFilesUploadOptionsSchema = lazySchema13(
|
|
3456
|
+
() => zodSchema13(
|
|
3457
|
+
z14.looseObject({
|
|
3458
|
+
displayName: z14.string().nullish(),
|
|
3459
|
+
pollIntervalMs: z14.number().positive().nullish(),
|
|
3460
|
+
pollTimeoutMs: z14.number().positive().nullish()
|
|
3489
3461
|
})
|
|
3490
3462
|
)
|
|
3491
3463
|
);
|
|
@@ -3495,31 +3467,31 @@ import {
|
|
|
3495
3467
|
AISDKError as AISDKError2
|
|
3496
3468
|
} from "@ai-sdk/provider";
|
|
3497
3469
|
import {
|
|
3498
|
-
combineHeaders as
|
|
3470
|
+
combineHeaders as combineHeaders4,
|
|
3499
3471
|
convertUint8ArrayToBase64,
|
|
3500
|
-
createJsonResponseHandler as
|
|
3472
|
+
createJsonResponseHandler as createJsonResponseHandler4,
|
|
3501
3473
|
getFromApi as getFromApi2,
|
|
3502
3474
|
isSameOrigin,
|
|
3503
3475
|
parseProviderOptions as parseProviderOptions5,
|
|
3504
|
-
postJsonToApi as
|
|
3505
|
-
resolve as
|
|
3476
|
+
postJsonToApi as postJsonToApi3,
|
|
3477
|
+
resolve as resolve3
|
|
3506
3478
|
} from "@ai-sdk/provider-utils";
|
|
3507
|
-
import { z as
|
|
3479
|
+
import { z as z16 } from "zod/v4";
|
|
3508
3480
|
|
|
3509
3481
|
// src/google-video-model-options.ts
|
|
3510
|
-
import { lazySchema as
|
|
3511
|
-
import { z as
|
|
3512
|
-
var googleVideoModelOptionsSchema =
|
|
3513
|
-
() =>
|
|
3514
|
-
|
|
3515
|
-
pollIntervalMs:
|
|
3516
|
-
pollTimeoutMs:
|
|
3517
|
-
personGeneration:
|
|
3518
|
-
negativePrompt:
|
|
3519
|
-
referenceImages:
|
|
3520
|
-
|
|
3521
|
-
bytesBase64Encoded:
|
|
3522
|
-
gcsUri:
|
|
3482
|
+
import { lazySchema as lazySchema14, zodSchema as zodSchema14 } from "@ai-sdk/provider-utils";
|
|
3483
|
+
import { z as z15 } from "zod/v4";
|
|
3484
|
+
var googleVideoModelOptionsSchema = lazySchema14(
|
|
3485
|
+
() => zodSchema14(
|
|
3486
|
+
z15.looseObject({
|
|
3487
|
+
pollIntervalMs: z15.number().positive().nullish(),
|
|
3488
|
+
pollTimeoutMs: z15.number().positive().nullish(),
|
|
3489
|
+
personGeneration: z15.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
|
|
3490
|
+
negativePrompt: z15.string().nullish(),
|
|
3491
|
+
referenceImages: z15.array(
|
|
3492
|
+
z15.object({
|
|
3493
|
+
bytesBase64Encoded: z15.string().nullish(),
|
|
3494
|
+
gcsUri: z15.string().nullish()
|
|
3523
3495
|
})
|
|
3524
3496
|
).nullish()
|
|
3525
3497
|
})
|
|
@@ -3693,7 +3665,7 @@ var GoogleVideoModel = class {
|
|
|
3693
3665
|
}
|
|
3694
3666
|
const videos = [];
|
|
3695
3667
|
const videoMetadata = [];
|
|
3696
|
-
const resolvedHeaders = await
|
|
3668
|
+
const resolvedHeaders = await resolve3(this.config.headers);
|
|
3697
3669
|
const apiKey = resolvedHeaders == null ? void 0 : resolvedHeaders["x-goog-api-key"];
|
|
3698
3670
|
for (const generatedSample of response.generateVideoResponse.generatedSamples) {
|
|
3699
3671
|
if ((_b = generatedSample.video) == null ? void 0 : _b.uri) {
|
|
@@ -3734,17 +3706,17 @@ var GoogleVideoModel = class {
|
|
|
3734
3706
|
var _a, _b, _c;
|
|
3735
3707
|
const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
|
|
3736
3708
|
const { instances, parameters, warnings } = await this.buildRequest(options);
|
|
3737
|
-
const { value: operation, responseHeaders } = await
|
|
3709
|
+
const { value: operation, responseHeaders } = await postJsonToApi3({
|
|
3738
3710
|
url: `${this.config.baseURL}/models/${this.modelId}:predictLongRunning`,
|
|
3739
|
-
headers:
|
|
3740
|
-
await
|
|
3711
|
+
headers: combineHeaders4(
|
|
3712
|
+
await resolve3(this.config.headers),
|
|
3741
3713
|
options.headers
|
|
3742
3714
|
),
|
|
3743
3715
|
body: {
|
|
3744
3716
|
instances,
|
|
3745
3717
|
parameters
|
|
3746
3718
|
},
|
|
3747
|
-
successfulResponseHandler:
|
|
3719
|
+
successfulResponseHandler: createJsonResponseHandler4(
|
|
3748
3720
|
googleOperationSchema
|
|
3749
3721
|
),
|
|
3750
3722
|
failedResponseHandler: googleFailedResponseHandler,
|
|
@@ -3775,11 +3747,11 @@ var GoogleVideoModel = class {
|
|
|
3775
3747
|
const { value: statusOperation, responseHeaders } = await getFromApi2({
|
|
3776
3748
|
url: `${this.config.baseURL}/${operationName}`,
|
|
3777
3749
|
validateUrl: false,
|
|
3778
|
-
headers:
|
|
3779
|
-
await
|
|
3750
|
+
headers: combineHeaders4(
|
|
3751
|
+
await resolve3(this.config.headers),
|
|
3780
3752
|
options.headers
|
|
3781
3753
|
),
|
|
3782
|
-
successfulResponseHandler:
|
|
3754
|
+
successfulResponseHandler: createJsonResponseHandler4(
|
|
3783
3755
|
googleOperationSchema
|
|
3784
3756
|
),
|
|
3785
3757
|
failedResponseHandler: googleFailedResponseHandler,
|
|
@@ -3815,20 +3787,20 @@ var GoogleVideoModel = class {
|
|
|
3815
3787
|
);
|
|
3816
3788
|
}
|
|
3817
3789
|
};
|
|
3818
|
-
var googleOperationSchema =
|
|
3819
|
-
name:
|
|
3820
|
-
done:
|
|
3821
|
-
error:
|
|
3822
|
-
code:
|
|
3823
|
-
message:
|
|
3824
|
-
status:
|
|
3790
|
+
var googleOperationSchema = z16.object({
|
|
3791
|
+
name: z16.string().nullish(),
|
|
3792
|
+
done: z16.boolean().nullish(),
|
|
3793
|
+
error: z16.object({
|
|
3794
|
+
code: z16.number().nullish(),
|
|
3795
|
+
message: z16.string(),
|
|
3796
|
+
status: z16.string().nullish()
|
|
3825
3797
|
}).nullish(),
|
|
3826
|
-
response:
|
|
3827
|
-
generateVideoResponse:
|
|
3828
|
-
generatedSamples:
|
|
3829
|
-
|
|
3830
|
-
video:
|
|
3831
|
-
uri:
|
|
3798
|
+
response: z16.object({
|
|
3799
|
+
generateVideoResponse: z16.object({
|
|
3800
|
+
generatedSamples: z16.array(
|
|
3801
|
+
z16.object({
|
|
3802
|
+
video: z16.object({
|
|
3803
|
+
uri: z16.string().nullish()
|
|
3832
3804
|
}).nullish()
|
|
3833
3805
|
})
|
|
3834
3806
|
).nullish()
|
|
@@ -3838,31 +3810,31 @@ var googleOperationSchema = z17.object({
|
|
|
3838
3810
|
|
|
3839
3811
|
// src/google-speech-model.ts
|
|
3840
3812
|
import {
|
|
3841
|
-
combineHeaders as
|
|
3813
|
+
combineHeaders as combineHeaders5,
|
|
3842
3814
|
convertBase64ToUint8Array,
|
|
3843
|
-
createJsonResponseHandler as
|
|
3815
|
+
createJsonResponseHandler as createJsonResponseHandler5,
|
|
3844
3816
|
parseProviderOptions as parseProviderOptions6,
|
|
3845
|
-
postJsonToApi as
|
|
3846
|
-
resolve as
|
|
3817
|
+
postJsonToApi as postJsonToApi4,
|
|
3818
|
+
resolve as resolve4,
|
|
3847
3819
|
serializeModelOptions as serializeModelOptions4,
|
|
3848
3820
|
WORKFLOW_DESERIALIZE as WORKFLOW_DESERIALIZE4,
|
|
3849
3821
|
WORKFLOW_SERIALIZE as WORKFLOW_SERIALIZE4
|
|
3850
3822
|
} from "@ai-sdk/provider-utils";
|
|
3851
3823
|
|
|
3852
3824
|
// src/google-speech-api.ts
|
|
3853
|
-
import { lazySchema as
|
|
3854
|
-
import { z as
|
|
3855
|
-
var googleSpeechResponseSchema =
|
|
3856
|
-
() =>
|
|
3857
|
-
|
|
3858
|
-
candidates:
|
|
3859
|
-
|
|
3860
|
-
content:
|
|
3861
|
-
parts:
|
|
3862
|
-
|
|
3863
|
-
inlineData:
|
|
3864
|
-
mimeType:
|
|
3865
|
-
data:
|
|
3825
|
+
import { lazySchema as lazySchema15, zodSchema as zodSchema15 } from "@ai-sdk/provider-utils";
|
|
3826
|
+
import { z as z17 } from "zod/v4";
|
|
3827
|
+
var googleSpeechResponseSchema = lazySchema15(
|
|
3828
|
+
() => zodSchema15(
|
|
3829
|
+
z17.object({
|
|
3830
|
+
candidates: z17.array(
|
|
3831
|
+
z17.object({
|
|
3832
|
+
content: z17.object({
|
|
3833
|
+
parts: z17.array(
|
|
3834
|
+
z17.object({
|
|
3835
|
+
inlineData: z17.object({
|
|
3836
|
+
mimeType: z17.string().nullish(),
|
|
3837
|
+
data: z17.string().nullish()
|
|
3866
3838
|
}).nullish()
|
|
3867
3839
|
})
|
|
3868
3840
|
).nullish()
|
|
@@ -3875,19 +3847,19 @@ var googleSpeechResponseSchema = lazySchema16(
|
|
|
3875
3847
|
|
|
3876
3848
|
// src/google-speech-model-options.ts
|
|
3877
3849
|
import {
|
|
3878
|
-
lazySchema as
|
|
3879
|
-
zodSchema as
|
|
3850
|
+
lazySchema as lazySchema16,
|
|
3851
|
+
zodSchema as zodSchema16
|
|
3880
3852
|
} from "@ai-sdk/provider-utils";
|
|
3881
|
-
import { z as
|
|
3882
|
-
var prebuiltVoiceConfigSchema =
|
|
3883
|
-
voiceName:
|
|
3853
|
+
import { z as z18 } from "zod/v4";
|
|
3854
|
+
var prebuiltVoiceConfigSchema = z18.object({
|
|
3855
|
+
voiceName: z18.string()
|
|
3884
3856
|
});
|
|
3885
|
-
var voiceConfigSchema =
|
|
3857
|
+
var voiceConfigSchema = z18.object({
|
|
3886
3858
|
prebuiltVoiceConfig: prebuiltVoiceConfigSchema
|
|
3887
3859
|
});
|
|
3888
|
-
var googleSpeechProviderOptionsSchema =
|
|
3889
|
-
() =>
|
|
3890
|
-
|
|
3860
|
+
var googleSpeechProviderOptionsSchema = lazySchema16(
|
|
3861
|
+
() => zodSchema16(
|
|
3862
|
+
z18.object({
|
|
3891
3863
|
/**
|
|
3892
3864
|
* Multi-speaker configuration for dialogue audio. When provided, this
|
|
3893
3865
|
* overrides the top-level `voice`. The Gemini TTS API supports up to two
|
|
@@ -3895,10 +3867,10 @@ var googleSpeechProviderOptionsSchema = lazySchema17(
|
|
|
3895
3867
|
*
|
|
3896
3868
|
* https://ai.google.dev/gemini-api/docs/speech-generation#multi-speaker
|
|
3897
3869
|
*/
|
|
3898
|
-
multiSpeakerVoiceConfig:
|
|
3899
|
-
speakerVoiceConfigs:
|
|
3900
|
-
|
|
3901
|
-
speaker:
|
|
3870
|
+
multiSpeakerVoiceConfig: z18.object({
|
|
3871
|
+
speakerVoiceConfigs: z18.array(
|
|
3872
|
+
z18.object({
|
|
3873
|
+
speaker: z18.string(),
|
|
3902
3874
|
voiceConfig: voiceConfigSchema
|
|
3903
3875
|
})
|
|
3904
3876
|
)
|
|
@@ -4012,15 +3984,15 @@ var GoogleSpeechModel = class _GoogleSpeechModel {
|
|
|
4012
3984
|
value: response,
|
|
4013
3985
|
responseHeaders,
|
|
4014
3986
|
rawValue: rawResponse
|
|
4015
|
-
} = await
|
|
3987
|
+
} = await postJsonToApi4({
|
|
4016
3988
|
url: `${this.config.baseURL}/models/${this.modelId}:generateContent`,
|
|
4017
|
-
headers:
|
|
4018
|
-
this.config.headers ? await
|
|
3989
|
+
headers: combineHeaders5(
|
|
3990
|
+
this.config.headers ? await resolve4(this.config.headers) : void 0,
|
|
4019
3991
|
options.headers
|
|
4020
3992
|
),
|
|
4021
3993
|
body: requestBody,
|
|
4022
3994
|
failedResponseHandler: googleFailedResponseHandler,
|
|
4023
|
-
successfulResponseHandler:
|
|
3995
|
+
successfulResponseHandler: createJsonResponseHandler5(
|
|
4024
3996
|
googleSpeechResponseSchema
|
|
4025
3997
|
),
|
|
4026
3998
|
abortSignal: options.abortSignal,
|
|
@@ -4111,13 +4083,13 @@ function writeAscii(view, offset, text) {
|
|
|
4111
4083
|
|
|
4112
4084
|
// src/interactions/google-interactions-language-model.ts
|
|
4113
4085
|
import {
|
|
4114
|
-
combineHeaders as
|
|
4086
|
+
combineHeaders as combineHeaders7,
|
|
4115
4087
|
createEventSourceResponseHandler as createEventSourceResponseHandler3,
|
|
4116
|
-
createJsonResponseHandler as
|
|
4088
|
+
createJsonResponseHandler as createJsonResponseHandler7,
|
|
4117
4089
|
generateId as defaultGenerateId2,
|
|
4118
4090
|
parseProviderOptions as parseProviderOptions7,
|
|
4119
|
-
postJsonToApi as
|
|
4120
|
-
resolve as
|
|
4091
|
+
postJsonToApi as postJsonToApi5,
|
|
4092
|
+
resolve as resolve5,
|
|
4121
4093
|
serializeModelOptions as serializeModelOptions5,
|
|
4122
4094
|
WORKFLOW_DESERIALIZE as WORKFLOW_DESERIALIZE5,
|
|
4123
4095
|
WORKFLOW_SERIALIZE as WORKFLOW_SERIALIZE5
|
|
@@ -5253,33 +5225,33 @@ ${block.text}`
|
|
|
5253
5225
|
|
|
5254
5226
|
// src/interactions/google-interactions-api.ts
|
|
5255
5227
|
import {
|
|
5256
|
-
lazySchema as
|
|
5257
|
-
zodSchema as
|
|
5228
|
+
lazySchema as lazySchema17,
|
|
5229
|
+
zodSchema as zodSchema17
|
|
5258
5230
|
} from "@ai-sdk/provider-utils";
|
|
5259
|
-
import { z as
|
|
5260
|
-
var tokenByModalitySchema = () =>
|
|
5261
|
-
modality:
|
|
5262
|
-
tokens:
|
|
5231
|
+
import { z as z19 } from "zod/v4";
|
|
5232
|
+
var tokenByModalitySchema = () => z19.object({
|
|
5233
|
+
modality: z19.string().nullish(),
|
|
5234
|
+
tokens: z19.number().nullish()
|
|
5263
5235
|
}).loose();
|
|
5264
|
-
var usageSchema2 = () =>
|
|
5265
|
-
total_input_tokens:
|
|
5266
|
-
total_output_tokens:
|
|
5267
|
-
total_thought_tokens:
|
|
5268
|
-
total_cached_tokens:
|
|
5269
|
-
total_tool_use_tokens:
|
|
5270
|
-
total_tokens:
|
|
5271
|
-
input_tokens_by_modality:
|
|
5272
|
-
output_tokens_by_modality:
|
|
5273
|
-
cached_tokens_by_modality:
|
|
5274
|
-
tool_use_tokens_by_modality:
|
|
5275
|
-
grounding_tool_count:
|
|
5276
|
-
|
|
5277
|
-
type:
|
|
5278
|
-
count:
|
|
5236
|
+
var usageSchema2 = () => z19.object({
|
|
5237
|
+
total_input_tokens: z19.number().nullish(),
|
|
5238
|
+
total_output_tokens: z19.number().nullish(),
|
|
5239
|
+
total_thought_tokens: z19.number().nullish(),
|
|
5240
|
+
total_cached_tokens: z19.number().nullish(),
|
|
5241
|
+
total_tool_use_tokens: z19.number().nullish(),
|
|
5242
|
+
total_tokens: z19.number().nullish(),
|
|
5243
|
+
input_tokens_by_modality: z19.array(tokenByModalitySchema()).nullish(),
|
|
5244
|
+
output_tokens_by_modality: z19.array(tokenByModalitySchema()).nullish(),
|
|
5245
|
+
cached_tokens_by_modality: z19.array(tokenByModalitySchema()).nullish(),
|
|
5246
|
+
tool_use_tokens_by_modality: z19.array(tokenByModalitySchema()).nullish(),
|
|
5247
|
+
grounding_tool_count: z19.array(
|
|
5248
|
+
z19.object({
|
|
5249
|
+
type: z19.string().nullish(),
|
|
5250
|
+
count: z19.number().nullish()
|
|
5279
5251
|
}).loose()
|
|
5280
5252
|
).nullish()
|
|
5281
5253
|
}).loose();
|
|
5282
|
-
var interactionStatusSchema = () =>
|
|
5254
|
+
var interactionStatusSchema = () => z19.enum([
|
|
5283
5255
|
"in_progress",
|
|
5284
5256
|
"requires_action",
|
|
5285
5257
|
"completed",
|
|
@@ -5288,69 +5260,69 @@ var interactionStatusSchema = () => z20.enum([
|
|
|
5288
5260
|
"incomplete"
|
|
5289
5261
|
]);
|
|
5290
5262
|
var annotationSchema = () => {
|
|
5291
|
-
const urlCitation =
|
|
5292
|
-
type:
|
|
5293
|
-
url:
|
|
5294
|
-
title:
|
|
5295
|
-
start_index:
|
|
5296
|
-
end_index:
|
|
5263
|
+
const urlCitation = z19.object({
|
|
5264
|
+
type: z19.literal("url_citation"),
|
|
5265
|
+
url: z19.string().nullish(),
|
|
5266
|
+
title: z19.string().nullish(),
|
|
5267
|
+
start_index: z19.number().nullish(),
|
|
5268
|
+
end_index: z19.number().nullish()
|
|
5297
5269
|
}).loose();
|
|
5298
|
-
const fileCitation =
|
|
5299
|
-
type:
|
|
5300
|
-
file_name:
|
|
5301
|
-
document_uri:
|
|
5302
|
-
url:
|
|
5303
|
-
page_number:
|
|
5304
|
-
media_id:
|
|
5305
|
-
start_index:
|
|
5306
|
-
end_index:
|
|
5307
|
-
custom_metadata:
|
|
5270
|
+
const fileCitation = z19.object({
|
|
5271
|
+
type: z19.literal("file_citation"),
|
|
5272
|
+
file_name: z19.string().nullish(),
|
|
5273
|
+
document_uri: z19.string().nullish(),
|
|
5274
|
+
url: z19.string().nullish(),
|
|
5275
|
+
page_number: z19.number().nullish(),
|
|
5276
|
+
media_id: z19.string().nullish(),
|
|
5277
|
+
start_index: z19.number().nullish(),
|
|
5278
|
+
end_index: z19.number().nullish(),
|
|
5279
|
+
custom_metadata: z19.record(z19.string(), z19.unknown()).nullish()
|
|
5308
5280
|
}).loose();
|
|
5309
|
-
const placeCitation =
|
|
5310
|
-
type:
|
|
5311
|
-
name:
|
|
5312
|
-
url:
|
|
5313
|
-
place_id:
|
|
5314
|
-
start_index:
|
|
5315
|
-
end_index:
|
|
5281
|
+
const placeCitation = z19.object({
|
|
5282
|
+
type: z19.literal("place_citation"),
|
|
5283
|
+
name: z19.string().nullish(),
|
|
5284
|
+
url: z19.string().nullish(),
|
|
5285
|
+
place_id: z19.string().nullish(),
|
|
5286
|
+
start_index: z19.number().nullish(),
|
|
5287
|
+
end_index: z19.number().nullish()
|
|
5316
5288
|
}).loose();
|
|
5317
|
-
return
|
|
5289
|
+
return z19.union([
|
|
5318
5290
|
urlCitation,
|
|
5319
5291
|
fileCitation,
|
|
5320
5292
|
placeCitation,
|
|
5321
|
-
|
|
5293
|
+
z19.object({ type: z19.string() }).loose()
|
|
5322
5294
|
]);
|
|
5323
5295
|
};
|
|
5324
|
-
var thoughtSummaryItemSchema = () =>
|
|
5325
|
-
type:
|
|
5326
|
-
text:
|
|
5327
|
-
data:
|
|
5328
|
-
mime_type:
|
|
5296
|
+
var thoughtSummaryItemSchema = () => z19.object({
|
|
5297
|
+
type: z19.string(),
|
|
5298
|
+
text: z19.string().nullish(),
|
|
5299
|
+
data: z19.string().nullish(),
|
|
5300
|
+
mime_type: z19.string().nullish()
|
|
5329
5301
|
}).loose();
|
|
5330
5302
|
var contentBlockSchema = () => {
|
|
5331
|
-
const textContent =
|
|
5332
|
-
type:
|
|
5333
|
-
text:
|
|
5334
|
-
annotations:
|
|
5303
|
+
const textContent = z19.object({
|
|
5304
|
+
type: z19.literal("text"),
|
|
5305
|
+
text: z19.string(),
|
|
5306
|
+
annotations: z19.array(annotationSchema()).nullish()
|
|
5335
5307
|
}).loose();
|
|
5336
|
-
const imageContent =
|
|
5337
|
-
type:
|
|
5338
|
-
data:
|
|
5339
|
-
mime_type:
|
|
5340
|
-
resolution:
|
|
5341
|
-
uri:
|
|
5308
|
+
const imageContent = z19.object({
|
|
5309
|
+
type: z19.literal("image"),
|
|
5310
|
+
data: z19.string().nullish(),
|
|
5311
|
+
mime_type: z19.string().nullish(),
|
|
5312
|
+
resolution: z19.enum(["low", "medium", "high", "ultra_high"]).nullish(),
|
|
5313
|
+
uri: z19.string().nullish()
|
|
5342
5314
|
}).loose();
|
|
5343
|
-
const videoContent =
|
|
5344
|
-
type:
|
|
5345
|
-
data:
|
|
5346
|
-
mime_type:
|
|
5347
|
-
uri:
|
|
5315
|
+
const videoContent = z19.object({
|
|
5316
|
+
type: z19.literal("video"),
|
|
5317
|
+
data: z19.string().nullish(),
|
|
5318
|
+
mime_type: z19.string().nullish(),
|
|
5319
|
+
uri: z19.string().nullish()
|
|
5348
5320
|
}).loose();
|
|
5349
|
-
return
|
|
5321
|
+
return z19.union([
|
|
5350
5322
|
textContent,
|
|
5351
5323
|
imageContent,
|
|
5352
5324
|
videoContent,
|
|
5353
|
-
|
|
5325
|
+
z19.object({ type: z19.string() }).loose()
|
|
5354
5326
|
]);
|
|
5355
5327
|
};
|
|
5356
5328
|
var BUILTIN_TOOL_CALL_STEP_TYPES = [
|
|
@@ -5370,158 +5342,158 @@ var BUILTIN_TOOL_RESULT_STEP_TYPES = [
|
|
|
5370
5342
|
"mcp_server_tool_result"
|
|
5371
5343
|
];
|
|
5372
5344
|
var stepSchema = () => {
|
|
5373
|
-
const userInputStep =
|
|
5374
|
-
type:
|
|
5375
|
-
content:
|
|
5345
|
+
const userInputStep = z19.object({
|
|
5346
|
+
type: z19.literal("user_input"),
|
|
5347
|
+
content: z19.array(contentBlockSchema()).nullish()
|
|
5376
5348
|
}).loose();
|
|
5377
|
-
const modelOutputStep =
|
|
5378
|
-
type:
|
|
5379
|
-
content:
|
|
5349
|
+
const modelOutputStep = z19.object({
|
|
5350
|
+
type: z19.literal("model_output"),
|
|
5351
|
+
content: z19.array(contentBlockSchema()).nullish()
|
|
5380
5352
|
}).loose();
|
|
5381
|
-
const functionCallStep =
|
|
5382
|
-
type:
|
|
5383
|
-
id:
|
|
5384
|
-
name:
|
|
5385
|
-
arguments:
|
|
5386
|
-
signature:
|
|
5353
|
+
const functionCallStep = z19.object({
|
|
5354
|
+
type: z19.literal("function_call"),
|
|
5355
|
+
id: z19.string(),
|
|
5356
|
+
name: z19.string(),
|
|
5357
|
+
arguments: z19.record(z19.string(), z19.unknown()).nullish(),
|
|
5358
|
+
signature: z19.string().nullish()
|
|
5387
5359
|
}).loose();
|
|
5388
|
-
const thoughtStep =
|
|
5389
|
-
type:
|
|
5390
|
-
signature:
|
|
5391
|
-
summary:
|
|
5360
|
+
const thoughtStep = z19.object({
|
|
5361
|
+
type: z19.literal("thought"),
|
|
5362
|
+
signature: z19.string().nullish(),
|
|
5363
|
+
summary: z19.array(thoughtSummaryItemSchema()).nullish()
|
|
5392
5364
|
}).loose();
|
|
5393
|
-
const builtinToolCallStep =
|
|
5394
|
-
type:
|
|
5395
|
-
id:
|
|
5396
|
-
arguments:
|
|
5397
|
-
name:
|
|
5398
|
-
server_name:
|
|
5399
|
-
search_type:
|
|
5400
|
-
signature:
|
|
5365
|
+
const builtinToolCallStep = z19.object({
|
|
5366
|
+
type: z19.enum(BUILTIN_TOOL_CALL_STEP_TYPES),
|
|
5367
|
+
id: z19.string(),
|
|
5368
|
+
arguments: z19.record(z19.string(), z19.unknown()).nullish(),
|
|
5369
|
+
name: z19.string().nullish(),
|
|
5370
|
+
server_name: z19.string().nullish(),
|
|
5371
|
+
search_type: z19.string().nullish(),
|
|
5372
|
+
signature: z19.string().nullish()
|
|
5401
5373
|
}).loose();
|
|
5402
|
-
const builtinToolResultStep =
|
|
5403
|
-
type:
|
|
5404
|
-
call_id:
|
|
5405
|
-
result:
|
|
5406
|
-
is_error:
|
|
5407
|
-
name:
|
|
5408
|
-
server_name:
|
|
5409
|
-
signature:
|
|
5374
|
+
const builtinToolResultStep = z19.object({
|
|
5375
|
+
type: z19.enum(BUILTIN_TOOL_RESULT_STEP_TYPES),
|
|
5376
|
+
call_id: z19.string(),
|
|
5377
|
+
result: z19.unknown().nullish(),
|
|
5378
|
+
is_error: z19.boolean().nullish(),
|
|
5379
|
+
name: z19.string().nullish(),
|
|
5380
|
+
server_name: z19.string().nullish(),
|
|
5381
|
+
signature: z19.string().nullish()
|
|
5410
5382
|
}).loose();
|
|
5411
|
-
return
|
|
5383
|
+
return z19.union([
|
|
5412
5384
|
userInputStep,
|
|
5413
5385
|
modelOutputStep,
|
|
5414
5386
|
functionCallStep,
|
|
5415
5387
|
thoughtStep,
|
|
5416
5388
|
builtinToolCallStep,
|
|
5417
5389
|
builtinToolResultStep,
|
|
5418
|
-
|
|
5390
|
+
z19.object({ type: z19.string() }).loose()
|
|
5419
5391
|
]);
|
|
5420
5392
|
};
|
|
5421
|
-
var googleInteractionsResponseSchema =
|
|
5422
|
-
() =>
|
|
5423
|
-
|
|
5393
|
+
var googleInteractionsResponseSchema = lazySchema17(
|
|
5394
|
+
() => zodSchema17(
|
|
5395
|
+
z19.object({
|
|
5424
5396
|
/*
|
|
5425
5397
|
* `id` is omitted from the response body when `store: false` (fully
|
|
5426
5398
|
* stateless mode) — there is no server-side interaction record for the
|
|
5427
5399
|
* client to reference. `nullish` lets the schema accept that shape.
|
|
5428
5400
|
*/
|
|
5429
|
-
id:
|
|
5430
|
-
created:
|
|
5431
|
-
updated:
|
|
5401
|
+
id: z19.string().nullish(),
|
|
5402
|
+
created: z19.string().nullish(),
|
|
5403
|
+
updated: z19.string().nullish(),
|
|
5432
5404
|
status: interactionStatusSchema(),
|
|
5433
|
-
model:
|
|
5434
|
-
agent:
|
|
5435
|
-
steps:
|
|
5405
|
+
model: z19.string().nullish(),
|
|
5406
|
+
agent: z19.string().nullish(),
|
|
5407
|
+
steps: z19.array(stepSchema()).nullish(),
|
|
5436
5408
|
usage: usageSchema2().nullish(),
|
|
5437
|
-
service_tier:
|
|
5438
|
-
previous_interaction_id:
|
|
5439
|
-
response_modalities:
|
|
5409
|
+
service_tier: z19.string().nullish(),
|
|
5410
|
+
previous_interaction_id: z19.string().nullish(),
|
|
5411
|
+
response_modalities: z19.array(z19.string()).nullish()
|
|
5440
5412
|
}).loose()
|
|
5441
5413
|
)
|
|
5442
5414
|
);
|
|
5443
|
-
var googleInteractionsEventSchema =
|
|
5444
|
-
() =>
|
|
5415
|
+
var googleInteractionsEventSchema = lazySchema17(
|
|
5416
|
+
() => zodSchema17(
|
|
5445
5417
|
(() => {
|
|
5446
5418
|
const status = interactionStatusSchema();
|
|
5447
5419
|
const annotation = annotationSchema();
|
|
5448
5420
|
const thoughtSummaryItem = thoughtSummaryItemSchema();
|
|
5449
|
-
const interactionCreatedEvent =
|
|
5450
|
-
event_type:
|
|
5451
|
-
event_id:
|
|
5452
|
-
interaction:
|
|
5421
|
+
const interactionCreatedEvent = z19.object({
|
|
5422
|
+
event_type: z19.literal("interaction.created"),
|
|
5423
|
+
event_id: z19.string().nullish(),
|
|
5424
|
+
interaction: z19.object({
|
|
5453
5425
|
/*
|
|
5454
5426
|
* `id` is omitted when `store: false` (fully stateless mode);
|
|
5455
5427
|
* see the matching note on `googleInteractionsResponseSchema.id`.
|
|
5456
5428
|
*/
|
|
5457
|
-
id:
|
|
5458
|
-
created:
|
|
5459
|
-
model:
|
|
5460
|
-
agent:
|
|
5429
|
+
id: z19.string().nullish(),
|
|
5430
|
+
created: z19.string().nullish(),
|
|
5431
|
+
model: z19.string().nullish(),
|
|
5432
|
+
agent: z19.string().nullish(),
|
|
5461
5433
|
status: status.nullish()
|
|
5462
5434
|
}).loose()
|
|
5463
5435
|
}).loose();
|
|
5464
|
-
const stepStartEvent =
|
|
5465
|
-
event_type:
|
|
5466
|
-
event_id:
|
|
5467
|
-
index:
|
|
5436
|
+
const stepStartEvent = z19.object({
|
|
5437
|
+
event_type: z19.literal("step.start"),
|
|
5438
|
+
event_id: z19.string().nullish(),
|
|
5439
|
+
index: z19.number(),
|
|
5468
5440
|
step: stepSchema()
|
|
5469
5441
|
}).loose();
|
|
5470
|
-
const stepDeltaText =
|
|
5471
|
-
type:
|
|
5472
|
-
text:
|
|
5442
|
+
const stepDeltaText = z19.object({
|
|
5443
|
+
type: z19.literal("text"),
|
|
5444
|
+
text: z19.string()
|
|
5473
5445
|
}).loose();
|
|
5474
|
-
const stepDeltaThoughtSummary =
|
|
5475
|
-
type:
|
|
5446
|
+
const stepDeltaThoughtSummary = z19.object({
|
|
5447
|
+
type: z19.literal("thought_summary"),
|
|
5476
5448
|
content: thoughtSummaryItem.nullish()
|
|
5477
5449
|
}).loose();
|
|
5478
|
-
const stepDeltaThoughtSignature =
|
|
5479
|
-
type:
|
|
5480
|
-
signature:
|
|
5450
|
+
const stepDeltaThoughtSignature = z19.object({
|
|
5451
|
+
type: z19.literal("thought_signature"),
|
|
5452
|
+
signature: z19.string().nullish()
|
|
5481
5453
|
}).loose();
|
|
5482
|
-
const stepDeltaArgumentsDelta =
|
|
5483
|
-
type:
|
|
5484
|
-
arguments:
|
|
5485
|
-
id:
|
|
5486
|
-
signature:
|
|
5454
|
+
const stepDeltaArgumentsDelta = z19.object({
|
|
5455
|
+
type: z19.literal("arguments_delta"),
|
|
5456
|
+
arguments: z19.string().nullish(),
|
|
5457
|
+
id: z19.string().nullish(),
|
|
5458
|
+
signature: z19.string().nullish()
|
|
5487
5459
|
}).loose();
|
|
5488
|
-
const stepDeltaTextAnnotation =
|
|
5489
|
-
type:
|
|
5490
|
-
annotations:
|
|
5460
|
+
const stepDeltaTextAnnotation = z19.object({
|
|
5461
|
+
type: z19.enum(["text_annotation_delta", "text_annotation"]),
|
|
5462
|
+
annotations: z19.array(annotation).nullish()
|
|
5491
5463
|
}).loose();
|
|
5492
|
-
const stepDeltaImage =
|
|
5493
|
-
type:
|
|
5494
|
-
data:
|
|
5495
|
-
mime_type:
|
|
5496
|
-
resolution:
|
|
5497
|
-
uri:
|
|
5464
|
+
const stepDeltaImage = z19.object({
|
|
5465
|
+
type: z19.literal("image"),
|
|
5466
|
+
data: z19.string().nullish(),
|
|
5467
|
+
mime_type: z19.string().nullish(),
|
|
5468
|
+
resolution: z19.enum(["low", "medium", "high", "ultra_high"]).nullish(),
|
|
5469
|
+
uri: z19.string().nullish()
|
|
5498
5470
|
}).loose();
|
|
5499
|
-
const stepDeltaVideo =
|
|
5500
|
-
type:
|
|
5501
|
-
data:
|
|
5502
|
-
mime_type:
|
|
5503
|
-
uri:
|
|
5471
|
+
const stepDeltaVideo = z19.object({
|
|
5472
|
+
type: z19.literal("video"),
|
|
5473
|
+
data: z19.string().nullish(),
|
|
5474
|
+
mime_type: z19.string().nullish(),
|
|
5475
|
+
uri: z19.string().nullish()
|
|
5504
5476
|
}).loose();
|
|
5505
|
-
const stepDeltaBuiltinToolCall =
|
|
5506
|
-
type:
|
|
5507
|
-
id:
|
|
5508
|
-
arguments:
|
|
5509
|
-
name:
|
|
5510
|
-
server_name:
|
|
5511
|
-
search_type:
|
|
5512
|
-
signature:
|
|
5477
|
+
const stepDeltaBuiltinToolCall = z19.object({
|
|
5478
|
+
type: z19.enum(BUILTIN_TOOL_CALL_STEP_TYPES),
|
|
5479
|
+
id: z19.string().nullish(),
|
|
5480
|
+
arguments: z19.record(z19.string(), z19.unknown()).nullish(),
|
|
5481
|
+
name: z19.string().nullish(),
|
|
5482
|
+
server_name: z19.string().nullish(),
|
|
5483
|
+
search_type: z19.string().nullish(),
|
|
5484
|
+
signature: z19.string().nullish()
|
|
5513
5485
|
}).loose();
|
|
5514
|
-
const stepDeltaBuiltinToolResult =
|
|
5515
|
-
type:
|
|
5516
|
-
call_id:
|
|
5517
|
-
result:
|
|
5518
|
-
is_error:
|
|
5519
|
-
name:
|
|
5520
|
-
server_name:
|
|
5521
|
-
signature:
|
|
5486
|
+
const stepDeltaBuiltinToolResult = z19.object({
|
|
5487
|
+
type: z19.enum(BUILTIN_TOOL_RESULT_STEP_TYPES),
|
|
5488
|
+
call_id: z19.string().nullish(),
|
|
5489
|
+
result: z19.unknown().nullish(),
|
|
5490
|
+
is_error: z19.boolean().nullish(),
|
|
5491
|
+
name: z19.string().nullish(),
|
|
5492
|
+
server_name: z19.string().nullish(),
|
|
5493
|
+
signature: z19.string().nullish()
|
|
5522
5494
|
}).loose();
|
|
5523
|
-
const stepDeltaUnknown =
|
|
5524
|
-
const stepDeltaUnion =
|
|
5495
|
+
const stepDeltaUnknown = z19.object({ type: z19.string() }).loose();
|
|
5496
|
+
const stepDeltaUnion = z19.union([
|
|
5525
5497
|
stepDeltaText,
|
|
5526
5498
|
stepDeltaImage,
|
|
5527
5499
|
stepDeltaVideo,
|
|
@@ -5533,55 +5505,55 @@ var googleInteractionsEventSchema = lazySchema18(
|
|
|
5533
5505
|
stepDeltaBuiltinToolResult,
|
|
5534
5506
|
stepDeltaUnknown
|
|
5535
5507
|
]);
|
|
5536
|
-
const stepDeltaEvent =
|
|
5537
|
-
event_type:
|
|
5538
|
-
event_id:
|
|
5539
|
-
index:
|
|
5508
|
+
const stepDeltaEvent = z19.object({
|
|
5509
|
+
event_type: z19.literal("step.delta"),
|
|
5510
|
+
event_id: z19.string().nullish(),
|
|
5511
|
+
index: z19.number(),
|
|
5540
5512
|
delta: stepDeltaUnion
|
|
5541
5513
|
}).loose();
|
|
5542
|
-
const stepStopEvent =
|
|
5543
|
-
event_type:
|
|
5544
|
-
event_id:
|
|
5545
|
-
index:
|
|
5514
|
+
const stepStopEvent = z19.object({
|
|
5515
|
+
event_type: z19.literal("step.stop"),
|
|
5516
|
+
event_id: z19.string().nullish(),
|
|
5517
|
+
index: z19.number()
|
|
5546
5518
|
}).loose();
|
|
5547
|
-
const interactionStatusUpdateEvent =
|
|
5548
|
-
event_type:
|
|
5549
|
-
event_id:
|
|
5550
|
-
interaction_id:
|
|
5519
|
+
const interactionStatusUpdateEvent = z19.object({
|
|
5520
|
+
event_type: z19.literal("interaction.status_update"),
|
|
5521
|
+
event_id: z19.string().nullish(),
|
|
5522
|
+
interaction_id: z19.string().nullish(),
|
|
5551
5523
|
status: status.nullish()
|
|
5552
5524
|
}).loose();
|
|
5553
|
-
const interactionInProgressEvent =
|
|
5554
|
-
event_type:
|
|
5555
|
-
event_id:
|
|
5556
|
-
interaction_id:
|
|
5525
|
+
const interactionInProgressEvent = z19.object({
|
|
5526
|
+
event_type: z19.literal("interaction.in_progress"),
|
|
5527
|
+
event_id: z19.string().nullish(),
|
|
5528
|
+
interaction_id: z19.string().nullish(),
|
|
5557
5529
|
status: status.nullish()
|
|
5558
5530
|
}).loose();
|
|
5559
|
-
const interactionRequiresActionEvent =
|
|
5560
|
-
event_type:
|
|
5561
|
-
event_id:
|
|
5562
|
-
interaction_id:
|
|
5531
|
+
const interactionRequiresActionEvent = z19.object({
|
|
5532
|
+
event_type: z19.literal("interaction.requires_action"),
|
|
5533
|
+
event_id: z19.string().nullish(),
|
|
5534
|
+
interaction_id: z19.string().nullish(),
|
|
5563
5535
|
status: status.nullish()
|
|
5564
5536
|
}).loose();
|
|
5565
|
-
const interactionCompletedEvent =
|
|
5566
|
-
event_type:
|
|
5567
|
-
event_id:
|
|
5568
|
-
interaction:
|
|
5569
|
-
id:
|
|
5537
|
+
const interactionCompletedEvent = z19.object({
|
|
5538
|
+
event_type: z19.literal("interaction.completed"),
|
|
5539
|
+
event_id: z19.string().nullish(),
|
|
5540
|
+
interaction: z19.object({
|
|
5541
|
+
id: z19.string().nullish(),
|
|
5570
5542
|
status: status.nullish(),
|
|
5571
5543
|
usage: usageSchema2().nullish(),
|
|
5572
|
-
service_tier:
|
|
5544
|
+
service_tier: z19.string().nullish()
|
|
5573
5545
|
}).loose()
|
|
5574
5546
|
}).loose();
|
|
5575
|
-
const errorEvent =
|
|
5576
|
-
event_type:
|
|
5577
|
-
event_id:
|
|
5578
|
-
error:
|
|
5579
|
-
code:
|
|
5580
|
-
message:
|
|
5547
|
+
const errorEvent = z19.object({
|
|
5548
|
+
event_type: z19.literal("error"),
|
|
5549
|
+
event_id: z19.string().nullish(),
|
|
5550
|
+
error: z19.object({
|
|
5551
|
+
code: z19.string().nullish(),
|
|
5552
|
+
message: z19.string().nullish()
|
|
5581
5553
|
}).loose().nullish()
|
|
5582
5554
|
}).loose();
|
|
5583
|
-
const unknownEvent =
|
|
5584
|
-
return
|
|
5555
|
+
const unknownEvent = z19.object({ event_type: z19.string() }).loose();
|
|
5556
|
+
return z19.union([
|
|
5585
5557
|
interactionCreatedEvent,
|
|
5586
5558
|
stepStartEvent,
|
|
5587
5559
|
stepDeltaEvent,
|
|
@@ -5599,29 +5571,29 @@ var googleInteractionsEventSchema = lazySchema18(
|
|
|
5599
5571
|
|
|
5600
5572
|
// src/interactions/google-interactions-language-model-options.ts
|
|
5601
5573
|
import {
|
|
5602
|
-
lazySchema as
|
|
5603
|
-
zodSchema as
|
|
5574
|
+
lazySchema as lazySchema18,
|
|
5575
|
+
zodSchema as zodSchema18
|
|
5604
5576
|
} from "@ai-sdk/provider-utils";
|
|
5605
|
-
import { z as
|
|
5606
|
-
var googleInteractionsLanguageModelOptions =
|
|
5607
|
-
() =>
|
|
5608
|
-
|
|
5609
|
-
previousInteractionId:
|
|
5610
|
-
store:
|
|
5611
|
-
agent:
|
|
5612
|
-
agentConfig:
|
|
5613
|
-
|
|
5614
|
-
type:
|
|
5577
|
+
import { z as z20 } from "zod/v4";
|
|
5578
|
+
var googleInteractionsLanguageModelOptions = lazySchema18(
|
|
5579
|
+
() => zodSchema18(
|
|
5580
|
+
z20.object({
|
|
5581
|
+
previousInteractionId: z20.string().nullish(),
|
|
5582
|
+
store: z20.boolean().nullish(),
|
|
5583
|
+
agent: z20.string().nullish(),
|
|
5584
|
+
agentConfig: z20.union([
|
|
5585
|
+
z20.object({
|
|
5586
|
+
type: z20.literal("dynamic")
|
|
5615
5587
|
}).loose(),
|
|
5616
|
-
|
|
5617
|
-
type:
|
|
5618
|
-
thinkingSummaries:
|
|
5619
|
-
visualization:
|
|
5620
|
-
collaborativePlanning:
|
|
5588
|
+
z20.object({
|
|
5589
|
+
type: z20.literal("deep-research"),
|
|
5590
|
+
thinkingSummaries: z20.enum(["auto", "none"]).nullish(),
|
|
5591
|
+
visualization: z20.enum(["off", "auto"]).nullish(),
|
|
5592
|
+
collaborativePlanning: z20.boolean().nullish()
|
|
5621
5593
|
})
|
|
5622
5594
|
]).nullish(),
|
|
5623
|
-
thinkingLevel:
|
|
5624
|
-
thinkingSummaries:
|
|
5595
|
+
thinkingLevel: z20.enum(["minimal", "low", "medium", "high"]).nullish(),
|
|
5596
|
+
thinkingSummaries: z20.enum(["auto", "none"]).nullish(),
|
|
5625
5597
|
/**
|
|
5626
5598
|
* Output-format entries that map directly to the API's `response_format`
|
|
5627
5599
|
* array. Use this to request image, audio, or non-JSON text outputs
|
|
@@ -5631,17 +5603,17 @@ var googleInteractionsLanguageModelOptions = lazySchema19(
|
|
|
5631
5603
|
* type: 'json', schema }` still drives JSON-mode and adds a matching
|
|
5632
5604
|
* text entry automatically; entries listed here are appended.
|
|
5633
5605
|
*/
|
|
5634
|
-
responseFormat:
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
type:
|
|
5638
|
-
mimeType:
|
|
5639
|
-
schema:
|
|
5606
|
+
responseFormat: z20.array(
|
|
5607
|
+
z20.union([
|
|
5608
|
+
z20.object({
|
|
5609
|
+
type: z20.literal("text"),
|
|
5610
|
+
mimeType: z20.string().nullish(),
|
|
5611
|
+
schema: z20.unknown().nullish()
|
|
5640
5612
|
}).loose(),
|
|
5641
|
-
|
|
5642
|
-
type:
|
|
5643
|
-
mimeType:
|
|
5644
|
-
aspectRatio:
|
|
5613
|
+
z20.object({
|
|
5614
|
+
type: z20.literal("image"),
|
|
5615
|
+
mimeType: z20.string().nullish(),
|
|
5616
|
+
aspectRatio: z20.enum([
|
|
5645
5617
|
"1:1",
|
|
5646
5618
|
"2:3",
|
|
5647
5619
|
"3:2",
|
|
@@ -5657,11 +5629,11 @@ var googleInteractionsLanguageModelOptions = lazySchema19(
|
|
|
5657
5629
|
"1:4",
|
|
5658
5630
|
"4:1"
|
|
5659
5631
|
]).nullish(),
|
|
5660
|
-
imageSize:
|
|
5632
|
+
imageSize: z20.enum(["1K", "2K", "4K", "512"]).nullish()
|
|
5661
5633
|
}).loose(),
|
|
5662
|
-
|
|
5663
|
-
type:
|
|
5664
|
-
mimeType:
|
|
5634
|
+
z20.object({
|
|
5635
|
+
type: z20.literal("audio"),
|
|
5636
|
+
mimeType: z20.string().nullish()
|
|
5665
5637
|
}).loose()
|
|
5666
5638
|
])
|
|
5667
5639
|
).nullish(),
|
|
@@ -5671,8 +5643,8 @@ var googleInteractionsLanguageModelOptions = lazySchema19(
|
|
|
5671
5643
|
* translates it into a matching `response_format` image entry and
|
|
5672
5644
|
* emits a warning when set.
|
|
5673
5645
|
*/
|
|
5674
|
-
imageConfig:
|
|
5675
|
-
aspectRatio:
|
|
5646
|
+
imageConfig: z20.object({
|
|
5647
|
+
aspectRatio: z20.enum([
|
|
5676
5648
|
"1:1",
|
|
5677
5649
|
"2:3",
|
|
5678
5650
|
"3:2",
|
|
@@ -5688,35 +5660,35 @@ var googleInteractionsLanguageModelOptions = lazySchema19(
|
|
|
5688
5660
|
"1:4",
|
|
5689
5661
|
"4:1"
|
|
5690
5662
|
]).nullish(),
|
|
5691
|
-
imageSize:
|
|
5663
|
+
imageSize: z20.enum(["1K", "2K", "4K", "512"]).nullish()
|
|
5692
5664
|
}).nullish(),
|
|
5693
|
-
mediaResolution:
|
|
5694
|
-
responseModalities:
|
|
5695
|
-
serviceTier:
|
|
5665
|
+
mediaResolution: z20.enum(["low", "medium", "high", "ultra_high"]).nullish(),
|
|
5666
|
+
responseModalities: z20.array(z20.enum(["text", "image", "audio", "video", "document"])).nullish(),
|
|
5667
|
+
serviceTier: z20.enum(["flex", "standard", "priority"]).nullish(),
|
|
5696
5668
|
/**
|
|
5697
5669
|
* Alternative to AI SDK `system` message. If both are set, the AI SDK
|
|
5698
5670
|
* `system` message wins and a warning is emitted.
|
|
5699
5671
|
*/
|
|
5700
|
-
systemInstruction:
|
|
5672
|
+
systemInstruction: z20.string().nullish(),
|
|
5701
5673
|
/**
|
|
5702
5674
|
* Per-block signature for round-tripping `thought.signature` and
|
|
5703
5675
|
* `function_call.signature` blocks. Set by the SDK on output reasoning /
|
|
5704
5676
|
* tool-call parts; passed back unchanged on input parts so the API
|
|
5705
5677
|
* accepts the prior turn.
|
|
5706
5678
|
*/
|
|
5707
|
-
signature:
|
|
5679
|
+
signature: z20.string().nullish(),
|
|
5708
5680
|
/**
|
|
5709
5681
|
* Set by the SDK on output assistant messages. The converter uses it to
|
|
5710
5682
|
* decide which messages to drop when compacting under
|
|
5711
5683
|
* `previousInteractionId`.
|
|
5712
5684
|
*/
|
|
5713
|
-
interactionId:
|
|
5685
|
+
interactionId: z20.string().nullish(),
|
|
5714
5686
|
/**
|
|
5715
5687
|
* Maximum time, in milliseconds, to poll a background interaction (agent
|
|
5716
5688
|
* call) before giving up. Defaults to 30 minutes. Long-running agents
|
|
5717
5689
|
* such as deep research can take tens of minutes — increase if needed.
|
|
5718
5690
|
*/
|
|
5719
|
-
pollingTimeoutMs:
|
|
5691
|
+
pollingTimeoutMs: z20.number().int().positive().nullish(),
|
|
5720
5692
|
/**
|
|
5721
5693
|
* Run the interaction in the background. Required for agents whose
|
|
5722
5694
|
* server-side workflow cannot complete within a single request/response.
|
|
@@ -5725,7 +5697,7 @@ var googleInteractionsLanguageModelOptions = lazySchema19(
|
|
|
5725
5697
|
* reject `true`; see the agent's documentation for which mode it
|
|
5726
5698
|
* requires.
|
|
5727
5699
|
*/
|
|
5728
|
-
background:
|
|
5700
|
+
background: z20.boolean().nullish(),
|
|
5729
5701
|
/**
|
|
5730
5702
|
* Environment configuration for the agent sandbox. Only applies to agent
|
|
5731
5703
|
* calls (`google.interactions({ agent })`); ignored on model-id calls.
|
|
@@ -5735,36 +5707,36 @@ var googleInteractionsLanguageModelOptions = lazySchema19(
|
|
|
5735
5707
|
* - object: provision a fresh sandbox and optionally preload `sources`
|
|
5736
5708
|
* and/or constrain outbound traffic via `network`.
|
|
5737
5709
|
*/
|
|
5738
|
-
environment:
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
type:
|
|
5742
|
-
sources:
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
type:
|
|
5746
|
-
source:
|
|
5747
|
-
target:
|
|
5710
|
+
environment: z20.union([
|
|
5711
|
+
z20.string(),
|
|
5712
|
+
z20.object({
|
|
5713
|
+
type: z20.literal("remote"),
|
|
5714
|
+
sources: z20.array(
|
|
5715
|
+
z20.union([
|
|
5716
|
+
z20.object({
|
|
5717
|
+
type: z20.literal("gcs"),
|
|
5718
|
+
source: z20.string(),
|
|
5719
|
+
target: z20.string().nullish()
|
|
5748
5720
|
}),
|
|
5749
|
-
|
|
5750
|
-
type:
|
|
5751
|
-
source:
|
|
5752
|
-
target:
|
|
5721
|
+
z20.object({
|
|
5722
|
+
type: z20.literal("repository"),
|
|
5723
|
+
source: z20.string(),
|
|
5724
|
+
target: z20.string().nullish()
|
|
5753
5725
|
}),
|
|
5754
|
-
|
|
5755
|
-
type:
|
|
5756
|
-
content:
|
|
5757
|
-
target:
|
|
5726
|
+
z20.object({
|
|
5727
|
+
type: z20.literal("inline"),
|
|
5728
|
+
content: z20.string(),
|
|
5729
|
+
target: z20.string()
|
|
5758
5730
|
})
|
|
5759
5731
|
])
|
|
5760
5732
|
).nullish(),
|
|
5761
|
-
network:
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
allowlist:
|
|
5765
|
-
|
|
5766
|
-
domain:
|
|
5767
|
-
transform:
|
|
5733
|
+
network: z20.union([
|
|
5734
|
+
z20.literal("disabled"),
|
|
5735
|
+
z20.object({
|
|
5736
|
+
allowlist: z20.array(
|
|
5737
|
+
z20.object({
|
|
5738
|
+
domain: z20.string(),
|
|
5739
|
+
transform: z20.array(z20.record(z20.string(), z20.string())).nullish()
|
|
5768
5740
|
})
|
|
5769
5741
|
)
|
|
5770
5742
|
})
|
|
@@ -5954,7 +5926,7 @@ function parseGoogleInteractionsOutputs({
|
|
|
5954
5926
|
|
|
5955
5927
|
// src/interactions/poll-google-interactions.ts
|
|
5956
5928
|
import {
|
|
5957
|
-
createJsonResponseHandler as
|
|
5929
|
+
createJsonResponseHandler as createJsonResponseHandler6,
|
|
5958
5930
|
delay as delay2,
|
|
5959
5931
|
getFromApi as getFromApi3,
|
|
5960
5932
|
isAbortError
|
|
@@ -5962,7 +5934,7 @@ import {
|
|
|
5962
5934
|
|
|
5963
5935
|
// src/interactions/cancel-google-interaction.ts
|
|
5964
5936
|
import {
|
|
5965
|
-
combineHeaders as
|
|
5937
|
+
combineHeaders as combineHeaders6,
|
|
5966
5938
|
getRuntimeEnvironmentUserAgent,
|
|
5967
5939
|
withUserAgentSuffix
|
|
5968
5940
|
} from "@ai-sdk/provider-utils";
|
|
@@ -5981,7 +5953,7 @@ async function cancelGoogleInteraction({
|
|
|
5981
5953
|
const response = await fetch2(url, {
|
|
5982
5954
|
method: "POST",
|
|
5983
5955
|
headers: withUserAgentSuffix(
|
|
5984
|
-
|
|
5956
|
+
combineHeaders6({ "Content-Type": "application/json" }, headers),
|
|
5985
5957
|
getRuntimeEnvironmentUserAgent()
|
|
5986
5958
|
),
|
|
5987
5959
|
body: "{}"
|
|
@@ -6042,7 +6014,7 @@ async function pollGoogleInteractionUntilTerminal({
|
|
|
6042
6014
|
validateUrl: false,
|
|
6043
6015
|
headers,
|
|
6044
6016
|
failedResponseHandler: googleFailedResponseHandler,
|
|
6045
|
-
successfulResponseHandler:
|
|
6017
|
+
successfulResponseHandler: createJsonResponseHandler6(
|
|
6046
6018
|
googleInteractionsResponseSchema
|
|
6047
6019
|
),
|
|
6048
6020
|
abortSignal,
|
|
@@ -6818,16 +6790,16 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
6818
6790
|
var _a, _b, _c, _d, _e, _f;
|
|
6819
6791
|
const { args, warnings, isAgent, pollingTimeoutMs } = await this.getArgs(options);
|
|
6820
6792
|
const url = `${this.config.baseURL}/interactions`;
|
|
6821
|
-
const mergedHeaders =
|
|
6822
|
-
this.config.headers ? await
|
|
6793
|
+
const mergedHeaders = combineHeaders7(
|
|
6794
|
+
this.config.headers ? await resolve5(this.config.headers) : void 0,
|
|
6823
6795
|
options.headers
|
|
6824
6796
|
);
|
|
6825
|
-
const postResult = await
|
|
6797
|
+
const postResult = await postJsonToApi5({
|
|
6826
6798
|
url,
|
|
6827
6799
|
headers: mergedHeaders,
|
|
6828
6800
|
body: args,
|
|
6829
6801
|
failedResponseHandler: googleFailedResponseHandler,
|
|
6830
|
-
successfulResponseHandler:
|
|
6802
|
+
successfulResponseHandler: createJsonResponseHandler7(
|
|
6831
6803
|
googleInteractionsResponseSchema
|
|
6832
6804
|
),
|
|
6833
6805
|
abortSignal: options.abortSignal,
|
|
@@ -6902,8 +6874,8 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
6902
6874
|
var _a;
|
|
6903
6875
|
const { args, warnings, isBackground, pollingTimeoutMs } = await this.getArgs(options);
|
|
6904
6876
|
const url = `${this.config.baseURL}/interactions`;
|
|
6905
|
-
const mergedHeaders =
|
|
6906
|
-
this.config.headers ? await
|
|
6877
|
+
const mergedHeaders = combineHeaders7(
|
|
6878
|
+
this.config.headers ? await resolve5(this.config.headers) : void 0,
|
|
6907
6879
|
options.headers
|
|
6908
6880
|
);
|
|
6909
6881
|
if (isBackground) {
|
|
@@ -6917,7 +6889,7 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
6917
6889
|
});
|
|
6918
6890
|
}
|
|
6919
6891
|
const body = { ...args, stream: true };
|
|
6920
|
-
const { responseHeaders, value: response } = await
|
|
6892
|
+
const { responseHeaders, value: response } = await postJsonToApi5({
|
|
6921
6893
|
url,
|
|
6922
6894
|
headers: mergedHeaders,
|
|
6923
6895
|
body,
|
|
@@ -6968,12 +6940,12 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
6968
6940
|
pollingTimeoutMs
|
|
6969
6941
|
}) {
|
|
6970
6942
|
var _a, _b;
|
|
6971
|
-
const postResult = await
|
|
6943
|
+
const postResult = await postJsonToApi5({
|
|
6972
6944
|
url,
|
|
6973
6945
|
headers: mergedHeaders,
|
|
6974
6946
|
body: args,
|
|
6975
6947
|
failedResponseHandler: googleFailedResponseHandler,
|
|
6976
|
-
successfulResponseHandler:
|
|
6948
|
+
successfulResponseHandler: createJsonResponseHandler7(
|
|
6977
6949
|
googleInteractionsResponseSchema
|
|
6978
6950
|
),
|
|
6979
6951
|
abortSignal: options.abortSignal,
|
|
@@ -7460,7 +7432,7 @@ import {
|
|
|
7460
7432
|
} from "@ai-sdk/provider";
|
|
7461
7433
|
import {
|
|
7462
7434
|
connectToWebSocket,
|
|
7463
|
-
combineHeaders as
|
|
7435
|
+
combineHeaders as combineHeaders8,
|
|
7464
7436
|
convertBase64ToUint8Array as convertBase64ToUint8Array2,
|
|
7465
7437
|
convertToBase64 as convertToBase644,
|
|
7466
7438
|
parseProviderOptions as parseProviderOptions8,
|
|
@@ -7473,18 +7445,18 @@ import {
|
|
|
7473
7445
|
|
|
7474
7446
|
// src/speech-translation/google-speech-translation-model-options.ts
|
|
7475
7447
|
import {
|
|
7476
|
-
lazySchema as
|
|
7477
|
-
zodSchema as
|
|
7448
|
+
lazySchema as lazySchema19,
|
|
7449
|
+
zodSchema as zodSchema19
|
|
7478
7450
|
} from "@ai-sdk/provider-utils";
|
|
7479
|
-
import { z as
|
|
7480
|
-
var googleSpeechTranslationModelOptions =
|
|
7481
|
-
() =>
|
|
7482
|
-
|
|
7451
|
+
import { z as z21 } from "zod/v4";
|
|
7452
|
+
var googleSpeechTranslationModelOptions = lazySchema19(
|
|
7453
|
+
() => zodSchema19(
|
|
7454
|
+
z21.object({
|
|
7483
7455
|
/**
|
|
7484
7456
|
* Whether input audio already in the target language should be echoed
|
|
7485
7457
|
* instead of producing silence.
|
|
7486
7458
|
*/
|
|
7487
|
-
echoTargetLanguage:
|
|
7459
|
+
echoTargetLanguage: z21.boolean().optional()
|
|
7488
7460
|
})
|
|
7489
7461
|
)
|
|
7490
7462
|
);
|
|
@@ -7547,7 +7519,7 @@ var GoogleSpeechTranslationModel = class _GoogleSpeechTranslationModel {
|
|
|
7547
7519
|
details: "The Gemini Live API always outputs 24kHz 16-bit PCM audio and does not accept an output audio format."
|
|
7548
7520
|
});
|
|
7549
7521
|
}
|
|
7550
|
-
const headers =
|
|
7522
|
+
const headers = combineHeaders8(this.config.headers(), options.headers);
|
|
7551
7523
|
let apiKey;
|
|
7552
7524
|
for (const [key, value] of Object.entries(headers)) {
|
|
7553
7525
|
if (key.toLowerCase() === "x-goog-api-key" && value != null) {
|
|
@@ -7610,8 +7582,8 @@ function createGoogleLiveSpeechTranslationStream({
|
|
|
7610
7582
|
let audioReader;
|
|
7611
7583
|
let connection;
|
|
7612
7584
|
let resolveSetupComplete;
|
|
7613
|
-
const setupComplete = new Promise((
|
|
7614
|
-
resolveSetupComplete =
|
|
7585
|
+
const setupComplete = new Promise((resolve6) => {
|
|
7586
|
+
resolveSetupComplete = resolve6;
|
|
7615
7587
|
});
|
|
7616
7588
|
let turnCounter = 0;
|
|
7617
7589
|
let sourceText = "";
|