@google/genai 1.50.1 → 1.52.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.
@@ -500,7 +500,7 @@ declare interface BatchJob {
500
500
  createTime?: string;
501
501
  /** Output only. Time when the Job for the first time entered the `JOB_STATE_RUNNING` state. */
502
502
  startTime?: string;
503
- /** The time when the BatchJob was completed. This field is for Vertex AI only.
503
+ /** The time when the BatchJob was completed. This field is for Gemini Enterprise Agent Platform only.
504
504
  */
505
505
  endTime?: string;
506
506
  /** The time when the BatchJob was last updated.
@@ -509,21 +509,24 @@ declare interface BatchJob {
509
509
  /** The name of the model that produces the predictions via the BatchJob.
510
510
  */
511
511
  model?: string;
512
- /** Configuration for the input data. This field is for Vertex AI only.
512
+ /** Configuration for the input data. This field is for Gemini Enterprise Agent Platform only.
513
513
  */
514
514
  src?: BatchJobSource;
515
515
  /** Configuration for the output data.
516
516
  */
517
517
  dest?: BatchJobDestination;
518
- /** Statistics on completed and failed prediction instances. This field is for Vertex AI only.
518
+ /** Statistics on completed and failed prediction instances. This field is for Gemini Enterprise Agent Platform only.
519
519
  */
520
520
  completionStats?: CompletionStats;
521
+ /** Information further describing the output of this job. Output only.
522
+ */
523
+ outputInfo?: BatchJobOutputInfo;
521
524
  }
522
525
 
523
526
  /** Config for `des` parameter. */
524
527
  declare interface BatchJobDestination {
525
528
  /** Storage format of the output files. Must be one of:
526
- 'jsonl', 'bigquery'.
529
+ 'jsonl', 'bigquery', 'vertex-dataset'.
527
530
  */
528
531
  format?: string;
529
532
  /** The Google Cloud Storage URI to the output file.
@@ -549,14 +552,27 @@ declare interface BatchJobDestination {
549
552
  the input requests.
550
553
  */
551
554
  inlinedEmbedContentResponses?: InlinedEmbedContentResponse[];
555
+ /** This field is experimental and may change in future versions. The Vertex AI dataset destination.
556
+ */
557
+ vertexDataset?: VertexMultimodalDatasetDestination;
552
558
  }
553
559
 
554
560
  declare type BatchJobDestinationUnion = BatchJobDestination | string;
555
561
 
562
+ /** Represents the `output_info` field in batch jobs. */
563
+ declare interface BatchJobOutputInfo {
564
+ /** This field is experimental and may change in future versions. The Vertex AI dataset name containing the output data. */
565
+ vertexMultimodalDatasetName?: string;
566
+ /** The full path of the Cloud Storage directory created, into which the prediction output is written. */
567
+ gcsOutputDirectory?: string;
568
+ /** The name of the BigQuery table created, in `predictions_<timestamp>` format, into which the prediction output is written. */
569
+ bigqueryOutputTable?: string;
570
+ }
571
+
556
572
  /** Config for `src` parameter. */
557
573
  declare interface BatchJobSource {
558
574
  /** Storage format of the input files. Must be one of:
559
- 'jsonl', 'bigquery'.
575
+ 'jsonl', 'bigquery', 'vertex-dataset'.
560
576
  */
561
577
  format?: string;
562
578
  /** The Google Cloud Storage URIs to input files.
@@ -572,6 +588,9 @@ declare interface BatchJobSource {
572
588
  /** The Gemini Developer API's inlined input data to run batch job.
573
589
  */
574
590
  inlinedRequests?: InlinedRequest[];
591
+ /** This field is experimental and may change in future versions. The Vertex AI dataset resource name to use as input. Must be of type multimodal.
592
+ */
593
+ vertexDatasetName?: string;
575
594
  }
576
595
 
577
596
  declare type BatchJobSourceUnion = BatchJobSource | InlinedRequest[] | string;
