@ai-sdk/google 4.0.48 → 4.0.50
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 +13 -0
- package/dist/index.d.ts +18 -18
- package/dist/index.js +427 -544
- package/dist/index.js.map +1 -1
- package/docs/15-google.mdx +4 -57
- package/package.json +2 -2
- 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.50" : "0.0.0-test";
|
|
11
11
|
|
|
12
12
|
// src/google-embedding-model.ts
|
|
13
13
|
import {
|
|
@@ -1232,13 +1232,13 @@ function isKnownPreGemini2Model(modelId) {
|
|
|
1232
1232
|
return gemini1ModelPattern.test(modelId) || /(^|\/)gemini-pro(?:-vision)?$/i.test(modelId) || /(^|\/)gemini-robotics-er-1\.5(?:[.-]|$)/i.test(modelId);
|
|
1233
1233
|
}
|
|
1234
1234
|
function getGoogleModelCapabilities(modelId) {
|
|
1235
|
-
const
|
|
1235
|
+
const isGeminiModel = geminiModelPattern.test(modelId);
|
|
1236
1236
|
const isGemini2Model = gemini2ModelPattern.test(modelId);
|
|
1237
1237
|
const isKnownPreGemini2 = isKnownPreGemini2Model(modelId);
|
|
1238
1238
|
const isKnownOlderModel = isKnownPreGemini2 || isGemini2Model;
|
|
1239
|
-
const usesGemini3Features =
|
|
1239
|
+
const usesGemini3Features = isGeminiModel && !isKnownOlderModel;
|
|
1240
1240
|
return {
|
|
1241
|
-
supportsGemini2Tools:
|
|
1241
|
+
supportsGemini2Tools: isGeminiModel && !isKnownPreGemini2 || modelId.toLowerCase().includes("nano-banana"),
|
|
1242
1242
|
supportsFileSearch: gemini25ModelPattern.test(modelId) || usesGemini3Features,
|
|
1243
1243
|
usesGemini3Features
|
|
1244
1244
|
};
|
|
@@ -3106,32 +3106,20 @@ var googleTools = {
|
|
|
3106
3106
|
|
|
3107
3107
|
// src/google-image-model.ts
|
|
3108
3108
|
import {
|
|
3109
|
-
combineHeaders as combineHeaders3,
|
|
3110
3109
|
convertToBase64 as convertToBase642,
|
|
3111
|
-
createJsonResponseHandler as createJsonResponseHandler3,
|
|
3112
3110
|
generateId as defaultGenerateId,
|
|
3113
|
-
lazySchema as lazySchema13,
|
|
3114
3111
|
parseProviderOptions as parseProviderOptions3,
|
|
3115
|
-
postJsonToApi as postJsonToApi3,
|
|
3116
|
-
resolve as resolve3,
|
|
3117
3112
|
serializeModelOptions as serializeModelOptions3,
|
|
3118
3113
|
WORKFLOW_SERIALIZE as WORKFLOW_SERIALIZE3,
|
|
3119
|
-
WORKFLOW_DESERIALIZE as WORKFLOW_DESERIALIZE3
|
|
3120
|
-
zodSchema as zodSchema13
|
|
3114
|
+
WORKFLOW_DESERIALIZE as WORKFLOW_DESERIALIZE3
|
|
3121
3115
|
} from "@ai-sdk/provider-utils";
|
|
3122
|
-
import { z as z14 } from "zod/v4";
|
|
3123
3116
|
|
|
3124
3117
|
// src/google-image-model-options.ts
|
|
3125
|
-
import {
|
|
3126
|
-
lazySchema as lazySchema12,
|
|
3127
|
-
zodSchema as zodSchema12
|
|
3128
|
-
} from "@ai-sdk/provider-utils";
|
|
3118
|
+
import { lazySchema as lazySchema12, zodSchema as zodSchema12 } from "@ai-sdk/provider-utils";
|
|
3129
3119
|
import { z as z13 } from "zod/v4";
|
|
3130
3120
|
var googleImageModelOptionsSchema = lazySchema12(
|
|
3131
3121
|
() => zodSchema12(
|
|
3132
3122
|
z13.object({
|
|
3133
|
-
personGeneration: z13.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
|
|
3134
|
-
aspectRatio: z13.enum(["1:1", "3:4", "4:3", "9:16", "16:9"]).nullish(),
|
|
3135
3123
|
/**
|
|
3136
3124
|
* Enable Google Search grounding for Gemini image models. The value is
|
|
3137
3125
|
* forwarded as the args of the `google.tools.googleSearch` provider
|
|
@@ -3167,121 +3155,18 @@ var GoogleImageModel = class _GoogleImageModel {
|
|
|
3167
3155
|
if (this.settings.maxImagesPerCall != null) {
|
|
3168
3156
|
return this.settings.maxImagesPerCall;
|
|
3169
3157
|
}
|
|
3170
|
-
|
|
3171
|
-
return 10;
|
|
3172
|
-
}
|
|
3173
|
-
return 4;
|
|
3158
|
+
return 10;
|
|
3174
3159
|
}
|
|
3175
3160
|
get provider() {
|
|
3176
3161
|
return this.config.provider;
|
|
3177
3162
|
}
|
|
3178
3163
|
async doGenerate(options) {
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
}
|
|
3182
|
-
return this.doGenerateImagen(options);
|
|
3183
|
-
}
|
|
3184
|
-
async doGenerateImagen(options) {
|
|
3185
|
-
var _a, _b, _c;
|
|
3186
|
-
const {
|
|
3187
|
-
prompt,
|
|
3188
|
-
n = 1,
|
|
3189
|
-
size,
|
|
3190
|
-
aspectRatio = "1:1",
|
|
3191
|
-
seed,
|
|
3192
|
-
providerOptions,
|
|
3193
|
-
headers,
|
|
3194
|
-
abortSignal,
|
|
3195
|
-
files,
|
|
3196
|
-
mask
|
|
3197
|
-
} = options;
|
|
3198
|
-
const warnings = [];
|
|
3199
|
-
if (files != null && files.length > 0) {
|
|
3200
|
-
throw new Error(
|
|
3201
|
-
"Google Gemini API does not support image editing with Imagen models. Use Google Vertex AI (@ai-sdk/google-vertex) for image editing capabilities."
|
|
3202
|
-
);
|
|
3203
|
-
}
|
|
3204
|
-
if (mask != null) {
|
|
3164
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
3165
|
+
if (!this.modelId.startsWith("gemini-")) {
|
|
3205
3166
|
throw new Error(
|
|
3206
|
-
"Google
|
|
3167
|
+
"Google image models other than Gemini are no longer supported. Use a model ID that starts with `gemini-`."
|
|
3207
3168
|
);
|
|
3208
3169
|
}
|
|
3209
|
-
if (size != null) {
|
|
3210
|
-
warnings.push({
|
|
3211
|
-
type: "unsupported",
|
|
3212
|
-
feature: "size",
|
|
3213
|
-
details: "This model does not support the `size` option. Use `aspectRatio` instead."
|
|
3214
|
-
});
|
|
3215
|
-
}
|
|
3216
|
-
if (seed != null) {
|
|
3217
|
-
warnings.push({
|
|
3218
|
-
type: "unsupported",
|
|
3219
|
-
feature: "seed",
|
|
3220
|
-
details: "This model does not support the `seed` option through this provider."
|
|
3221
|
-
});
|
|
3222
|
-
}
|
|
3223
|
-
const googleOptions = await parseProviderOptions3({
|
|
3224
|
-
provider: "google",
|
|
3225
|
-
providerOptions,
|
|
3226
|
-
schema: googleImageModelOptionsSchema
|
|
3227
|
-
});
|
|
3228
|
-
const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
|
|
3229
|
-
const parameters = {
|
|
3230
|
-
sampleCount: n
|
|
3231
|
-
};
|
|
3232
|
-
if (aspectRatio != null) {
|
|
3233
|
-
parameters.aspectRatio = aspectRatio;
|
|
3234
|
-
}
|
|
3235
|
-
if (googleOptions) {
|
|
3236
|
-
const { googleSearch: imagenGoogleSearch, ...imagenOptions } = googleOptions;
|
|
3237
|
-
if (imagenGoogleSearch != null) {
|
|
3238
|
-
warnings.push({
|
|
3239
|
-
type: "unsupported",
|
|
3240
|
-
feature: "googleSearch",
|
|
3241
|
-
details: "Google Search grounding is only supported on Gemini image models."
|
|
3242
|
-
});
|
|
3243
|
-
}
|
|
3244
|
-
Object.assign(parameters, imagenOptions);
|
|
3245
|
-
}
|
|
3246
|
-
const body = {
|
|
3247
|
-
instances: [{ prompt }],
|
|
3248
|
-
parameters
|
|
3249
|
-
};
|
|
3250
|
-
const { responseHeaders, value: response } = await postJsonToApi3({
|
|
3251
|
-
url: `${this.config.baseURL}/models/${this.modelId}:predict`,
|
|
3252
|
-
headers: combineHeaders3(
|
|
3253
|
-
this.config.headers ? await resolve3(this.config.headers) : void 0,
|
|
3254
|
-
headers
|
|
3255
|
-
),
|
|
3256
|
-
body,
|
|
3257
|
-
failedResponseHandler: googleFailedResponseHandler,
|
|
3258
|
-
successfulResponseHandler: createJsonResponseHandler3(
|
|
3259
|
-
googleImageResponseSchema
|
|
3260
|
-
),
|
|
3261
|
-
abortSignal,
|
|
3262
|
-
fetch: this.config.fetch
|
|
3263
|
-
});
|
|
3264
|
-
return {
|
|
3265
|
-
images: response.predictions.map(
|
|
3266
|
-
(p) => p.bytesBase64Encoded
|
|
3267
|
-
),
|
|
3268
|
-
warnings,
|
|
3269
|
-
providerMetadata: {
|
|
3270
|
-
google: {
|
|
3271
|
-
images: response.predictions.map(() => ({
|
|
3272
|
-
// Add any prediction-specific metadata here
|
|
3273
|
-
}))
|
|
3274
|
-
}
|
|
3275
|
-
},
|
|
3276
|
-
response: {
|
|
3277
|
-
timestamp: currentDate,
|
|
3278
|
-
modelId: this.modelId,
|
|
3279
|
-
headers: responseHeaders
|
|
3280
|
-
}
|
|
3281
|
-
};
|
|
3282
|
-
}
|
|
3283
|
-
async doGenerateGemini(options) {
|
|
3284
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
3285
3170
|
const {
|
|
3286
3171
|
prompt,
|
|
3287
3172
|
n,
|
|
@@ -3344,7 +3229,12 @@ var GoogleImageModel = class _GoogleImageModel {
|
|
|
3344
3229
|
providerOptions,
|
|
3345
3230
|
schema: googleImageModelOptionsSchema
|
|
3346
3231
|
});
|
|
3347
|
-
const {
|
|
3232
|
+
const {
|
|
3233
|
+
googleSearch: _strippedGoogleSearch,
|
|
3234
|
+
responseModalities: _strippedResponseModalities,
|
|
3235
|
+
imageConfig: userImageConfig,
|
|
3236
|
+
...passthroughGoogleOptions
|
|
3237
|
+
} = (_a = providerOptions == null ? void 0 : providerOptions.google) != null ? _a : {};
|
|
3348
3238
|
const languageModel = new GoogleLanguageModel(this.modelId, {
|
|
3349
3239
|
provider: this.config.provider,
|
|
3350
3240
|
baseURL: this.config.baseURL,
|
|
@@ -3357,11 +3247,14 @@ var GoogleImageModel = class _GoogleImageModel {
|
|
|
3357
3247
|
seed,
|
|
3358
3248
|
providerOptions: {
|
|
3359
3249
|
google: {
|
|
3250
|
+
...passthroughGoogleOptions,
|
|
3360
3251
|
responseModalities: ["IMAGE"],
|
|
3361
|
-
imageConfig: aspectRatio ? {
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3252
|
+
imageConfig: aspectRatio != null || userImageConfig != null ? {
|
|
3253
|
+
...userImageConfig,
|
|
3254
|
+
...aspectRatio != null ? {
|
|
3255
|
+
aspectRatio
|
|
3256
|
+
} : {}
|
|
3257
|
+
} : void 0
|
|
3365
3258
|
}
|
|
3366
3259
|
},
|
|
3367
3260
|
tools: (googleImageOptions == null ? void 0 : googleImageOptions.googleSearch) != null ? [
|
|
@@ -3405,32 +3298,22 @@ var GoogleImageModel = class _GoogleImageModel {
|
|
|
3405
3298
|
};
|
|
3406
3299
|
}
|
|
3407
3300
|
};
|
|
3408
|
-
function isGeminiModel(modelId) {
|
|
3409
|
-
return modelId.startsWith("gemini-");
|
|
3410
|
-
}
|
|
3411
|
-
var googleImageResponseSchema = lazySchema13(
|
|
3412
|
-
() => zodSchema13(
|
|
3413
|
-
z14.object({
|
|
3414
|
-
predictions: z14.array(z14.object({ bytesBase64Encoded: z14.string() })).default([])
|
|
3415
|
-
})
|
|
3416
|
-
)
|
|
3417
|
-
);
|
|
3418
3301
|
|
|
3419
3302
|
// src/google-files.ts
|
|
3420
3303
|
import {
|
|
3421
3304
|
AISDKError
|
|
3422
3305
|
} from "@ai-sdk/provider";
|
|
3423
3306
|
import {
|
|
3424
|
-
combineHeaders as
|
|
3307
|
+
combineHeaders as combineHeaders3,
|
|
3425
3308
|
convertInlineFileDataToUint8Array,
|
|
3426
|
-
createJsonResponseHandler as
|
|
3309
|
+
createJsonResponseHandler as createJsonResponseHandler3,
|
|
3427
3310
|
delay,
|
|
3428
|
-
lazySchema as
|
|
3311
|
+
lazySchema as lazySchema13,
|
|
3429
3312
|
parseProviderOptions as parseProviderOptions4,
|
|
3430
|
-
zodSchema as
|
|
3313
|
+
zodSchema as zodSchema13,
|
|
3431
3314
|
getFromApi
|
|
3432
3315
|
} from "@ai-sdk/provider-utils";
|
|
3433
|
-
import { z as
|
|
3316
|
+
import { z as z14 } from "zod/v4";
|
|
3434
3317
|
var GoogleFiles = class {
|
|
3435
3318
|
constructor(config) {
|
|
3436
3319
|
this.config = config;
|
|
@@ -3517,8 +3400,8 @@ var GoogleFiles = class {
|
|
|
3517
3400
|
const { value: fileStatus } = await getFromApi({
|
|
3518
3401
|
url: `${this.config.baseURL}/${file.name}`,
|
|
3519
3402
|
validateUrl: false,
|
|
3520
|
-
headers:
|
|
3521
|
-
successfulResponseHandler:
|
|
3403
|
+
headers: combineHeaders3(resolvedHeaders),
|
|
3404
|
+
successfulResponseHandler: createJsonResponseHandler3(
|
|
3522
3405
|
googleFileResponseSchema
|
|
3523
3406
|
),
|
|
3524
3407
|
failedResponseHandler: googleFailedResponseHandler,
|
|
@@ -3553,28 +3436,28 @@ var GoogleFiles = class {
|
|
|
3553
3436
|
};
|
|
3554
3437
|
}
|
|
3555
3438
|
};
|
|
3556
|
-
var googleFileResponseSchema =
|
|
3557
|
-
() =>
|
|
3558
|
-
|
|
3559
|
-
name:
|
|
3560
|
-
displayName:
|
|
3561
|
-
mimeType:
|
|
3562
|
-
sizeBytes:
|
|
3563
|
-
createTime:
|
|
3564
|
-
updateTime:
|
|
3565
|
-
expirationTime:
|
|
3566
|
-
sha256Hash:
|
|
3567
|
-
uri:
|
|
3568
|
-
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()
|
|
3569
3452
|
})
|
|
3570
3453
|
)
|
|
3571
3454
|
);
|
|
3572
|
-
var googleFilesUploadOptionsSchema =
|
|
3573
|
-
() =>
|
|
3574
|
-
|
|
3575
|
-
displayName:
|
|
3576
|
-
pollIntervalMs:
|
|
3577
|
-
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()
|
|
3578
3461
|
})
|
|
3579
3462
|
)
|
|
3580
3463
|
);
|
|
@@ -3584,31 +3467,31 @@ import {
|
|
|
3584
3467
|
AISDKError as AISDKError2
|
|
3585
3468
|
} from "@ai-sdk/provider";
|
|
3586
3469
|
import {
|
|
3587
|
-
combineHeaders as
|
|
3470
|
+
combineHeaders as combineHeaders4,
|
|
3588
3471
|
convertUint8ArrayToBase64,
|
|
3589
|
-
createJsonResponseHandler as
|
|
3472
|
+
createJsonResponseHandler as createJsonResponseHandler4,
|
|
3590
3473
|
getFromApi as getFromApi2,
|
|
3591
3474
|
isSameOrigin,
|
|
3592
3475
|
parseProviderOptions as parseProviderOptions5,
|
|
3593
|
-
postJsonToApi as
|
|
3594
|
-
resolve as
|
|
3476
|
+
postJsonToApi as postJsonToApi3,
|
|
3477
|
+
resolve as resolve3
|
|
3595
3478
|
} from "@ai-sdk/provider-utils";
|
|
3596
|
-
import { z as
|
|
3479
|
+
import { z as z16 } from "zod/v4";
|
|
3597
3480
|
|
|
3598
3481
|
// src/google-video-model-options.ts
|
|
3599
|
-
import { lazySchema as
|
|
3600
|
-
import { z as
|
|
3601
|
-
var googleVideoModelOptionsSchema =
|
|
3602
|
-
() =>
|
|
3603
|
-
|
|
3604
|
-
pollIntervalMs:
|
|
3605
|
-
pollTimeoutMs:
|
|
3606
|
-
personGeneration:
|
|
3607
|
-
negativePrompt:
|
|
3608
|
-
referenceImages:
|
|
3609
|
-
|
|
3610
|
-
bytesBase64Encoded:
|
|
3611
|
-
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()
|
|
3612
3495
|
})
|
|
3613
3496
|
).nullish()
|
|
3614
3497
|
})
|
|
@@ -3782,7 +3665,7 @@ var GoogleVideoModel = class {
|
|
|
3782
3665
|
}
|
|
3783
3666
|
const videos = [];
|
|
3784
3667
|
const videoMetadata = [];
|
|
3785
|
-
const resolvedHeaders = await
|
|
3668
|
+
const resolvedHeaders = await resolve3(this.config.headers);
|
|
3786
3669
|
const apiKey = resolvedHeaders == null ? void 0 : resolvedHeaders["x-goog-api-key"];
|
|
3787
3670
|
for (const generatedSample of response.generateVideoResponse.generatedSamples) {
|
|
3788
3671
|
if ((_b = generatedSample.video) == null ? void 0 : _b.uri) {
|
|
@@ -3823,17 +3706,17 @@ var GoogleVideoModel = class {
|
|
|
3823
3706
|
var _a, _b, _c;
|
|
3824
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();
|
|
3825
3708
|
const { instances, parameters, warnings } = await this.buildRequest(options);
|
|
3826
|
-
const { value: operation, responseHeaders } = await
|
|
3709
|
+
const { value: operation, responseHeaders } = await postJsonToApi3({
|
|
3827
3710
|
url: `${this.config.baseURL}/models/${this.modelId}:predictLongRunning`,
|
|
3828
|
-
headers:
|
|
3829
|
-
await
|
|
3711
|
+
headers: combineHeaders4(
|
|
3712
|
+
await resolve3(this.config.headers),
|
|
3830
3713
|
options.headers
|
|
3831
3714
|
),
|
|
3832
3715
|
body: {
|
|
3833
3716
|
instances,
|
|
3834
3717
|
parameters
|
|
3835
3718
|
},
|
|
3836
|
-
successfulResponseHandler:
|
|
3719
|
+
successfulResponseHandler: createJsonResponseHandler4(
|
|
3837
3720
|
googleOperationSchema
|
|
3838
3721
|
),
|
|
3839
3722
|
failedResponseHandler: googleFailedResponseHandler,
|
|
@@ -3864,11 +3747,11 @@ var GoogleVideoModel = class {
|
|
|
3864
3747
|
const { value: statusOperation, responseHeaders } = await getFromApi2({
|
|
3865
3748
|
url: `${this.config.baseURL}/${operationName}`,
|
|
3866
3749
|
validateUrl: false,
|
|
3867
|
-
headers:
|
|
3868
|
-
await
|
|
3750
|
+
headers: combineHeaders4(
|
|
3751
|
+
await resolve3(this.config.headers),
|
|
3869
3752
|
options.headers
|
|
3870
3753
|
),
|
|
3871
|
-
successfulResponseHandler:
|
|
3754
|
+
successfulResponseHandler: createJsonResponseHandler4(
|
|
3872
3755
|
googleOperationSchema
|
|
3873
3756
|
),
|
|
3874
3757
|
failedResponseHandler: googleFailedResponseHandler,
|
|
@@ -3904,20 +3787,20 @@ var GoogleVideoModel = class {
|
|
|
3904
3787
|
);
|
|
3905
3788
|
}
|
|
3906
3789
|
};
|
|
3907
|
-
var googleOperationSchema =
|
|
3908
|
-
name:
|
|
3909
|
-
done:
|
|
3910
|
-
error:
|
|
3911
|
-
code:
|
|
3912
|
-
message:
|
|
3913
|
-
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()
|
|
3914
3797
|
}).nullish(),
|
|
3915
|
-
response:
|
|
3916
|
-
generateVideoResponse:
|
|
3917
|
-
generatedSamples:
|
|
3918
|
-
|
|
3919
|
-
video:
|
|
3920
|
-
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()
|
|
3921
3804
|
}).nullish()
|
|
3922
3805
|
})
|
|
3923
3806
|
).nullish()
|
|
@@ -3927,31 +3810,31 @@ var googleOperationSchema = z17.object({
|
|
|
3927
3810
|
|
|
3928
3811
|
// src/google-speech-model.ts
|
|
3929
3812
|
import {
|
|
3930
|
-
combineHeaders as
|
|
3813
|
+
combineHeaders as combineHeaders5,
|
|
3931
3814
|
convertBase64ToUint8Array,
|
|
3932
|
-
createJsonResponseHandler as
|
|
3815
|
+
createJsonResponseHandler as createJsonResponseHandler5,
|
|
3933
3816
|
parseProviderOptions as parseProviderOptions6,
|
|
3934
|
-
postJsonToApi as
|
|
3935
|
-
resolve as
|
|
3817
|
+
postJsonToApi as postJsonToApi4,
|
|
3818
|
+
resolve as resolve4,
|
|
3936
3819
|
serializeModelOptions as serializeModelOptions4,
|
|
3937
3820
|
WORKFLOW_DESERIALIZE as WORKFLOW_DESERIALIZE4,
|
|
3938
3821
|
WORKFLOW_SERIALIZE as WORKFLOW_SERIALIZE4
|
|
3939
3822
|
} from "@ai-sdk/provider-utils";
|
|
3940
3823
|
|
|
3941
3824
|
// src/google-speech-api.ts
|
|
3942
|
-
import { lazySchema as
|
|
3943
|
-
import { z as
|
|
3944
|
-
var googleSpeechResponseSchema =
|
|
3945
|
-
() =>
|
|
3946
|
-
|
|
3947
|
-
candidates:
|
|
3948
|
-
|
|
3949
|
-
content:
|
|
3950
|
-
parts:
|
|
3951
|
-
|
|
3952
|
-
inlineData:
|
|
3953
|
-
mimeType:
|
|
3954
|
-
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()
|
|
3955
3838
|
}).nullish()
|
|
3956
3839
|
})
|
|
3957
3840
|
).nullish()
|
|
@@ -3964,19 +3847,19 @@ var googleSpeechResponseSchema = lazySchema16(
|
|
|
3964
3847
|
|
|
3965
3848
|
// src/google-speech-model-options.ts
|
|
3966
3849
|
import {
|
|
3967
|
-
lazySchema as
|
|
3968
|
-
zodSchema as
|
|
3850
|
+
lazySchema as lazySchema16,
|
|
3851
|
+
zodSchema as zodSchema16
|
|
3969
3852
|
} from "@ai-sdk/provider-utils";
|
|
3970
|
-
import { z as
|
|
3971
|
-
var prebuiltVoiceConfigSchema =
|
|
3972
|
-
voiceName:
|
|
3853
|
+
import { z as z18 } from "zod/v4";
|
|
3854
|
+
var prebuiltVoiceConfigSchema = z18.object({
|
|
3855
|
+
voiceName: z18.string()
|
|
3973
3856
|
});
|
|
3974
|
-
var voiceConfigSchema =
|
|
3857
|
+
var voiceConfigSchema = z18.object({
|
|
3975
3858
|
prebuiltVoiceConfig: prebuiltVoiceConfigSchema
|
|
3976
3859
|
});
|
|
3977
|
-
var googleSpeechProviderOptionsSchema =
|
|
3978
|
-
() =>
|
|
3979
|
-
|
|
3860
|
+
var googleSpeechProviderOptionsSchema = lazySchema16(
|
|
3861
|
+
() => zodSchema16(
|
|
3862
|
+
z18.object({
|
|
3980
3863
|
/**
|
|
3981
3864
|
* Multi-speaker configuration for dialogue audio. When provided, this
|
|
3982
3865
|
* overrides the top-level `voice`. The Gemini TTS API supports up to two
|
|
@@ -3984,10 +3867,10 @@ var googleSpeechProviderOptionsSchema = lazySchema17(
|
|
|
3984
3867
|
*
|
|
3985
3868
|
* https://ai.google.dev/gemini-api/docs/speech-generation#multi-speaker
|
|
3986
3869
|
*/
|
|
3987
|
-
multiSpeakerVoiceConfig:
|
|
3988
|
-
speakerVoiceConfigs:
|
|
3989
|
-
|
|
3990
|
-
speaker:
|
|
3870
|
+
multiSpeakerVoiceConfig: z18.object({
|
|
3871
|
+
speakerVoiceConfigs: z18.array(
|
|
3872
|
+
z18.object({
|
|
3873
|
+
speaker: z18.string(),
|
|
3991
3874
|
voiceConfig: voiceConfigSchema
|
|
3992
3875
|
})
|
|
3993
3876
|
)
|
|
@@ -4101,15 +3984,15 @@ var GoogleSpeechModel = class _GoogleSpeechModel {
|
|
|
4101
3984
|
value: response,
|
|
4102
3985
|
responseHeaders,
|
|
4103
3986
|
rawValue: rawResponse
|
|
4104
|
-
} = await
|
|
3987
|
+
} = await postJsonToApi4({
|
|
4105
3988
|
url: `${this.config.baseURL}/models/${this.modelId}:generateContent`,
|
|
4106
|
-
headers:
|
|
4107
|
-
this.config.headers ? await
|
|
3989
|
+
headers: combineHeaders5(
|
|
3990
|
+
this.config.headers ? await resolve4(this.config.headers) : void 0,
|
|
4108
3991
|
options.headers
|
|
4109
3992
|
),
|
|
4110
3993
|
body: requestBody,
|
|
4111
3994
|
failedResponseHandler: googleFailedResponseHandler,
|
|
4112
|
-
successfulResponseHandler:
|
|
3995
|
+
successfulResponseHandler: createJsonResponseHandler5(
|
|
4113
3996
|
googleSpeechResponseSchema
|
|
4114
3997
|
),
|
|
4115
3998
|
abortSignal: options.abortSignal,
|
|
@@ -4200,13 +4083,13 @@ function writeAscii(view, offset, text) {
|
|
|
4200
4083
|
|
|
4201
4084
|
// src/interactions/google-interactions-language-model.ts
|
|
4202
4085
|
import {
|
|
4203
|
-
combineHeaders as
|
|
4086
|
+
combineHeaders as combineHeaders7,
|
|
4204
4087
|
createEventSourceResponseHandler as createEventSourceResponseHandler3,
|
|
4205
|
-
createJsonResponseHandler as
|
|
4088
|
+
createJsonResponseHandler as createJsonResponseHandler7,
|
|
4206
4089
|
generateId as defaultGenerateId2,
|
|
4207
4090
|
parseProviderOptions as parseProviderOptions7,
|
|
4208
|
-
postJsonToApi as
|
|
4209
|
-
resolve as
|
|
4091
|
+
postJsonToApi as postJsonToApi5,
|
|
4092
|
+
resolve as resolve5,
|
|
4210
4093
|
serializeModelOptions as serializeModelOptions5,
|
|
4211
4094
|
WORKFLOW_DESERIALIZE as WORKFLOW_DESERIALIZE5,
|
|
4212
4095
|
WORKFLOW_SERIALIZE as WORKFLOW_SERIALIZE5
|
|
@@ -5342,33 +5225,33 @@ ${block.text}`
|
|
|
5342
5225
|
|
|
5343
5226
|
// src/interactions/google-interactions-api.ts
|
|
5344
5227
|
import {
|
|
5345
|
-
lazySchema as
|
|
5346
|
-
zodSchema as
|
|
5228
|
+
lazySchema as lazySchema17,
|
|
5229
|
+
zodSchema as zodSchema17
|
|
5347
5230
|
} from "@ai-sdk/provider-utils";
|
|
5348
|
-
import { z as
|
|
5349
|
-
var tokenByModalitySchema = () =>
|
|
5350
|
-
modality:
|
|
5351
|
-
tokens:
|
|
5231
|
+
import { z as z19 } from "zod/v4";
|
|
5232
|
+
var tokenByModalitySchema = () => z19.object({
|
|
5233
|
+
modality: z19.string().nullish(),
|
|
5234
|
+
tokens: z19.number().nullish()
|
|
5352
5235
|
}).loose();
|
|
5353
|
-
var usageSchema2 = () =>
|
|
5354
|
-
total_input_tokens:
|
|
5355
|
-
total_output_tokens:
|
|
5356
|
-
total_thought_tokens:
|
|
5357
|
-
total_cached_tokens:
|
|
5358
|
-
total_tool_use_tokens:
|
|
5359
|
-
total_tokens:
|
|
5360
|
-
input_tokens_by_modality:
|
|
5361
|
-
output_tokens_by_modality:
|
|
5362
|
-
cached_tokens_by_modality:
|
|
5363
|
-
tool_use_tokens_by_modality:
|
|
5364
|
-
grounding_tool_count:
|
|
5365
|
-
|
|
5366
|
-
type:
|
|
5367
|
-
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()
|
|
5368
5251
|
}).loose()
|
|
5369
5252
|
).nullish()
|
|
5370
5253
|
}).loose();
|
|
5371
|
-
var interactionStatusSchema = () =>
|
|
5254
|
+
var interactionStatusSchema = () => z19.enum([
|
|
5372
5255
|
"in_progress",
|
|
5373
5256
|
"requires_action",
|
|
5374
5257
|
"completed",
|
|
@@ -5377,69 +5260,69 @@ var interactionStatusSchema = () => z20.enum([
|
|
|
5377
5260
|
"incomplete"
|
|
5378
5261
|
]);
|
|
5379
5262
|
var annotationSchema = () => {
|
|
5380
|
-
const urlCitation =
|
|
5381
|
-
type:
|
|
5382
|
-
url:
|
|
5383
|
-
title:
|
|
5384
|
-
start_index:
|
|
5385
|
-
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()
|
|
5386
5269
|
}).loose();
|
|
5387
|
-
const fileCitation =
|
|
5388
|
-
type:
|
|
5389
|
-
file_name:
|
|
5390
|
-
document_uri:
|
|
5391
|
-
url:
|
|
5392
|
-
page_number:
|
|
5393
|
-
media_id:
|
|
5394
|
-
start_index:
|
|
5395
|
-
end_index:
|
|
5396
|
-
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()
|
|
5397
5280
|
}).loose();
|
|
5398
|
-
const placeCitation =
|
|
5399
|
-
type:
|
|
5400
|
-
name:
|
|
5401
|
-
url:
|
|
5402
|
-
place_id:
|
|
5403
|
-
start_index:
|
|
5404
|
-
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()
|
|
5405
5288
|
}).loose();
|
|
5406
|
-
return
|
|
5289
|
+
return z19.union([
|
|
5407
5290
|
urlCitation,
|
|
5408
5291
|
fileCitation,
|
|
5409
5292
|
placeCitation,
|
|
5410
|
-
|
|
5293
|
+
z19.object({ type: z19.string() }).loose()
|
|
5411
5294
|
]);
|
|
5412
5295
|
};
|
|
5413
|
-
var thoughtSummaryItemSchema = () =>
|
|
5414
|
-
type:
|
|
5415
|
-
text:
|
|
5416
|
-
data:
|
|
5417
|
-
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()
|
|
5418
5301
|
}).loose();
|
|
5419
5302
|
var contentBlockSchema = () => {
|
|
5420
|
-
const textContent =
|
|
5421
|
-
type:
|
|
5422
|
-
text:
|
|
5423
|
-
annotations:
|
|
5303
|
+
const textContent = z19.object({
|
|
5304
|
+
type: z19.literal("text"),
|
|
5305
|
+
text: z19.string(),
|
|
5306
|
+
annotations: z19.array(annotationSchema()).nullish()
|
|
5424
5307
|
}).loose();
|
|
5425
|
-
const imageContent =
|
|
5426
|
-
type:
|
|
5427
|
-
data:
|
|
5428
|
-
mime_type:
|
|
5429
|
-
resolution:
|
|
5430
|
-
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()
|
|
5431
5314
|
}).loose();
|
|
5432
|
-
const videoContent =
|
|
5433
|
-
type:
|
|
5434
|
-
data:
|
|
5435
|
-
mime_type:
|
|
5436
|
-
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()
|
|
5437
5320
|
}).loose();
|
|
5438
|
-
return
|
|
5321
|
+
return z19.union([
|
|
5439
5322
|
textContent,
|
|
5440
5323
|
imageContent,
|
|
5441
5324
|
videoContent,
|
|
5442
|
-
|
|
5325
|
+
z19.object({ type: z19.string() }).loose()
|
|
5443
5326
|
]);
|
|
5444
5327
|
};
|
|
5445
5328
|
var BUILTIN_TOOL_CALL_STEP_TYPES = [
|
|
@@ -5459,158 +5342,158 @@ var BUILTIN_TOOL_RESULT_STEP_TYPES = [
|
|
|
5459
5342
|
"mcp_server_tool_result"
|
|
5460
5343
|
];
|
|
5461
5344
|
var stepSchema = () => {
|
|
5462
|
-
const userInputStep =
|
|
5463
|
-
type:
|
|
5464
|
-
content:
|
|
5345
|
+
const userInputStep = z19.object({
|
|
5346
|
+
type: z19.literal("user_input"),
|
|
5347
|
+
content: z19.array(contentBlockSchema()).nullish()
|
|
5465
5348
|
}).loose();
|
|
5466
|
-
const modelOutputStep =
|
|
5467
|
-
type:
|
|
5468
|
-
content:
|
|
5349
|
+
const modelOutputStep = z19.object({
|
|
5350
|
+
type: z19.literal("model_output"),
|
|
5351
|
+
content: z19.array(contentBlockSchema()).nullish()
|
|
5469
5352
|
}).loose();
|
|
5470
|
-
const functionCallStep =
|
|
5471
|
-
type:
|
|
5472
|
-
id:
|
|
5473
|
-
name:
|
|
5474
|
-
arguments:
|
|
5475
|
-
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()
|
|
5476
5359
|
}).loose();
|
|
5477
|
-
const thoughtStep =
|
|
5478
|
-
type:
|
|
5479
|
-
signature:
|
|
5480
|
-
summary:
|
|
5360
|
+
const thoughtStep = z19.object({
|
|
5361
|
+
type: z19.literal("thought"),
|
|
5362
|
+
signature: z19.string().nullish(),
|
|
5363
|
+
summary: z19.array(thoughtSummaryItemSchema()).nullish()
|
|
5481
5364
|
}).loose();
|
|
5482
|
-
const builtinToolCallStep =
|
|
5483
|
-
type:
|
|
5484
|
-
id:
|
|
5485
|
-
arguments:
|
|
5486
|
-
name:
|
|
5487
|
-
server_name:
|
|
5488
|
-
search_type:
|
|
5489
|
-
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()
|
|
5490
5373
|
}).loose();
|
|
5491
|
-
const builtinToolResultStep =
|
|
5492
|
-
type:
|
|
5493
|
-
call_id:
|
|
5494
|
-
result:
|
|
5495
|
-
is_error:
|
|
5496
|
-
name:
|
|
5497
|
-
server_name:
|
|
5498
|
-
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()
|
|
5499
5382
|
}).loose();
|
|
5500
|
-
return
|
|
5383
|
+
return z19.union([
|
|
5501
5384
|
userInputStep,
|
|
5502
5385
|
modelOutputStep,
|
|
5503
5386
|
functionCallStep,
|
|
5504
5387
|
thoughtStep,
|
|
5505
5388
|
builtinToolCallStep,
|
|
5506
5389
|
builtinToolResultStep,
|
|
5507
|
-
|
|
5390
|
+
z19.object({ type: z19.string() }).loose()
|
|
5508
5391
|
]);
|
|
5509
5392
|
};
|
|
5510
|
-
var googleInteractionsResponseSchema =
|
|
5511
|
-
() =>
|
|
5512
|
-
|
|
5393
|
+
var googleInteractionsResponseSchema = lazySchema17(
|
|
5394
|
+
() => zodSchema17(
|
|
5395
|
+
z19.object({
|
|
5513
5396
|
/*
|
|
5514
5397
|
* `id` is omitted from the response body when `store: false` (fully
|
|
5515
5398
|
* stateless mode) — there is no server-side interaction record for the
|
|
5516
5399
|
* client to reference. `nullish` lets the schema accept that shape.
|
|
5517
5400
|
*/
|
|
5518
|
-
id:
|
|
5519
|
-
created:
|
|
5520
|
-
updated:
|
|
5401
|
+
id: z19.string().nullish(),
|
|
5402
|
+
created: z19.string().nullish(),
|
|
5403
|
+
updated: z19.string().nullish(),
|
|
5521
5404
|
status: interactionStatusSchema(),
|
|
5522
|
-
model:
|
|
5523
|
-
agent:
|
|
5524
|
-
steps:
|
|
5405
|
+
model: z19.string().nullish(),
|
|
5406
|
+
agent: z19.string().nullish(),
|
|
5407
|
+
steps: z19.array(stepSchema()).nullish(),
|
|
5525
5408
|
usage: usageSchema2().nullish(),
|
|
5526
|
-
service_tier:
|
|
5527
|
-
previous_interaction_id:
|
|
5528
|
-
response_modalities:
|
|
5409
|
+
service_tier: z19.string().nullish(),
|
|
5410
|
+
previous_interaction_id: z19.string().nullish(),
|
|
5411
|
+
response_modalities: z19.array(z19.string()).nullish()
|
|
5529
5412
|
}).loose()
|
|
5530
5413
|
)
|
|
5531
5414
|
);
|
|
5532
|
-
var googleInteractionsEventSchema =
|
|
5533
|
-
() =>
|
|
5415
|
+
var googleInteractionsEventSchema = lazySchema17(
|
|
5416
|
+
() => zodSchema17(
|
|
5534
5417
|
(() => {
|
|
5535
5418
|
const status = interactionStatusSchema();
|
|
5536
5419
|
const annotation = annotationSchema();
|
|
5537
5420
|
const thoughtSummaryItem = thoughtSummaryItemSchema();
|
|
5538
|
-
const interactionCreatedEvent =
|
|
5539
|
-
event_type:
|
|
5540
|
-
event_id:
|
|
5541
|
-
interaction:
|
|
5421
|
+
const interactionCreatedEvent = z19.object({
|
|
5422
|
+
event_type: z19.literal("interaction.created"),
|
|
5423
|
+
event_id: z19.string().nullish(),
|
|
5424
|
+
interaction: z19.object({
|
|
5542
5425
|
/*
|
|
5543
5426
|
* `id` is omitted when `store: false` (fully stateless mode);
|
|
5544
5427
|
* see the matching note on `googleInteractionsResponseSchema.id`.
|
|
5545
5428
|
*/
|
|
5546
|
-
id:
|
|
5547
|
-
created:
|
|
5548
|
-
model:
|
|
5549
|
-
agent:
|
|
5429
|
+
id: z19.string().nullish(),
|
|
5430
|
+
created: z19.string().nullish(),
|
|
5431
|
+
model: z19.string().nullish(),
|
|
5432
|
+
agent: z19.string().nullish(),
|
|
5550
5433
|
status: status.nullish()
|
|
5551
5434
|
}).loose()
|
|
5552
5435
|
}).loose();
|
|
5553
|
-
const stepStartEvent =
|
|
5554
|
-
event_type:
|
|
5555
|
-
event_id:
|
|
5556
|
-
index:
|
|
5436
|
+
const stepStartEvent = z19.object({
|
|
5437
|
+
event_type: z19.literal("step.start"),
|
|
5438
|
+
event_id: z19.string().nullish(),
|
|
5439
|
+
index: z19.number(),
|
|
5557
5440
|
step: stepSchema()
|
|
5558
5441
|
}).loose();
|
|
5559
|
-
const stepDeltaText =
|
|
5560
|
-
type:
|
|
5561
|
-
text:
|
|
5442
|
+
const stepDeltaText = z19.object({
|
|
5443
|
+
type: z19.literal("text"),
|
|
5444
|
+
text: z19.string()
|
|
5562
5445
|
}).loose();
|
|
5563
|
-
const stepDeltaThoughtSummary =
|
|
5564
|
-
type:
|
|
5446
|
+
const stepDeltaThoughtSummary = z19.object({
|
|
5447
|
+
type: z19.literal("thought_summary"),
|
|
5565
5448
|
content: thoughtSummaryItem.nullish()
|
|
5566
5449
|
}).loose();
|
|
5567
|
-
const stepDeltaThoughtSignature =
|
|
5568
|
-
type:
|
|
5569
|
-
signature:
|
|
5450
|
+
const stepDeltaThoughtSignature = z19.object({
|
|
5451
|
+
type: z19.literal("thought_signature"),
|
|
5452
|
+
signature: z19.string().nullish()
|
|
5570
5453
|
}).loose();
|
|
5571
|
-
const stepDeltaArgumentsDelta =
|
|
5572
|
-
type:
|
|
5573
|
-
arguments:
|
|
5574
|
-
id:
|
|
5575
|
-
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()
|
|
5576
5459
|
}).loose();
|
|
5577
|
-
const stepDeltaTextAnnotation =
|
|
5578
|
-
type:
|
|
5579
|
-
annotations:
|
|
5460
|
+
const stepDeltaTextAnnotation = z19.object({
|
|
5461
|
+
type: z19.enum(["text_annotation_delta", "text_annotation"]),
|
|
5462
|
+
annotations: z19.array(annotation).nullish()
|
|
5580
5463
|
}).loose();
|
|
5581
|
-
const stepDeltaImage =
|
|
5582
|
-
type:
|
|
5583
|
-
data:
|
|
5584
|
-
mime_type:
|
|
5585
|
-
resolution:
|
|
5586
|
-
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()
|
|
5587
5470
|
}).loose();
|
|
5588
|
-
const stepDeltaVideo =
|
|
5589
|
-
type:
|
|
5590
|
-
data:
|
|
5591
|
-
mime_type:
|
|
5592
|
-
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()
|
|
5593
5476
|
}).loose();
|
|
5594
|
-
const stepDeltaBuiltinToolCall =
|
|
5595
|
-
type:
|
|
5596
|
-
id:
|
|
5597
|
-
arguments:
|
|
5598
|
-
name:
|
|
5599
|
-
server_name:
|
|
5600
|
-
search_type:
|
|
5601
|
-
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()
|
|
5602
5485
|
}).loose();
|
|
5603
|
-
const stepDeltaBuiltinToolResult =
|
|
5604
|
-
type:
|
|
5605
|
-
call_id:
|
|
5606
|
-
result:
|
|
5607
|
-
is_error:
|
|
5608
|
-
name:
|
|
5609
|
-
server_name:
|
|
5610
|
-
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()
|
|
5611
5494
|
}).loose();
|
|
5612
|
-
const stepDeltaUnknown =
|
|
5613
|
-
const stepDeltaUnion =
|
|
5495
|
+
const stepDeltaUnknown = z19.object({ type: z19.string() }).loose();
|
|
5496
|
+
const stepDeltaUnion = z19.union([
|
|
5614
5497
|
stepDeltaText,
|
|
5615
5498
|
stepDeltaImage,
|
|
5616
5499
|
stepDeltaVideo,
|
|
@@ -5622,55 +5505,55 @@ var googleInteractionsEventSchema = lazySchema18(
|
|
|
5622
5505
|
stepDeltaBuiltinToolResult,
|
|
5623
5506
|
stepDeltaUnknown
|
|
5624
5507
|
]);
|
|
5625
|
-
const stepDeltaEvent =
|
|
5626
|
-
event_type:
|
|
5627
|
-
event_id:
|
|
5628
|
-
index:
|
|
5508
|
+
const stepDeltaEvent = z19.object({
|
|
5509
|
+
event_type: z19.literal("step.delta"),
|
|
5510
|
+
event_id: z19.string().nullish(),
|
|
5511
|
+
index: z19.number(),
|
|
5629
5512
|
delta: stepDeltaUnion
|
|
5630
5513
|
}).loose();
|
|
5631
|
-
const stepStopEvent =
|
|
5632
|
-
event_type:
|
|
5633
|
-
event_id:
|
|
5634
|
-
index:
|
|
5514
|
+
const stepStopEvent = z19.object({
|
|
5515
|
+
event_type: z19.literal("step.stop"),
|
|
5516
|
+
event_id: z19.string().nullish(),
|
|
5517
|
+
index: z19.number()
|
|
5635
5518
|
}).loose();
|
|
5636
|
-
const interactionStatusUpdateEvent =
|
|
5637
|
-
event_type:
|
|
5638
|
-
event_id:
|
|
5639
|
-
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(),
|
|
5640
5523
|
status: status.nullish()
|
|
5641
5524
|
}).loose();
|
|
5642
|
-
const interactionInProgressEvent =
|
|
5643
|
-
event_type:
|
|
5644
|
-
event_id:
|
|
5645
|
-
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(),
|
|
5646
5529
|
status: status.nullish()
|
|
5647
5530
|
}).loose();
|
|
5648
|
-
const interactionRequiresActionEvent =
|
|
5649
|
-
event_type:
|
|
5650
|
-
event_id:
|
|
5651
|
-
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(),
|
|
5652
5535
|
status: status.nullish()
|
|
5653
5536
|
}).loose();
|
|
5654
|
-
const interactionCompletedEvent =
|
|
5655
|
-
event_type:
|
|
5656
|
-
event_id:
|
|
5657
|
-
interaction:
|
|
5658
|
-
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(),
|
|
5659
5542
|
status: status.nullish(),
|
|
5660
5543
|
usage: usageSchema2().nullish(),
|
|
5661
|
-
service_tier:
|
|
5544
|
+
service_tier: z19.string().nullish()
|
|
5662
5545
|
}).loose()
|
|
5663
5546
|
}).loose();
|
|
5664
|
-
const errorEvent =
|
|
5665
|
-
event_type:
|
|
5666
|
-
event_id:
|
|
5667
|
-
error:
|
|
5668
|
-
code:
|
|
5669
|
-
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()
|
|
5670
5553
|
}).loose().nullish()
|
|
5671
5554
|
}).loose();
|
|
5672
|
-
const unknownEvent =
|
|
5673
|
-
return
|
|
5555
|
+
const unknownEvent = z19.object({ event_type: z19.string() }).loose();
|
|
5556
|
+
return z19.union([
|
|
5674
5557
|
interactionCreatedEvent,
|
|
5675
5558
|
stepStartEvent,
|
|
5676
5559
|
stepDeltaEvent,
|
|
@@ -5688,29 +5571,29 @@ var googleInteractionsEventSchema = lazySchema18(
|
|
|
5688
5571
|
|
|
5689
5572
|
// src/interactions/google-interactions-language-model-options.ts
|
|
5690
5573
|
import {
|
|
5691
|
-
lazySchema as
|
|
5692
|
-
zodSchema as
|
|
5574
|
+
lazySchema as lazySchema18,
|
|
5575
|
+
zodSchema as zodSchema18
|
|
5693
5576
|
} from "@ai-sdk/provider-utils";
|
|
5694
|
-
import { z as
|
|
5695
|
-
var googleInteractionsLanguageModelOptions =
|
|
5696
|
-
() =>
|
|
5697
|
-
|
|
5698
|
-
previousInteractionId:
|
|
5699
|
-
store:
|
|
5700
|
-
agent:
|
|
5701
|
-
agentConfig:
|
|
5702
|
-
|
|
5703
|
-
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")
|
|
5704
5587
|
}).loose(),
|
|
5705
|
-
|
|
5706
|
-
type:
|
|
5707
|
-
thinkingSummaries:
|
|
5708
|
-
visualization:
|
|
5709
|
-
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()
|
|
5710
5593
|
})
|
|
5711
5594
|
]).nullish(),
|
|
5712
|
-
thinkingLevel:
|
|
5713
|
-
thinkingSummaries:
|
|
5595
|
+
thinkingLevel: z20.enum(["minimal", "low", "medium", "high"]).nullish(),
|
|
5596
|
+
thinkingSummaries: z20.enum(["auto", "none"]).nullish(),
|
|
5714
5597
|
/**
|
|
5715
5598
|
* Output-format entries that map directly to the API's `response_format`
|
|
5716
5599
|
* array. Use this to request image, audio, or non-JSON text outputs
|
|
@@ -5720,17 +5603,17 @@ var googleInteractionsLanguageModelOptions = lazySchema19(
|
|
|
5720
5603
|
* type: 'json', schema }` still drives JSON-mode and adds a matching
|
|
5721
5604
|
* text entry automatically; entries listed here are appended.
|
|
5722
5605
|
*/
|
|
5723
|
-
responseFormat:
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
type:
|
|
5727
|
-
mimeType:
|
|
5728
|
-
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()
|
|
5729
5612
|
}).loose(),
|
|
5730
|
-
|
|
5731
|
-
type:
|
|
5732
|
-
mimeType:
|
|
5733
|
-
aspectRatio:
|
|
5613
|
+
z20.object({
|
|
5614
|
+
type: z20.literal("image"),
|
|
5615
|
+
mimeType: z20.string().nullish(),
|
|
5616
|
+
aspectRatio: z20.enum([
|
|
5734
5617
|
"1:1",
|
|
5735
5618
|
"2:3",
|
|
5736
5619
|
"3:2",
|
|
@@ -5746,11 +5629,11 @@ var googleInteractionsLanguageModelOptions = lazySchema19(
|
|
|
5746
5629
|
"1:4",
|
|
5747
5630
|
"4:1"
|
|
5748
5631
|
]).nullish(),
|
|
5749
|
-
imageSize:
|
|
5632
|
+
imageSize: z20.enum(["1K", "2K", "4K", "512"]).nullish()
|
|
5750
5633
|
}).loose(),
|
|
5751
|
-
|
|
5752
|
-
type:
|
|
5753
|
-
mimeType:
|
|
5634
|
+
z20.object({
|
|
5635
|
+
type: z20.literal("audio"),
|
|
5636
|
+
mimeType: z20.string().nullish()
|
|
5754
5637
|
}).loose()
|
|
5755
5638
|
])
|
|
5756
5639
|
).nullish(),
|
|
@@ -5760,8 +5643,8 @@ var googleInteractionsLanguageModelOptions = lazySchema19(
|
|
|
5760
5643
|
* translates it into a matching `response_format` image entry and
|
|
5761
5644
|
* emits a warning when set.
|
|
5762
5645
|
*/
|
|
5763
|
-
imageConfig:
|
|
5764
|
-
aspectRatio:
|
|
5646
|
+
imageConfig: z20.object({
|
|
5647
|
+
aspectRatio: z20.enum([
|
|
5765
5648
|
"1:1",
|
|
5766
5649
|
"2:3",
|
|
5767
5650
|
"3:2",
|
|
@@ -5777,35 +5660,35 @@ var googleInteractionsLanguageModelOptions = lazySchema19(
|
|
|
5777
5660
|
"1:4",
|
|
5778
5661
|
"4:1"
|
|
5779
5662
|
]).nullish(),
|
|
5780
|
-
imageSize:
|
|
5663
|
+
imageSize: z20.enum(["1K", "2K", "4K", "512"]).nullish()
|
|
5781
5664
|
}).nullish(),
|
|
5782
|
-
mediaResolution:
|
|
5783
|
-
responseModalities:
|
|
5784
|
-
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(),
|
|
5785
5668
|
/**
|
|
5786
5669
|
* Alternative to AI SDK `system` message. If both are set, the AI SDK
|
|
5787
5670
|
* `system` message wins and a warning is emitted.
|
|
5788
5671
|
*/
|
|
5789
|
-
systemInstruction:
|
|
5672
|
+
systemInstruction: z20.string().nullish(),
|
|
5790
5673
|
/**
|
|
5791
5674
|
* Per-block signature for round-tripping `thought.signature` and
|
|
5792
5675
|
* `function_call.signature` blocks. Set by the SDK on output reasoning /
|
|
5793
5676
|
* tool-call parts; passed back unchanged on input parts so the API
|
|
5794
5677
|
* accepts the prior turn.
|
|
5795
5678
|
*/
|
|
5796
|
-
signature:
|
|
5679
|
+
signature: z20.string().nullish(),
|
|
5797
5680
|
/**
|
|
5798
5681
|
* Set by the SDK on output assistant messages. The converter uses it to
|
|
5799
5682
|
* decide which messages to drop when compacting under
|
|
5800
5683
|
* `previousInteractionId`.
|
|
5801
5684
|
*/
|
|
5802
|
-
interactionId:
|
|
5685
|
+
interactionId: z20.string().nullish(),
|
|
5803
5686
|
/**
|
|
5804
5687
|
* Maximum time, in milliseconds, to poll a background interaction (agent
|
|
5805
5688
|
* call) before giving up. Defaults to 30 minutes. Long-running agents
|
|
5806
5689
|
* such as deep research can take tens of minutes — increase if needed.
|
|
5807
5690
|
*/
|
|
5808
|
-
pollingTimeoutMs:
|
|
5691
|
+
pollingTimeoutMs: z20.number().int().positive().nullish(),
|
|
5809
5692
|
/**
|
|
5810
5693
|
* Run the interaction in the background. Required for agents whose
|
|
5811
5694
|
* server-side workflow cannot complete within a single request/response.
|
|
@@ -5814,7 +5697,7 @@ var googleInteractionsLanguageModelOptions = lazySchema19(
|
|
|
5814
5697
|
* reject `true`; see the agent's documentation for which mode it
|
|
5815
5698
|
* requires.
|
|
5816
5699
|
*/
|
|
5817
|
-
background:
|
|
5700
|
+
background: z20.boolean().nullish(),
|
|
5818
5701
|
/**
|
|
5819
5702
|
* Environment configuration for the agent sandbox. Only applies to agent
|
|
5820
5703
|
* calls (`google.interactions({ agent })`); ignored on model-id calls.
|
|
@@ -5824,36 +5707,36 @@ var googleInteractionsLanguageModelOptions = lazySchema19(
|
|
|
5824
5707
|
* - object: provision a fresh sandbox and optionally preload `sources`
|
|
5825
5708
|
* and/or constrain outbound traffic via `network`.
|
|
5826
5709
|
*/
|
|
5827
|
-
environment:
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
type:
|
|
5831
|
-
sources:
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
type:
|
|
5835
|
-
source:
|
|
5836
|
-
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()
|
|
5837
5720
|
}),
|
|
5838
|
-
|
|
5839
|
-
type:
|
|
5840
|
-
source:
|
|
5841
|
-
target:
|
|
5721
|
+
z20.object({
|
|
5722
|
+
type: z20.literal("repository"),
|
|
5723
|
+
source: z20.string(),
|
|
5724
|
+
target: z20.string().nullish()
|
|
5842
5725
|
}),
|
|
5843
|
-
|
|
5844
|
-
type:
|
|
5845
|
-
content:
|
|
5846
|
-
target:
|
|
5726
|
+
z20.object({
|
|
5727
|
+
type: z20.literal("inline"),
|
|
5728
|
+
content: z20.string(),
|
|
5729
|
+
target: z20.string()
|
|
5847
5730
|
})
|
|
5848
5731
|
])
|
|
5849
5732
|
).nullish(),
|
|
5850
|
-
network:
|
|
5851
|
-
|
|
5852
|
-
|
|
5853
|
-
allowlist:
|
|
5854
|
-
|
|
5855
|
-
domain:
|
|
5856
|
-
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()
|
|
5857
5740
|
})
|
|
5858
5741
|
)
|
|
5859
5742
|
})
|
|
@@ -6043,7 +5926,7 @@ function parseGoogleInteractionsOutputs({
|
|
|
6043
5926
|
|
|
6044
5927
|
// src/interactions/poll-google-interactions.ts
|
|
6045
5928
|
import {
|
|
6046
|
-
createJsonResponseHandler as
|
|
5929
|
+
createJsonResponseHandler as createJsonResponseHandler6,
|
|
6047
5930
|
delay as delay2,
|
|
6048
5931
|
getFromApi as getFromApi3,
|
|
6049
5932
|
isAbortError
|
|
@@ -6051,7 +5934,7 @@ import {
|
|
|
6051
5934
|
|
|
6052
5935
|
// src/interactions/cancel-google-interaction.ts
|
|
6053
5936
|
import {
|
|
6054
|
-
combineHeaders as
|
|
5937
|
+
combineHeaders as combineHeaders6,
|
|
6055
5938
|
getRuntimeEnvironmentUserAgent,
|
|
6056
5939
|
withUserAgentSuffix
|
|
6057
5940
|
} from "@ai-sdk/provider-utils";
|
|
@@ -6070,7 +5953,7 @@ async function cancelGoogleInteraction({
|
|
|
6070
5953
|
const response = await fetch2(url, {
|
|
6071
5954
|
method: "POST",
|
|
6072
5955
|
headers: withUserAgentSuffix(
|
|
6073
|
-
|
|
5956
|
+
combineHeaders6({ "Content-Type": "application/json" }, headers),
|
|
6074
5957
|
getRuntimeEnvironmentUserAgent()
|
|
6075
5958
|
),
|
|
6076
5959
|
body: "{}"
|
|
@@ -6131,7 +6014,7 @@ async function pollGoogleInteractionUntilTerminal({
|
|
|
6131
6014
|
validateUrl: false,
|
|
6132
6015
|
headers,
|
|
6133
6016
|
failedResponseHandler: googleFailedResponseHandler,
|
|
6134
|
-
successfulResponseHandler:
|
|
6017
|
+
successfulResponseHandler: createJsonResponseHandler6(
|
|
6135
6018
|
googleInteractionsResponseSchema
|
|
6136
6019
|
),
|
|
6137
6020
|
abortSignal,
|
|
@@ -6907,16 +6790,16 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
6907
6790
|
var _a, _b, _c, _d, _e, _f;
|
|
6908
6791
|
const { args, warnings, isAgent, pollingTimeoutMs } = await this.getArgs(options);
|
|
6909
6792
|
const url = `${this.config.baseURL}/interactions`;
|
|
6910
|
-
const mergedHeaders =
|
|
6911
|
-
this.config.headers ? await
|
|
6793
|
+
const mergedHeaders = combineHeaders7(
|
|
6794
|
+
this.config.headers ? await resolve5(this.config.headers) : void 0,
|
|
6912
6795
|
options.headers
|
|
6913
6796
|
);
|
|
6914
|
-
const postResult = await
|
|
6797
|
+
const postResult = await postJsonToApi5({
|
|
6915
6798
|
url,
|
|
6916
6799
|
headers: mergedHeaders,
|
|
6917
6800
|
body: args,
|
|
6918
6801
|
failedResponseHandler: googleFailedResponseHandler,
|
|
6919
|
-
successfulResponseHandler:
|
|
6802
|
+
successfulResponseHandler: createJsonResponseHandler7(
|
|
6920
6803
|
googleInteractionsResponseSchema
|
|
6921
6804
|
),
|
|
6922
6805
|
abortSignal: options.abortSignal,
|
|
@@ -6991,8 +6874,8 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
6991
6874
|
var _a;
|
|
6992
6875
|
const { args, warnings, isBackground, pollingTimeoutMs } = await this.getArgs(options);
|
|
6993
6876
|
const url = `${this.config.baseURL}/interactions`;
|
|
6994
|
-
const mergedHeaders =
|
|
6995
|
-
this.config.headers ? await
|
|
6877
|
+
const mergedHeaders = combineHeaders7(
|
|
6878
|
+
this.config.headers ? await resolve5(this.config.headers) : void 0,
|
|
6996
6879
|
options.headers
|
|
6997
6880
|
);
|
|
6998
6881
|
if (isBackground) {
|
|
@@ -7006,7 +6889,7 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
7006
6889
|
});
|
|
7007
6890
|
}
|
|
7008
6891
|
const body = { ...args, stream: true };
|
|
7009
|
-
const { responseHeaders, value: response } = await
|
|
6892
|
+
const { responseHeaders, value: response } = await postJsonToApi5({
|
|
7010
6893
|
url,
|
|
7011
6894
|
headers: mergedHeaders,
|
|
7012
6895
|
body,
|
|
@@ -7057,12 +6940,12 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
7057
6940
|
pollingTimeoutMs
|
|
7058
6941
|
}) {
|
|
7059
6942
|
var _a, _b;
|
|
7060
|
-
const postResult = await
|
|
6943
|
+
const postResult = await postJsonToApi5({
|
|
7061
6944
|
url,
|
|
7062
6945
|
headers: mergedHeaders,
|
|
7063
6946
|
body: args,
|
|
7064
6947
|
failedResponseHandler: googleFailedResponseHandler,
|
|
7065
|
-
successfulResponseHandler:
|
|
6948
|
+
successfulResponseHandler: createJsonResponseHandler7(
|
|
7066
6949
|
googleInteractionsResponseSchema
|
|
7067
6950
|
),
|
|
7068
6951
|
abortSignal: options.abortSignal,
|
|
@@ -7549,7 +7432,7 @@ import {
|
|
|
7549
7432
|
} from "@ai-sdk/provider";
|
|
7550
7433
|
import {
|
|
7551
7434
|
connectToWebSocket,
|
|
7552
|
-
combineHeaders as
|
|
7435
|
+
combineHeaders as combineHeaders8,
|
|
7553
7436
|
convertBase64ToUint8Array as convertBase64ToUint8Array2,
|
|
7554
7437
|
convertToBase64 as convertToBase644,
|
|
7555
7438
|
parseProviderOptions as parseProviderOptions8,
|
|
@@ -7562,18 +7445,18 @@ import {
|
|
|
7562
7445
|
|
|
7563
7446
|
// src/speech-translation/google-speech-translation-model-options.ts
|
|
7564
7447
|
import {
|
|
7565
|
-
lazySchema as
|
|
7566
|
-
zodSchema as
|
|
7448
|
+
lazySchema as lazySchema19,
|
|
7449
|
+
zodSchema as zodSchema19
|
|
7567
7450
|
} from "@ai-sdk/provider-utils";
|
|
7568
|
-
import { z as
|
|
7569
|
-
var googleSpeechTranslationModelOptions =
|
|
7570
|
-
() =>
|
|
7571
|
-
|
|
7451
|
+
import { z as z21 } from "zod/v4";
|
|
7452
|
+
var googleSpeechTranslationModelOptions = lazySchema19(
|
|
7453
|
+
() => zodSchema19(
|
|
7454
|
+
z21.object({
|
|
7572
7455
|
/**
|
|
7573
7456
|
* Whether input audio already in the target language should be echoed
|
|
7574
7457
|
* instead of producing silence.
|
|
7575
7458
|
*/
|
|
7576
|
-
echoTargetLanguage:
|
|
7459
|
+
echoTargetLanguage: z21.boolean().optional()
|
|
7577
7460
|
})
|
|
7578
7461
|
)
|
|
7579
7462
|
);
|
|
@@ -7636,7 +7519,7 @@ var GoogleSpeechTranslationModel = class _GoogleSpeechTranslationModel {
|
|
|
7636
7519
|
details: "The Gemini Live API always outputs 24kHz 16-bit PCM audio and does not accept an output audio format."
|
|
7637
7520
|
});
|
|
7638
7521
|
}
|
|
7639
|
-
const headers =
|
|
7522
|
+
const headers = combineHeaders8(this.config.headers(), options.headers);
|
|
7640
7523
|
let apiKey;
|
|
7641
7524
|
for (const [key, value] of Object.entries(headers)) {
|
|
7642
7525
|
if (key.toLowerCase() === "x-goog-api-key" && value != null) {
|
|
@@ -7699,8 +7582,8 @@ function createGoogleLiveSpeechTranslationStream({
|
|
|
7699
7582
|
let audioReader;
|
|
7700
7583
|
let connection;
|
|
7701
7584
|
let resolveSetupComplete;
|
|
7702
|
-
const setupComplete = new Promise((
|
|
7703
|
-
resolveSetupComplete =
|
|
7585
|
+
const setupComplete = new Promise((resolve6) => {
|
|
7586
|
+
resolveSetupComplete = resolve6;
|
|
7704
7587
|
});
|
|
7705
7588
|
let turnCounter = 0;
|
|
7706
7589
|
let sourceText = "";
|