@ai-sdk/google 4.0.0-beta.21 → 4.0.0-beta.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/README.md +2 -0
- package/dist/index.d.mts +10 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.js +250 -55
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +261 -52
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +40 -5
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +45 -6
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/convert-to-google-generative-ai-messages.ts +58 -17
- package/src/google-generative-ai-files.ts +230 -0
- package/src/google-generative-ai-prompt.ts +10 -2
- package/src/google-provider.ts +13 -0
- package/src/index.ts +1 -0
package/dist/index.mjs
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.0-beta.
|
|
10
|
+
var VERSION = true ? "4.0.0-beta.23" : "0.0.0-test";
|
|
11
11
|
|
|
12
12
|
// src/google-generative-ai-embedding-model.ts
|
|
13
13
|
import {
|
|
@@ -408,7 +408,11 @@ function isEmptyObjectSchema(jsonSchema) {
|
|
|
408
408
|
import {
|
|
409
409
|
UnsupportedFunctionalityError
|
|
410
410
|
} from "@ai-sdk/provider";
|
|
411
|
-
import {
|
|
411
|
+
import {
|
|
412
|
+
convertToBase64,
|
|
413
|
+
isProviderReference,
|
|
414
|
+
resolveProviderReference
|
|
415
|
+
} from "@ai-sdk/provider-utils";
|
|
412
416
|
var dataUrlRegex = /^data:([^;,]+);base64,(.+)$/s;
|
|
413
417
|
function parseBase64DataUrl(value) {
|
|
414
418
|
const match = dataUrlRegex.exec(value);
|
|
@@ -543,19 +547,36 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
543
547
|
}
|
|
544
548
|
case "file": {
|
|
545
549
|
const mediaType = part.mediaType === "image/*" ? "image/jpeg" : part.mediaType;
|
|
546
|
-
|
|
547
|
-
|
|
550
|
+
if (part.data instanceof URL) {
|
|
551
|
+
parts.push({
|
|
548
552
|
fileData: {
|
|
549
553
|
mimeType: mediaType,
|
|
550
554
|
fileUri: part.data.toString()
|
|
551
555
|
}
|
|
552
|
-
}
|
|
556
|
+
});
|
|
557
|
+
} else if (isProviderReference(part.data)) {
|
|
558
|
+
if (providerOptionsName === "vertex") {
|
|
559
|
+
throw new UnsupportedFunctionalityError({
|
|
560
|
+
functionality: "file parts with provider references"
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
parts.push({
|
|
564
|
+
fileData: {
|
|
565
|
+
mimeType: mediaType,
|
|
566
|
+
fileUri: resolveProviderReference({
|
|
567
|
+
reference: part.data,
|
|
568
|
+
provider: "google"
|
|
569
|
+
})
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
} else {
|
|
573
|
+
parts.push({
|
|
553
574
|
inlineData: {
|
|
554
575
|
mimeType: mediaType,
|
|
555
576
|
data: convertToBase64(part.data)
|
|
556
577
|
}
|
|
557
|
-
}
|
|
558
|
-
|
|
578
|
+
});
|
|
579
|
+
}
|
|
559
580
|
break;
|
|
560
581
|
}
|
|
561
582
|
}
|
|
@@ -606,6 +627,24 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
606
627
|
functionality: "File data URLs in assistant messages are not supported"
|
|
607
628
|
});
|
|
608
629
|
}
|
|
630
|
+
if (isProviderReference(part.data)) {
|
|
631
|
+
if (providerOptionsName === "vertex") {
|
|
632
|
+
throw new UnsupportedFunctionalityError({
|
|
633
|
+
functionality: "file parts with provider references"
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
return {
|
|
637
|
+
fileData: {
|
|
638
|
+
mimeType: part.mediaType,
|
|
639
|
+
fileUri: resolveProviderReference({
|
|
640
|
+
reference: part.data,
|
|
641
|
+
provider: "google"
|
|
642
|
+
})
|
|
643
|
+
},
|
|
644
|
+
...(providerOpts == null ? void 0 : providerOpts.thought) === true ? { thought: true } : {},
|
|
645
|
+
thoughtSignature
|
|
646
|
+
};
|
|
647
|
+
}
|
|
609
648
|
return {
|
|
610
649
|
inlineData: {
|
|
611
650
|
mimeType: part.mediaType,
|
|
@@ -2540,23 +2579,186 @@ var googleImageModelOptionsSchema = lazySchema11(
|
|
|
2540
2579
|
)
|
|
2541
2580
|
);
|
|
2542
2581
|
|
|
2543
|
-
// src/google-generative-ai-
|
|
2582
|
+
// src/google-generative-ai-files.ts
|
|
2544
2583
|
import {
|
|
2545
2584
|
AISDKError
|
|
2546
2585
|
} from "@ai-sdk/provider";
|
|
2547
2586
|
import {
|
|
2548
2587
|
combineHeaders as combineHeaders4,
|
|
2549
|
-
convertUint8ArrayToBase64,
|
|
2550
2588
|
createJsonResponseHandler as createJsonResponseHandler4,
|
|
2551
2589
|
delay,
|
|
2552
|
-
getFromApi,
|
|
2553
2590
|
lazySchema as lazySchema12,
|
|
2554
2591
|
parseProviderOptions as parseProviderOptions4,
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
zodSchema as zodSchema12
|
|
2592
|
+
zodSchema as zodSchema12,
|
|
2593
|
+
getFromApi
|
|
2558
2594
|
} from "@ai-sdk/provider-utils";
|
|
2559
2595
|
import { z as z14 } from "zod/v4";
|
|
2596
|
+
var GoogleGenerativeAIFiles = class {
|
|
2597
|
+
constructor(config) {
|
|
2598
|
+
this.config = config;
|
|
2599
|
+
this.specificationVersion = "v4";
|
|
2600
|
+
}
|
|
2601
|
+
get provider() {
|
|
2602
|
+
return this.config.provider;
|
|
2603
|
+
}
|
|
2604
|
+
async uploadFile(options) {
|
|
2605
|
+
var _a, _b, _c, _d;
|
|
2606
|
+
const googleOptions = await parseProviderOptions4({
|
|
2607
|
+
provider: "google",
|
|
2608
|
+
providerOptions: options.providerOptions,
|
|
2609
|
+
schema: googleFilesUploadOptionsSchema
|
|
2610
|
+
});
|
|
2611
|
+
const resolvedHeaders = this.config.headers();
|
|
2612
|
+
const fetchFn = (_a = this.config.fetch) != null ? _a : globalThis.fetch;
|
|
2613
|
+
const warnings = [];
|
|
2614
|
+
if (options.filename != null) {
|
|
2615
|
+
warnings.push({ type: "unsupported", feature: "filename" });
|
|
2616
|
+
}
|
|
2617
|
+
const data = options.data;
|
|
2618
|
+
const fileBytes = data instanceof Uint8Array ? data : Uint8Array.from(atob(data), (c) => c.charCodeAt(0));
|
|
2619
|
+
const mediaType = options.mediaType;
|
|
2620
|
+
const displayName = googleOptions == null ? void 0 : googleOptions.displayName;
|
|
2621
|
+
const baseOrigin = this.config.baseURL.replace(/\/v1beta$/, "");
|
|
2622
|
+
const initResponse = await fetchFn(`${baseOrigin}/upload/v1beta/files`, {
|
|
2623
|
+
method: "POST",
|
|
2624
|
+
headers: {
|
|
2625
|
+
...resolvedHeaders,
|
|
2626
|
+
"X-Goog-Upload-Protocol": "resumable",
|
|
2627
|
+
"X-Goog-Upload-Command": "start",
|
|
2628
|
+
"X-Goog-Upload-Header-Content-Length": String(fileBytes.length),
|
|
2629
|
+
"X-Goog-Upload-Header-Content-Type": mediaType,
|
|
2630
|
+
"Content-Type": "application/json"
|
|
2631
|
+
},
|
|
2632
|
+
body: JSON.stringify({
|
|
2633
|
+
file: {
|
|
2634
|
+
...displayName != null ? { display_name: displayName } : {}
|
|
2635
|
+
}
|
|
2636
|
+
})
|
|
2637
|
+
});
|
|
2638
|
+
if (!initResponse.ok) {
|
|
2639
|
+
const errorBody = await initResponse.text();
|
|
2640
|
+
throw new AISDKError({
|
|
2641
|
+
name: "GOOGLE_FILES_UPLOAD_ERROR",
|
|
2642
|
+
message: `Failed to initiate resumable upload: ${initResponse.status} ${errorBody}`
|
|
2643
|
+
});
|
|
2644
|
+
}
|
|
2645
|
+
const uploadUrl = initResponse.headers.get("x-goog-upload-url");
|
|
2646
|
+
if (!uploadUrl) {
|
|
2647
|
+
throw new AISDKError({
|
|
2648
|
+
name: "GOOGLE_FILES_UPLOAD_ERROR",
|
|
2649
|
+
message: "No upload URL returned from initiation request"
|
|
2650
|
+
});
|
|
2651
|
+
}
|
|
2652
|
+
const uploadResponse = await fetchFn(uploadUrl, {
|
|
2653
|
+
method: "POST",
|
|
2654
|
+
headers: {
|
|
2655
|
+
"Content-Length": String(fileBytes.length),
|
|
2656
|
+
"X-Goog-Upload-Offset": "0",
|
|
2657
|
+
"X-Goog-Upload-Command": "upload, finalize"
|
|
2658
|
+
},
|
|
2659
|
+
body: fileBytes
|
|
2660
|
+
});
|
|
2661
|
+
if (!uploadResponse.ok) {
|
|
2662
|
+
const errorBody = await uploadResponse.text();
|
|
2663
|
+
throw new AISDKError({
|
|
2664
|
+
name: "GOOGLE_FILES_UPLOAD_ERROR",
|
|
2665
|
+
message: `Failed to upload file data: ${uploadResponse.status} ${errorBody}`
|
|
2666
|
+
});
|
|
2667
|
+
}
|
|
2668
|
+
const uploadResult = await uploadResponse.json();
|
|
2669
|
+
let file = uploadResult.file;
|
|
2670
|
+
const pollIntervalMs = (_b = googleOptions == null ? void 0 : googleOptions.pollIntervalMs) != null ? _b : 2e3;
|
|
2671
|
+
const pollTimeoutMs = (_c = googleOptions == null ? void 0 : googleOptions.pollTimeoutMs) != null ? _c : 3e5;
|
|
2672
|
+
const startTime = Date.now();
|
|
2673
|
+
while (file.state === "PROCESSING") {
|
|
2674
|
+
if (Date.now() - startTime > pollTimeoutMs) {
|
|
2675
|
+
throw new AISDKError({
|
|
2676
|
+
name: "GOOGLE_FILES_UPLOAD_TIMEOUT",
|
|
2677
|
+
message: `File processing timed out after ${pollTimeoutMs}ms`
|
|
2678
|
+
});
|
|
2679
|
+
}
|
|
2680
|
+
await delay(pollIntervalMs);
|
|
2681
|
+
const { value: fileStatus } = await getFromApi({
|
|
2682
|
+
url: `${this.config.baseURL}/${file.name}`,
|
|
2683
|
+
headers: combineHeaders4(resolvedHeaders),
|
|
2684
|
+
successfulResponseHandler: createJsonResponseHandler4(
|
|
2685
|
+
googleFileResponseSchema
|
|
2686
|
+
),
|
|
2687
|
+
failedResponseHandler: googleFailedResponseHandler,
|
|
2688
|
+
fetch: this.config.fetch
|
|
2689
|
+
});
|
|
2690
|
+
file = fileStatus;
|
|
2691
|
+
}
|
|
2692
|
+
if (file.state === "FAILED") {
|
|
2693
|
+
throw new AISDKError({
|
|
2694
|
+
name: "GOOGLE_FILES_UPLOAD_FAILED",
|
|
2695
|
+
message: `File processing failed for ${file.name}`
|
|
2696
|
+
});
|
|
2697
|
+
}
|
|
2698
|
+
return {
|
|
2699
|
+
warnings,
|
|
2700
|
+
providerReference: { google: file.uri },
|
|
2701
|
+
mediaType: (_d = file.mimeType) != null ? _d : options.mediaType,
|
|
2702
|
+
providerMetadata: {
|
|
2703
|
+
google: {
|
|
2704
|
+
name: file.name,
|
|
2705
|
+
displayName: file.displayName,
|
|
2706
|
+
mimeType: file.mimeType,
|
|
2707
|
+
sizeBytes: file.sizeBytes,
|
|
2708
|
+
state: file.state,
|
|
2709
|
+
uri: file.uri,
|
|
2710
|
+
...file.createTime != null ? { createTime: file.createTime } : {},
|
|
2711
|
+
...file.updateTime != null ? { updateTime: file.updateTime } : {},
|
|
2712
|
+
...file.expirationTime != null ? { expirationTime: file.expirationTime } : {},
|
|
2713
|
+
...file.sha256Hash != null ? { sha256Hash: file.sha256Hash } : {}
|
|
2714
|
+
}
|
|
2715
|
+
}
|
|
2716
|
+
};
|
|
2717
|
+
}
|
|
2718
|
+
};
|
|
2719
|
+
var googleFileResponseSchema = lazySchema12(
|
|
2720
|
+
() => zodSchema12(
|
|
2721
|
+
z14.object({
|
|
2722
|
+
name: z14.string(),
|
|
2723
|
+
displayName: z14.string().nullish(),
|
|
2724
|
+
mimeType: z14.string(),
|
|
2725
|
+
sizeBytes: z14.string().nullish(),
|
|
2726
|
+
createTime: z14.string().nullish(),
|
|
2727
|
+
updateTime: z14.string().nullish(),
|
|
2728
|
+
expirationTime: z14.string().nullish(),
|
|
2729
|
+
sha256Hash: z14.string().nullish(),
|
|
2730
|
+
uri: z14.string(),
|
|
2731
|
+
state: z14.string()
|
|
2732
|
+
})
|
|
2733
|
+
)
|
|
2734
|
+
);
|
|
2735
|
+
var googleFilesUploadOptionsSchema = lazySchema12(
|
|
2736
|
+
() => zodSchema12(
|
|
2737
|
+
z14.object({
|
|
2738
|
+
displayName: z14.string().nullish(),
|
|
2739
|
+
pollIntervalMs: z14.number().positive().nullish(),
|
|
2740
|
+
pollTimeoutMs: z14.number().positive().nullish()
|
|
2741
|
+
}).passthrough()
|
|
2742
|
+
)
|
|
2743
|
+
);
|
|
2744
|
+
|
|
2745
|
+
// src/google-generative-ai-video-model.ts
|
|
2746
|
+
import {
|
|
2747
|
+
AISDKError as AISDKError2
|
|
2748
|
+
} from "@ai-sdk/provider";
|
|
2749
|
+
import {
|
|
2750
|
+
combineHeaders as combineHeaders5,
|
|
2751
|
+
convertUint8ArrayToBase64 as convertUint8ArrayToBase642,
|
|
2752
|
+
createJsonResponseHandler as createJsonResponseHandler5,
|
|
2753
|
+
delay as delay2,
|
|
2754
|
+
getFromApi as getFromApi2,
|
|
2755
|
+
lazySchema as lazySchema13,
|
|
2756
|
+
parseProviderOptions as parseProviderOptions5,
|
|
2757
|
+
postJsonToApi as postJsonToApi5,
|
|
2758
|
+
resolve as resolve4,
|
|
2759
|
+
zodSchema as zodSchema13
|
|
2760
|
+
} from "@ai-sdk/provider-utils";
|
|
2761
|
+
import { z as z15 } from "zod/v4";
|
|
2560
2762
|
var GoogleGenerativeAIVideoModel = class {
|
|
2561
2763
|
constructor(modelId, config) {
|
|
2562
2764
|
this.modelId = modelId;
|
|
@@ -2573,7 +2775,7 @@ var GoogleGenerativeAIVideoModel = class {
|
|
|
2573
2775
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2574
2776
|
const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
|
|
2575
2777
|
const warnings = [];
|
|
2576
|
-
const googleOptions = await
|
|
2778
|
+
const googleOptions = await parseProviderOptions5({
|
|
2577
2779
|
provider: "google",
|
|
2578
2780
|
providerOptions: options.providerOptions,
|
|
2579
2781
|
schema: googleVideoModelOptionsSchema
|
|
@@ -2591,7 +2793,7 @@ var GoogleGenerativeAIVideoModel = class {
|
|
|
2591
2793
|
details: "Google Generative AI video models require base64-encoded images. URL will be ignored."
|
|
2592
2794
|
});
|
|
2593
2795
|
} else {
|
|
2594
|
-
const base64Data = typeof options.image.data === "string" ? options.image.data :
|
|
2796
|
+
const base64Data = typeof options.image.data === "string" ? options.image.data : convertUint8ArrayToBase642(options.image.data);
|
|
2595
2797
|
instance.image = {
|
|
2596
2798
|
inlineData: {
|
|
2597
2799
|
mimeType: options.image.mediaType || "image/png",
|
|
@@ -2657,9 +2859,9 @@ var GoogleGenerativeAIVideoModel = class {
|
|
|
2657
2859
|
}
|
|
2658
2860
|
}
|
|
2659
2861
|
}
|
|
2660
|
-
const { value: operation } = await
|
|
2862
|
+
const { value: operation } = await postJsonToApi5({
|
|
2661
2863
|
url: `${this.config.baseURL}/models/${this.modelId}:predictLongRunning`,
|
|
2662
|
-
headers:
|
|
2864
|
+
headers: combineHeaders5(
|
|
2663
2865
|
await resolve4(this.config.headers),
|
|
2664
2866
|
options.headers
|
|
2665
2867
|
),
|
|
@@ -2667,7 +2869,7 @@ var GoogleGenerativeAIVideoModel = class {
|
|
|
2667
2869
|
instances,
|
|
2668
2870
|
parameters
|
|
2669
2871
|
},
|
|
2670
|
-
successfulResponseHandler:
|
|
2872
|
+
successfulResponseHandler: createJsonResponseHandler5(
|
|
2671
2873
|
googleOperationSchema
|
|
2672
2874
|
),
|
|
2673
2875
|
failedResponseHandler: googleFailedResponseHandler,
|
|
@@ -2676,7 +2878,7 @@ var GoogleGenerativeAIVideoModel = class {
|
|
|
2676
2878
|
});
|
|
2677
2879
|
const operationName = operation.name;
|
|
2678
2880
|
if (!operationName) {
|
|
2679
|
-
throw new
|
|
2881
|
+
throw new AISDKError2({
|
|
2680
2882
|
name: "GOOGLE_VIDEO_GENERATION_ERROR",
|
|
2681
2883
|
message: "No operation name returned from API"
|
|
2682
2884
|
});
|
|
@@ -2688,25 +2890,25 @@ var GoogleGenerativeAIVideoModel = class {
|
|
|
2688
2890
|
let responseHeaders;
|
|
2689
2891
|
while (!finalOperation.done) {
|
|
2690
2892
|
if (Date.now() - startTime > pollTimeoutMs) {
|
|
2691
|
-
throw new
|
|
2893
|
+
throw new AISDKError2({
|
|
2692
2894
|
name: "GOOGLE_VIDEO_GENERATION_TIMEOUT",
|
|
2693
2895
|
message: `Video generation timed out after ${pollTimeoutMs}ms`
|
|
2694
2896
|
});
|
|
2695
2897
|
}
|
|
2696
|
-
await
|
|
2898
|
+
await delay2(pollIntervalMs);
|
|
2697
2899
|
if ((_f = options.abortSignal) == null ? void 0 : _f.aborted) {
|
|
2698
|
-
throw new
|
|
2900
|
+
throw new AISDKError2({
|
|
2699
2901
|
name: "GOOGLE_VIDEO_GENERATION_ABORTED",
|
|
2700
2902
|
message: "Video generation request was aborted"
|
|
2701
2903
|
});
|
|
2702
2904
|
}
|
|
2703
|
-
const { value: statusOperation, responseHeaders: pollHeaders } = await
|
|
2905
|
+
const { value: statusOperation, responseHeaders: pollHeaders } = await getFromApi2({
|
|
2704
2906
|
url: `${this.config.baseURL}/${operationName}`,
|
|
2705
|
-
headers:
|
|
2907
|
+
headers: combineHeaders5(
|
|
2706
2908
|
await resolve4(this.config.headers),
|
|
2707
2909
|
options.headers
|
|
2708
2910
|
),
|
|
2709
|
-
successfulResponseHandler:
|
|
2911
|
+
successfulResponseHandler: createJsonResponseHandler5(
|
|
2710
2912
|
googleOperationSchema
|
|
2711
2913
|
),
|
|
2712
2914
|
failedResponseHandler: googleFailedResponseHandler,
|
|
@@ -2717,14 +2919,14 @@ var GoogleGenerativeAIVideoModel = class {
|
|
|
2717
2919
|
responseHeaders = pollHeaders;
|
|
2718
2920
|
}
|
|
2719
2921
|
if (finalOperation.error) {
|
|
2720
|
-
throw new
|
|
2922
|
+
throw new AISDKError2({
|
|
2721
2923
|
name: "GOOGLE_VIDEO_GENERATION_FAILED",
|
|
2722
2924
|
message: `Video generation failed: ${finalOperation.error.message}`
|
|
2723
2925
|
});
|
|
2724
2926
|
}
|
|
2725
2927
|
const response = finalOperation.response;
|
|
2726
2928
|
if (!((_g = response == null ? void 0 : response.generateVideoResponse) == null ? void 0 : _g.generatedSamples) || response.generateVideoResponse.generatedSamples.length === 0) {
|
|
2727
|
-
throw new
|
|
2929
|
+
throw new AISDKError2({
|
|
2728
2930
|
name: "GOOGLE_VIDEO_GENERATION_ERROR",
|
|
2729
2931
|
message: `No videos in response. Response: ${JSON.stringify(finalOperation)}`
|
|
2730
2932
|
});
|
|
@@ -2747,7 +2949,7 @@ var GoogleGenerativeAIVideoModel = class {
|
|
|
2747
2949
|
}
|
|
2748
2950
|
}
|
|
2749
2951
|
if (videos.length === 0) {
|
|
2750
|
-
throw new
|
|
2952
|
+
throw new AISDKError2({
|
|
2751
2953
|
name: "GOOGLE_VIDEO_GENERATION_ERROR",
|
|
2752
2954
|
message: "No valid videos in response"
|
|
2753
2955
|
});
|
|
@@ -2768,37 +2970,37 @@ var GoogleGenerativeAIVideoModel = class {
|
|
|
2768
2970
|
};
|
|
2769
2971
|
}
|
|
2770
2972
|
};
|
|
2771
|
-
var googleOperationSchema =
|
|
2772
|
-
name:
|
|
2773
|
-
done:
|
|
2774
|
-
error:
|
|
2775
|
-
code:
|
|
2776
|
-
message:
|
|
2777
|
-
status:
|
|
2973
|
+
var googleOperationSchema = z15.object({
|
|
2974
|
+
name: z15.string().nullish(),
|
|
2975
|
+
done: z15.boolean().nullish(),
|
|
2976
|
+
error: z15.object({
|
|
2977
|
+
code: z15.number().nullish(),
|
|
2978
|
+
message: z15.string(),
|
|
2979
|
+
status: z15.string().nullish()
|
|
2778
2980
|
}).nullish(),
|
|
2779
|
-
response:
|
|
2780
|
-
generateVideoResponse:
|
|
2781
|
-
generatedSamples:
|
|
2782
|
-
|
|
2783
|
-
video:
|
|
2784
|
-
uri:
|
|
2981
|
+
response: z15.object({
|
|
2982
|
+
generateVideoResponse: z15.object({
|
|
2983
|
+
generatedSamples: z15.array(
|
|
2984
|
+
z15.object({
|
|
2985
|
+
video: z15.object({
|
|
2986
|
+
uri: z15.string().nullish()
|
|
2785
2987
|
}).nullish()
|
|
2786
2988
|
})
|
|
2787
2989
|
).nullish()
|
|
2788
2990
|
}).nullish()
|
|
2789
2991
|
}).nullish()
|
|
2790
2992
|
});
|
|
2791
|
-
var googleVideoModelOptionsSchema =
|
|
2792
|
-
() =>
|
|
2793
|
-
|
|
2794
|
-
pollIntervalMs:
|
|
2795
|
-
pollTimeoutMs:
|
|
2796
|
-
personGeneration:
|
|
2797
|
-
negativePrompt:
|
|
2798
|
-
referenceImages:
|
|
2799
|
-
|
|
2800
|
-
bytesBase64Encoded:
|
|
2801
|
-
gcsUri:
|
|
2993
|
+
var googleVideoModelOptionsSchema = lazySchema13(
|
|
2994
|
+
() => zodSchema13(
|
|
2995
|
+
z15.object({
|
|
2996
|
+
pollIntervalMs: z15.number().positive().nullish(),
|
|
2997
|
+
pollTimeoutMs: z15.number().positive().nullish(),
|
|
2998
|
+
personGeneration: z15.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
|
|
2999
|
+
negativePrompt: z15.string().nullish(),
|
|
3000
|
+
referenceImages: z15.array(
|
|
3001
|
+
z15.object({
|
|
3002
|
+
bytesBase64Encoded: z15.string().nullish(),
|
|
3003
|
+
gcsUri: z15.string().nullish()
|
|
2802
3004
|
})
|
|
2803
3005
|
).nullish()
|
|
2804
3006
|
}).passthrough()
|
|
@@ -2855,6 +3057,12 @@ function createGoogleGenerativeAI(options = {}) {
|
|
|
2855
3057
|
headers: getHeaders,
|
|
2856
3058
|
fetch: options.fetch
|
|
2857
3059
|
});
|
|
3060
|
+
const createFiles = () => new GoogleGenerativeAIFiles({
|
|
3061
|
+
provider: providerName,
|
|
3062
|
+
baseURL,
|
|
3063
|
+
headers: getHeaders,
|
|
3064
|
+
fetch: options.fetch
|
|
3065
|
+
});
|
|
2858
3066
|
const createVideoModel = (modelId) => {
|
|
2859
3067
|
var _a2;
|
|
2860
3068
|
return new GoogleGenerativeAIVideoModel(modelId, {
|
|
@@ -2885,6 +3093,7 @@ function createGoogleGenerativeAI(options = {}) {
|
|
|
2885
3093
|
provider.imageModel = createImageModel;
|
|
2886
3094
|
provider.video = createVideoModel;
|
|
2887
3095
|
provider.videoModel = createVideoModel;
|
|
3096
|
+
provider.files = createFiles;
|
|
2888
3097
|
provider.tools = googleTools;
|
|
2889
3098
|
return provider;
|
|
2890
3099
|
}
|