@ai-sdk/google 4.0.0-canary.76 → 4.0.0-canary.78
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 +14 -0
- package/dist/index.js +21 -7
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +32 -2
- package/dist/internal/index.js +322 -48
- package/dist/internal/index.js.map +1 -1
- package/package.json +2 -2
- package/src/google-speech-model.ts +31 -6
- package/src/internal/index.ts +1 -0
package/dist/internal/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
2
2
|
import { WORKFLOW_SERIALIZE, WORKFLOW_DESERIALIZE, Resolvable, FetchFunction, InferSchema } from '@ai-sdk/provider-utils';
|
|
3
|
-
import
|
|
3
|
+
import * as _ai_sdk_provider from '@ai-sdk/provider';
|
|
4
|
+
import { LanguageModelV4, JSONObject, LanguageModelV4CallOptions, LanguageModelV4GenerateResult, LanguageModelV4StreamResult, SpeechModelV4 } from '@ai-sdk/provider';
|
|
4
5
|
import { z } from 'zod/v4';
|
|
5
6
|
|
|
6
7
|
type GoogleModelId = 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-flash-lite-001' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro-preview-tts' | 'gemini-2.5-flash-native-audio-latest' | 'gemini-2.5-flash-native-audio-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-pro-preview-customtools' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-3.1-flash-tts-preview' | 'gemini-3.5-flash' | 'gemini-pro-latest' | 'gemini-flash-latest' | 'gemini-flash-lite-latest' | 'deep-research-pro-preview-12-2025' | 'deep-research-max-preview-04-2026' | 'deep-research-preview-04-2026' | 'nano-banana-pro-preview' | 'aqa' | 'gemini-robotics-er-1.5-preview' | 'gemma-3-1b-it' | 'gemma-3-4b-it' | 'gemma-3n-e4b-it' | 'gemma-3n-e2b-it' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
|
|
@@ -242,6 +243,35 @@ type SafetyRatingSchema = NonNullable<InferSchema<typeof responseSchema>['candid
|
|
|
242
243
|
type PromptFeedbackSchema = NonNullable<InferSchema<typeof responseSchema>['promptFeedback']>;
|
|
243
244
|
type UsageMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['usageMetadata']>;
|
|
244
245
|
|
|
246
|
+
type GoogleSpeechModelId = 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro-preview-tts' | 'gemini-3.1-flash-tts-preview' | (string & {});
|
|
247
|
+
|
|
248
|
+
interface GoogleSpeechModelConfig {
|
|
249
|
+
provider: string;
|
|
250
|
+
baseURL: string;
|
|
251
|
+
headers?: Resolvable<Record<string, string | undefined>>;
|
|
252
|
+
fetch?: FetchFunction;
|
|
253
|
+
_internal?: {
|
|
254
|
+
currentDate?: () => Date;
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
declare class GoogleSpeechModel implements SpeechModelV4 {
|
|
258
|
+
readonly modelId: GoogleSpeechModelId;
|
|
259
|
+
private readonly config;
|
|
260
|
+
readonly specificationVersion = "v4";
|
|
261
|
+
static [WORKFLOW_SERIALIZE](model: GoogleSpeechModel): {
|
|
262
|
+
modelId: string;
|
|
263
|
+
config: _ai_sdk_provider.JSONObject;
|
|
264
|
+
};
|
|
265
|
+
static [WORKFLOW_DESERIALIZE](options: {
|
|
266
|
+
modelId: GoogleSpeechModelId;
|
|
267
|
+
config: GoogleSpeechModelConfig;
|
|
268
|
+
}): GoogleSpeechModel;
|
|
269
|
+
get provider(): string;
|
|
270
|
+
constructor(modelId: GoogleSpeechModelId, config: GoogleSpeechModelConfig);
|
|
271
|
+
private getArgs;
|
|
272
|
+
doGenerate(options: Parameters<SpeechModelV4['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV4['doGenerate']>>>;
|
|
273
|
+
}
|
|
274
|
+
|
|
245
275
|
declare const googleTools: {
|
|
246
276
|
/**
|
|
247
277
|
* Creates a Google search tool that gives Google direct access to real-time web content.
|
|
@@ -325,4 +355,4 @@ declare const googleTools: {
|
|
|
325
355
|
}, {}>;
|
|
326
356
|
};
|
|
327
357
|
|
|
328
|
-
export { GoogleLanguageModel, type GoogleModelId, type GroundingMetadataSchema, type PromptFeedbackSchema, type SafetyRatingSchema, type UrlContextMetadataSchema, type UsageMetadataSchema, getGroundingMetadataSchema, getUrlContextMetadataSchema, googleTools };
|
|
358
|
+
export { GoogleLanguageModel, type GoogleModelId, GoogleSpeechModel, type GroundingMetadataSchema, type PromptFeedbackSchema, type SafetyRatingSchema, type UrlContextMetadataSchema, type UsageMetadataSchema, getGroundingMetadataSchema, getUrlContextMetadataSchema, googleTools };
|
package/dist/internal/index.js
CHANGED
|
@@ -2421,123 +2421,396 @@ var chunkSchema = lazySchema3(
|
|
|
2421
2421
|
)
|
|
2422
2422
|
);
|
|
2423
2423
|
|
|
2424
|
+
// src/google-speech-model.ts
|
|
2425
|
+
import {
|
|
2426
|
+
combineHeaders as combineHeaders2,
|
|
2427
|
+
convertBase64ToUint8Array,
|
|
2428
|
+
createJsonResponseHandler as createJsonResponseHandler2,
|
|
2429
|
+
parseProviderOptions as parseProviderOptions2,
|
|
2430
|
+
postJsonToApi as postJsonToApi2,
|
|
2431
|
+
resolve as resolve2,
|
|
2432
|
+
serializeModelOptions as serializeModelOptions2,
|
|
2433
|
+
WORKFLOW_DESERIALIZE as WORKFLOW_DESERIALIZE2,
|
|
2434
|
+
WORKFLOW_SERIALIZE as WORKFLOW_SERIALIZE2
|
|
2435
|
+
} from "@ai-sdk/provider-utils";
|
|
2436
|
+
|
|
2437
|
+
// src/google-speech-api.ts
|
|
2438
|
+
import { lazySchema as lazySchema4, zodSchema as zodSchema4 } from "@ai-sdk/provider-utils";
|
|
2439
|
+
import { z as z4 } from "zod/v4";
|
|
2440
|
+
var googleSpeechResponseSchema = lazySchema4(
|
|
2441
|
+
() => zodSchema4(
|
|
2442
|
+
z4.object({
|
|
2443
|
+
candidates: z4.array(
|
|
2444
|
+
z4.object({
|
|
2445
|
+
content: z4.object({
|
|
2446
|
+
parts: z4.array(
|
|
2447
|
+
z4.object({
|
|
2448
|
+
inlineData: z4.object({
|
|
2449
|
+
mimeType: z4.string().nullish(),
|
|
2450
|
+
data: z4.string().nullish()
|
|
2451
|
+
}).nullish()
|
|
2452
|
+
})
|
|
2453
|
+
).nullish()
|
|
2454
|
+
}).nullish()
|
|
2455
|
+
})
|
|
2456
|
+
).nullish()
|
|
2457
|
+
})
|
|
2458
|
+
)
|
|
2459
|
+
);
|
|
2460
|
+
|
|
2461
|
+
// src/google-speech-model-options.ts
|
|
2462
|
+
import {
|
|
2463
|
+
lazySchema as lazySchema5,
|
|
2464
|
+
zodSchema as zodSchema5
|
|
2465
|
+
} from "@ai-sdk/provider-utils";
|
|
2466
|
+
import { z as z5 } from "zod/v4";
|
|
2467
|
+
var prebuiltVoiceConfigSchema = z5.object({
|
|
2468
|
+
voiceName: z5.string()
|
|
2469
|
+
});
|
|
2470
|
+
var voiceConfigSchema = z5.object({
|
|
2471
|
+
prebuiltVoiceConfig: prebuiltVoiceConfigSchema
|
|
2472
|
+
});
|
|
2473
|
+
var googleSpeechProviderOptionsSchema = lazySchema5(
|
|
2474
|
+
() => zodSchema5(
|
|
2475
|
+
z5.object({
|
|
2476
|
+
/**
|
|
2477
|
+
* Multi-speaker configuration for dialogue audio. When provided, this
|
|
2478
|
+
* overrides the top-level `voice`. The Gemini TTS API supports up to two
|
|
2479
|
+
* speakers; each speaker name must match a name used in the input text.
|
|
2480
|
+
*
|
|
2481
|
+
* https://ai.google.dev/gemini-api/docs/speech-generation#multi-speaker
|
|
2482
|
+
*/
|
|
2483
|
+
multiSpeakerVoiceConfig: z5.object({
|
|
2484
|
+
speakerVoiceConfigs: z5.array(
|
|
2485
|
+
z5.object({
|
|
2486
|
+
speaker: z5.string(),
|
|
2487
|
+
voiceConfig: voiceConfigSchema
|
|
2488
|
+
})
|
|
2489
|
+
)
|
|
2490
|
+
}).optional()
|
|
2491
|
+
})
|
|
2492
|
+
)
|
|
2493
|
+
);
|
|
2494
|
+
|
|
2495
|
+
// src/google-speech-model.ts
|
|
2496
|
+
var DEFAULT_VOICE = "Kore";
|
|
2497
|
+
var DEFAULT_SAMPLE_RATE = 24e3;
|
|
2498
|
+
var GoogleSpeechModel = class _GoogleSpeechModel {
|
|
2499
|
+
constructor(modelId, config) {
|
|
2500
|
+
this.modelId = modelId;
|
|
2501
|
+
this.config = config;
|
|
2502
|
+
this.specificationVersion = "v4";
|
|
2503
|
+
}
|
|
2504
|
+
static [WORKFLOW_SERIALIZE2](model) {
|
|
2505
|
+
return serializeModelOptions2({
|
|
2506
|
+
modelId: model.modelId,
|
|
2507
|
+
config: model.config
|
|
2508
|
+
});
|
|
2509
|
+
}
|
|
2510
|
+
static [WORKFLOW_DESERIALIZE2](options) {
|
|
2511
|
+
return new _GoogleSpeechModel(options.modelId, options.config);
|
|
2512
|
+
}
|
|
2513
|
+
get provider() {
|
|
2514
|
+
return this.config.provider;
|
|
2515
|
+
}
|
|
2516
|
+
async getArgs({
|
|
2517
|
+
text,
|
|
2518
|
+
voice = DEFAULT_VOICE,
|
|
2519
|
+
outputFormat,
|
|
2520
|
+
instructions,
|
|
2521
|
+
speed,
|
|
2522
|
+
language,
|
|
2523
|
+
providerOptions
|
|
2524
|
+
}) {
|
|
2525
|
+
const warnings = [];
|
|
2526
|
+
const providerOptionsNames = this.config.provider.includes("vertex") ? ["googleVertex", "vertex"] : ["google"];
|
|
2527
|
+
let googleOptions;
|
|
2528
|
+
for (const name of providerOptionsNames) {
|
|
2529
|
+
googleOptions = await parseProviderOptions2({
|
|
2530
|
+
provider: name,
|
|
2531
|
+
providerOptions,
|
|
2532
|
+
schema: googleSpeechProviderOptionsSchema
|
|
2533
|
+
});
|
|
2534
|
+
if (googleOptions != null) {
|
|
2535
|
+
break;
|
|
2536
|
+
}
|
|
2537
|
+
}
|
|
2538
|
+
if (googleOptions == null && !providerOptionsNames.includes("google")) {
|
|
2539
|
+
googleOptions = await parseProviderOptions2({
|
|
2540
|
+
provider: "google",
|
|
2541
|
+
providerOptions,
|
|
2542
|
+
schema: googleSpeechProviderOptionsSchema
|
|
2543
|
+
});
|
|
2544
|
+
}
|
|
2545
|
+
const multiSpeakerVoiceConfig = googleOptions == null ? void 0 : googleOptions.multiSpeakerVoiceConfig;
|
|
2546
|
+
const speechConfig = multiSpeakerVoiceConfig ? { multiSpeakerVoiceConfig } : { voiceConfig: { prebuiltVoiceConfig: { voiceName: voice } } };
|
|
2547
|
+
let promptText = text;
|
|
2548
|
+
if (instructions != null) {
|
|
2549
|
+
if (multiSpeakerVoiceConfig) {
|
|
2550
|
+
warnings.push({
|
|
2551
|
+
type: "unsupported",
|
|
2552
|
+
feature: "instructions",
|
|
2553
|
+
details: "Google Gemini TTS ignores `instructions` when `multiSpeakerVoiceConfig` is set, because prepending them would break multi-speaker transcript parsing."
|
|
2554
|
+
});
|
|
2555
|
+
} else {
|
|
2556
|
+
promptText = `${instructions}: ${text}`;
|
|
2557
|
+
}
|
|
2558
|
+
}
|
|
2559
|
+
if (speed != null) {
|
|
2560
|
+
warnings.push({
|
|
2561
|
+
type: "unsupported",
|
|
2562
|
+
feature: "speed",
|
|
2563
|
+
details: "Google Gemini TTS models do not support the `speed` option. It was ignored."
|
|
2564
|
+
});
|
|
2565
|
+
}
|
|
2566
|
+
if (language != null) {
|
|
2567
|
+
warnings.push({
|
|
2568
|
+
type: "unsupported",
|
|
2569
|
+
feature: "language",
|
|
2570
|
+
details: "Google Gemini TTS models do not support the `language` option. Language is detected automatically from the input text."
|
|
2571
|
+
});
|
|
2572
|
+
}
|
|
2573
|
+
let resolvedOutputFormat = "wav";
|
|
2574
|
+
if (outputFormat === "pcm") {
|
|
2575
|
+
resolvedOutputFormat = "pcm";
|
|
2576
|
+
} else if (outputFormat != null && outputFormat !== "wav") {
|
|
2577
|
+
warnings.push({
|
|
2578
|
+
type: "unsupported",
|
|
2579
|
+
feature: "outputFormat",
|
|
2580
|
+
details: `Unsupported output format: ${outputFormat}. Using wav instead.`
|
|
2581
|
+
});
|
|
2582
|
+
}
|
|
2583
|
+
const requestBody = {
|
|
2584
|
+
contents: [{ role: "user", parts: [{ text: promptText }] }],
|
|
2585
|
+
generationConfig: {
|
|
2586
|
+
responseModalities: ["AUDIO"],
|
|
2587
|
+
speechConfig
|
|
2588
|
+
}
|
|
2589
|
+
};
|
|
2590
|
+
return { requestBody, warnings, outputFormat: resolvedOutputFormat };
|
|
2591
|
+
}
|
|
2592
|
+
async doGenerate(options) {
|
|
2593
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
2594
|
+
const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
|
|
2595
|
+
const { requestBody, warnings, outputFormat } = await this.getArgs(options);
|
|
2596
|
+
const {
|
|
2597
|
+
value: response,
|
|
2598
|
+
responseHeaders,
|
|
2599
|
+
rawValue: rawResponse
|
|
2600
|
+
} = await postJsonToApi2({
|
|
2601
|
+
url: `${this.config.baseURL}/models/${this.modelId}:generateContent`,
|
|
2602
|
+
headers: combineHeaders2(
|
|
2603
|
+
this.config.headers ? await resolve2(this.config.headers) : void 0,
|
|
2604
|
+
options.headers
|
|
2605
|
+
),
|
|
2606
|
+
body: requestBody,
|
|
2607
|
+
failedResponseHandler: googleFailedResponseHandler,
|
|
2608
|
+
successfulResponseHandler: createJsonResponseHandler2(
|
|
2609
|
+
googleSpeechResponseSchema
|
|
2610
|
+
),
|
|
2611
|
+
abortSignal: options.abortSignal,
|
|
2612
|
+
fetch: this.config.fetch
|
|
2613
|
+
});
|
|
2614
|
+
let base64Audio;
|
|
2615
|
+
let mimeType;
|
|
2616
|
+
for (const candidate of (_d = response.candidates) != null ? _d : []) {
|
|
2617
|
+
for (const part of (_f = (_e = candidate.content) == null ? void 0 : _e.parts) != null ? _f : []) {
|
|
2618
|
+
if ((_g = part.inlineData) == null ? void 0 : _g.data) {
|
|
2619
|
+
base64Audio = part.inlineData.data;
|
|
2620
|
+
mimeType = (_h = part.inlineData.mimeType) != null ? _h : void 0;
|
|
2621
|
+
break;
|
|
2622
|
+
}
|
|
2623
|
+
}
|
|
2624
|
+
if (base64Audio != null) {
|
|
2625
|
+
break;
|
|
2626
|
+
}
|
|
2627
|
+
}
|
|
2628
|
+
const sampleRate = (_i = parseSampleRate(mimeType)) != null ? _i : DEFAULT_SAMPLE_RATE;
|
|
2629
|
+
const pcm = base64Audio != null ? convertBase64ToUint8Array(base64Audio) : new Uint8Array(0);
|
|
2630
|
+
const audio = outputFormat === "pcm" || pcm.length === 0 ? pcm : addWavHeader(pcm, sampleRate);
|
|
2631
|
+
if (outputFormat === "pcm" && pcm.length > 0) {
|
|
2632
|
+
warnings.push({
|
|
2633
|
+
type: "unsupported",
|
|
2634
|
+
feature: "outputFormat",
|
|
2635
|
+
details: `Returning raw PCM audio (signed 16-bit little-endian, mono, ${sampleRate} Hz). These bytes have no container header and are not directly playable; see providerMetadata.google for the sample rate and mime type.`
|
|
2636
|
+
});
|
|
2637
|
+
}
|
|
2638
|
+
return {
|
|
2639
|
+
audio,
|
|
2640
|
+
warnings,
|
|
2641
|
+
request: {
|
|
2642
|
+
body: JSON.stringify(requestBody)
|
|
2643
|
+
},
|
|
2644
|
+
response: {
|
|
2645
|
+
timestamp: currentDate,
|
|
2646
|
+
modelId: this.modelId,
|
|
2647
|
+
headers: responseHeaders,
|
|
2648
|
+
body: rawResponse
|
|
2649
|
+
},
|
|
2650
|
+
providerMetadata: {
|
|
2651
|
+
google: {
|
|
2652
|
+
sampleRate,
|
|
2653
|
+
mimeType: mimeType != null ? mimeType : null
|
|
2654
|
+
}
|
|
2655
|
+
}
|
|
2656
|
+
};
|
|
2657
|
+
}
|
|
2658
|
+
};
|
|
2659
|
+
function parseSampleRate(mimeType) {
|
|
2660
|
+
if (mimeType == null) {
|
|
2661
|
+
return void 0;
|
|
2662
|
+
}
|
|
2663
|
+
const match = /rate=(\d+)/.exec(mimeType);
|
|
2664
|
+
return match ? Number.parseInt(match[1], 10) : void 0;
|
|
2665
|
+
}
|
|
2666
|
+
function addWavHeader(pcm, sampleRate) {
|
|
2667
|
+
const numChannels = 1;
|
|
2668
|
+
const bitsPerSample = 16;
|
|
2669
|
+
const blockAlign = numChannels * bitsPerSample / 8;
|
|
2670
|
+
const byteRate = sampleRate * blockAlign;
|
|
2671
|
+
const dataSize = pcm.length;
|
|
2672
|
+
const buffer = new ArrayBuffer(44 + dataSize);
|
|
2673
|
+
const view = new DataView(buffer);
|
|
2674
|
+
writeAscii(view, 0, "RIFF");
|
|
2675
|
+
view.setUint32(4, 36 + dataSize, true);
|
|
2676
|
+
writeAscii(view, 8, "WAVE");
|
|
2677
|
+
writeAscii(view, 12, "fmt ");
|
|
2678
|
+
view.setUint32(16, 16, true);
|
|
2679
|
+
view.setUint16(20, 1, true);
|
|
2680
|
+
view.setUint16(22, numChannels, true);
|
|
2681
|
+
view.setUint32(24, sampleRate, true);
|
|
2682
|
+
view.setUint32(28, byteRate, true);
|
|
2683
|
+
view.setUint16(32, blockAlign, true);
|
|
2684
|
+
view.setUint16(34, bitsPerSample, true);
|
|
2685
|
+
writeAscii(view, 36, "data");
|
|
2686
|
+
view.setUint32(40, dataSize, true);
|
|
2687
|
+
const out = new Uint8Array(buffer);
|
|
2688
|
+
out.set(pcm, 44);
|
|
2689
|
+
return out;
|
|
2690
|
+
}
|
|
2691
|
+
function writeAscii(view, offset, text) {
|
|
2692
|
+
for (let i = 0; i < text.length; i++) {
|
|
2693
|
+
view.setUint8(offset + i, text.charCodeAt(i));
|
|
2694
|
+
}
|
|
2695
|
+
}
|
|
2696
|
+
|
|
2424
2697
|
// src/tool/code-execution.ts
|
|
2425
2698
|
import { createProviderExecutedToolFactory } from "@ai-sdk/provider-utils";
|
|
2426
|
-
import { z as
|
|
2699
|
+
import { z as z6 } from "zod/v4";
|
|
2427
2700
|
var codeExecution = createProviderExecutedToolFactory({
|
|
2428
2701
|
id: "google.code_execution",
|
|
2429
|
-
inputSchema:
|
|
2430
|
-
language:
|
|
2431
|
-
code:
|
|
2702
|
+
inputSchema: z6.object({
|
|
2703
|
+
language: z6.string().describe("The programming language of the code."),
|
|
2704
|
+
code: z6.string().describe("The code to be executed.")
|
|
2432
2705
|
}),
|
|
2433
|
-
outputSchema:
|
|
2434
|
-
outcome:
|
|
2435
|
-
output:
|
|
2706
|
+
outputSchema: z6.object({
|
|
2707
|
+
outcome: z6.string().describe('The outcome of the execution (e.g., "OUTCOME_OK").'),
|
|
2708
|
+
output: z6.string().describe("The output from the code execution.")
|
|
2436
2709
|
})
|
|
2437
2710
|
});
|
|
2438
2711
|
|
|
2439
2712
|
// src/tool/enterprise-web-search.ts
|
|
2440
2713
|
import {
|
|
2441
2714
|
createProviderExecutedToolFactory as createProviderExecutedToolFactory2,
|
|
2442
|
-
lazySchema as
|
|
2443
|
-
zodSchema as
|
|
2715
|
+
lazySchema as lazySchema6,
|
|
2716
|
+
zodSchema as zodSchema6
|
|
2444
2717
|
} from "@ai-sdk/provider-utils";
|
|
2445
|
-
import { z as
|
|
2718
|
+
import { z as z7 } from "zod/v4";
|
|
2446
2719
|
var enterpriseWebSearch = createProviderExecutedToolFactory2({
|
|
2447
2720
|
id: "google.enterprise_web_search",
|
|
2448
|
-
inputSchema:
|
|
2449
|
-
outputSchema:
|
|
2721
|
+
inputSchema: lazySchema6(() => zodSchema6(z7.object({}))),
|
|
2722
|
+
outputSchema: lazySchema6(() => zodSchema6(z7.object({})))
|
|
2450
2723
|
});
|
|
2451
2724
|
|
|
2452
2725
|
// src/tool/file-search.ts
|
|
2453
2726
|
import {
|
|
2454
2727
|
createProviderExecutedToolFactory as createProviderExecutedToolFactory3,
|
|
2455
|
-
lazySchema as
|
|
2456
|
-
zodSchema as
|
|
2728
|
+
lazySchema as lazySchema7,
|
|
2729
|
+
zodSchema as zodSchema7
|
|
2457
2730
|
} from "@ai-sdk/provider-utils";
|
|
2458
|
-
import { z as
|
|
2459
|
-
var fileSearchArgsBaseSchema =
|
|
2731
|
+
import { z as z8 } from "zod/v4";
|
|
2732
|
+
var fileSearchArgsBaseSchema = z8.object({
|
|
2460
2733
|
/** The names of the file_search_stores to retrieve from.
|
|
2461
2734
|
* Example: `fileSearchStores/my-file-search-store-123`
|
|
2462
2735
|
*/
|
|
2463
|
-
fileSearchStoreNames:
|
|
2736
|
+
fileSearchStoreNames: z8.array(z8.string()).describe(
|
|
2464
2737
|
"The names of the file_search_stores to retrieve from. Example: `fileSearchStores/my-file-search-store-123`"
|
|
2465
2738
|
),
|
|
2466
2739
|
/** The number of file search retrieval chunks to retrieve. */
|
|
2467
|
-
topK:
|
|
2740
|
+
topK: z8.number().int().positive().describe("The number of file search retrieval chunks to retrieve.").optional(),
|
|
2468
2741
|
/** Metadata filter to apply to the file search retrieval documents.
|
|
2469
2742
|
* See https://google.aip.dev/160 for the syntax of the filter expression.
|
|
2470
2743
|
*/
|
|
2471
|
-
metadataFilter:
|
|
2744
|
+
metadataFilter: z8.string().describe(
|
|
2472
2745
|
"Metadata filter to apply to the file search retrieval documents. See https://google.aip.dev/160 for the syntax of the filter expression."
|
|
2473
2746
|
).optional()
|
|
2474
2747
|
}).passthrough();
|
|
2475
2748
|
var fileSearch = createProviderExecutedToolFactory3({
|
|
2476
2749
|
id: "google.file_search",
|
|
2477
|
-
inputSchema:
|
|
2478
|
-
outputSchema:
|
|
2750
|
+
inputSchema: lazySchema7(() => zodSchema7(z8.object({}))),
|
|
2751
|
+
outputSchema: lazySchema7(() => zodSchema7(z8.object({})))
|
|
2479
2752
|
});
|
|
2480
2753
|
|
|
2481
2754
|
// src/tool/google-maps.ts
|
|
2482
2755
|
import {
|
|
2483
2756
|
createProviderExecutedToolFactory as createProviderExecutedToolFactory4,
|
|
2484
|
-
lazySchema as
|
|
2485
|
-
zodSchema as
|
|
2757
|
+
lazySchema as lazySchema8,
|
|
2758
|
+
zodSchema as zodSchema8
|
|
2486
2759
|
} from "@ai-sdk/provider-utils";
|
|
2487
|
-
import { z as
|
|
2760
|
+
import { z as z9 } from "zod/v4";
|
|
2488
2761
|
var googleMaps = createProviderExecutedToolFactory4({
|
|
2489
2762
|
id: "google.google_maps",
|
|
2490
|
-
inputSchema:
|
|
2491
|
-
outputSchema:
|
|
2763
|
+
inputSchema: lazySchema8(() => zodSchema8(z9.object({}))),
|
|
2764
|
+
outputSchema: lazySchema8(() => zodSchema8(z9.object({})))
|
|
2492
2765
|
});
|
|
2493
2766
|
|
|
2494
2767
|
// src/tool/google-search.ts
|
|
2495
2768
|
import {
|
|
2496
2769
|
createProviderExecutedToolFactory as createProviderExecutedToolFactory5,
|
|
2497
|
-
lazySchema as
|
|
2498
|
-
zodSchema as
|
|
2770
|
+
lazySchema as lazySchema9,
|
|
2771
|
+
zodSchema as zodSchema9
|
|
2499
2772
|
} from "@ai-sdk/provider-utils";
|
|
2500
|
-
import { z as
|
|
2501
|
-
var googleSearchToolArgsBaseSchema =
|
|
2502
|
-
searchTypes:
|
|
2503
|
-
webSearch:
|
|
2504
|
-
imageSearch:
|
|
2773
|
+
import { z as z10 } from "zod/v4";
|
|
2774
|
+
var googleSearchToolArgsBaseSchema = z10.object({
|
|
2775
|
+
searchTypes: z10.object({
|
|
2776
|
+
webSearch: z10.object({}).optional(),
|
|
2777
|
+
imageSearch: z10.object({}).optional()
|
|
2505
2778
|
}).optional(),
|
|
2506
|
-
timeRangeFilter:
|
|
2507
|
-
startTime:
|
|
2508
|
-
endTime:
|
|
2779
|
+
timeRangeFilter: z10.object({
|
|
2780
|
+
startTime: z10.string(),
|
|
2781
|
+
endTime: z10.string()
|
|
2509
2782
|
}).optional()
|
|
2510
2783
|
}).passthrough();
|
|
2511
2784
|
var googleSearch = createProviderExecutedToolFactory5({
|
|
2512
2785
|
id: "google.google_search",
|
|
2513
|
-
inputSchema:
|
|
2514
|
-
outputSchema:
|
|
2786
|
+
inputSchema: lazySchema9(() => zodSchema9(z10.object({}))),
|
|
2787
|
+
outputSchema: lazySchema9(() => zodSchema9(z10.object({})))
|
|
2515
2788
|
});
|
|
2516
2789
|
|
|
2517
2790
|
// src/tool/url-context.ts
|
|
2518
2791
|
import {
|
|
2519
2792
|
createProviderExecutedToolFactory as createProviderExecutedToolFactory6,
|
|
2520
|
-
lazySchema as
|
|
2521
|
-
zodSchema as
|
|
2793
|
+
lazySchema as lazySchema10,
|
|
2794
|
+
zodSchema as zodSchema10
|
|
2522
2795
|
} from "@ai-sdk/provider-utils";
|
|
2523
|
-
import { z as
|
|
2796
|
+
import { z as z11 } from "zod/v4";
|
|
2524
2797
|
var urlContext = createProviderExecutedToolFactory6({
|
|
2525
2798
|
id: "google.url_context",
|
|
2526
|
-
inputSchema:
|
|
2527
|
-
outputSchema:
|
|
2799
|
+
inputSchema: lazySchema10(() => zodSchema10(z11.object({}))),
|
|
2800
|
+
outputSchema: lazySchema10(() => zodSchema10(z11.object({})))
|
|
2528
2801
|
});
|
|
2529
2802
|
|
|
2530
2803
|
// src/tool/vertex-rag-store.ts
|
|
2531
2804
|
import {
|
|
2532
2805
|
createProviderExecutedToolFactory as createProviderExecutedToolFactory7,
|
|
2533
|
-
lazySchema as
|
|
2534
|
-
zodSchema as
|
|
2806
|
+
lazySchema as lazySchema11,
|
|
2807
|
+
zodSchema as zodSchema11
|
|
2535
2808
|
} from "@ai-sdk/provider-utils";
|
|
2536
|
-
import { z as
|
|
2809
|
+
import { z as z12 } from "zod/v4";
|
|
2537
2810
|
var vertexRagStore = createProviderExecutedToolFactory7({
|
|
2538
2811
|
id: "google.vertex_rag_store",
|
|
2539
|
-
inputSchema:
|
|
2540
|
-
outputSchema:
|
|
2812
|
+
inputSchema: lazySchema11(() => zodSchema11(z12.object({}))),
|
|
2813
|
+
outputSchema: lazySchema11(() => zodSchema11(z12.object({})))
|
|
2541
2814
|
});
|
|
2542
2815
|
|
|
2543
2816
|
// src/google-tools.ts
|
|
@@ -2601,6 +2874,7 @@ var googleTools = {
|
|
|
2601
2874
|
};
|
|
2602
2875
|
export {
|
|
2603
2876
|
GoogleLanguageModel,
|
|
2877
|
+
GoogleSpeechModel,
|
|
2604
2878
|
getGroundingMetadataSchema,
|
|
2605
2879
|
getUrlContextMetadataSchema,
|
|
2606
2880
|
googleTools
|