@@ -934,7 +953,7 @@ declare interface ContentEmbedding {
934
953
  /** A list of floats representing an embedding.
935
954
  */
936
955
  values?: number[];
937
- /** Vertex API only. Statistics of the input text associated with this
956
+ /** Gemini Enterprise Agent Platform only. Statistics of the input text associated with this
938
957
  embedding.
939
958
  */
940
959
  statistics?: ContentEmbeddingStatistics;
@@ -942,11 +961,11 @@ declare interface ContentEmbedding {
942
961
 
943
962
  /** Statistics of the input text associated with the result of content embedding. */
944
963
  declare interface ContentEmbeddingStatistics {
945
- /** Vertex API only. If the input text was truncated due to having
964
+ /** Gemini Enterprise Agent Platform only. If the input text was truncated due to having
946
965
  a length longer than the allowed maximum input.
947
966
  */
948
967
  truncated?: boolean;
949
- /** Vertex API only. Number of tokens of the input text.
968
+ /** Gemini Enterprise Agent Platform only. Number of tokens of the input text.
950
969
  */
951
970
  tokenCount?: number;
952
971
  }
@@ -1300,6 +1319,10 @@ declare interface CreateFileSearchStoreConfig {
1300
1319
  /** The human-readable display name for the file search store.
1301
1320
  */
1302
1321
  displayName?: string;
1322
+ /** The embedding model to use for the FileSearchStore.
1323
+ Format: `models/{model}`. If not specified, the default embedding model will be used.
1324
+ */
1325
+ embeddingModel?: string;
1303
1326
  }
1304
1327
 
1305
1328
  /** Config for file_search_stores.create parameters. */
@@ -1390,9 +1413,9 @@ declare interface CreateTuningJobConfig {
1390
1413
  adapterSize?: AdapterSize;
1391
1414
  /** Tuning mode for tuning. */
1392
1415
  tuningMode?: TuningMode;
1393
- /** Custom base model for tuning. This is only supported for OSS models in Vertex. */
1416
+ /** Custom base model for tuning. This is only supported for OSS models in Gemini Enterprise Agent Platform. */
1394
1417
  customBaseModel?: string;
1395
- /** The batch size hyperparameter for tuning. This is only supported for OSS models in Vertex. */
1418
+ /** The batch size hyperparameter for tuning. This is only supported for OSS models in Gemini Enterprise Agent Platform. */
1396
1419
  batchSize?: number;
1397
1420
  /** The learning rate for tuning. OSS models only. Mutually exclusive with learning_rate_multiplier. */
1398
1421
  learningRate?: number;
@@ -1708,7 +1731,8 @@ declare interface DistillationHyperParameters {
1708
1731
  /** Optional. Multiplier for adjusting the default learning rate. */
1709
1732
  learningRateMultiplier?: number;
1710
1733
  /** The batch size hyperparameter for tuning.
1711
- This is only supported for OSS models in Vertex. */
1734
+ This is only supported for OSS models in Gemini Enterprise Agent Platform.
1735
+ */
1712
1736
  batchSize?: number;
1713
1737
  /** The learning rate for tuning. OSS models only. */
1714
1738
  learningRate?: number;
@@ -1822,6 +1846,19 @@ declare interface DownloadFileParameters {
1822
1846
  config?: DownloadFileConfig;
1823
1847
  }
1824
1848
 
1849
+ /** Used to override the default configuration. */
1850
+ declare interface DownloadMediaConfig {
1851
+ /** Used to override HTTP request options. */
1852
+ httpOptions?: HttpOptions;
1853
+ /** Abort signal which can be used to cancel the request.
1854
+
1855
+ NOTE: AbortSignal is a client-only operation. Using it to cancel an
1856
+ operation will not cancel the request in the service. You will still
1857
+ be charged usage for any applicable operations.
1858
+ */
1859
+ abortSignal?: AbortSignal;
1860
+ }
1861
+
1825
1862
  /** Describes the options to customize dynamic retrieval. */
1826
1863
  declare interface DynamicRetrievalConfig {
1827
1864
  /** Optional. The threshold to be used in dynamic retrieval. If not set, a system default value is used. */
@@ -1963,27 +2000,27 @@ declare interface EmbedContentConfig {
1963
2000
  using the earlier model (`models/embedding-001`).
1964
2001
  */
1965
2002
  outputDimensionality?: number;
1966
- /** Vertex API only. The MIME type of the input.
2003
+ /** Gemini Enterprise Agent Platform only. The MIME type of the input.
1967
2004
  */
1968
2005
  mimeType?: string;
1969
- /** Vertex API only. Whether to silently truncate inputs longer than
2006
+ /** Gemini Enterprise Agent Platform only. Whether to silently truncate inputs longer than
1970
2007
  the max sequence length. If this option is set to false, oversized inputs
1971
2008
  will lead to an INVALID_ARGUMENT error, similar to other text APIs.
1972
2009
  */
1973
2010
  autoTruncate?: boolean;
1974
- /** Vertex API only. Whether to enable OCR for document content.
2011
+ /** Gemini Enterprise Agent Platform only. Whether to enable OCR for document content.
1975
2012
  Only applicable to Gemini Embedding 2 models.
1976
2013
  */
1977
2014
  documentOcr?: boolean;
1978
- /** Vertex API only. Whether to extract audio from video content.
2015
+ /** Gemini Enterprise Agent Platform only. Whether to extract audio from video content.
1979
2016
  Only applicable to Gemini Embedding 2 models.
1980
2017
  */
1981
2018
  audioTrackExtraction?: boolean;
1982
2019
  }
1983
2020
 
1984
- /** Request-level metadata for the Vertex Embed Content API. */
2021
+ /** Request-level metadata for the Gemini Enterprise Agent Platform Embed Content API. */
1985
2022
  declare interface EmbedContentMetadata {
1986
- /** Vertex API only. The total number of billable characters included
2023
+ /** Gemini Enterprise Agent Platform only. The total number of billable characters included
1987
2024
  in the request.
1988
2025
  */
1989
2026
  billableCharacterCount?: number;
@@ -2013,7 +2050,7 @@ declare interface EmbedContentParametersPrivate {
2013
2050
  /** The single content to embed. Only the `parts.text` fields will be counted.
2014
2051
  */
2015
2052
  content?: ContentUnion;
2016
- /** The Vertex embedding API to use.
2053
+ /** The Gemini Enterprise Agent Platform embedding API to use.
2017
2054
  */
2018
2055
  embeddingApiType?: EmbeddingApiType;
2019
2056
  /** Configuration that contains optional parameters.
@@ -2029,12 +2066,12 @@ declare class EmbedContentResponse {
2029
2066
  the batch request.
2030
2067
  */
2031
2068
  embeddings?: ContentEmbedding[];
2032
- /** Vertex API only. Metadata about the request.
2069
+ /** Gemini Enterprise Agent Platform only. Metadata about the request.
2033
2070
  */
2034
2071
  metadata?: EmbedContentMetadata;
2035
2072
  }
2036
2073
 
2037
- /** Enum representing the Vertex embedding API to use. */
2074
+ /** Enum representing the Gemini Enterprise Agent Platform embedding API to use. */
2038
2075
  declare enum EmbeddingApiType {
2039
2076
  /**
2040
2077
  * predict API endpoint (default)
@@ -2294,6 +2331,8 @@ declare interface FileSearchStore {
2294
2331
  /** The size of raw bytes ingested into the FileSearchStore. This is the
2295
2332
  total size of all the documents in the FileSearchStore. */
2296
2333
  sizeBytes?: string;
2334
+ /** The embedding model used by the FileSearchStore. */
2335
+ embeddingModel?: string;
2297
2336
  }
2298
2337
 
2299
2338
  /** Source of the File. */
@@ -2757,7 +2796,7 @@ declare interface GenerateContentConfig {
2757
2796
  */
2758
2797
  imageConfig?: ImageConfig;
2759
2798
  /** Enables enhanced civic answers. It may not be available for all
2760
- models. This field is not supported in Vertex AI.
2799
+ models. This field is not supported in Gemini Enterprise Agent Platform.
2761
2800
  */
2762
2801
  enableEnhancedCivicAnswers?: boolean;
2763
2802
  /** Settings for prompt and response sanitization using the Model Armor
@@ -3138,6 +3177,8 @@ declare interface GenerateVideosConfig {
3138
3177
  /** Webhook configuration for receiving notifications when the
3139
3178
  video generation operation completes. */
3140
3179
  webhookConfig?: WebhookConfig;
3180
+ /** Resize mode of the image input for video generation. */
3181
+ resizeMode?: ImageResizeMode;
3141
3182
  }
3142
3183
 
3143
3184
  /** A video generation operation. */
@@ -3636,6 +3677,10 @@ declare interface GroundingChunkRetrievedContext {
3636
3677
  customMetadata?: GroundingChunkCustomMetadata[];
3637
3678
  /** Optional. Name of the `FileSearchStore` containing the document. Example: `fileSearchStores/123`. This field is not supported in Vertex AI. */
3638
3679
  fileSearchStore?: string;
3680
+ /** Optional. Page number of the retrieved context. This field is not supported in Vertex AI. */
3681
+ pageNumber?: number;
3682
+ /** Optional. Media ID. This field is not supported in Vertex AI. */
3683
+ mediaId?: string;
3639
3684
  }
3640
3685
 
3641
3686
  /** A list of string values. This data type is not supported in Vertex AI. */
@@ -3885,7 +3930,7 @@ declare interface HttpOptions {
3885
3930
  timeout?: number;
3886
3931
  /** Extra parameters to add to the request body.
3887
3932
  The structure must match the backend API's request structure.
3888
- - VertexAI backend API docs: https://cloud.google.com/vertex-ai/docs/reference/rest
3933
+ - Gemini Enterprise Agent Platform backend API docs: https://cloud.google.com/vertex-ai/docs/reference/rest
3889
3934
  - GeminiAPI backend API docs: https://ai.google.dev/api/rest */
3890
3935
  extraBody?: Record<string, unknown>;
3891
3936
  /** HTTP retry options for the request. */
@@ -4041,6 +4086,20 @@ declare enum ImagePromptLanguage {
4041
4086
  es = "es"
4042
4087
  }
4043
4088
 
4089
+ /** Resize mode for the image input for video generation. */
4090
+ declare enum ImageResizeMode {
4091
+ /**
4092
+ * Crop the image to fit the correct aspect ratio (so we lose parts
4093
+ of the image in the process).
4094
+ */
4095
+ CROP = "CROP",
4096
+ /**
4097
+ * Pad the image to fit the correct aspect ratio (so we don't lose
4098
+ any parts of the image in the process).
4099
+ */
4100
+ PAD = "PAD"
4101
+ }
4102
+
4044
4103
  /** Image search for grounding and related configurations. */
4045
4104
  declare interface ImageSearch {
4046
4105
  }
@@ -6901,7 +6960,7 @@ declare interface TunedModelInfo {
6901
6960
  declare interface TuningDataset {
6902
6961
  /** GCS URI of the file containing training dataset in JSONL format. */
6903
6962
  gcsUri?: string;
6904
- /** The resource name of the Vertex Multimodal Dataset that is used as training dataset. Example: 'projects/my-project-id-or-number/locations/my-location/datasets/my-dataset-id'. */
6963
+ /** The resource name of the Gemini Enterprise Agent Platform (previously known as Vertex AI) Multimodal Dataset that is used as training dataset. Example: 'projects/my-project-id-or-number/locations/my-location/datasets/my-dataset-id'. */
6905
6964
  vertexDatasetResource?: string;
6906
6965
  /** Inline examples with simple input/output text. */
6907
6966
  examples?: TuningExample[];
@@ -7096,7 +7155,7 @@ declare enum TuningTask {
7096
7155
  declare interface TuningValidationDataset {
7097
7156
  /** GCS URI of the file containing validation dataset in JSONL format. */
7098
7157
  gcsUri?: string;
7099
- /** The resource name of the Vertex Multimodal Dataset that is used as validation dataset. Example: 'projects/my-project-id-or-number/locations/my-location/datasets/my-dataset-id'. */
7158
+ /** The resource name of the Gemini Enterprise Agent Platform (previously known as Vertex AI) Multimodal Dataset that is used as validation dataset. Example: 'projects/my-project-id-or-number/locations/my-location/datasets/my-dataset-id'. */
7100
7159
  vertexDatasetResource?: string;
7101
7160
  }
7102
7161
 
@@ -7336,6 +7395,7 @@ declare namespace types {
7336
7395
  VideoGenerationReferenceType,
7337
7396
  VideoGenerationMaskMode,
7338
7397
  VideoCompressionQuality,
7398
+ ImageResizeMode,
7339
7399
  TuningMethod,
7340
7400
  FileState,
7341
7401
  FileSource,
@@ -7653,6 +7713,7 @@ declare namespace types {
7653
7713
  RegisterFilesResponse,
7654
7714
  InlinedRequest,
7655
7715
  BatchJobSource,
7716
+ VertexMultimodalDatasetDestination,
7656
7717
  JobError,
7657
7718
  InlinedResponse,
7658
7719
  SingleEmbedContentResponse,
@@ -7660,6 +7721,7 @@ declare namespace types {
7660
7721
  BatchJobDestination,
7661
7722
  CreateBatchJobConfig,
7662
7723
  CreateBatchJobParameters,
7724
+ BatchJobOutputInfo,
7663
7725
  CompletionStats,
7664
7726
  BatchJob,
7665
7727
  EmbedContentBatch,
@@ -7763,6 +7825,7 @@ declare namespace types {
7763
7825
  EmbedContentParameters,
7764
7826
  UploadToFileSearchStoreResponse,
7765
7827
  UploadToFileSearchStoreOperation,
7828
+ DownloadMediaConfig,
7766
7829
  BlobImageUnion,
7767
7830
  PartUnion,
7768
7831
  PartListUnion,
@@ -8153,6 +8216,16 @@ declare interface VertexAISearchDataStoreSpec {
8153
8216
  filter?: string;
8154
8217
  }
8155
8218
 
8219
+ /** This class is experimental and may change in future versions.
8220
+
8221
+ The specification for an output Vertex AI multimodal dataset. */
8222
+ declare interface VertexMultimodalDatasetDestination {
8223
+ /** The BigQuery destination for the multimodal dataset. */
8224
+ bigqueryDestination?: string;
8225
+ /** The display name of the multimodal dataset. */
8226
+ displayName?: string;
8227
+ }
8228
+
8156
8229
  /** Retrieve from Vertex RAG Store for grounding. This data type is not supported in Gemini API. */
8157
8230
  declare interface VertexRagStore {
8158
8231
  /** Optional. Deprecated. Please use rag_resources instead. */
@@ -274,60 +274,6 @@ function _moveValueRecursive(data, sourceKeys, destKeys, keyIdx, excludeKeys) {
274
274
  }
275
275
  }
276
276
 
277
- /**
278
- * @license
279
- * Copyright 2025 Google LLC
280
- * SPDX-License-Identifier: Apache-2.0
281
- */
282
- // Code generated by the Google Gen AI SDK generator DO NOT EDIT.
283
- function uploadToFileSearchStoreConfigToMldev(fromObject, parentObject) {
284
- const toObject = {};
285
- const fromMimeType = getValueByPath(fromObject, ['mimeType']);
286
- if (parentObject !== undefined && fromMimeType != null) {
287
- setValueByPath(parentObject, ['mimeType'], fromMimeType);
288
- }
289
- const fromDisplayName = getValueByPath(fromObject, ['displayName']);
290
- if (parentObject !== undefined && fromDisplayName != null) {
291
- setValueByPath(parentObject, ['displayName'], fromDisplayName);
292
- }
293
- const fromCustomMetadata = getValueByPath(fromObject, [
294
- 'customMetadata',
295
- ]);
296
- if (parentObject !== undefined && fromCustomMetadata != null) {
297
- let transformedList = fromCustomMetadata;
298
- if (Array.isArray(transformedList)) {
299
- transformedList = transformedList.map((item) => {
300
- return item;
301
- });
302
- }
303
- setValueByPath(parentObject, ['customMetadata'], transformedList);
304
- }
305
- const fromChunkingConfig = getValueByPath(fromObject, [
306
- 'chunkingConfig',
307
- ]);
308
- if (parentObject !== undefined && fromChunkingConfig != null) {
309
- setValueByPath(parentObject, ['chunkingConfig'], fromChunkingConfig);
310
- }
311
- return toObject;
312
- }
313
-
314
- /**
315
- * @license
316
- * Copyright 2025 Google LLC
317
- * SPDX-License-Identifier: Apache-2.0
318
- */
319
- /**
320
- * API errors raised by the GenAI API.
321
- */
322
- class ApiError extends Error {
323
- constructor(options) {
324
- super(options.message);
325
- this.name = 'ApiError';
326
- this.status = options.status;
327
- Object.setPrototypeOf(this, ApiError.prototype);
328
- }
329
- }
330
-
331
277
  /**
332
278
  * @license
333
279
  * Copyright 2025 Google LLC
@@ -1398,7 +1344,7 @@ var FeatureSelectionPreference;
1398
1344
  FeatureSelectionPreference["BALANCED"] = "BALANCED";
1399
1345
  FeatureSelectionPreference["PRIORITIZE_COST"] = "PRIORITIZE_COST";
1400
1346
  })(FeatureSelectionPreference || (FeatureSelectionPreference = {}));
1401
- /** Enum representing the Vertex embedding API to use. */
1347
+ /** Enum representing the Gemini Enterprise Agent Platform embedding API to use. */
1402
1348
  var EmbeddingApiType;
1403
1349
  (function (EmbeddingApiType) {
1404
1350
  /**
@@ -1556,6 +1502,20 @@ var VideoCompressionQuality;
1556
1502
  */
1557
1503
  VideoCompressionQuality["LOSSLESS"] = "LOSSLESS";
1558
1504
  })(VideoCompressionQuality || (VideoCompressionQuality = {}));
1505
+ /** Resize mode for the image input for video generation. */
1506
+ var ImageResizeMode;
1507
+ (function (ImageResizeMode) {
1508
+ /**
1509
+ * Crop the image to fit the correct aspect ratio (so we lose parts
1510
+ of the image in the process).
1511
+ */
1512
+ ImageResizeMode["CROP"] = "CROP";
1513
+ /**
1514
+ * Pad the image to fit the correct aspect ratio (so we don't lose
1515
+ any parts of the image in the process).
1516
+ */
1517
+ ImageResizeMode["PAD"] = "PAD";
1518
+ })(ImageResizeMode || (ImageResizeMode = {}));
1559
1519
  /** Enum representing the tuning method. */
1560
1520
  var TuningMethod;
1561
1521
  (function (TuningMethod) {
@@ -1967,6 +1927,120 @@ class UploadToFileSearchStoreOperation {
1967
1927
  }
1968
1928
  }
1969
1929
 
1930
+ /**
1931
+ * @license
1932
+ * Copyright 2025 Google LLC
1933
+ * SPDX-License-Identifier: Apache-2.0
1934
+ */
1935
+ function _isFile(origin) {
1936
+ return (origin !== null &&
1937
+ origin !== undefined &&
1938
+ typeof origin === 'object' &&
1939
+ 'name' in origin);
1940
+ }
1941
+ function isGeneratedVideo(origin) {
1942
+ return (origin !== null &&
1943
+ origin !== undefined &&
1944
+ typeof origin === 'object' &&
1945
+ 'video' in origin);
1946
+ }
1947
+ function isVideo(origin) {
1948
+ return (origin !== null &&
1949
+ origin !== undefined &&
1950
+ typeof origin === 'object' &&
1951
+ 'uri' in origin);
1952
+ }
1953
+ function tFileName(fromName) {
1954
+ var _a;
1955
+ let name;
1956
+ if (_isFile(fromName)) {
1957
+ name = fromName.name;
1958
+ }
1959
+ if (isVideo(fromName)) {
1960
+ name = fromName.uri;
1961
+ if (name === undefined) {
1962
+ return undefined;
1963
+ }
1964
+ }
1965
+ if (isGeneratedVideo(fromName)) {
1966
+ name = (_a = fromName.video) === null || _a === void 0 ? void 0 : _a.uri;
1967
+ if (name === undefined) {
1968
+ return undefined;
1969
+ }
1970
+ }
1971
+ if (typeof fromName === 'string') {
1972
+ name = fromName;
1973
+ }
1974
+ if (name === undefined) {
1975
+ throw new Error('Could not extract file name from the provided input.');
1976
+ }
1977
+ if (name.startsWith('https://')) {
1978
+ const suffix = name.split('files/')[1];
1979
+ const match = suffix.match(/[a-z0-9]+/);
1980
+ if (match === null) {
1981
+ throw new Error(`Could not extract file name from URI ${name}`);
1982
+ }
1983
+ name = match[0];
1984
+ }
1985
+ else if (name.startsWith('files/')) {
1986
+ name = name.split('files/')[1];
1987
+ }
1988
+ return name;
1989
+ }
1990
+
1991
+ /**
1992
+ * @license
1993
+ * Copyright 2025 Google LLC
1994
+ * SPDX-License-Identifier: Apache-2.0
1995
+ */
1996
+ function uploadToFileSearchStoreConfigToMldev(fromObject, parentObject) {
1997
+ const toObject = {};
1998
+ const fromMimeType = getValueByPath(fromObject, ['mimeType']);
1999
+ if (parentObject !== undefined && fromMimeType != null) {
2000
+ setValueByPath(parentObject, ['mimeType'], fromMimeType);
2001
+ }
2002
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
2003
+ if (parentObject !== undefined && fromDisplayName != null) {
2004
+ setValueByPath(parentObject, ['displayName'], fromDisplayName);
2005
+ }
2006
+ const fromCustomMetadata = getValueByPath(fromObject, [
2007
+ 'customMetadata',
2008
+ ]);
2009
+ if (parentObject !== undefined && fromCustomMetadata != null) {
2010
+ let transformedList = fromCustomMetadata;
2011
+ if (Array.isArray(transformedList)) {
2012
+ transformedList = transformedList.map((item) => {
2013
+ return item;
2014
+ });
2015
+ }
2016
+ setValueByPath(parentObject, ['customMetadata'], transformedList);
2017
+ }
2018
+ const fromChunkingConfig = getValueByPath(fromObject, [
2019
+ 'chunkingConfig',
2020
+ ]);
2021
+ if (parentObject !== undefined && fromChunkingConfig != null) {
2022
+ setValueByPath(parentObject, ['chunkingConfig'], fromChunkingConfig);
2023
+ }
2024
+ return toObject;
2025
+ }
2026
+
2027
+ /**
2028
+ * @license
2029
+ * Copyright 2025 Google LLC
2030
+ * SPDX-License-Identifier: Apache-2.0
2031
+ */
2032
+ /**
2033
+ * API errors raised by the GenAI API.
2034
+ */
2035
+ class ApiError extends Error {
2036
+ constructor(options) {
2037
+ super(options.message);
2038
+ this.name = 'ApiError';
2039
+ this.status = options.status;
2040
+ Object.setPrototypeOf(this, ApiError.prototype);
2041
+ }
2042
+ }
2043
+
1970
2044
  /**
1971
2045
  * @license
1972
2046
  * Copyright 2025 Google LLC
@@ -1976,7 +2050,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
1976
2050
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
1977
2051
  const USER_AGENT_HEADER = 'User-Agent';
1978
2052
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
1979
- const SDK_VERSION = '1.50.1'; // x-release-please-version
2053
+ const SDK_VERSION = '1.52.0'; // x-release-please-version
1980
2054
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
1981
2055
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
1982
2056
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -2725,67 +2799,6 @@ function buildGoogleAuthOptions(googleAuthOptions) {
2725
2799
  }
2726
2800
  }
2727
2801
 
2728
- /**
2729
- * @license
2730
- * Copyright 2025 Google LLC
2731
- * SPDX-License-Identifier: Apache-2.0
2732
- */
2733
- function _isFile(origin) {
2734
- return (origin !== null &&
2735
- origin !== undefined &&
2736
- typeof origin === 'object' &&
2737
- 'name' in origin);
2738
- }
2739
- function isGeneratedVideo(origin) {
2740
- return (origin !== null &&
2741
- origin !== undefined &&
2742
- typeof origin === 'object' &&
2743
- 'video' in origin);
2744
- }
2745
- function isVideo(origin) {
2746
- return (origin !== null &&
2747
- origin !== undefined &&
2748
- typeof origin === 'object' &&
2749
- 'uri' in origin);
2750
- }
2751
- function tFileName(fromName) {
2752
- var _a;
2753
- let name;
2754
- if (_isFile(fromName)) {
2755
- name = fromName.name;
2756
- }
2757
- if (isVideo(fromName)) {
2758
- name = fromName.uri;
2759
- if (name === undefined) {
2760
- return undefined;
2761
- }
2762
- }
2763
- if (isGeneratedVideo(fromName)) {
2764
- name = (_a = fromName.video) === null || _a === void 0 ? void 0 : _a.uri;
2765
- if (name === undefined) {
2766
- return undefined;
2767
- }
2768
- }
2769
- if (typeof fromName === 'string') {
2770
- name = fromName;
2771
- }
2772
- if (name === undefined) {
2773
- throw new Error('Could not extract file name from the provided input.');
2774
- }
2775
- if (name.startsWith('https://')) {
2776
- const suffix = name.split('files/')[1];
2777
- const match = suffix.match(/[a-z0-9]+/);
2778
- if (match === null) {
2779
- throw new Error(`Could not extract file name from URI ${name}`);
2780
- }
2781
- name = match[0];
2782
- }
2783
- else if (name.startsWith('files/')) {
2784
- name = name.split('files/')[1];
2785
- }
2786
- return name;
2787
- }
2788
-
2789
2802
  /**
2790
2803
  * @license
2791
2804
  * Copyright 2025 Google LLC