@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/web/web.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
|
|
|
@@ -3646,12 +3620,10 @@ export declare class HttpResponse {
|
|
|
3646
3620
|
/** An image. */
|
|
3647
3621
|
declare interface Image_2 {
|
|
3648
3622
|
/** The Cloud Storage URI of the image. ``Image`` can contain a value
|
|
3649
|
-
for this field or the ``image_bytes`` field but not both.
|
|
3650
|
-
*/
|
|
3623
|
+
for this field or the ``image_bytes`` field but not both. */
|
|
3651
3624
|
gcsUri?: string;
|
|
3652
3625
|
/** The image bytes data. ``Image`` can contain a value for this field
|
|
3653
3626
|
or the ``gcs_uri`` field but not both.
|
|
3654
|
-
|
|
3655
3627
|
* @remarks Encoded as base64 string. */
|
|
3656
3628
|
imageBytes?: string;
|
|
3657
3629
|
/** The MIME type of the image. */
|
|
@@ -5142,26 +5114,16 @@ export declare class Models extends BaseModule {
|
|
|
5142
5114
|
*/
|
|
5143
5115
|
embedContent(params: types.EmbedContentParameters): Promise<types.EmbedContentResponse>;
|
|
5144
5116
|
/**
|
|
5145
|
-
*
|
|
5146
|
-
*
|
|
5147
|
-
* @param params - The parameters for generating images.
|
|
5148
|
-
* @return The response from the API.
|
|
5149
|
-
*
|
|
5150
|
-
* @example
|
|
5151
|
-
* ```ts
|
|
5152
|
-
* const response = await ai.models.generateImages({
|
|
5153
|
-
* model: 'imagen-3.0-generate-002',
|
|
5154
|
-
* prompt: 'Robot holding a red skateboard',
|
|
5155
|
-
* config: {
|
|
5156
|
-
* numberOfImages: 1,
|
|
5157
|
-
* includeRaiReason: true,
|
|
5158
|
-
* },
|
|
5159
|
-
* });
|
|
5160
|
-
* console.log(response?.generatedImages?.[0]?.image?.imageBytes);
|
|
5161
|
-
* ```
|
|
5117
|
+
* Private method for generating images.
|
|
5162
5118
|
*/
|
|
5163
5119
|
private generateImagesInternal;
|
|
5120
|
+
/**
|
|
5121
|
+
* Private method for editing an image.
|
|
5122
|
+
*/
|
|
5164
5123
|
private editImageInternal;
|
|
5124
|
+
/**
|
|
5125
|
+
* Private method for upscaling an image.
|
|
5126
|
+
*/
|
|
5165
5127
|
private upscaleImageInternal;
|
|
5166
5128
|
/**
|
|
5167
5129
|
* Recontextualizes an image.
|
|
@@ -5300,27 +5262,7 @@ export declare class Models extends BaseModule {
|
|
|
5300
5262
|
*/
|
|
5301
5263
|
computeTokens(params: types.ComputeTokensParameters): Promise<types.ComputeTokensResponse>;
|
|
5302
5264
|
/**
|
|
5303
|
-
*
|
|
5304
|
-
*
|
|
5305
|
-
* @param params - The parameters for generating videos.
|
|
5306
|
-
* @return A Promise<GenerateVideosOperation> which allows you to track the progress and eventually retrieve the generated videos using the operations.get method.
|
|
5307
|
-
*
|
|
5308
|
-
* @example
|
|
5309
|
-
* ```ts
|
|
5310
|
-
* const operation = await ai.models.generateVideos({
|
|
5311
|
-
* model: 'veo-2.0-generate-001',
|
|
5312
|
-
* prompt: 'A neon hologram of a cat driving at top speed',
|
|
5313
|
-
* config: {
|
|
5314
|
-
* numberOfVideos: 1
|
|
5315
|
-
* });
|
|
5316
|
-
*
|
|
5317
|
-
* while (!operation.done) {
|
|
5318
|
-
* await new Promise(resolve => setTimeout(resolve, 10000));
|
|
5319
|
-
* operation = await ai.operations.getVideosOperation({operation: operation});
|
|
5320
|
-
* }
|
|
5321
|
-
*
|
|
5322
|
-
* console.log(operation.response?.generatedVideos?.[0]?.video?.uri);
|
|
5323
|
-
* ```
|
|
5265
|
+
* Private method for generating videos.
|
|
5324
5266
|
*/
|
|
5325
5267
|
private generateVideosInternal;
|
|
5326
5268
|
}
|
|
@@ -5908,14 +5850,11 @@ export declare interface RetrievalMetadata {
|
|
|
5908
5850
|
|
|
5909
5851
|
/** Safety attributes of a GeneratedImage or the user-provided prompt. */
|
|
5910
5852
|
export declare interface SafetyAttributes {
|
|
5911
|
-
/** List of RAI categories.
|
|
5912
|
-
*/
|
|
5853
|
+
/** List of RAI categories. */
|
|
5913
5854
|
categories?: string[];
|
|
5914
|
-
/** List of scores of each categories.
|
|
5915
|
-
*/
|
|
5855
|
+
/** List of scores of each categories. */
|
|
5916
5856
|
scores?: number[];
|
|
5917
|
-
/** Internal use only.
|
|
5918
|
-
*/
|
|
5857
|
+
/** Internal use only. */
|
|
5919
5858
|
contentType?: string;
|
|
5920
5859
|
}
|
|
5921
5860
|
|
|
@@ -7522,8 +7461,8 @@ export declare interface UpscaleImageConfig {
|
|
|
7522
7461
|
includeRaiReason?: boolean;
|
|
7523
7462
|
/** The image format that the output should be saved as. */
|
|
7524
7463
|
outputMimeType?: string;
|
|
7525
|
-
/** The level of compression if the
|
|
7526
|
-
``image/jpeg``. */
|
|
7464
|
+
/** The level of compression. Only applicable if the
|
|
7465
|
+
``output_mime_type`` is ``image/jpeg``. */
|
|
7527
7466
|
outputCompressionQuality?: number;
|
|
7528
7467
|
/** Whether to add an image enhancing step before upscaling.
|
|
7529
7468
|
It is expected to suppress the noise and JPEG compression artifacts
|
|
@@ -7677,7 +7616,7 @@ export declare interface Video {
|
|
|
7677
7616
|
/** Video bytes.
|
|
7678
7617
|
* @remarks Encoded as base64 string. */
|
|
7679
7618
|
videoBytes?: string;
|
|
7680
|
-
/** Video encoding, for example
|
|
7619
|
+
/** Video encoding, for example ``video/mp4``. */
|
|
7681
7620
|
mimeType?: string;
|
|
7682
7621
|
}
|
|
7683
7622
|
|
|
@@ -7697,8 +7636,7 @@ export declare enum VideoCompressionQuality {
|
|
|
7697
7636
|
|
|
7698
7637
|
/** A reference image for video generation. */
|
|
7699
7638
|
export declare interface VideoGenerationReferenceImage {
|
|
7700
|
-
/** The reference image.
|
|
7701
|
-
*/
|
|
7639
|
+
/** The reference image. */
|
|
7702
7640
|
image?: Image_2;
|
|
7703
7641
|
/** The type of the reference image, which defines how the reference
|
|
7704
7642
|
image will be used to generate the video. */
|