@google/genai 1.16.0 → 1.17.0
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/dist/genai.d.ts +75 -137
- package/dist/index.cjs +13 -42
- package/dist/index.mjs +13 -42
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +13 -42
- package/dist/node/index.mjs +13 -42
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +75 -137
- package/dist/web/index.mjs +13 -42
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +75 -137
- package/package.json +1 -1
package/dist/genai.d.ts
CHANGED
|
@@ -1720,54 +1720,40 @@ export declare interface EditImageConfig {
|
|
|
1720
1720
|
be charged usage for any applicable operations.
|
|
1721
1721
|
*/
|
|
1722
1722
|
abortSignal?: AbortSignal;
|
|
1723
|
-
/** Cloud Storage URI used to store the generated images.
|
|
1724
|
-
*/
|
|
1723
|
+
/** Cloud Storage URI used to store the generated images. */
|
|
1725
1724
|
outputGcsUri?: string;
|
|
1726
|
-
/** Description of what to discourage in the generated images.
|
|
1727
|
-
*/
|
|
1725
|
+
/** Description of what to discourage in the generated images. */
|
|
1728
1726
|
negativePrompt?: string;
|
|
1729
|
-
/** Number of images to generate.
|
|
1730
|
-
*/
|
|
1727
|
+
/** Number of images to generate. */
|
|
1731
1728
|
numberOfImages?: number;
|
|
1732
1729
|
/** Aspect ratio of the generated images. Supported values are
|
|
1733
|
-
"1:1", "3:4", "4:3", "9:16", and "16:9".
|
|
1734
|
-
*/
|
|
1730
|
+
"1:1", "3:4", "4:3", "9:16", and "16:9". */
|
|
1735
1731
|
aspectRatio?: string;
|
|
1736
1732
|
/** Controls how much the model adheres to the text prompt. Large
|
|
1737
1733
|
values increase output and prompt alignment, but may compromise image
|
|
1738
|
-
quality.
|
|
1739
|
-
*/
|
|
1734
|
+
quality. */
|
|
1740
1735
|
guidanceScale?: number;
|
|
1741
1736
|
/** Random seed for image generation. This is not available when
|
|
1742
|
-
``add_watermark`` is set to true.
|
|
1743
|
-
*/
|
|
1737
|
+
``add_watermark`` is set to true. */
|
|
1744
1738
|
seed?: number;
|
|
1745
|
-
/** Filter level for safety filtering.
|
|
1746
|
-
*/
|
|
1739
|
+
/** Filter level for safety filtering. */
|
|
1747
1740
|
safetyFilterLevel?: SafetyFilterLevel;
|
|
1748
|
-
/** Allows generation of people by the model.
|
|
1749
|
-
*/
|
|
1741
|
+
/** Allows generation of people by the model. */
|
|
1750
1742
|
personGeneration?: PersonGeneration;
|
|
1751
1743
|
/** Whether to report the safety scores of each generated image and
|
|
1752
|
-
the positive prompt in the response.
|
|
1753
|
-
*/
|
|
1744
|
+
the positive prompt in the response. */
|
|
1754
1745
|
includeSafetyAttributes?: boolean;
|
|
1755
1746
|
/** Whether to include the Responsible AI filter reason if the image
|
|
1756
|
-
is filtered out of the response.
|
|
1757
|
-
*/
|
|
1747
|
+
is filtered out of the response. */
|
|
1758
1748
|
includeRaiReason?: boolean;
|
|
1759
|
-
/** Language of the text in the prompt.
|
|
1760
|
-
*/
|
|
1749
|
+
/** Language of the text in the prompt. */
|
|
1761
1750
|
language?: ImagePromptLanguage;
|
|
1762
|
-
/** MIME type of the generated image.
|
|
1763
|
-
*/
|
|
1751
|
+
/** MIME type of the generated image. */
|
|
1764
1752
|
outputMimeType?: string;
|
|
1765
1753
|
/** Compression quality of the generated image (for ``image/jpeg``
|
|
1766
|
-
only).
|
|
1767
|
-
*/
|
|
1754
|
+
only). */
|
|
1768
1755
|
outputCompressionQuality?: number;
|
|
1769
|
-
/** Whether to add a watermark to the generated images.
|
|
1770
|
-
*/
|
|
1756
|
+
/** Whether to add a watermark to the generated images. */
|
|
1771
1757
|
addWatermark?: boolean;
|
|
1772
1758
|
/** Describes the editing mode for the request. */
|
|
1773
1759
|
editMode?: EditMode;
|
|
@@ -1796,7 +1782,7 @@ export declare class EditImageResponse {
|
|
|
1796
1782
|
generatedImages?: GeneratedImage[];
|
|
1797
1783
|
}
|
|
1798
1784
|
|
|
1799
|
-
/** Enum representing the
|
|
1785
|
+
/** Enum representing the editing mode. */
|
|
1800
1786
|
export declare enum EditMode {
|
|
1801
1787
|
EDIT_MODE_DEFAULT = "EDIT_MODE_DEFAULT",
|
|
1802
1788
|
EDIT_MODE_INPAINT_REMOVAL = "EDIT_MODE_INPAINT_REMOVAL",
|
|
@@ -2724,20 +2710,16 @@ export declare class GenerateContentResponseUsageMetadata {
|
|
|
2724
2710
|
|
|
2725
2711
|
/** An output image. */
|
|
2726
2712
|
export declare interface GeneratedImage {
|
|
2727
|
-
/** The output image data.
|
|
2728
|
-
*/
|
|
2713
|
+
/** The output image data. */
|
|
2729
2714
|
image?: Image_2;
|
|
2730
2715
|
/** Responsible AI filter reason if the image is filtered out of the
|
|
2731
|
-
response.
|
|
2732
|
-
*/
|
|
2716
|
+
response. */
|
|
2733
2717
|
raiFilteredReason?: string;
|
|
2734
2718
|
/** Safety attributes of the image. Lists of RAI categories and their
|
|
2735
|
-
scores of each content.
|
|
2736
|
-
*/
|
|
2719
|
+
scores of each content. */
|
|
2737
2720
|
safetyAttributes?: SafetyAttributes;
|
|
2738
2721
|
/** The rewritten prompt used for the image generation if the prompt
|
|
2739
|
-
enhancer is enabled.
|
|
2740
|
-
*/
|
|
2722
|
+
enhancer is enabled. */
|
|
2741
2723
|
enhancedPrompt?: string;
|
|
2742
2724
|
}
|
|
2743
2725
|
|
|
@@ -2766,61 +2748,45 @@ export declare interface GenerateImagesConfig {
|
|
|
2766
2748
|
be charged usage for any applicable operations.
|
|
2767
2749
|
*/
|
|
2768
2750
|
abortSignal?: AbortSignal;
|
|
2769
|
-
/** Cloud Storage URI used to store the generated images.
|
|
2770
|
-
*/
|
|
2751
|
+
/** Cloud Storage URI used to store the generated images. */
|
|
2771
2752
|
outputGcsUri?: string;
|
|
2772
|
-
/** Description of what to discourage in the generated images.
|
|
2773
|
-
*/
|
|
2753
|
+
/** Description of what to discourage in the generated images. */
|
|
2774
2754
|
negativePrompt?: string;
|
|
2775
|
-
/** Number of images to generate.
|
|
2776
|
-
*/
|
|
2755
|
+
/** Number of images to generate. */
|
|
2777
2756
|
numberOfImages?: number;
|
|
2778
2757
|
/** Aspect ratio of the generated images. Supported values are
|
|
2779
|
-
"1:1", "3:4", "4:3", "9:16", and "16:9".
|
|
2780
|
-
*/
|
|
2758
|
+
"1:1", "3:4", "4:3", "9:16", and "16:9". */
|
|
2781
2759
|
aspectRatio?: string;
|
|
2782
2760
|
/** Controls how much the model adheres to the text prompt. Large
|
|
2783
2761
|
values increase output and prompt alignment, but may compromise image
|
|
2784
|
-
quality.
|
|
2785
|
-
*/
|
|
2762
|
+
quality. */
|
|
2786
2763
|
guidanceScale?: number;
|
|
2787
2764
|
/** Random seed for image generation. This is not available when
|
|
2788
|
-
``add_watermark`` is set to true.
|
|
2789
|
-
*/
|
|
2765
|
+
``add_watermark`` is set to true. */
|
|
2790
2766
|
seed?: number;
|
|
2791
|
-
/** Filter level for safety filtering.
|
|
2792
|
-
*/
|
|
2767
|
+
/** Filter level for safety filtering. */
|
|
2793
2768
|
safetyFilterLevel?: SafetyFilterLevel;
|
|
2794
|
-
/** Allows generation of people by the model.
|
|
2795
|
-
*/
|
|
2769
|
+
/** Allows generation of people by the model. */
|
|
2796
2770
|
personGeneration?: PersonGeneration;
|
|
2797
2771
|
/** Whether to report the safety scores of each generated image and
|
|
2798
|
-
the positive prompt in the response.
|
|
2799
|
-
*/
|
|
2772
|
+
the positive prompt in the response. */
|
|
2800
2773
|
includeSafetyAttributes?: boolean;
|
|
2801
2774
|
/** Whether to include the Responsible AI filter reason if the image
|
|
2802
|
-
is filtered out of the response.
|
|
2803
|
-
*/
|
|
2775
|
+
is filtered out of the response. */
|
|
2804
2776
|
includeRaiReason?: boolean;
|
|
2805
|
-
/** Language of the text in the prompt.
|
|
2806
|
-
*/
|
|
2777
|
+
/** Language of the text in the prompt. */
|
|
2807
2778
|
language?: ImagePromptLanguage;
|
|
2808
|
-
/** MIME type of the generated image.
|
|
2809
|
-
*/
|
|
2779
|
+
/** MIME type of the generated image. */
|
|
2810
2780
|
outputMimeType?: string;
|
|
2811
2781
|
/** Compression quality of the generated image (for ``image/jpeg``
|
|
2812
|
-
only).
|
|
2813
|
-
*/
|
|
2782
|
+
only). */
|
|
2814
2783
|
outputCompressionQuality?: number;
|
|
2815
|
-
/** Whether to add a watermark to the generated images.
|
|
2816
|
-
*/
|
|
2784
|
+
/** Whether to add a watermark to the generated images. */
|
|
2817
2785
|
addWatermark?: boolean;
|
|
2818
2786
|
/** The size of the largest dimension of the generated image.
|
|
2819
|
-
Supported sizes are 1K and 2K (not supported for Imagen 3 models).
|
|
2820
|
-
*/
|
|
2787
|
+
Supported sizes are 1K and 2K (not supported for Imagen 3 models). */
|
|
2821
2788
|
imageSize?: string;
|
|
2822
|
-
/** Whether to use the prompt rewriting logic.
|
|
2823
|
-
*/
|
|
2789
|
+
/** Whether to use the prompt rewriting logic. */
|
|
2824
2790
|
enhancePrompt?: boolean;
|
|
2825
2791
|
}
|
|
2826
2792
|
|
|
@@ -2841,12 +2807,10 @@ export declare interface GenerateImagesParameters {
|
|
|
2841
2807
|
export declare class GenerateImagesResponse {
|
|
2842
2808
|
/** Used to retain the full HTTP response. */
|
|
2843
2809
|
sdkHttpResponse?: HttpResponse;
|
|
2844
|
-
/** List of generated images.
|
|
2845
|
-
*/
|
|
2810
|
+
/** List of generated images. */
|
|
2846
2811
|
generatedImages?: GeneratedImage[];
|
|
2847
2812
|
/** Safety attributes of the positive prompt. Only populated if
|
|
2848
|
-
``include_safety_attributes`` is set to True.
|
|
2849
|
-
*/
|
|
2813
|
+
``include_safety_attributes`` is set to True. */
|
|
2850
2814
|
positivePromptSafetyAttributes?: SafetyAttributes;
|
|
2851
2815
|
}
|
|
2852
2816
|
|
|
@@ -2869,23 +2833,32 @@ export declare interface GenerateVideosConfig {
|
|
|
2869
2833
|
fps?: number;
|
|
2870
2834
|
/** Duration of the clip for video generation in seconds. */
|
|
2871
2835
|
durationSeconds?: number;
|
|
2872
|
-
/** The RNG seed. If RNG seed is exactly same for each request with
|
|
2836
|
+
/** The RNG seed. If RNG seed is exactly same for each request with
|
|
2837
|
+
unchanged inputs, the prediction results will be consistent. Otherwise,
|
|
2838
|
+
a random RNG seed will be used each time to produce a different
|
|
2839
|
+
result. */
|
|
2873
2840
|
seed?: number;
|
|
2874
|
-
/** The aspect ratio for the generated video. 16:9 (landscape) and
|
|
2841
|
+
/** The aspect ratio for the generated video. 16:9 (landscape) and
|
|
2842
|
+
9:16 (portrait) are supported. */
|
|
2875
2843
|
aspectRatio?: string;
|
|
2876
|
-
/** The resolution for the generated video. 720p and 1080p are
|
|
2844
|
+
/** The resolution for the generated video. 720p and 1080p are
|
|
2845
|
+
supported. */
|
|
2877
2846
|
resolution?: string;
|
|
2878
|
-
/** Whether allow to generate person videos, and restrict to specific
|
|
2847
|
+
/** Whether allow to generate person videos, and restrict to specific
|
|
2848
|
+
ages. Supported values are: dont_allow, allow_adult. */
|
|
2879
2849
|
personGeneration?: string;
|
|
2880
|
-
/** The pubsub topic where to publish the video generation
|
|
2850
|
+
/** The pubsub topic where to publish the video generation
|
|
2851
|
+
progress. */
|
|
2881
2852
|
pubsubTopic?: string;
|
|
2882
|
-
/**
|
|
2853
|
+
/** Explicitly state what should not be included in the generated
|
|
2854
|
+
videos. */
|
|
2883
2855
|
negativePrompt?: string;
|
|
2884
2856
|
/** Whether to use the prompt rewriting logic. */
|
|
2885
2857
|
enhancePrompt?: boolean;
|
|
2886
2858
|
/** Whether to generate audio along with the video. */
|
|
2887
2859
|
generateAudio?: boolean;
|
|
2888
|
-
/** Image to use as the last frame of generated videos.
|
|
2860
|
+
/** Image to use as the last frame of generated videos.
|
|
2861
|
+
Only supported for image to video use cases. */
|
|
2889
2862
|
lastFrame?: Image_2;
|
|
2890
2863
|
/** The images to use as the references to generate the videos.
|
|
2891
2864
|
If this field is provided, the text prompt field must also be provided.
|
|
@@ -2923,13 +2896,14 @@ export declare interface GenerateVideosParameters {
|
|
|
2923
2896
|
/** ID of the model to use. For a list of models, see `Google models
|
|
2924
2897
|
<https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models>`_. */
|
|
2925
2898
|
model: string;
|
|
2926
|
-
/** The text prompt for generating the videos.
|
|
2899
|
+
/** The text prompt for generating the videos.
|
|
2900
|
+
Optional if image or video is provided. */
|
|
2927
2901
|
prompt?: string;
|
|
2928
2902
|
/** The input image for generating the videos.
|
|
2929
|
-
Optional if prompt
|
|
2903
|
+
Optional if prompt is provided. Not allowed if video is provided. */
|
|
2930
2904
|
image?: Image_2;
|
|
2931
2905
|
/** The input video for video extension use cases.
|
|
2932
|
-
Optional if prompt
|
|
2906
|
+
Optional if prompt is provided. Not allowed if image is provided. */
|
|
2933
2907
|
video?: Video;
|
|
2934
2908
|
/** A set of source input(s) for video generation. */
|
|
2935
2909
|
source?: GenerateVideosSource;
|
|
@@ -2953,10 +2927,10 @@ export declare interface GenerateVideosSource {
|
|
|
2953
2927
|
Optional if image or video is provided. */
|
|
2954
2928
|
prompt?: string;
|
|
2955
2929
|
/** The input image for generating the videos.
|
|
2956
|
-
Optional if prompt
|
|
2930
|
+
Optional if prompt is provided. Not allowed if video is provided. */
|
|
2957
2931
|
image?: Image_2;
|
|
2958
2932
|
/** The input video for video extension use cases.
|
|
2959
|
-
Optional if prompt
|
|
2933
|
+
Optional if prompt is provided. Not allowed if image is provided. */
|
|
2960
2934
|
video?: Video;
|
|
2961
2935
|
}
|
|
2962
2936
|
|
|
@@ -3641,12 +3615,10 @@ export declare class HttpResponse {
|
|
|
3641
3615
|
/** An image. */
|
|
3642
3616
|
declare interface Image_2 {
|
|
3643
3617
|
/** The Cloud Storage URI of the image. ``Image`` can contain a value
|
|
3644
|
-
for this field or the ``image_bytes`` field but not both.
|
|
3645
|
-
*/
|
|
3618
|
+
for this field or the ``image_bytes`` field but not both. */
|
|
3646
3619
|
gcsUri?: string;
|
|
3647
3620
|
/** The image bytes data. ``Image`` can contain a value for this field
|
|
3648
3621
|
or the ``gcs_uri`` field but not both.
|
|
3649
|
-
|
|
3650
3622
|
* @remarks Encoded as base64 string. */
|
|
3651
3623
|
imageBytes?: string;
|
|
3652
3624
|
/** The MIME type of the image. */
|
|
@@ -5137,26 +5109,16 @@ export declare class Models extends BaseModule {
|
|
|
5137
5109
|
*/
|
|
5138
5110
|
embedContent(params: types.EmbedContentParameters): Promise<types.EmbedContentResponse>;
|
|
5139
5111
|
/**
|
|
5140
|
-
*
|
|
5141
|
-
*
|
|
5142
|
-
* @param params - The parameters for generating images.
|
|
5143
|
-
* @return The response from the API.
|
|
5144
|
-
*
|
|
5145
|
-
* @example
|
|
5146
|
-
* ```ts
|
|
5147
|
-
* const response = await ai.models.generateImages({
|
|
5148
|
-
* model: 'imagen-3.0-generate-002',
|
|
5149
|
-
* prompt: 'Robot holding a red skateboard',
|
|
5150
|
-
* config: {
|
|
5151
|
-
* numberOfImages: 1,
|
|
5152
|
-
* includeRaiReason: true,
|
|
5153
|
-
* },
|
|
5154
|
-
* });
|
|
5155
|
-
* console.log(response?.generatedImages?.[0]?.image?.imageBytes);
|
|
5156
|
-
* ```
|
|
5112
|
+
* Private method for generating images.
|
|
5157
5113
|
*/
|
|
5158
5114
|
private generateImagesInternal;
|
|
5115
|
+
/**
|
|
5116
|
+
* Private method for editing an image.
|
|
5117
|
+
*/
|
|
5159
5118
|
private editImageInternal;
|
|
5119
|
+
/**
|
|
5120
|
+
* Private method for upscaling an image.
|
|
5121
|
+
*/
|
|
5160
5122
|
private upscaleImageInternal;
|
|
5161
5123
|
/**
|
|
5162
5124
|
* Recontextualizes an image.
|
|
@@ -5295,27 +5257,7 @@ export declare class Models extends BaseModule {
|
|
|
5295
5257
|
*/
|
|
5296
5258
|
computeTokens(params: types.ComputeTokensParameters): Promise<types.ComputeTokensResponse>;
|
|
5297
5259
|
/**
|
|
5298
|
-
*
|
|
5299
|
-
*
|
|
5300
|
-
* @param params - The parameters for generating videos.
|
|
5301
|
-
* @return A Promise<GenerateVideosOperation> which allows you to track the progress and eventually retrieve the generated videos using the operations.get method.
|
|
5302
|
-
*
|
|
5303
|
-
* @example
|
|
5304
|
-
* ```ts
|
|
5305
|
-
* const operation = await ai.models.generateVideos({
|
|
5306
|
-
* model: 'veo-2.0-generate-001',
|
|
5307
|
-
* prompt: 'A neon hologram of a cat driving at top speed',
|
|
5308
|
-
* config: {
|
|
5309
|
-
* numberOfVideos: 1
|
|
5310
|
-
* });
|
|
5311
|
-
*
|
|
5312
|
-
* while (!operation.done) {
|
|
5313
|
-
* await new Promise(resolve => setTimeout(resolve, 10000));
|
|
5314
|
-
* operation = await ai.operations.getVideosOperation({operation: operation});
|
|
5315
|
-
* }
|
|
5316
|
-
*
|
|
5317
|
-
* console.log(operation.response?.generatedVideos?.[0]?.video?.uri);
|
|
5318
|
-
* ```
|
|
5260
|
+
* Private method for generating videos.
|
|
5319
5261
|
*/
|
|
5320
5262
|
private generateVideosInternal;
|
|
5321
5263
|
}
|
|
@@ -5903,14 +5845,11 @@ export declare interface RetrievalMetadata {
|
|
|
5903
5845
|
|
|
5904
5846
|
/** Safety attributes of a GeneratedImage or the user-provided prompt. */
|
|
5905
5847
|
export declare interface SafetyAttributes {
|
|
5906
|
-
/** List of RAI categories.
|
|
5907
|
-
*/
|
|
5848
|
+
/** List of RAI categories. */
|
|
5908
5849
|
categories?: string[];
|
|
5909
|
-
/** List of scores of each categories.
|
|
5910
|
-
*/
|
|
5850
|
+
/** List of scores of each categories. */
|
|
5911
5851
|
scores?: number[];
|
|
5912
|
-
/** Internal use only.
|
|
5913
|
-
*/
|
|
5852
|
+
/** Internal use only. */
|
|
5914
5853
|
contentType?: string;
|
|
5915
5854
|
}
|
|
5916
5855
|
|
|
@@ -7517,8 +7456,8 @@ export declare interface UpscaleImageConfig {
|
|
|
7517
7456
|
includeRaiReason?: boolean;
|
|
7518
7457
|
/** The image format that the output should be saved as. */
|
|
7519
7458
|
outputMimeType?: string;
|
|
7520
|
-
/** The level of compression if the
|
|
7521
|
-
``image/jpeg``. */
|
|
7459
|
+
/** The level of compression. Only applicable if the
|
|
7460
|
+
``output_mime_type`` is ``image/jpeg``. */
|
|
7522
7461
|
outputCompressionQuality?: number;
|
|
7523
7462
|
/** Whether to add an image enhancing step before upscaling.
|
|
7524
7463
|
It is expected to suppress the noise and JPEG compression artifacts
|
|
@@ -7672,7 +7611,7 @@ export declare interface Video {
|
|
|
7672
7611
|
/** Video bytes.
|
|
7673
7612
|
* @remarks Encoded as base64 string. */
|
|
7674
7613
|
videoBytes?: string;
|
|
7675
|
-
/** Video encoding, for example
|
|
7614
|
+
/** Video encoding, for example ``video/mp4``. */
|
|
7676
7615
|
mimeType?: string;
|
|
7677
7616
|
}
|
|
7678
7617
|
|
|
@@ -7692,8 +7631,7 @@ export declare enum VideoCompressionQuality {
|
|
|
7692
7631
|
|
|
7693
7632
|
/** A reference image for video generation. */
|
|
7694
7633
|
export declare interface VideoGenerationReferenceImage {
|
|
7695
|
-
/** The reference image.
|
|
7696
|
-
*/
|
|
7634
|
+
/** The reference image. */
|
|
7697
7635
|
image?: Image_2;
|
|
7698
7636
|
/** The type of the reference image, which defines how the reference
|
|
7699
7637
|
image will be used to generate the video. */
|
package/dist/index.cjs
CHANGED
|
@@ -861,7 +861,7 @@ exports.SubjectReferenceType = void 0;
|
|
|
861
861
|
SubjectReferenceType["SUBJECT_TYPE_ANIMAL"] = "SUBJECT_TYPE_ANIMAL";
|
|
862
862
|
SubjectReferenceType["SUBJECT_TYPE_PRODUCT"] = "SUBJECT_TYPE_PRODUCT";
|
|
863
863
|
})(exports.SubjectReferenceType || (exports.SubjectReferenceType = {}));
|
|
864
|
-
/** Enum representing the
|
|
864
|
+
/** Enum representing the editing mode. */
|
|
865
865
|
exports.EditMode = void 0;
|
|
866
866
|
(function (EditMode) {
|
|
867
867
|
EditMode["EDIT_MODE_DEFAULT"] = "EDIT_MODE_DEFAULT";
|
|
@@ -6617,7 +6617,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
6617
6617
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
6618
6618
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
6619
6619
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
6620
|
-
const SDK_VERSION = '1.
|
|
6620
|
+
const SDK_VERSION = '1.17.0'; // x-release-please-version
|
|
6621
6621
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
6622
6622
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
6623
6623
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -11193,8 +11193,9 @@ function generateVideosConfigToMldev(fromObject, parentObject) {
|
|
|
11193
11193
|
if (parentObject !== undefined && fromAspectRatio != null) {
|
|
11194
11194
|
setValueByPath(parentObject, ['parameters', 'aspectRatio'], fromAspectRatio);
|
|
11195
11195
|
}
|
|
11196
|
-
|
|
11197
|
-
|
|
11196
|
+
const fromResolution = getValueByPath(fromObject, ['resolution']);
|
|
11197
|
+
if (parentObject !== undefined && fromResolution != null) {
|
|
11198
|
+
setValueByPath(parentObject, ['parameters', 'resolution'], fromResolution);
|
|
11198
11199
|
}
|
|
11199
11200
|
const fromPersonGeneration = getValueByPath(fromObject, [
|
|
11200
11201
|
'personGeneration',
|
|
@@ -15883,23 +15884,7 @@ class Models extends BaseModule {
|
|
|
15883
15884
|
}
|
|
15884
15885
|
}
|
|
15885
15886
|
/**
|
|
15886
|
-
*
|
|
15887
|
-
*
|
|
15888
|
-
* @param params - The parameters for generating images.
|
|
15889
|
-
* @return The response from the API.
|
|
15890
|
-
*
|
|
15891
|
-
* @example
|
|
15892
|
-
* ```ts
|
|
15893
|
-
* const response = await ai.models.generateImages({
|
|
15894
|
-
* model: 'imagen-3.0-generate-002',
|
|
15895
|
-
* prompt: 'Robot holding a red skateboard',
|
|
15896
|
-
* config: {
|
|
15897
|
-
* numberOfImages: 1,
|
|
15898
|
-
* includeRaiReason: true,
|
|
15899
|
-
* },
|
|
15900
|
-
* });
|
|
15901
|
-
* console.log(response?.generatedImages?.[0]?.image?.imageBytes);
|
|
15902
|
-
* ```
|
|
15887
|
+
* Private method for generating images.
|
|
15903
15888
|
*/
|
|
15904
15889
|
async generateImagesInternal(params) {
|
|
15905
15890
|
var _a, _b, _c, _d;
|
|
@@ -15971,6 +15956,9 @@ class Models extends BaseModule {
|
|
|
15971
15956
|
});
|
|
15972
15957
|
}
|
|
15973
15958
|
}
|
|
15959
|
+
/**
|
|
15960
|
+
* Private method for editing an image.
|
|
15961
|
+
*/
|
|
15974
15962
|
async editImageInternal(params) {
|
|
15975
15963
|
var _a, _b;
|
|
15976
15964
|
let response;
|
|
@@ -16012,6 +16000,9 @@ class Models extends BaseModule {
|
|
|
16012
16000
|
throw new Error('This method is only supported by the Vertex AI.');
|
|
16013
16001
|
}
|
|
16014
16002
|
}
|
|
16003
|
+
/**
|
|
16004
|
+
* Private method for upscaling an image.
|
|
16005
|
+
*/
|
|
16015
16006
|
async upscaleImageInternal(params) {
|
|
16016
16007
|
var _a, _b;
|
|
16017
16008
|
let response;
|
|
@@ -16611,27 +16602,7 @@ class Models extends BaseModule {
|
|
|
16611
16602
|
}
|
|
16612
16603
|
}
|
|
16613
16604
|
/**
|
|
16614
|
-
*
|
|
16615
|
-
*
|
|
16616
|
-
* @param params - The parameters for generating videos.
|
|
16617
|
-
* @return A Promise<GenerateVideosOperation> which allows you to track the progress and eventually retrieve the generated videos using the operations.get method.
|
|
16618
|
-
*
|
|
16619
|
-
* @example
|
|
16620
|
-
* ```ts
|
|
16621
|
-
* const operation = await ai.models.generateVideos({
|
|
16622
|
-
* model: 'veo-2.0-generate-001',
|
|
16623
|
-
* prompt: 'A neon hologram of a cat driving at top speed',
|
|
16624
|
-
* config: {
|
|
16625
|
-
* numberOfVideos: 1
|
|
16626
|
-
* });
|
|
16627
|
-
*
|
|
16628
|
-
* while (!operation.done) {
|
|
16629
|
-
* await new Promise(resolve => setTimeout(resolve, 10000));
|
|
16630
|
-
* operation = await ai.operations.getVideosOperation({operation: operation});
|
|
16631
|
-
* }
|
|
16632
|
-
*
|
|
16633
|
-
* console.log(operation.response?.generatedVideos?.[0]?.video?.uri);
|
|
16634
|
-
* ```
|
|
16605
|
+
* Private method for generating videos.
|
|
16635
16606
|
*/
|
|
16636
16607
|
async generateVideosInternal(params) {
|
|
16637
16608
|
var _a, _b, _c, _d;
|
package/dist/index.mjs
CHANGED
|
@@ -859,7 +859,7 @@ var SubjectReferenceType;
|
|
|
859
859
|
SubjectReferenceType["SUBJECT_TYPE_ANIMAL"] = "SUBJECT_TYPE_ANIMAL";
|
|
860
860
|
SubjectReferenceType["SUBJECT_TYPE_PRODUCT"] = "SUBJECT_TYPE_PRODUCT";
|
|
861
861
|
})(SubjectReferenceType || (SubjectReferenceType = {}));
|
|
862
|
-
/** Enum representing the
|
|
862
|
+
/** Enum representing the editing mode. */
|
|
863
863
|
var EditMode;
|
|
864
864
|
(function (EditMode) {
|
|
865
865
|
EditMode["EDIT_MODE_DEFAULT"] = "EDIT_MODE_DEFAULT";
|
|
@@ -6615,7 +6615,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
6615
6615
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
6616
6616
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
6617
6617
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
6618
|
-
const SDK_VERSION = '1.
|
|
6618
|
+
const SDK_VERSION = '1.17.0'; // x-release-please-version
|
|
6619
6619
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
6620
6620
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
6621
6621
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -11191,8 +11191,9 @@ function generateVideosConfigToMldev(fromObject, parentObject) {
|
|
|
11191
11191
|
if (parentObject !== undefined && fromAspectRatio != null) {
|
|
11192
11192
|
setValueByPath(parentObject, ['parameters', 'aspectRatio'], fromAspectRatio);
|
|
11193
11193
|
}
|
|
11194
|
-
|
|
11195
|
-
|
|
11194
|
+
const fromResolution = getValueByPath(fromObject, ['resolution']);
|
|
11195
|
+
if (parentObject !== undefined && fromResolution != null) {
|
|
11196
|
+
setValueByPath(parentObject, ['parameters', 'resolution'], fromResolution);
|
|
11196
11197
|
}
|
|
11197
11198
|
const fromPersonGeneration = getValueByPath(fromObject, [
|
|
11198
11199
|
'personGeneration',
|
|
@@ -15881,23 +15882,7 @@ class Models extends BaseModule {
|
|
|
15881
15882
|
}
|
|
15882
15883
|
}
|
|
15883
15884
|
/**
|
|
15884
|
-
*
|
|
15885
|
-
*
|
|
15886
|
-
* @param params - The parameters for generating images.
|
|
15887
|
-
* @return The response from the API.
|
|
15888
|
-
*
|
|
15889
|
-
* @example
|
|
15890
|
-
* ```ts
|
|
15891
|
-
* const response = await ai.models.generateImages({
|
|
15892
|
-
* model: 'imagen-3.0-generate-002',
|
|
15893
|
-
* prompt: 'Robot holding a red skateboard',
|
|
15894
|
-
* config: {
|
|
15895
|
-
* numberOfImages: 1,
|
|
15896
|
-
* includeRaiReason: true,
|
|
15897
|
-
* },
|
|
15898
|
-
* });
|
|
15899
|
-
* console.log(response?.generatedImages?.[0]?.image?.imageBytes);
|
|
15900
|
-
* ```
|
|
15885
|
+
* Private method for generating images.
|
|
15901
15886
|
*/
|
|
15902
15887
|
async generateImagesInternal(params) {
|
|
15903
15888
|
var _a, _b, _c, _d;
|
|
@@ -15969,6 +15954,9 @@ class Models extends BaseModule {
|
|
|
15969
15954
|
});
|
|
15970
15955
|
}
|
|
15971
15956
|
}
|
|
15957
|
+
/**
|
|
15958
|
+
* Private method for editing an image.
|
|
15959
|
+
*/
|
|
15972
15960
|
async editImageInternal(params) {
|
|
15973
15961
|
var _a, _b;
|
|
15974
15962
|
let response;
|
|
@@ -16010,6 +15998,9 @@ class Models extends BaseModule {
|
|
|
16010
15998
|
throw new Error('This method is only supported by the Vertex AI.');
|
|
16011
15999
|
}
|
|
16012
16000
|
}
|
|
16001
|
+
/**
|
|
16002
|
+
* Private method for upscaling an image.
|
|
16003
|
+
*/
|
|
16013
16004
|
async upscaleImageInternal(params) {
|
|
16014
16005
|
var _a, _b;
|
|
16015
16006
|
let response;
|
|
@@ -16609,27 +16600,7 @@ class Models extends BaseModule {
|
|
|
16609
16600
|
}
|
|
16610
16601
|
}
|
|
16611
16602
|
/**
|
|
16612
|
-
*
|
|
16613
|
-
*
|
|
16614
|
-
* @param params - The parameters for generating videos.
|
|
16615
|
-
* @return A Promise<GenerateVideosOperation> which allows you to track the progress and eventually retrieve the generated videos using the operations.get method.
|
|
16616
|
-
*
|
|
16617
|
-
* @example
|
|
16618
|
-
* ```ts
|
|
16619
|
-
* const operation = await ai.models.generateVideos({
|
|
16620
|
-
* model: 'veo-2.0-generate-001',
|
|
16621
|
-
* prompt: 'A neon hologram of a cat driving at top speed',
|
|
16622
|
-
* config: {
|
|
16623
|
-
* numberOfVideos: 1
|
|
16624
|
-
* });
|
|
16625
|
-
*
|
|
16626
|
-
* while (!operation.done) {
|
|
16627
|
-
* await new Promise(resolve => setTimeout(resolve, 10000));
|
|
16628
|
-
* operation = await ai.operations.getVideosOperation({operation: operation});
|
|
16629
|
-
* }
|
|
16630
|
-
*
|
|
16631
|
-
* console.log(operation.response?.generatedVideos?.[0]?.video?.uri);
|
|
16632
|
-
* ```
|
|
16603
|
+
* Private method for generating videos.
|
|
16633
16604
|
*/
|
|
16634
16605
|
async generateVideosInternal(params) {
|
|
16635
16606
|
var _a, _b, _c, _d;
|