@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.
@@ -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
  }
@@ -5139,6 +5161,27 @@ export declare class Models extends BaseModule {
5139
5161
  * ```
5140
5162
  */
5141
5163
  recontextImage(params: types.RecontextImageParameters): Promise<types.RecontextImageResponse>;
5164
+ /**
5165
+ * Segments an image, creating a mask of a specified area.
5166
+ *
5167
+ * @param params - The parameters for segmenting an image.
5168
+ * @return The response from the API.
5169
+ *
5170
+ * @example
5171
+ * ```ts
5172
+ * const response = await ai.models.segmentImage({
5173
+ * model: 'image-segmentation-001',
5174
+ * source: {
5175
+ * image: image,
5176
+ * },
5177
+ * config: {
5178
+ * mode: 'foreground',
5179
+ * },
5180
+ * });
5181
+ * console.log(response?.generatedMasks?.[0]?.mask?.imageBytes);
5182
+ * ```
5183
+ */
5184
+ segmentImage(params: types.SegmentImageParameters): Promise<types.SegmentImageResponse>;
5142
5185
  /**
5143
5186
  * Fetches information about a model by name.
5144
5187
  *
@@ -5981,6 +6024,12 @@ export declare interface Schema {
5981
6024
 
5982
6025
  export declare type SchemaUnion = Schema | unknown;
5983
6026
 
6027
+ /** An image mask representing a brush scribble. */
6028
+ export declare interface ScribbleImage {
6029
+ /** The brush scribble to guide segmentation. Valid for the interactive mode. */
6030
+ image?: Image_2;
6031
+ }
6032
+
5984
6033
  /** Google search entry point. */
5985
6034
  export declare interface SearchEntryPoint {
5986
6035
  /** Optional. Web content snippet that can be embedded in a web page or an app webview. */
@@ -6002,6 +6051,75 @@ export declare interface Segment {
6002
6051
  text?: string;
6003
6052
  }
6004
6053
 
6054
+ /** Configuration for segmenting an image. */
6055
+ export declare interface SegmentImageConfig {
6056
+ /** Used to override HTTP request options. */
6057
+ httpOptions?: HttpOptions;
6058
+ /** Abort signal which can be used to cancel the request.
6059
+
6060
+ NOTE: AbortSignal is a client-only operation. Using it to cancel an
6061
+ operation will not cancel the request in the service. You will still
6062
+ be charged usage for any applicable operations.
6063
+ */
6064
+ abortSignal?: AbortSignal;
6065
+ /** The segmentation mode to use. */
6066
+ mode?: SegmentMode;
6067
+ /** The maximum number of predictions to return up to, by top
6068
+ confidence score. */
6069
+ maxPredictions?: number;
6070
+ /** The confidence score threshold for the detections as a decimal
6071
+ value. Only predictions with a confidence score higher than this
6072
+ threshold will be returned. */
6073
+ confidenceThreshold?: number;
6074
+ /** A decimal value representing how much dilation to apply to the
6075
+ masks. 0 for no dilation. 1.0 means the masked area covers the whole
6076
+ image. */
6077
+ maskDilation?: number;
6078
+ /** The binary color threshold to apply to the masks. The threshold
6079
+ can be set to a decimal value between 0 and 255 non-inclusive.
6080
+ Set to -1 for no binary color thresholding. */
6081
+ binaryColorThreshold?: number;
6082
+ }
6083
+
6084
+ /** The parameters for segmenting an image. */
6085
+ export declare interface SegmentImageParameters {
6086
+ /** ID of the model to use. For a list of models, see `Google models
6087
+ <https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models>`_. */
6088
+ model: string;
6089
+ /** A set of source input(s) for image segmentation. */
6090
+ source: SegmentImageSource;
6091
+ /** Configuration for image segmentation. */
6092
+ config?: SegmentImageConfig;
6093
+ }
6094
+
6095
+ /** The output images response. */
6096
+ export declare class SegmentImageResponse {
6097
+ /** List of generated image masks.
6098
+ */
6099
+ generatedMasks?: GeneratedImageMask[];
6100
+ }
6101
+
6102
+ /** A set of source input(s) for image segmentation. */
6103
+ export declare interface SegmentImageSource {
6104
+ /** A text prompt for guiding the model during image segmentation.
6105
+ Required for prompt mode and semantic mode, disallowed for other modes. */
6106
+ prompt?: string;
6107
+ /** The image to be segmented. */
6108
+ image?: Image_2;
6109
+ /** The brush scribble to guide segmentation.
6110
+ Required for the interactive mode, disallowed for other modes. */
6111
+ scribbleImage?: ScribbleImage;
6112
+ }
6113
+
6114
+ /** Enum that represents the segmentation mode. */
6115
+ export declare enum SegmentMode {
6116
+ FOREGROUND = "FOREGROUND",
6117
+ BACKGROUND = "BACKGROUND",
6118
+ PROMPT = "PROMPT",
6119
+ SEMANTIC = "SEMANTIC",
6120
+ INTERACTIVE = "INTERACTIVE"
6121
+ }
6122
+
6005
6123
  /** Parameters for sending a message within a chat session.
6006
6124
 
6007
6125
  These parameters are used with the `chat.sendMessage()` method.
@@ -6889,6 +7007,7 @@ declare namespace types {
6889
7007
  ControlReferenceType,
6890
7008
  SubjectReferenceType,
6891
7009
  EditMode,
7010
+ SegmentMode,
6892
7011
  VideoCompressionQuality,
6893
7012
  FileState,
6894
7013
  FileSource,
@@ -7019,6 +7138,13 @@ declare namespace types {
7019
7138
  RecontextImageConfig,
7020
7139
  RecontextImageParameters,
7021
7140
  RecontextImageResponse,
7141
+ ScribbleImage,
7142
+ SegmentImageSource,
7143
+ SegmentImageConfig,
7144
+ SegmentImageParameters,
7145
+ EntityLabel,
7146
+ GeneratedImageMask,
7147
+ SegmentImageResponse,
7022
7148
  GetModelConfig,
7023
7149
  GetModelParameters,
7024
7150
  Endpoint,
@@ -7043,6 +7169,7 @@ declare namespace types {
7043
7169
  TokensInfo,
7044
7170
  ComputeTokensResponse,
7045
7171
  Video,
7172
+ VideoGenerationReferenceImage,
7046
7173
  GenerateVideosConfig,
7047
7174
  GenerateVideosParameters,
7048
7175
  GeneratedVideo,
@@ -7507,6 +7634,17 @@ export declare enum VideoCompressionQuality {
7507
7634
  LOSSLESS = "LOSSLESS"
7508
7635
  }
7509
7636
 
7637
+ /** A reference image for video generation. */
7638
+ export declare interface VideoGenerationReferenceImage {
7639
+ /** The reference image.
7640
+ */
7641
+ image?: Image_2;
7642
+ /** The type of the reference image, which defines how the reference
7643
+ image will be used to generate the video. Supported values are 'asset'
7644
+ or 'style'. */
7645
+ referenceType?: string;
7646
+ }
7647
+
7510
7648
  /** Describes how the video in the Part should be used by the model. */
7511
7649
  export declare interface VideoMetadata {
7512
7650
  /** The frame rate of the video sent to the model. If not specified, the
@@ -897,6 +897,15 @@ var EditMode;
897
897
  EditMode["EDIT_MODE_BGSWAP"] = "EDIT_MODE_BGSWAP";
898
898
  EditMode["EDIT_MODE_PRODUCT_IMAGE"] = "EDIT_MODE_PRODUCT_IMAGE";
899
899
  })(EditMode || (EditMode = {}));
900
+ /** Enum that represents the segmentation mode. */
901
+ var SegmentMode;
902
+ (function (SegmentMode) {
903
+ SegmentMode["FOREGROUND"] = "FOREGROUND";
904
+ SegmentMode["BACKGROUND"] = "BACKGROUND";
905
+ SegmentMode["PROMPT"] = "PROMPT";
906
+ SegmentMode["SEMANTIC"] = "SEMANTIC";
907
+ SegmentMode["INTERACTIVE"] = "INTERACTIVE";
908
+ })(SegmentMode || (SegmentMode = {}));
900
909
  /** Enum that controls the compression quality of the generated videos. */
901
910
  var VideoCompressionQuality;
902
911
  (function (VideoCompressionQuality) {
@@ -1543,6 +1552,9 @@ class UpscaleImageResponse {
1543
1552
  /** The output images response. */
1544
1553
  class RecontextImageResponse {
1545
1554
  }
1555
+ /** The output images response. */
1556
+ class SegmentImageResponse {
1557
+ }
1546
1558
  class ListModelsResponse {
1547
1559
  }
1548
1560
  class DeleteModelResponse {
@@ -4281,6 +4293,7 @@ class Batches extends BaseModule {
4281
4293
  * ```
4282
4294
  */
4283
4295
  this.create = async (params) => {
4296
+ var _a, _b;
4284
4297
  if (this.apiClient.isVertexAI()) {
4285
4298
  const timestamp = Date.now();
4286
4299
  const timestampStr = timestamp.toString();
@@ -4305,6 +4318,55 @@ class Batches extends BaseModule {
4305
4318
  }
4306
4319
  }
4307
4320
  }
4321
+ else {
4322
+ if (Array.isArray(params.src) ||
4323
+ (typeof params.src !== 'string' && params.src.inlinedRequests)) {
4324
+ // Move system instruction to httpOptions extraBody.
4325
+ let path = '';
4326
+ let queryParams = {};
4327
+ const body = createBatchJobParametersToMldev(this.apiClient, params);
4328
+ path = formatMap('{model}:batchGenerateContent', body['_url']);
4329
+ queryParams = body['_query'];
4330
+ // Move system instruction to 'request':
4331
+ // {'systemInstruction': system_instruction}
4332
+ const batch = body['batch'];
4333
+ const inputConfig = batch['inputConfig'];
4334
+ const requestsWrapper = inputConfig['requests'];
4335
+ const requests = requestsWrapper['requests'];
4336
+ const newRequests = [];
4337
+ for (const request of requests) {
4338
+ const requestDict = request;
4339
+ if (requestDict['systemInstruction']) {
4340
+ const systemInstructionValue = requestDict['systemInstruction'];
4341
+ delete requestDict['systemInstruction'];
4342
+ const requestContent = requestDict['request'];
4343
+ requestContent['systemInstruction'] = systemInstructionValue;
4344
+ requestDict['request'] = requestContent;
4345
+ }
4346
+ newRequests.push(requestDict);
4347
+ }
4348
+ requestsWrapper['requests'] = newRequests;
4349
+ delete body['config'];
4350
+ delete body['_url'];
4351
+ delete body['_query'];
4352
+ const response = this.apiClient
4353
+ .request({
4354
+ path: path,
4355
+ queryParams: queryParams,
4356
+ body: JSON.stringify(body),
4357
+ httpMethod: 'POST',
4358
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
4359
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
4360
+ })
4361
+ .then((httpResponse) => {
4362
+ return httpResponse.json();
4363
+ });
4364
+ return response.then((apiResponse) => {
4365
+ const resp = batchJobFromMldev(apiResponse);
4366
+ return resp;
4367
+ });
4368
+ }
4369
+ }
4308
4370
  return await this.createInternal(params);
4309
4371
  };
