@ai-sdk/google 4.0.101 → 4.0.102
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 +10 -0
- package/dist/index.d.ts +10 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +42 -46
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +19 -29
- package/dist/internal/index.js.map +1 -1
- package/docs/15-google.mdx +1 -1
- package/package.json +2 -2
- package/src/google-batch.ts +37 -34
- package/src/google-embedding-model-options.ts +15 -14
- package/src/google-files.ts +1 -11
- package/src/google-image-model-options.ts +1 -1
- package/src/google-language-model.ts +43 -40
- package/src/google-speech-model-options.ts +17 -14
- package/src/google-video-model.ts +34 -27
- package/src/tool/file-search.ts +34 -27
- package/src/tool/google-search.ts +16 -15
- package/src/transcription/google-transcription-model-options.ts +40 -31
- package/src/transcription/google-transcription-model.ts +37 -30
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @ai-sdk/google
|
|
2
2
|
|
|
3
|
+
## 4.0.102
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 39a776b: Add a shared encodePathSegment helper and use it to encode provider-returned identifiers in credentialed follow-up request paths.
|
|
8
|
+
- 754407e: Defer construction of provider validation schemas until first use to reduce package import time.
|
|
9
|
+
- Updated dependencies [b089ce8]
|
|
10
|
+
- Updated dependencies [39a776b]
|
|
11
|
+
- @ai-sdk/provider-utils@5.0.65
|
|
12
|
+
|
|
3
13
|
## 4.0.101
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -270,7 +270,7 @@ interface GoogleProviderMetadata {
|
|
|
270
270
|
}
|
|
271
271
|
//#endregion
|
|
272
272
|
//#region src/tool/google-search.d.ts
|
|
273
|
-
declare const googleSearchToolArgsBaseSchema: z.ZodObject<{
|
|
273
|
+
declare const googleSearchToolArgsBaseSchema: () => z.ZodObject<{
|
|
274
274
|
searchTypes: z.ZodOptional<z.ZodObject<{
|
|
275
275
|
webSearch: z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
|
|
276
276
|
imageSearch: z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
|
|
@@ -280,7 +280,7 @@ declare const googleSearchToolArgsBaseSchema: z.ZodObject<{
|
|
|
280
280
|
endTime: z.ZodString;
|
|
281
281
|
}, z.core.$strip>>;
|
|
282
282
|
}, z.core.$loose>;
|
|
283
|
-
type GoogleSearchToolArgs = z.infer<typeof googleSearchToolArgsBaseSchema
|
|
283
|
+
type GoogleSearchToolArgs = z.infer<ReturnType<typeof googleSearchToolArgsBaseSchema>>;
|
|
284
284
|
//#endregion
|
|
285
285
|
//#region src/google-image-model-options.d.ts
|
|
286
286
|
type GoogleImageModelOptions = Omit<GoogleLanguageModelOptions, 'responseModalities'> & {
|
|
@@ -625,17 +625,14 @@ type GoogleTranscriptionModelId = 'gemini-3.5-transcribe' | 'gemini-3.5-transcri
|
|
|
625
625
|
* live (`gemini-3.5-transcribe-live`) transcription. Maps onto Google's
|
|
626
626
|
* `AudioTranscriptionConfig`.
|
|
627
627
|
*/
|
|
628
|
-
declare const googleTranscriptionModelOptions:
|
|
629
|
-
languageCodes
|
|
630
|
-
customVocabulary
|
|
631
|
-
wordTimestamp
|
|
632
|
-
diarization
|
|
633
|
-
mode
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
}>>;
|
|
637
|
-
}, z.core.$strip>;
|
|
638
|
-
type GoogleTranscriptionModelOptions = z.infer<typeof googleTranscriptionModelOptions>;
|
|
628
|
+
declare const googleTranscriptionModelOptions: import("@ai-sdk/provider-utils").LazySchema<{
|
|
629
|
+
languageCodes?: string[] | undefined;
|
|
630
|
+
customVocabulary?: string[] | undefined;
|
|
631
|
+
wordTimestamp?: boolean | undefined;
|
|
632
|
+
diarization?: boolean | undefined;
|
|
633
|
+
mode?: "SMART" | "VERBATIM" | undefined;
|
|
634
|
+
}>;
|
|
635
|
+
type GoogleTranscriptionModelOptions = InferSchema<typeof googleTranscriptionModelOptions>;
|
|
639
636
|
//#endregion
|
|
640
637
|
//#region src/speech-translation/google-speech-translation-model-options.d.ts
|
|
641
638
|
type GoogleSpeechTranslationModelId = 'gemini-3.5-live-translate-preview' | (string & {});
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["DecisionModelV4","BatchV4","SpeechTranslationModelV4","RealtimeFactoryV4","RealtimeModelV4ClientSecretOptions","RealtimeModelV4ClientSecretResult","RealtimeModelV4ServerEvent","RealtimeModelV4ClientEvent","RealtimeModelV4","RealtimeModelV4SessionConfig","TranscriptionModelV4StreamOptions","SpeechTranslationModelV4StreamOptions","SpeechTranslationModelV4"],"sources":["../src/google-error.ts","../src/google-language-model-options.ts","../src/google-language-model.ts","../src/google-prompt.ts","../src/tool/google-search.ts","../src/google-image-model-options.ts","../src/google-embedding-model-options.ts","../src/google-video-model-options.ts","../src/google-video-settings.ts","../src/google-speech-model-options.ts","../src/google-files.ts","../src/interactions/google-interactions-language-model-options.ts","../src/interactions/google-interactions-provider-metadata.ts","../src/interactions/google-interactions-agent.ts","../src/google-tools.ts","../src/google-image-settings.ts","../src/transcription/google-transcription-model-options.ts","../src/speech-translation/google-speech-translation-model-options.ts","../src/google-provider.ts","../src/realtime/google-realtime-model.ts","../src/realtime/google-realtime-model-options.ts","../src/transcription/google-transcription-model.ts","../src/speech-translation/google-speech-translation-model.ts","../src/version.ts"],"mappings":";;;;cAgBM,wDAAqB;;;;;;;;KAQf,kBAAkB,mBAAmB;;;KCjBrC;cAqDC,6DAA0B;;;;;;;;;;;;;;;WAA1B;;;;;;;;;;;;;;;;;;;;;;;;KA+OD,6BAA6B,mBAChC;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["DecisionModelV4","BatchV4","SpeechTranslationModelV4","RealtimeFactoryV4","RealtimeModelV4ClientSecretOptions","RealtimeModelV4ClientSecretResult","RealtimeModelV4ServerEvent","RealtimeModelV4ClientEvent","RealtimeModelV4","RealtimeModelV4SessionConfig","TranscriptionModelV4StreamOptions","SpeechTranslationModelV4StreamOptions","SpeechTranslationModelV4"],"sources":["../src/google-error.ts","../src/google-language-model-options.ts","../src/google-language-model.ts","../src/google-prompt.ts","../src/tool/google-search.ts","../src/google-image-model-options.ts","../src/google-embedding-model-options.ts","../src/google-video-model-options.ts","../src/google-video-settings.ts","../src/google-speech-model-options.ts","../src/google-files.ts","../src/interactions/google-interactions-language-model-options.ts","../src/interactions/google-interactions-provider-metadata.ts","../src/interactions/google-interactions-agent.ts","../src/google-tools.ts","../src/google-image-settings.ts","../src/transcription/google-transcription-model-options.ts","../src/speech-translation/google-speech-translation-model-options.ts","../src/google-provider.ts","../src/realtime/google-realtime-model.ts","../src/realtime/google-realtime-model-options.ts","../src/transcription/google-transcription-model.ts","../src/speech-translation/google-speech-translation-model.ts","../src/version.ts"],"mappings":";;;;cAgBM,wDAAqB;;;;;;;;KAQf,kBAAkB,mBAAmB;;;KCjBrC;cAqDC,6DAA0B;;;;;;;;;;;;;;;WAA1B;;;;;;;;;;;;;;;;;;;;;;;;KA+OD,6BAA6B,mBAChC;;;cCurDI,iDAAc;;;cAAd;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4BR,kBAAkB,YACrB,mBAAmB;KAGT,0BAA0B,YACpC;KAGU,2BAA2B,YACrC;KAGU,qBAAqB,YAC/B;KAGU,uBAAuB,YACjC,mBAAmB;KAGT,sBAAsB,YAChC,mBAAmB;;;KCj8DT,0BAA0B;KAE1B,2BAA2B;KAE3B,qBAAqB;KAErB,uBA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B,QAAQ;EACR,YAAY;EACZ;IACE,oBAAoB;IACpB;;;qBAIS,oCAAoC;WAsBpC,SAAS;mBACD;WAtBV;UAED,oBAAoB,OAAO;;;;UAO3B,sBAAsB;IAC5B,SAAS;IACT,QAAQ;MACT;MAIG;EAKO,YAAA,SAAS,4BACD,QAAQ;UAGb;EAUR,WACJ,SAAS,WAAW,yCACnB,QAAQ,QAAQ,WAAW;EAmGxB,SACJ,SAASC,iDACR,QACD,QAAQ,WAAW,YAAY;;;;KCxKvB;EACV;EACA;EACA,eAAe;EACf,YAAY;EACZ;IACE,oBAAoB;IACpB;;;cAIS,wCAAwCE;WAC1C;WACA,SAAS;mBAED;UAET,oBAAoB,OAAO;;;;UAO3B,sBAAsB;IAC5B,SAAS;IACT,QAAQ;MACT;MAIG;EAKF,YAAA,SAAS,gCACT,QAAQ;EAMJ,SACJ,SAASD,qDACR,QAAQ,QAAQ,WAAWC;;;;qBCpHnB"}
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { EXPERIMENTAL_EMBEDDING_MODEL_PROVIDER_OPTIONS_TRANSFORMER, WORKFLOW_DESERIALIZE, WORKFLOW_SERIALIZE, combineHeaders, connectToWebSocket, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertInlineFileDataToUint8Array, convertJsonResponseToolStream, convertToBase64, convertUint8ArrayToBase64, createEventSourceResponseHandler, createJsonErrorResponseHandler, createJsonLinesResponseHandler, createJsonResponseHandler, createNullLanguageModelUsage, createProviderExecutedToolFactory, createProviderStreamError, createToolNameMapping, delay, detectMediaType, downloadBlob, generateId, getFromApi, getRuntimeEnvironmentUserAgent, getTopLevelMediaType, isAbortError, isCustomReasoning, isFullMediaType, isRecord, isSameOrigin, isUrlSupported, lazySchema, loadApiKey, mapReasoningToProviderBudget, mapReasoningToProviderEffort, normalizeBatchRequestCounts, parseProviderOptions, postJsonToApi, postToApi, resolve, resolveFullMediaType, resolveProviderReference, safeParseJSON, safeValidateTypes, secureJsonParse, serializeModelOptions, waitForWebSocketBufferDrain, withUserAgentSuffix, withoutTrailingSlash, zodSchema } from "@ai-sdk/provider-utils";
|
|
1
|
+
import { EXPERIMENTAL_EMBEDDING_MODEL_PROVIDER_OPTIONS_TRANSFORMER, WORKFLOW_DESERIALIZE, WORKFLOW_SERIALIZE, combineHeaders, connectToWebSocket, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertInlineFileDataToUint8Array, convertJsonResponseToolStream, convertToBase64, convertUint8ArrayToBase64, createEventSourceResponseHandler, createJsonErrorResponseHandler, createJsonLinesResponseHandler, createJsonResponseHandler, createNullLanguageModelUsage, createProviderExecutedToolFactory, createProviderStreamError, createToolNameMapping, delay, detectMediaType, downloadBlob, encodePathSegment, generateId, getFromApi, getRuntimeEnvironmentUserAgent, getTopLevelMediaType, isAbortError, isCustomReasoning, isFullMediaType, isRecord, isSameOrigin, isUrlSupported, lazySchema, loadApiKey, mapReasoningToProviderBudget, mapReasoningToProviderEffort, normalizeBatchRequestCounts, parseProviderOptions, postJsonToApi, postToApi, resolve, resolveFullMediaType, resolveProviderReference, safeParseJSON, safeValidateTypes, secureJsonParse, serializeModelOptions, waitForWebSocketBufferDrain, withUserAgentSuffix, withoutTrailingSlash, zodSchema } from "@ai-sdk/provider-utils";
|
|
2
2
|
import { Experimental_DecisionLanguageModel } from "@ai-sdk/provider-utils/experimental-decision";
|
|
3
3
|
import { AISDKError, InvalidArgumentError, InvalidResponseDataError, TooManyEmbeddingValuesForCallError, UnsupportedFunctionalityError } from "@ai-sdk/provider";
|
|
4
4
|
import { z } from "zod/v4";
|
|
5
5
|
//#region src/version.ts
|
|
6
|
-
const VERSION = "4.0.
|
|
6
|
+
const VERSION = "4.0.102";
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/google-error.ts
|
|
9
9
|
const getGoogleErrorSchema = () => z.object({
|
|
@@ -19,7 +19,7 @@ const googleFailedResponseHandler = createJsonErrorResponseHandler({
|
|
|
19
19
|
});
|
|
20
20
|
//#endregion
|
|
21
21
|
//#region src/google-embedding-model-options.ts
|
|
22
|
-
const googleEmbeddingContentPartSchema = z.union([
|
|
22
|
+
const googleEmbeddingContentPartSchema = () => z.union([
|
|
23
23
|
z.object({ text: z.string() }),
|
|
24
24
|
z.object({ inlineData: z.object({
|
|
25
25
|
mimeType: z.string(),
|
|
@@ -67,7 +67,7 @@ const googleEmbeddingModelOptions = lazySchema(() => zodSchema(z.object({
|
|
|
67
67
|
* The array length must match the number of values being embedded. In
|
|
68
68
|
* the case of a single embedding, the array length must be 1.
|
|
69
69
|
*/
|
|
70
|
-
content: z.array(z.array(googleEmbeddingContentPartSchema).min(1).nullable()).optional()
|
|
70
|
+
content: z.array(z.array(googleEmbeddingContentPartSchema()).min(1).nullable()).optional()
|
|
71
71
|
})));
|
|
72
72
|
//#endregion
|
|
73
73
|
//#region src/google-embedding-model.ts
|
|
@@ -2524,7 +2524,7 @@ const getGroundingMetadataSchema = () => z.object({
|
|
|
2524
2524
|
})).nullish(),
|
|
2525
2525
|
retrievalMetadata: z.union([z.object({ webDynamicRetrievalScore: z.number() }), z.object({})]).nullish()
|
|
2526
2526
|
});
|
|
2527
|
-
const partialArgSchema = z.object({
|
|
2527
|
+
const partialArgSchema = () => z.object({
|
|
2528
2528
|
jsonPath: z.string(),
|
|
2529
2529
|
stringValue: z.string().nullish(),
|
|
2530
2530
|
numberValue: z.number().nullish(),
|
|
@@ -2538,7 +2538,7 @@ const getContentSchema = () => z.object({ parts: z.array(z.union([
|
|
|
2538
2538
|
id: z.string().nullish(),
|
|
2539
2539
|
name: z.string().nullish(),
|
|
2540
2540
|
args: z.unknown().nullish(),
|
|
2541
|
-
partialArgs: z.array(partialArgSchema).nullish(),
|
|
2541
|
+
partialArgs: z.array(partialArgSchema()).nullish(),
|
|
2542
2542
|
willContinue: z.boolean().nullish()
|
|
2543
2543
|
}),
|
|
2544
2544
|
thoughtSignature: z.string().nullish()
|
|
@@ -2589,11 +2589,11 @@ const getSafetyRatingSchema = () => z.object({
|
|
|
2589
2589
|
severityScore: z.number().nullish(),
|
|
2590
2590
|
blocked: z.boolean().nullish()
|
|
2591
2591
|
});
|
|
2592
|
-
const tokenDetailsSchema = z.array(z.object({
|
|
2592
|
+
const tokenDetailsSchema = () => z.array(z.object({
|
|
2593
2593
|
modality: z.string(),
|
|
2594
2594
|
tokenCount: z.number()
|
|
2595
2595
|
}).loose()).nullish();
|
|
2596
|
-
const usageSchema$1 = z.object({
|
|
2596
|
+
const usageSchema$1 = () => z.object({
|
|
2597
2597
|
cachedContentTokenCount: z.number().nullish(),
|
|
2598
2598
|
thoughtsTokenCount: z.number().nullish(),
|
|
2599
2599
|
promptTokenCount: z.number().nullish(),
|
|
@@ -2602,10 +2602,10 @@ const usageSchema$1 = z.object({
|
|
|
2602
2602
|
totalTokenCount: z.number().nullish(),
|
|
2603
2603
|
trafficType: z.string().nullish(),
|
|
2604
2604
|
serviceTier: z.string().nullish(),
|
|
2605
|
-
promptTokensDetails: tokenDetailsSchema,
|
|
2606
|
-
cacheTokensDetails: tokenDetailsSchema,
|
|
2607
|
-
candidatesTokensDetails: tokenDetailsSchema,
|
|
2608
|
-
toolUsePromptTokensDetails: tokenDetailsSchema
|
|
2605
|
+
promptTokensDetails: tokenDetailsSchema(),
|
|
2606
|
+
cacheTokensDetails: tokenDetailsSchema(),
|
|
2607
|
+
candidatesTokensDetails: tokenDetailsSchema(),
|
|
2608
|
+
toolUsePromptTokensDetails: tokenDetailsSchema()
|
|
2609
2609
|
}).loose();
|
|
2610
2610
|
const getUrlContextMetadataSchema = () => z.object({ urlMetadata: z.array(z.object({
|
|
2611
2611
|
retrievedUrl: z.string(),
|
|
@@ -2622,7 +2622,7 @@ const responseSchema = lazySchema(() => zodSchema(z.object({
|
|
|
2622
2622
|
groundingMetadata: getGroundingMetadataSchema().nullish(),
|
|
2623
2623
|
urlContextMetadata: getUrlContextMetadataSchema().nullish()
|
|
2624
2624
|
})).nullish(),
|
|
2625
|
-
usageMetadata: usageSchema$1.nullish(),
|
|
2625
|
+
usageMetadata: usageSchema$1().nullish(),
|
|
2626
2626
|
promptFeedback: z.object({
|
|
2627
2627
|
blockReason: z.string().nullish(),
|
|
2628
2628
|
safetyRatings: z.array(getSafetyRatingSchema()).nullish()
|
|
@@ -2640,7 +2640,7 @@ const chunkSchema = lazySchema(() => zodSchema(z.object({
|
|
|
2640
2640
|
groundingMetadata: getGroundingMetadataSchema().nullish(),
|
|
2641
2641
|
urlContextMetadata: getUrlContextMetadataSchema().nullish()
|
|
2642
2642
|
})).nullish(),
|
|
2643
|
-
usageMetadata: usageSchema$1.nullish(),
|
|
2643
|
+
usageMetadata: usageSchema$1().nullish(),
|
|
2644
2644
|
promptFeedback: z.object({
|
|
2645
2645
|
blockReason: z.string().nullish(),
|
|
2646
2646
|
safetyRatings: z.array(getSafetyRatingSchema()).nullish()
|
|
@@ -2651,7 +2651,7 @@ function isConfirmedPromptBlockReason(blockReason) {
|
|
|
2651
2651
|
}
|
|
2652
2652
|
//#endregion
|
|
2653
2653
|
//#region src/tool/google-search.ts
|
|
2654
|
-
const googleSearchToolArgsBaseSchema = z.looseObject({
|
|
2654
|
+
const googleSearchToolArgsBaseSchema = () => z.looseObject({
|
|
2655
2655
|
searchTypes: z.object({
|
|
2656
2656
|
webSearch: z.object({}).optional(),
|
|
2657
2657
|
imageSearch: z.object({}).optional()
|
|
@@ -2678,7 +2678,7 @@ const googleImageModelOptionsSchema = lazySchema(() => zodSchema(z.object({
|
|
|
2678
2678
|
* dedicated escape hatch for grounding image generation the same way
|
|
2679
2679
|
* `generateText` does.
|
|
2680
2680
|
*/
|
|
2681
|
-
googleSearch: googleSearchToolArgsBaseSchema.optional() })));
|
|
2681
|
+
googleSearch: googleSearchToolArgsBaseSchema().optional() })));
|
|
2682
2682
|
//#endregion
|
|
2683
2683
|
//#region src/google-batch.ts
|
|
2684
2684
|
const googleBatchInputFileMaxBytes = 2147483648;
|
|
@@ -2699,23 +2699,23 @@ function assertSupportedBatchRequests(requests) {
|
|
|
2699
2699
|
});
|
|
2700
2700
|
}
|
|
2701
2701
|
}
|
|
2702
|
-
const googleRpcStatusSchema = z.object({
|
|
2702
|
+
const googleRpcStatusSchema = () => z.object({
|
|
2703
2703
|
code: z.union([z.number(), z.string()]).nullish(),
|
|
2704
2704
|
message: z.string().nullish(),
|
|
2705
2705
|
status: z.string().nullish()
|
|
2706
2706
|
});
|
|
2707
|
-
const googleBatchStatsSchema = z.object({
|
|
2707
|
+
const googleBatchStatsSchema = () => z.object({
|
|
2708
2708
|
requestCount: z.union([z.string(), z.number()]).nullish(),
|
|
2709
2709
|
successfulRequestCount: z.union([z.string(), z.number()]).nullish(),
|
|
2710
2710
|
failedRequestCount: z.union([z.string(), z.number()]).nullish(),
|
|
2711
2711
|
pendingRequestCount: z.union([z.string(), z.number()]).nullish()
|
|
2712
2712
|
});
|
|
2713
|
-
const googleBatchOutputSchema = z.object({
|
|
2713
|
+
const googleBatchOutputSchema = () => z.object({
|
|
2714
2714
|
responsesFile: z.string().nullish(),
|
|
2715
2715
|
inlinedResponses: z.object({ inlinedResponses: z.array(z.object({
|
|
2716
2716
|
metadata: z.object({ key: z.string() }),
|
|
2717
2717
|
response: z.unknown().nullish(),
|
|
2718
|
-
error: googleRpcStatusSchema.nullish()
|
|
2718
|
+
error: googleRpcStatusSchema().nullish()
|
|
2719
2719
|
})) }).nullish()
|
|
2720
2720
|
});
|
|
2721
2721
|
const googleBatchOperationZodSchema = () => z.object({
|
|
@@ -2723,12 +2723,12 @@ const googleBatchOperationZodSchema = () => z.object({
|
|
|
2723
2723
|
metadata: z.object({
|
|
2724
2724
|
state: z.string().nullish(),
|
|
2725
2725
|
createTime: z.string().nullish(),
|
|
2726
|
-
batchStats: googleBatchStatsSchema.nullish(),
|
|
2727
|
-
output: googleBatchOutputSchema.nullish()
|
|
2726
|
+
batchStats: googleBatchStatsSchema().nullish(),
|
|
2727
|
+
output: googleBatchOutputSchema().nullish()
|
|
2728
2728
|
}).nullish(),
|
|
2729
2729
|
done: z.boolean().nullish(),
|
|
2730
|
-
error: googleRpcStatusSchema.nullish(),
|
|
2731
|
-
response: googleBatchOutputSchema.nullish()
|
|
2730
|
+
error: googleRpcStatusSchema().nullish(),
|
|
2731
|
+
response: googleBatchOutputSchema().nullish()
|
|
2732
2732
|
});
|
|
2733
2733
|
const googleBatchOperationSchema = lazySchema(() => zodSchema(googleBatchOperationZodSchema()));
|
|
2734
2734
|
const googleBatchListResponseSchema = lazySchema(() => zodSchema(z.object({
|
|
@@ -2743,7 +2743,7 @@ const googleFileUploadResponseSchema = lazySchema(() => zodSchema(z.object({ fil
|
|
|
2743
2743
|
const googleBatchResultLineSchema = lazySchema(() => zodSchema(z.object({
|
|
2744
2744
|
key: z.string(),
|
|
2745
2745
|
response: z.unknown().nullish(),
|
|
2746
|
-
error: googleRpcStatusSchema.nullish()
|
|
2746
|
+
error: googleRpcStatusSchema().nullish()
|
|
2747
2747
|
})));
|
|
2748
2748
|
const googleBatchResponsePreviewSchema = lazySchema(() => zodSchema(z.object({
|
|
2749
2749
|
candidates: z.array(z.unknown()).nullish(),
|
|
@@ -3255,7 +3255,7 @@ const enterpriseWebSearch = createProviderExecutedToolFactory({
|
|
|
3255
3255
|
});
|
|
3256
3256
|
//#endregion
|
|
3257
3257
|
//#region src/tool/file-search.ts
|
|
3258
|
-
z.looseObject({
|
|
3258
|
+
lazySchema(() => zodSchema(z.looseObject({
|
|
3259
3259
|
/** The names of the file_search_stores to retrieve from.
|
|
3260
3260
|
* Example: `fileSearchStores/my-file-search-store-123`
|
|
3261
3261
|
*/
|
|
@@ -3266,7 +3266,7 @@ z.looseObject({
|
|
|
3266
3266
|
* See https://google.aip.dev/160 for the syntax of the filter expression.
|
|
3267
3267
|
*/
|
|
3268
3268
|
metadataFilter: z.string().describe("Metadata filter to apply to the file search retrieval documents. See https://google.aip.dev/160 for the syntax of the filter expression.").optional()
|
|
3269
|
-
});
|
|
3269
|
+
})));
|
|
3270
3270
|
const fileSearch = createProviderExecutedToolFactory({
|
|
3271
3271
|
id: "google.file_search",
|
|
3272
3272
|
inputSchema: lazySchema(() => zodSchema(z.object({}))),
|
|
@@ -3476,10 +3476,6 @@ var GoogleImageModel = class GoogleImageModel {
|
|
|
3476
3476
|
};
|
|
3477
3477
|
//#endregion
|
|
3478
3478
|
//#region src/google-files.ts
|
|
3479
|
-
function encodePathSegment(value) {
|
|
3480
|
-
const encodedValue = encodeURIComponent(value);
|
|
3481
|
-
return encodedValue === "." ? "%252E" : encodedValue === ".." ? "%252E%252E" : encodedValue;
|
|
3482
|
-
}
|
|
3483
3479
|
var GoogleFiles = class {
|
|
3484
3480
|
get provider() {
|
|
3485
3481
|
return this.config.provider;
|
|
@@ -3847,7 +3843,7 @@ var GoogleVideoModel = class {
|
|
|
3847
3843
|
return this.buildCompletedResult(statusOperation, responseHeaders, [], currentDate);
|
|
3848
3844
|
}
|
|
3849
3845
|
};
|
|
3850
|
-
const googleOperationSchema = z.object({
|
|
3846
|
+
const googleOperationSchema = lazySchema(() => zodSchema(z.object({
|
|
3851
3847
|
name: z.string().nullish(),
|
|
3852
3848
|
done: z.boolean().nullish(),
|
|
3853
3849
|
error: z.object({
|
|
@@ -3856,7 +3852,7 @@ const googleOperationSchema = z.object({
|
|
|
3856
3852
|
status: z.string().nullish()
|
|
3857
3853
|
}).nullish(),
|
|
3858
3854
|
response: z.object({ generateVideoResponse: z.object({ generatedSamples: z.array(z.object({ video: z.object({ uri: z.string().nullish() }).nullish() })).nullish() }).nullish() }).nullish()
|
|
3859
|
-
});
|
|
3855
|
+
})));
|
|
3860
3856
|
//#endregion
|
|
3861
3857
|
//#region src/google-speech-api.ts
|
|
3862
3858
|
/**
|
|
@@ -3900,18 +3896,18 @@ function getGoogleSpeechInput({ text, voice, providerOptions }) {
|
|
|
3900
3896
|
}
|
|
3901
3897
|
//#endregion
|
|
3902
3898
|
//#region src/google-speech-model-options.ts
|
|
3903
|
-
const prebuiltVoiceConfigSchema = z.object({ voiceName: z.string() });
|
|
3904
|
-
const voiceConfigSchema = z.object({
|
|
3905
|
-
prebuiltVoiceConfig: prebuiltVoiceConfigSchema,
|
|
3899
|
+
const prebuiltVoiceConfigSchema = () => z.object({ voiceName: z.string() });
|
|
3900
|
+
const voiceConfigSchema = () => z.object({
|
|
3901
|
+
prebuiltVoiceConfig: prebuiltVoiceConfigSchema(),
|
|
3906
3902
|
voice: z.never().optional()
|
|
3907
3903
|
});
|
|
3908
|
-
const speechMetadataSchema = z.object({
|
|
3904
|
+
const speechMetadataSchema = () => z.object({
|
|
3909
3905
|
speaker: z.string().min(1).optional(),
|
|
3910
3906
|
style: z.string().optional()
|
|
3911
3907
|
});
|
|
3912
3908
|
const googleSpeechProviderOptionsSchema = lazySchema(() => zodSchema(z.object({
|
|
3913
3909
|
/** Turn-level directions for the top-level text, for Gemini 3.8 TTS. */
|
|
3914
|
-
speechMetadata: speechMetadataSchema.optional(),
|
|
3910
|
+
speechMetadata: speechMetadataSchema().optional(),
|
|
3915
3911
|
/**
|
|
3916
3912
|
* Structured transcript for Gemini 3.8 TTS. Replaces the top-level text;
|
|
3917
3913
|
* pass text: '' when using turns. Each multi-speaker turn must name a
|
|
@@ -3919,7 +3915,7 @@ const googleSpeechProviderOptionsSchema = lazySchema(() => zodSchema(z.object({
|
|
|
3919
3915
|
*/
|
|
3920
3916
|
turns: z.array(z.object({
|
|
3921
3917
|
text: z.string(),
|
|
3922
|
-
speechMetadata: speechMetadataSchema.optional()
|
|
3918
|
+
speechMetadata: speechMetadataSchema().optional()
|
|
3923
3919
|
})).min(1).optional(),
|
|
3924
3920
|
/**
|
|
3925
3921
|
* Multi-speaker configuration for dialogue audio. When provided, this
|
|
@@ -3931,7 +3927,7 @@ const googleSpeechProviderOptionsSchema = lazySchema(() => zodSchema(z.object({
|
|
|
3931
3927
|
*/
|
|
3932
3928
|
multiSpeakerVoiceConfig: z.object({ speakerVoiceConfigs: z.array(z.object({
|
|
3933
3929
|
speaker: z.string(),
|
|
3934
|
-
voiceConfig: voiceConfigSchema
|
|
3930
|
+
voiceConfig: voiceConfigSchema()
|
|
3935
3931
|
})) }).optional()
|
|
3936
3932
|
})));
|
|
3937
3933
|
//#endregion
|
|
@@ -7400,7 +7396,7 @@ var GoogleRealtimeModel = class {
|
|
|
7400
7396
|
* live (`gemini-3.5-transcribe-live`) transcription. Maps onto Google's
|
|
7401
7397
|
* `AudioTranscriptionConfig`.
|
|
7402
7398
|
*/
|
|
7403
|
-
const googleTranscriptionModelOptions = z.object({
|
|
7399
|
+
const googleTranscriptionModelOptions = lazySchema(() => zodSchema(z.object({
|
|
7404
7400
|
/**
|
|
7405
7401
|
* BCP-47 language codes providing hints about the languages present in the
|
|
7406
7402
|
* audio. If omitted or empty, defaults to automatic language detection.
|
|
@@ -7429,7 +7425,7 @@ const googleTranscriptionModelOptions = z.object({
|
|
|
7429
7425
|
* (lists, numbers, dates, paragraph breaks), and grammar/casing polish.
|
|
7430
7426
|
*/
|
|
7431
7427
|
mode: z.enum(["SMART", "VERBATIM"]).optional()
|
|
7432
|
-
});
|
|
7428
|
+
})));
|
|
7433
7429
|
//#endregion
|
|
7434
7430
|
//#region src/transcription/google-transcription-model.ts
|
|
7435
7431
|
const liveWebSocketPath$1 = "google.ai.generativelanguage.v1beta.GenerativeService.BidiGenerateContent";
|
|
@@ -7794,25 +7790,25 @@ function validateLiveInputAudioFormat(inputAudioFormat) {
|
|
|
7794
7790
|
message: "The Gemini Live transcription API only supports 16kHz 16-bit PCM input audio."
|
|
7795
7791
|
});
|
|
7796
7792
|
}
|
|
7797
|
-
const googleInteractionsWordAnnotationSchema = z.object({
|
|
7793
|
+
const googleInteractionsWordAnnotationSchema = () => z.object({
|
|
7798
7794
|
type: z.string().nullish(),
|
|
7799
7795
|
text: z.string().nullish(),
|
|
7800
7796
|
speaker: z.string().nullish(),
|
|
7801
7797
|
start_offset: z.string().nullish(),
|
|
7802
7798
|
end_offset: z.string().nullish()
|
|
7803
7799
|
});
|
|
7804
|
-
const googleInteractionsTranscriptionResponseSchema = z.object({
|
|
7800
|
+
const googleInteractionsTranscriptionResponseSchema = lazySchema(() => zodSchema(z.object({
|
|
7805
7801
|
status: z.string().nullish(),
|
|
7806
7802
|
steps: z.array(z.object({
|
|
7807
7803
|
type: z.string().nullish(),
|
|
7808
7804
|
content: z.array(z.object({
|
|
7809
7805
|
type: z.string().nullish(),
|
|
7810
7806
|
text: z.string().nullish(),
|
|
7811
|
-
annotations: z.array(googleInteractionsWordAnnotationSchema).nullish()
|
|
7807
|
+
annotations: z.array(googleInteractionsWordAnnotationSchema()).nullish()
|
|
7812
7808
|
})).nullish()
|
|
7813
7809
|
})).nullish(),
|
|
7814
7810
|
usage: z.record(z.string(), z.json()).nullish()
|
|
7815
|
-
});
|
|
7811
|
+
})));
|
|
7816
7812
|
//#endregion
|
|
7817
7813
|
//#region src/speech-translation/google-speech-translation-model-options.ts
|
|
7818
7814
|
const googleSpeechTranslationModelOptions = lazySchema(() => zodSchema(z.object({
|