@google/genai 1.14.0 → 1.15.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/README.md +24 -0
- package/dist/genai.d.ts +138 -0
- package/dist/index.cjs +264 -4
- package/dist/index.mjs +264 -5
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +264 -4
- package/dist/node/index.mjs +264 -5
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +138 -0
- package/dist/web/index.mjs +264 -5
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +138 -0
- package/package.json +1 -1
package/dist/web/web.d.ts
CHANGED
|
@@ -1885,6 +1885,14 @@ export declare interface EnterpriseWebSearch {
|
|
|
1885
1885
|
excludeDomains?: string[];
|
|
1886
1886
|
}
|
|
1887
1887
|
|
|
1888
|
+
/** An entity representing the segmented area. */
|
|
1889
|
+
export declare interface EntityLabel {
|
|
1890
|
+
/** The label of the segmented entity. */
|
|
1891
|
+
label?: string;
|
|
1892
|
+
/** The confidence score of the detected label. */
|
|
1893
|
+
score?: number;
|
|
1894
|
+
}
|
|
1895
|
+
|
|
1888
1896
|
/** The environment being operated. */
|
|
1889
1897
|
export declare enum Environment {
|
|
1890
1898
|
/**
|
|
@@ -2702,6 +2710,14 @@ export declare interface GeneratedImage {
|
|
|
2702
2710
|
enhancedPrompt?: string;
|
|
2703
2711
|
}
|
|
2704
2712
|
|
|
2713
|
+
/** A generated image mask. */
|
|
2714
|
+
export declare interface GeneratedImageMask {
|
|
2715
|
+
/** The generated image mask. */
|
|
2716
|
+
mask?: Image_2;
|
|
2717
|
+
/** The detected entities on the segmented area. */
|
|
2718
|
+
labels?: EntityLabel[];
|
|
2719
|
+
}
|
|
2720
|
+
|
|
2705
2721
|
/** A generated video. */
|
|
2706
2722
|
export declare interface GeneratedVideo {
|
|
2707
2723
|
/** The output video */
|
|
@@ -2840,6 +2856,12 @@ export declare interface GenerateVideosConfig {
|
|
|
2840
2856
|
generateAudio?: boolean;
|
|
2841
2857
|
/** Image to use as the last frame of generated videos. Only supported for image to video use cases. */
|
|
2842
2858
|
lastFrame?: Image_2;
|
|
2859
|
+
/** The images to use as the references to generate the videos.
|
|
2860
|
+
If this field is provided, the text prompt field must also be provided.
|
|
2861
|
+
The image, video, or last_frame field are not supported. Each image must
|
|
2862
|
+
be associated with a type. Veo 2 supports up to 3 asset images *or* 1
|
|
2863
|
+
style image. */
|
|
2864
|
+
referenceImages?: VideoGenerationReferenceImage[];
|
|
2843
2865
|
/** Compression quality of the generated videos. */
|
|
2844
2866
|
compressionQuality?: VideoCompressionQuality;
|
|
2845
2867
|
}
|
|
@@ -5132,6 +5154,27 @@ export declare class Models extends BaseModule {
|
|
|
5132
5154
|
* ```
|
|
5133
5155
|
*/
|
|
5134
5156
|
recontextImage(params: types.RecontextImageParameters): Promise<types.RecontextImageResponse>;
|
|
5157
|
+
/**
|
|
5158
|
+
* Segments an image, creating a mask of a specified area.
|
|
5159
|
+
*
|
|
5160
|
+
* @param params - The parameters for segmenting an image.
|
|
5161
|
+
* @return The response from the API.
|
|
5162
|
+
*
|
|
5163
|
+
* @example
|
|
5164
|
+
* ```ts
|
|
5165
|
+
* const response = await ai.models.segmentImage({
|
|
5166
|
+
* model: 'image-segmentation-001',
|
|
5167
|
+
* source: {
|
|
5168
|
+
* image: image,
|
|
5169
|
+
* },
|
|
5170
|
+
* config: {
|
|
5171
|
+
* mode: 'foreground',
|
|
5172
|
+
* },
|
|
5173
|
+
* });
|
|
5174
|
+
* console.log(response?.generatedMasks?.[0]?.mask?.imageBytes);
|
|
5175
|
+
* ```
|
|
5176
|
+
*/
|
|
5177
|
+
segmentImage(params: types.SegmentImageParameters): Promise<types.SegmentImageResponse>;
|
|
5135
5178
|
/**
|
|
5136
5179
|
* Fetches information about a model by name.
|
|
5137
5180
|
*
|
|
@@ -5974,6 +6017,12 @@ export declare interface Schema {
|
|
|
5974
6017
|
|
|
5975
6018
|
export declare type SchemaUnion = Schema | unknown;
|
|
5976
6019
|
|
|
6020
|
+
/** An image mask representing a brush scribble. */
|
|
6021
|
+
export declare interface ScribbleImage {
|
|
6022
|
+
/** The brush scribble to guide segmentation. Valid for the interactive mode. */
|
|
6023
|
+
image?: Image_2;
|
|
6024
|
+
}
|
|
6025
|
+
|
|
5977
6026
|
/** Google search entry point. */
|
|
5978
6027
|
export declare interface SearchEntryPoint {
|
|
5979
6028
|
/** Optional. Web content snippet that can be embedded in a web page or an app webview. */
|
|
@@ -5995,6 +6044,75 @@ export declare interface Segment {
|
|
|
5995
6044
|
text?: string;
|
|
5996
6045
|
}
|
|
5997
6046
|
|
|
6047
|
+
/** Configuration for segmenting an image. */
|
|
6048
|
+
export declare interface SegmentImageConfig {
|
|
6049
|
+
/** Used to override HTTP request options. */
|
|
6050
|
+
httpOptions?: HttpOptions;
|
|
6051
|
+
/** Abort signal which can be used to cancel the request.
|
|
6052
|
+
|
|
6053
|
+
NOTE: AbortSignal is a client-only operation. Using it to cancel an
|
|
6054
|
+
operation will not cancel the request in the service. You will still
|
|
6055
|
+
be charged usage for any applicable operations.
|
|
6056
|
+
*/
|
|
6057
|
+
abortSignal?: AbortSignal;
|
|
6058
|
+
/** The segmentation mode to use. */
|
|
6059
|
+
mode?: SegmentMode;
|
|
6060
|
+
/** The maximum number of predictions to return up to, by top
|
|
6061
|
+
confidence score. */
|
|
6062
|
+
maxPredictions?: number;
|
|
6063
|
+
/** The confidence score threshold for the detections as a decimal
|
|
6064
|
+
value. Only predictions with a confidence score higher than this
|
|
6065
|
+
threshold will be returned. */
|
|
6066
|
+
confidenceThreshold?: number;
|
|
6067
|
+
/** A decimal value representing how much dilation to apply to the
|
|
6068
|
+
masks. 0 for no dilation. 1.0 means the masked area covers the whole
|
|
6069
|
+
image. */
|
|
6070
|
+
maskDilation?: number;
|
|
6071
|
+
/** The binary color threshold to apply to the masks. The threshold
|
|
6072
|
+
can be set to a decimal value between 0 and 255 non-inclusive.
|
|
6073
|
+
Set to -1 for no binary color thresholding. */
|
|
6074
|
+
binaryColorThreshold?: number;
|
|
6075
|
+
}
|
|
6076
|
+
|
|
6077
|
+
/** The parameters for segmenting an image. */
|
|
6078
|
+
export declare interface SegmentImageParameters {
|
|
6079
|
+
/** ID of the model to use. For a list of models, see `Google models
|
|
6080
|
+
<https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models>`_. */
|
|
6081
|
+
model: string;
|
|
6082
|
+
/** A set of source input(s) for image segmentation. */
|
|
6083
|
+
source: SegmentImageSource;
|
|
6084
|
+
/** Configuration for image segmentation. */
|
|
6085
|
+
config?: SegmentImageConfig;
|
|
6086
|
+
}
|
|
6087
|
+
|
|
6088
|
+
/** The output images response. */
|
|
6089
|
+
export declare class SegmentImageResponse {
|
|
6090
|
+
/** List of generated image masks.
|
|
6091
|
+
*/
|
|
6092
|
+
generatedMasks?: GeneratedImageMask[];
|
|
6093
|
+
}
|
|
6094
|
+
|
|
6095
|
+
/** A set of source input(s) for image segmentation. */
|
|
6096
|
+
export declare interface SegmentImageSource {
|
|
6097
|
+
/** A text prompt for guiding the model during image segmentation.
|
|
6098
|
+
Required for prompt mode and semantic mode, disallowed for other modes. */
|
|
6099
|
+
prompt?: string;
|
|
6100
|
+
/** The image to be segmented. */
|
|
6101
|
+
image?: Image_2;
|
|
6102
|
+
/** The brush scribble to guide segmentation.
|
|
6103
|
+
Required for the interactive mode, disallowed for other modes. */
|
|
6104
|
+
scribbleImage?: ScribbleImage;
|
|
6105
|
+
}
|
|
6106
|
+
|
|
6107
|
+
/** Enum that represents the segmentation mode. */
|
|
6108
|
+
export declare enum SegmentMode {
|
|
6109
|
+
FOREGROUND = "FOREGROUND",
|
|
6110
|
+
BACKGROUND = "BACKGROUND",
|
|
6111
|
+
PROMPT = "PROMPT",
|
|
6112
|
+
SEMANTIC = "SEMANTIC",
|
|
6113
|
+
INTERACTIVE = "INTERACTIVE"
|
|
6114
|
+
}
|
|
6115
|
+
|
|
5998
6116
|
/** Parameters for sending a message within a chat session.
|
|
5999
6117
|
|
|
6000
6118
|
These parameters are used with the `chat.sendMessage()` method.
|
|
@@ -6882,6 +7000,7 @@ declare namespace types {
|
|
|
6882
7000
|
ControlReferenceType,
|
|
6883
7001
|
SubjectReferenceType,
|
|
6884
7002
|
EditMode,
|
|
7003
|
+
SegmentMode,
|
|
6885
7004
|
VideoCompressionQuality,
|
|
6886
7005
|
FileState,
|
|
6887
7006
|
FileSource,
|
|
@@ -7012,6 +7131,13 @@ declare namespace types {
|
|
|
7012
7131
|
RecontextImageConfig,
|
|
7013
7132
|
RecontextImageParameters,
|
|
7014
7133
|
RecontextImageResponse,
|
|
7134
|
+
ScribbleImage,
|
|
7135
|
+
SegmentImageSource,
|
|
7136
|
+
SegmentImageConfig,
|
|
7137
|
+
SegmentImageParameters,
|
|
7138
|
+
EntityLabel,
|
|
7139
|
+
GeneratedImageMask,
|
|
7140
|
+
SegmentImageResponse,
|
|
7015
7141
|
GetModelConfig,
|
|
7016
7142
|
GetModelParameters,
|
|
7017
7143
|
Endpoint,
|
|
@@ -7036,6 +7162,7 @@ declare namespace types {
|
|
|
7036
7162
|
TokensInfo,
|
|
7037
7163
|
ComputeTokensResponse,
|
|
7038
7164
|
Video,
|
|
7165
|
+
VideoGenerationReferenceImage,
|
|
7039
7166
|
GenerateVideosConfig,
|
|
7040
7167
|
GenerateVideosParameters,
|
|
7041
7168
|
GeneratedVideo,
|
|
@@ -7500,6 +7627,17 @@ export declare enum VideoCompressionQuality {
|
|
|
7500
7627
|
LOSSLESS = "LOSSLESS"
|
|
7501
7628
|
}
|
|
7502
7629
|
|
|
7630
|
+
/** A reference image for video generation. */
|
|
7631
|
+
export declare interface VideoGenerationReferenceImage {
|
|
7632
|
+
/** The reference image.
|
|
7633
|
+
*/
|
|
7634
|
+
image?: Image_2;
|
|
7635
|
+
/** The type of the reference image, which defines how the reference
|
|
7636
|
+
image will be used to generate the video. Supported values are 'asset'
|
|
7637
|
+
or 'style'. */
|
|
7638
|
+
referenceType?: string;
|
|
7639
|
+
}
|
|
7640
|
+
|
|
7503
7641
|
/** Describes how the video in the Part should be used by the model. */
|
|
7504
7642
|
export declare interface VideoMetadata {
|
|
7505
7643
|
/** The frame rate of the video sent to the model. If not specified, the
|