4310
4372
  /**
@@ -6215,9 +6277,6 @@ function isValidContent(content) {
6215
6277
  if (part === undefined || Object.keys(part).length === 0) {
6216
6278
  return false;
6217
6279
  }
6218
- if (!part.thought && part.text !== undefined && part.text === '') {
6219
- return false;
6220
- }
6221
6280
  }
6222
6281
  return true;
6223
6282
  }
@@ -10422,6 +10481,9 @@ function generateVideosConfigToMldev(fromObject, parentObject) {
10422
10481
  if (getValueByPath(fromObject, ['lastFrame']) !== undefined) {
10423
10482
  throw new Error('lastFrame parameter is not supported in Gemini API.');
10424
10483
  }
10484
+ if (getValueByPath(fromObject, ['referenceImages']) !== undefined) {
10485
+ throw new Error('referenceImages parameter is not supported in Gemini API.');
10486
+ }
10425
10487
  if (getValueByPath(fromObject, ['compressionQuality']) !== undefined) {
10426
10488
  throw new Error('compressionQuality parameter is not supported in Gemini API.');
10427
10489
  }
@@ -11732,6 +11794,78 @@ function recontextImageParametersToVertex(apiClient, fromObject) {
11732
11794
  }
11733
11795
  return toObject;
11734
11796
  }
11797
+ function scribbleImageToVertex(fromObject) {
11798
+ const toObject = {};
11799
+ const fromImage = getValueByPath(fromObject, ['image']);
11800
+ if (fromImage != null) {
11801
+ setValueByPath(toObject, ['image'], imageToVertex(fromImage));
11802
+ }
11803
+ return toObject;
11804
+ }
11805
+ function segmentImageSourceToVertex(fromObject, parentObject) {
11806
+ const toObject = {};
11807
+ const fromPrompt = getValueByPath(fromObject, ['prompt']);
11808
+ if (parentObject !== undefined && fromPrompt != null) {
11809
+ setValueByPath(parentObject, ['instances[0]', 'prompt'], fromPrompt);
11810
+ }
11811
+ const fromImage = getValueByPath(fromObject, ['image']);
11812
+ if (parentObject !== undefined && fromImage != null) {
11813
+ setValueByPath(parentObject, ['instances[0]', 'image'], imageToVertex(fromImage));
11814
+ }
11815
+ const fromScribbleImage = getValueByPath(fromObject, [
11816
+ 'scribbleImage',
11817
+ ]);
11818
+ if (parentObject !== undefined && fromScribbleImage != null) {
11819
+ setValueByPath(parentObject, ['instances[0]', 'scribble'], scribbleImageToVertex(fromScribbleImage));
11820
+ }
11821
+ return toObject;
11822
+ }
11823
+ function segmentImageConfigToVertex(fromObject, parentObject) {
11824
+ const toObject = {};
11825
+ const fromMode = getValueByPath(fromObject, ['mode']);
11826
+ if (parentObject !== undefined && fromMode != null) {
11827
+ setValueByPath(parentObject, ['parameters', 'mode'], fromMode);
11828
+ }
11829
+ const fromMaxPredictions = getValueByPath(fromObject, [
11830
+ 'maxPredictions',
11831
+ ]);
11832
+ if (parentObject !== undefined && fromMaxPredictions != null) {
11833
+ setValueByPath(parentObject, ['parameters', 'maxPredictions'], fromMaxPredictions);
11834
+ }
11835
+ const fromConfidenceThreshold = getValueByPath(fromObject, [
11836
+ 'confidenceThreshold',
11837
+ ]);
11838
+ if (parentObject !== undefined && fromConfidenceThreshold != null) {
11839
+ setValueByPath(parentObject, ['parameters', 'confidenceThreshold'], fromConfidenceThreshold);
11840
+ }
11841
+ const fromMaskDilation = getValueByPath(fromObject, ['maskDilation']);
11842
+ if (parentObject !== undefined && fromMaskDilation != null) {
11843
+ setValueByPath(parentObject, ['parameters', 'maskDilation'], fromMaskDilation);
11844
+ }
11845
+ const fromBinaryColorThreshold = getValueByPath(fromObject, [
11846
+ 'binaryColorThreshold',
11847
+ ]);
11848
+ if (parentObject !== undefined && fromBinaryColorThreshold != null) {
11849
+ setValueByPath(parentObject, ['parameters', 'binaryColorThreshold'], fromBinaryColorThreshold);
11850
+ }
11851
+ return toObject;
11852
+ }
11853
+ function segmentImageParametersToVertex(apiClient, fromObject) {
11854
+ const toObject = {};
11855
+ const fromModel = getValueByPath(fromObject, ['model']);
11856
+ if (fromModel != null) {
11857
+ setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
11858
+ }
11859
+ const fromSource = getValueByPath(fromObject, ['source']);
11860
+ if (fromSource != null) {
11861
+ setValueByPath(toObject, ['config'], segmentImageSourceToVertex(fromSource, toObject));
11862
+ }
11863
+ const fromConfig = getValueByPath(fromObject, ['config']);
11864
+ if (fromConfig != null) {
11865
+ setValueByPath(toObject, ['config'], segmentImageConfigToVertex(fromConfig, toObject));
11866
+ }
11867
+ return toObject;
11868
+ }
11735
11869
  function getModelParametersToVertex(apiClient, fromObject) {
11736
11870
  const toObject = {};
11737
11871
  const fromModel = getValueByPath(fromObject, ['model']);
@@ -11900,6 +12034,20 @@ function videoToVertex(fromObject) {
11900
12034
  }
11901
12035
  return toObject;
11902
12036
  }
12037
+ function videoGenerationReferenceImageToVertex(fromObject) {
12038
+ const toObject = {};
12039
+ const fromImage = getValueByPath(fromObject, ['image']);
12040
+ if (fromImage != null) {
12041
+ setValueByPath(toObject, ['image'], imageToVertex(fromImage));
12042
+ }
12043
+ const fromReferenceType = getValueByPath(fromObject, [
12044
+ 'referenceType',
12045
+ ]);
12046
+ if (fromReferenceType != null) {
12047
+ setValueByPath(toObject, ['referenceType'], fromReferenceType);
12048
+ }
12049
+ return toObject;
12050
+ }
11903
12051
  function generateVideosConfigToVertex(fromObject, parentObject) {
11904
12052
  const toObject = {};
11905
12053
  const fromNumberOfVideos = getValueByPath(fromObject, [
@@ -11966,6 +12114,18 @@ function generateVideosConfigToVertex(fromObject, parentObject) {
11966
12114
  if (parentObject !== undefined && fromLastFrame != null) {
11967
12115
  setValueByPath(parentObject, ['instances[0]', 'lastFrame'], imageToVertex(fromLastFrame));
11968
12116
  }
12117
+ const fromReferenceImages = getValueByPath(fromObject, [
12118
+ 'referenceImages',
12119
+ ]);
12120
+ if (parentObject !== undefined && fromReferenceImages != null) {
12121
+ let transformedList = fromReferenceImages;
12122
+ if (Array.isArray(transformedList)) {
12123
+ transformedList = transformedList.map((item) => {
12124
+ return videoGenerationReferenceImageToVertex(item);
12125
+ });
12126
+ }
12127
+ setValueByPath(parentObject, ['instances[0]', 'referenceImages'], transformedList);
12128
+ }
11969
12129
  const fromCompressionQuality = getValueByPath(fromObject, [
11970
12130
  'compressionQuality',
11971
12131
  ]);
@@ -13015,6 +13175,50 @@ function recontextImageResponseFromVertex(fromObject) {
13015
13175
  }
13016
13176
  return toObject;
13017
13177
  }
13178
+ function entityLabelFromVertex(fromObject) {
13179
+ const toObject = {};
13180
+ const fromLabel = getValueByPath(fromObject, ['label']);
13181
+ if (fromLabel != null) {
13182
+ setValueByPath(toObject, ['label'], fromLabel);
13183
+ }
13184
+ const fromScore = getValueByPath(fromObject, ['score']);
13185
+ if (fromScore != null) {
13186
+ setValueByPath(toObject, ['score'], fromScore);
13187
+ }
13188
+ return toObject;
13189
+ }
13190
+ function generatedImageMaskFromVertex(fromObject) {
13191
+ const toObject = {};
13192
+ const fromMask = getValueByPath(fromObject, ['_self']);
13193
+ if (fromMask != null) {
13194
+ setValueByPath(toObject, ['mask'], imageFromVertex(fromMask));
13195
+ }
13196
+ const fromLabels = getValueByPath(fromObject, ['labels']);
13197
+ if (fromLabels != null) {
13198
+ let transformedList = fromLabels;
13199
+ if (Array.isArray(transformedList)) {
13200
+ transformedList = transformedList.map((item) => {
13201
+ return entityLabelFromVertex(item);
13202
+ });
13203
+ }
13204
+ setValueByPath(toObject, ['labels'], transformedList);
13205
+ }
13206
+ return toObject;
13207
+ }
13208
+ function segmentImageResponseFromVertex(fromObject) {
13209
+ const toObject = {};
13210
+ const fromGeneratedMasks = getValueByPath(fromObject, ['predictions']);
13211
+ if (fromGeneratedMasks != null) {
13212
+ let transformedList = fromGeneratedMasks;
13213
+ if (Array.isArray(transformedList)) {
13214
+ transformedList = transformedList.map((item) => {
13215
+ return generatedImageMaskFromVertex(item);
13216
+ });
13217
+ }
13218
+ setValueByPath(toObject, ['generatedMasks'], transformedList);
13219
+ }
13220
+ return toObject;
13221
+ }
13018
13222
  function endpointFromVertex(fromObject) {
13019
13223
  const toObject = {};
13020
13224
  const fromName = getValueByPath(fromObject, ['endpoint']);
@@ -13262,7 +13466,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
13262
13466
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
13263
13467
  const USER_AGENT_HEADER = 'User-Agent';
13264
13468
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
13265
- const SDK_VERSION = '1.14.0'; // x-release-please-version
13469
+ const SDK_VERSION = '1.15.0'; // x-release-please-version
13266
13470
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
13267
13471
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
13268
13472
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -15705,6 +15909,61 @@ class Models extends BaseModule {
15705
15909
  throw new Error('This method is only supported by the Vertex AI.');
15706
15910
  }
15707
15911
  }
15912
+ /**
15913
+ * Segments an image, creating a mask of a specified area.
15914
+ *
15915
+ * @param params - The parameters for segmenting an image.
15916
+ * @return The response from the API.
15917
+ *
15918
+ * @example
15919
+ * ```ts
15920
+ * const response = await ai.models.segmentImage({
15921
+ * model: 'image-segmentation-001',
15922
+ * source: {
15923
+ * image: image,
15924
+ * },
15925
+ * config: {
15926
+ * mode: 'foreground',
15927
+ * },
15928
+ * });
15929
+ * console.log(response?.generatedMasks?.[0]?.mask?.imageBytes);
15930
+ * ```
15931
+ */
15932
+ async segmentImage(params) {
15933
+ var _a, _b;
15934
+ let response;
15935
+ let path = '';
15936
+ let queryParams = {};
15937
+ if (this.apiClient.isVertexAI()) {
15938
+ const body = segmentImageParametersToVertex(this.apiClient, params);
15939
+ path = formatMap('{model}:predict', body['_url']);
15940
+ queryParams = body['_query'];
15941
+ delete body['config'];
15942
+ delete body['_url'];
15943
+ delete body['_query'];
15944
+ response = this.apiClient
15945
+ .request({
15946
+ path: path,
15947
+ queryParams: queryParams,
15948
+ body: JSON.stringify(body),
15949
+ httpMethod: 'POST',
15950
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
15951
+ abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
15952
+ })
15953
+ .then((httpResponse) => {
15954
+ return httpResponse.json();
15955
+ });
15956
+ return response.then((apiResponse) => {
15957
+ const resp = segmentImageResponseFromVertex(apiResponse);
15958
+ const typedResp = new SegmentImageResponse();
15959
+ Object.assign(typedResp, resp);
15960
+ return typedResp;
15961
+ });
15962
+ }
15963
+ else {
15964
+ throw new Error('This method is only supported by the Vertex AI.');
15965
+ }
15966
+ }
15708
15967
  /**
15709
15968
  * Fetches information about a model by name.
15710
15969
  *
@@ -18454,5 +18713,5 @@ class GoogleGenAI {
18454
18713
  }
18455
18714
  }
18456
18715
 
18457
- export { ActivityHandling, AdapterSize, ApiError, ApiSpec, AuthType, Batches, Behavior, BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EndSensitivity, Environment, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosOperation, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, InlinedResponse, JobState, Language, ListBatchJobsResponse, ListCachedContentsResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Mode, Models, MusicGenerationMode, Operations, Outcome, PagedItem, Pager, PersonGeneration, RawReferenceImage, RecontextImageResponse, ReplayResponse, SafetyFilterLevel, Scale, Session, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, Tokens, TrafficType, TuningMode, TurnCoverage, Type, UpscaleImageResponse, UrlRetrievalStatus, VideoCompressionQuality, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
18716
+ export { ActivityHandling, AdapterSize, ApiError, ApiSpec, AuthType, Batches, Behavior, BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EndSensitivity, Environment, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosOperation, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, InlinedResponse, JobState, Language, ListBatchJobsResponse, ListCachedContentsResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Mode, Models, MusicGenerationMode, Operations, Outcome, PagedItem, Pager, PersonGeneration, RawReferenceImage, RecontextImageResponse, ReplayResponse, SafetyFilterLevel, Scale, SegmentImageResponse, SegmentMode, Session, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, Tokens, TrafficType, TuningMode, TurnCoverage, Type, UpscaleImageResponse, UrlRetrievalStatus, VideoCompressionQuality, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
18458
18717
  //# sourceMappingURL=index.mjs.map