@google/genai 0.7.0 → 0.8.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.
@@ -1538,6 +1538,7 @@ class Pager {
1538
1538
  * SPDX-License-Identifier: Apache-2.0
1539
1539
  */
1540
1540
  // Code generated by the Google Gen AI SDK generator DO NOT EDIT.
1541
+ /** Required. Outcome of the code execution. */
1541
1542
  exports.Outcome = void 0;
1542
1543
  (function (Outcome) {
1543
1544
  Outcome["OUTCOME_UNSPECIFIED"] = "OUTCOME_UNSPECIFIED";
@@ -1545,11 +1546,13 @@ exports.Outcome = void 0;
1545
1546
  Outcome["OUTCOME_FAILED"] = "OUTCOME_FAILED";
1546
1547
  Outcome["OUTCOME_DEADLINE_EXCEEDED"] = "OUTCOME_DEADLINE_EXCEEDED";
1547
1548
  })(exports.Outcome || (exports.Outcome = {}));
1549
+ /** Required. Programming language of the `code`. */
1548
1550
  exports.Language = void 0;
1549
1551
  (function (Language) {
1550
1552
  Language["LANGUAGE_UNSPECIFIED"] = "LANGUAGE_UNSPECIFIED";
1551
1553
  Language["PYTHON"] = "PYTHON";
1552
1554
  })(exports.Language || (exports.Language = {}));
1555
+ /** Optional. The type of the data. */
1553
1556
  exports.Type = void 0;
1554
1557
  (function (Type) {
1555
1558
  Type["TYPE_UNSPECIFIED"] = "TYPE_UNSPECIFIED";
@@ -1560,6 +1563,7 @@ exports.Type = void 0;
1560
1563
  Type["ARRAY"] = "ARRAY";
1561
1564
  Type["OBJECT"] = "OBJECT";
1562
1565
  })(exports.Type || (exports.Type = {}));
1566
+ /** Required. Harm category. */
1563
1567
  exports.HarmCategory = void 0;
1564
1568
  (function (HarmCategory) {
1565
1569
  HarmCategory["HARM_CATEGORY_UNSPECIFIED"] = "HARM_CATEGORY_UNSPECIFIED";
@@ -1569,12 +1573,14 @@ exports.HarmCategory = void 0;
1569
1573
  HarmCategory["HARM_CATEGORY_SEXUALLY_EXPLICIT"] = "HARM_CATEGORY_SEXUALLY_EXPLICIT";
1570
1574
  HarmCategory["HARM_CATEGORY_CIVIC_INTEGRITY"] = "HARM_CATEGORY_CIVIC_INTEGRITY";
1571
1575
  })(exports.HarmCategory || (exports.HarmCategory = {}));
1576
+ /** Optional. Specify if the threshold is used for probability or severity score. If not specified, the threshold is used for probability score. */
1572
1577
  exports.HarmBlockMethod = void 0;
1573
1578
  (function (HarmBlockMethod) {
1574
1579
  HarmBlockMethod["HARM_BLOCK_METHOD_UNSPECIFIED"] = "HARM_BLOCK_METHOD_UNSPECIFIED";
1575
1580
  HarmBlockMethod["SEVERITY"] = "SEVERITY";
1576
1581
  HarmBlockMethod["PROBABILITY"] = "PROBABILITY";
1577
1582
  })(exports.HarmBlockMethod || (exports.HarmBlockMethod = {}));
1583
+ /** Required. The harm block threshold. */
1578
1584
  exports.HarmBlockThreshold = void 0;
1579
1585
  (function (HarmBlockThreshold) {
1580
1586
  HarmBlockThreshold["HARM_BLOCK_THRESHOLD_UNSPECIFIED"] = "HARM_BLOCK_THRESHOLD_UNSPECIFIED";
@@ -1584,11 +1590,16 @@ exports.HarmBlockThreshold = void 0;
1584
1590
  HarmBlockThreshold["BLOCK_NONE"] = "BLOCK_NONE";
1585
1591
  HarmBlockThreshold["OFF"] = "OFF";
1586
1592
  })(exports.HarmBlockThreshold || (exports.HarmBlockThreshold = {}));
1593
+ /** The mode of the predictor to be used in dynamic retrieval. */
1587
1594
  exports.Mode = void 0;
1588
1595
  (function (Mode) {
1589
1596
  Mode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
1590
1597
  Mode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
1591
1598
  })(exports.Mode || (exports.Mode = {}));
1599
+ /** Output only. The reason why the model stopped generating tokens.
1600
+
1601
+ If empty, the model has not stopped generating the tokens.
1602
+ */
1592
1603
  exports.FinishReason = void 0;
1593
1604
  (function (FinishReason) {
1594
1605
  FinishReason["FINISH_REASON_UNSPECIFIED"] = "FINISH_REASON_UNSPECIFIED";
@@ -1603,6 +1614,7 @@ exports.FinishReason = void 0;
1603
1614
  FinishReason["MALFORMED_FUNCTION_CALL"] = "MALFORMED_FUNCTION_CALL";
1604
1615
  FinishReason["IMAGE_SAFETY"] = "IMAGE_SAFETY";
1605
1616
  })(exports.FinishReason || (exports.FinishReason = {}));
1617
+ /** Output only. Harm probability levels in the content. */
1606
1618
  exports.HarmProbability = void 0;
1607
1619
  (function (HarmProbability) {
1608
1620
  HarmProbability["HARM_PROBABILITY_UNSPECIFIED"] = "HARM_PROBABILITY_UNSPECIFIED";
@@ -1611,6 +1623,7 @@ exports.HarmProbability = void 0;
1611
1623
  HarmProbability["MEDIUM"] = "MEDIUM";
1612
1624
  HarmProbability["HIGH"] = "HIGH";
1613
1625
  })(exports.HarmProbability || (exports.HarmProbability = {}));
1626
+ /** Output only. Harm severity levels in the content. */
1614
1627
  exports.HarmSeverity = void 0;
1615
1628
  (function (HarmSeverity) {
1616
1629
  HarmSeverity["HARM_SEVERITY_UNSPECIFIED"] = "HARM_SEVERITY_UNSPECIFIED";
@@ -1619,6 +1632,7 @@ exports.HarmSeverity = void 0;
1619
1632
  HarmSeverity["HARM_SEVERITY_MEDIUM"] = "HARM_SEVERITY_MEDIUM";
1620
1633
  HarmSeverity["HARM_SEVERITY_HIGH"] = "HARM_SEVERITY_HIGH";
1621
1634
  })(exports.HarmSeverity || (exports.HarmSeverity = {}));
1635
+ /** Output only. Blocked reason. */
1622
1636
  exports.BlockedReason = void 0;
1623
1637
  (function (BlockedReason) {
1624
1638
  BlockedReason["BLOCKED_REASON_UNSPECIFIED"] = "BLOCKED_REASON_UNSPECIFIED";
@@ -1627,6 +1641,14 @@ exports.BlockedReason = void 0;
1627
1641
  BlockedReason["BLOCKLIST"] = "BLOCKLIST";
1628
1642
  BlockedReason["PROHIBITED_CONTENT"] = "PROHIBITED_CONTENT";
1629
1643
  })(exports.BlockedReason || (exports.BlockedReason = {}));
1644
+ /** Output only. Traffic type. This shows whether a request consumes Pay-As-You-Go or Provisioned Throughput quota. */
1645
+ exports.TrafficType = void 0;
1646
+ (function (TrafficType) {
1647
+ TrafficType["TRAFFIC_TYPE_UNSPECIFIED"] = "TRAFFIC_TYPE_UNSPECIFIED";
1648
+ TrafficType["ON_DEMAND"] = "ON_DEMAND";
1649
+ TrafficType["PROVISIONED_THROUGHPUT"] = "PROVISIONED_THROUGHPUT";
1650
+ })(exports.TrafficType || (exports.TrafficType = {}));
1651
+ /** Server content modalities. */
1630
1652
  exports.Modality = void 0;
1631
1653
  (function (Modality) {
1632
1654
  Modality["MODALITY_UNSPECIFIED"] = "MODALITY_UNSPECIFIED";
@@ -1634,17 +1656,21 @@ exports.Modality = void 0;
1634
1656
  Modality["IMAGE"] = "IMAGE";
1635
1657
  Modality["AUDIO"] = "AUDIO";
1636
1658
  })(exports.Modality || (exports.Modality = {}));
1637
- exports.State = void 0;
1638
- (function (State) {
1639
- State["STATE_UNSPECIFIED"] = "STATE_UNSPECIFIED";
1640
- State["ACTIVE"] = "ACTIVE";
1641
- State["ERROR"] = "ERROR";
1642
- })(exports.State || (exports.State = {}));
1659
+ /** The media resolution to use. */
1660
+ exports.MediaResolution = void 0;
1661
+ (function (MediaResolution) {
1662
+ MediaResolution["MEDIA_RESOLUTION_UNSPECIFIED"] = "MEDIA_RESOLUTION_UNSPECIFIED";
1663
+ MediaResolution["MEDIA_RESOLUTION_LOW"] = "MEDIA_RESOLUTION_LOW";
1664
+ MediaResolution["MEDIA_RESOLUTION_MEDIUM"] = "MEDIA_RESOLUTION_MEDIUM";
1665
+ MediaResolution["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
1666
+ })(exports.MediaResolution || (exports.MediaResolution = {}));
1667
+ /** Config for the dynamic retrieval config mode. */
1643
1668
  exports.DynamicRetrievalConfigMode = void 0;
1644
1669
  (function (DynamicRetrievalConfigMode) {
1645
1670
  DynamicRetrievalConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
1646
1671
  DynamicRetrievalConfigMode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
1647
1672
  })(exports.DynamicRetrievalConfigMode || (exports.DynamicRetrievalConfigMode = {}));
1673
+ /** Config for the function calling config mode. */
1648
1674
  exports.FunctionCallingConfigMode = void 0;
1649
1675
  (function (FunctionCallingConfigMode) {
1650
1676
  FunctionCallingConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
@@ -1652,13 +1678,7 @@ exports.FunctionCallingConfigMode = void 0;
1652
1678
  FunctionCallingConfigMode["ANY"] = "ANY";
1653
1679
  FunctionCallingConfigMode["NONE"] = "NONE";
1654
1680
  })(exports.FunctionCallingConfigMode || (exports.FunctionCallingConfigMode = {}));
1655
- exports.MediaResolution = void 0;
1656
- (function (MediaResolution) {
1657
- MediaResolution["MEDIA_RESOLUTION_UNSPECIFIED"] = "MEDIA_RESOLUTION_UNSPECIFIED";
1658
- MediaResolution["MEDIA_RESOLUTION_LOW"] = "MEDIA_RESOLUTION_LOW";
1659
- MediaResolution["MEDIA_RESOLUTION_MEDIUM"] = "MEDIA_RESOLUTION_MEDIUM";
1660
- MediaResolution["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
1661
- })(exports.MediaResolution || (exports.MediaResolution = {}));
1681
+ /** Enum that controls the safety filter level for objectionable content. */
1662
1682
  exports.SafetyFilterLevel = void 0;
1663
1683
  (function (SafetyFilterLevel) {
1664
1684
  SafetyFilterLevel["BLOCK_LOW_AND_ABOVE"] = "BLOCK_LOW_AND_ABOVE";
@@ -1666,12 +1686,14 @@ exports.SafetyFilterLevel = void 0;
1666
1686
  SafetyFilterLevel["BLOCK_ONLY_HIGH"] = "BLOCK_ONLY_HIGH";
1667
1687
  SafetyFilterLevel["BLOCK_NONE"] = "BLOCK_NONE";
1668
1688
  })(exports.SafetyFilterLevel || (exports.SafetyFilterLevel = {}));
1689
+ /** Enum that controls the generation of people. */
1669
1690
  exports.PersonGeneration = void 0;
1670
1691
  (function (PersonGeneration) {
1671
1692
  PersonGeneration["DONT_ALLOW"] = "DONT_ALLOW";
1672
1693
  PersonGeneration["ALLOW_ADULT"] = "ALLOW_ADULT";
1673
1694
  PersonGeneration["ALLOW_ALL"] = "ALLOW_ALL";
1674
1695
  })(exports.PersonGeneration || (exports.PersonGeneration = {}));
1696
+ /** Enum that specifies the language of the text in the prompt. */
1675
1697
  exports.ImagePromptLanguage = void 0;
1676
1698
  (function (ImagePromptLanguage) {
1677
1699
  ImagePromptLanguage["auto"] = "auto";
@@ -1680,6 +1702,7 @@ exports.ImagePromptLanguage = void 0;
1680
1702
  ImagePromptLanguage["ko"] = "ko";
1681
1703
  ImagePromptLanguage["hi"] = "hi";
1682
1704
  })(exports.ImagePromptLanguage || (exports.ImagePromptLanguage = {}));
1705
+ /** State for the lifecycle of a File. */
1683
1706
  exports.FileState = void 0;
1684
1707
  (function (FileState) {
1685
1708
  FileState["STATE_UNSPECIFIED"] = "STATE_UNSPECIFIED";
@@ -1687,12 +1710,14 @@ exports.FileState = void 0;
1687
1710
  FileState["ACTIVE"] = "ACTIVE";
1688
1711
  FileState["FAILED"] = "FAILED";
1689
1712
  })(exports.FileState || (exports.FileState = {}));
1713
+ /** Source of the File. */
1690
1714
  exports.FileSource = void 0;
1691
1715
  (function (FileSource) {
1692
1716
  FileSource["SOURCE_UNSPECIFIED"] = "SOURCE_UNSPECIFIED";
1693
1717
  FileSource["UPLOADED"] = "UPLOADED";
1694
1718
  FileSource["GENERATED"] = "GENERATED";
1695
1719
  })(exports.FileSource || (exports.FileSource = {}));
1720
+ /** Enum representing the mask mode of a mask reference image. */
1696
1721
  exports.MaskReferenceMode = void 0;
1697
1722
  (function (MaskReferenceMode) {
1698
1723
  MaskReferenceMode["MASK_MODE_DEFAULT"] = "MASK_MODE_DEFAULT";
@@ -1701,6 +1726,7 @@ exports.MaskReferenceMode = void 0;
1701
1726
  MaskReferenceMode["MASK_MODE_FOREGROUND"] = "MASK_MODE_FOREGROUND";
1702
1727
  MaskReferenceMode["MASK_MODE_SEMANTIC"] = "MASK_MODE_SEMANTIC";
1703
1728
  })(exports.MaskReferenceMode || (exports.MaskReferenceMode = {}));
1729
+ /** Enum representing the control type of a control reference image. */
1704
1730
  exports.ControlReferenceType = void 0;
1705
1731
  (function (ControlReferenceType) {
1706
1732
  ControlReferenceType["CONTROL_TYPE_DEFAULT"] = "CONTROL_TYPE_DEFAULT";
@@ -1708,6 +1734,7 @@ exports.ControlReferenceType = void 0;
1708
1734
  ControlReferenceType["CONTROL_TYPE_SCRIBBLE"] = "CONTROL_TYPE_SCRIBBLE";
1709
1735
  ControlReferenceType["CONTROL_TYPE_FACE_MESH"] = "CONTROL_TYPE_FACE_MESH";
1710
1736
  })(exports.ControlReferenceType || (exports.ControlReferenceType = {}));
1737
+ /** Enum representing the subject type of a subject reference image. */
1711
1738
  exports.SubjectReferenceType = void 0;
1712
1739
  (function (SubjectReferenceType) {
1713
1740
  SubjectReferenceType["SUBJECT_TYPE_DEFAULT"] = "SUBJECT_TYPE_DEFAULT";
@@ -1715,6 +1742,7 @@ exports.SubjectReferenceType = void 0;
1715
1742
  SubjectReferenceType["SUBJECT_TYPE_ANIMAL"] = "SUBJECT_TYPE_ANIMAL";
1716
1743
  SubjectReferenceType["SUBJECT_TYPE_PRODUCT"] = "SUBJECT_TYPE_PRODUCT";
1717
1744
  })(exports.SubjectReferenceType || (exports.SubjectReferenceType = {}));
1745
+ /** Server content modalities. */
1718
1746
  exports.MediaModality = void 0;
1719
1747
  (function (MediaModality) {
1720
1748
  MediaModality["MODALITY_UNSPECIFIED"] = "MODALITY_UNSPECIFIED";
@@ -1724,6 +1752,34 @@ exports.MediaModality = void 0;
1724
1752
  MediaModality["AUDIO"] = "AUDIO";
1725
1753
  MediaModality["DOCUMENT"] = "DOCUMENT";
1726
1754
  })(exports.MediaModality || (exports.MediaModality = {}));
1755
+ /** Start of speech sensitivity. */
1756
+ exports.StartSensitivity = void 0;
1757
+ (function (StartSensitivity) {
1758
+ StartSensitivity["START_SENSITIVITY_UNSPECIFIED"] = "START_SENSITIVITY_UNSPECIFIED";
1759
+ StartSensitivity["START_SENSITIVITY_HIGH"] = "START_SENSITIVITY_HIGH";
1760
+ StartSensitivity["START_SENSITIVITY_LOW"] = "START_SENSITIVITY_LOW";
1761
+ })(exports.StartSensitivity || (exports.StartSensitivity = {}));
1762
+ /** End of speech sensitivity. */
1763
+ exports.EndSensitivity = void 0;
1764
+ (function (EndSensitivity) {
1765
+ EndSensitivity["END_SENSITIVITY_UNSPECIFIED"] = "END_SENSITIVITY_UNSPECIFIED";
1766
+ EndSensitivity["END_SENSITIVITY_HIGH"] = "END_SENSITIVITY_HIGH";
1767
+ EndSensitivity["END_SENSITIVITY_LOW"] = "END_SENSITIVITY_LOW";
1768
+ })(exports.EndSensitivity || (exports.EndSensitivity = {}));
1769
+ /** The different ways of handling user activity. */
1770
+ exports.ActivityHandling = void 0;
1771
+ (function (ActivityHandling) {
1772
+ ActivityHandling["ACTIVITY_HANDLING_UNSPECIFIED"] = "ACTIVITY_HANDLING_UNSPECIFIED";
1773
+ ActivityHandling["START_OF_ACTIVITY_INTERRUPTS"] = "START_OF_ACTIVITY_INTERRUPTS";
1774
+ ActivityHandling["NO_INTERRUPTION"] = "NO_INTERRUPTION";
1775
+ })(exports.ActivityHandling || (exports.ActivityHandling = {}));
1776
+ /** Options about which input is included in the user's turn. */
1777
+ exports.TurnCoverage = void 0;
1778
+ (function (TurnCoverage) {
1779
+ TurnCoverage["TURN_COVERAGE_UNSPECIFIED"] = "TURN_COVERAGE_UNSPECIFIED";
1780
+ TurnCoverage["TURN_INCLUDES_ONLY_ACTIVITY"] = "TURN_INCLUDES_ONLY_ACTIVITY";
1781
+ TurnCoverage["TURN_INCLUDES_ALL_INPUT"] = "TURN_INCLUDES_ALL_INPUT";
1782
+ })(exports.TurnCoverage || (exports.TurnCoverage = {}));
1727
1783
  /** A function response. */
1728
1784
  class FunctionResponse {
1729
1785
  }
@@ -1770,7 +1826,7 @@ function createPartFromFunctionResponse(id, name, response) {
1770
1826
  };
1771
1827
  }
1772
1828
  /**
1773
- * Creates a `Part` object from a `base64` `string`.
1829
+ * Creates a `Part` object from a `base64` encoded `string`.
1774
1830
  */
1775
1831
  function createPartFromBase64(data, mimeType) {
1776
1832
  return {
@@ -3152,7 +3208,9 @@ class Files extends BaseModule {
3152
3208
  * This section can contain multiple paragraphs and code examples.
3153
3209
  *
3154
3210
  * @param params - Optional parameters specified in the
3155
- * `common.UploadFileParameters` interface.
3211
+ * `types.UploadFileParameters` interface.
3212
+ * @see {@link types.UploadFileParameters#config} for the optional
3213
+ * config in the parameters.
3156
3214
  * @return A promise that resolves to a `types.File` object.
3157
3215
  * @throws An error if called on a Vertex AI client.
3158
3216
  * @throws An error if the `mimeType` is not provided and can not be inferred,
@@ -3656,6 +3714,12 @@ function thinkingConfigToMldev(apiClient, fromObject) {
3656
3714
  if (fromIncludeThoughts != null) {
3657
3715
  setValueByPath(toObject, ['includeThoughts'], fromIncludeThoughts);
3658
3716
  }
3717
+ const fromThinkingBudget = getValueByPath(fromObject, [
3718
+ 'thinkingBudget',
3719
+ ]);
3720
+ if (fromThinkingBudget != null) {
3721
+ setValueByPath(toObject, ['thinkingBudget'], fromThinkingBudget);
3722
+ }
3659
3723
  return toObject;
3660
3724
  }
3661
3725
  function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
@@ -3959,6 +4023,18 @@ function generateImagesParametersToMldev(apiClient, fromObject) {
3959
4023
  }
3960
4024
  return toObject;
3961
4025
  }
4026
+ function getModelParametersToMldev(apiClient, fromObject) {
4027
+ const toObject = {};
4028
+ const fromModel = getValueByPath(fromObject, ['model']);
4029
+ if (fromModel != null) {
4030
+ setValueByPath(toObject, ['_url', 'name'], tModel(apiClient, fromModel));
4031
+ }
4032
+ const fromConfig = getValueByPath(fromObject, ['config']);
4033
+ if (fromConfig != null) {
4034
+ setValueByPath(toObject, ['config'], fromConfig);
4035
+ }
4036
+ return toObject;
4037
+ }
3962
4038
  function countTokensConfigToMldev(apiClient, fromObject) {
3963
4039
  const toObject = {};
3964
4040
  if (getValueByPath(fromObject, ['systemInstruction']) !== undefined) {
@@ -4404,6 +4480,12 @@ function thinkingConfigToVertex(apiClient, fromObject) {
4404
4480
  if (fromIncludeThoughts != null) {
4405
4481
  setValueByPath(toObject, ['includeThoughts'], fromIncludeThoughts);
4406
4482
  }
4483
+ const fromThinkingBudget = getValueByPath(fromObject, [
4484
+ 'thinkingBudget',
4485
+ ]);
4486
+ if (fromThinkingBudget != null) {
4487
+ setValueByPath(toObject, ['thinkingBudget'], fromThinkingBudget);
4488
+ }
4407
4489
  return toObject;
4408
4490
  }
4409
4491
  function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
@@ -4721,6 +4803,18 @@ function generateImagesParametersToVertex(apiClient, fromObject) {
4721
4803
  }
4722
4804
  return toObject;
4723
4805
  }
4806
+ function getModelParametersToVertex(apiClient, fromObject) {
4807
+ const toObject = {};
4808
+ const fromModel = getValueByPath(fromObject, ['model']);
4809
+ if (fromModel != null) {
4810
+ setValueByPath(toObject, ['_url', 'name'], tModel(apiClient, fromModel));
4811
+ }
4812
+ const fromConfig = getValueByPath(fromObject, ['config']);
4813
+ if (fromConfig != null) {
4814
+ setValueByPath(toObject, ['config'], fromConfig);
4815
+ }
4816
+ return toObject;
4817
+ }
4724
4818
  function countTokensConfigToVertex(apiClient, fromObject, parentObject) {
4725
4819
  const toObject = {};
4726
4820
  const fromSystemInstruction = getValueByPath(fromObject, [
@@ -5144,6 +5238,64 @@ function generateImagesResponseFromMldev(apiClient, fromObject) {
5144
5238
  }
5145
5239
  return toObject;
5146
5240
  }
5241
+ function tunedModelInfoFromMldev(apiClient, fromObject) {
5242
+ const toObject = {};
5243
+ const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
5244
+ if (fromBaseModel != null) {
5245
+ setValueByPath(toObject, ['baseModel'], fromBaseModel);
5246
+ }
5247
+ const fromCreateTime = getValueByPath(fromObject, ['createTime']);
5248
+ if (fromCreateTime != null) {
5249
+ setValueByPath(toObject, ['createTime'], fromCreateTime);
5250
+ }
5251
+ const fromUpdateTime = getValueByPath(fromObject, ['updateTime']);
5252
+ if (fromUpdateTime != null) {
5253
+ setValueByPath(toObject, ['updateTime'], fromUpdateTime);
5254
+ }
5255
+ return toObject;
5256
+ }
5257
+ function modelFromMldev(apiClient, fromObject) {
5258
+ const toObject = {};
5259
+ const fromName = getValueByPath(fromObject, ['name']);
5260
+ if (fromName != null) {
5261
+ setValueByPath(toObject, ['name'], fromName);
5262
+ }
5263
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
5264
+ if (fromDisplayName != null) {
5265
+ setValueByPath(toObject, ['displayName'], fromDisplayName);
5266
+ }
5267
+ const fromDescription = getValueByPath(fromObject, ['description']);
5268
+ if (fromDescription != null) {
5269
+ setValueByPath(toObject, ['description'], fromDescription);
5270
+ }
5271
+ const fromVersion = getValueByPath(fromObject, ['version']);
5272
+ if (fromVersion != null) {
5273
+ setValueByPath(toObject, ['version'], fromVersion);
5274
+ }
5275
+ const fromTunedModelInfo = getValueByPath(fromObject, ['_self']);
5276
+ if (fromTunedModelInfo != null) {
5277
+ setValueByPath(toObject, ['tunedModelInfo'], tunedModelInfoFromMldev(apiClient, fromTunedModelInfo));
5278
+ }
5279
+ const fromInputTokenLimit = getValueByPath(fromObject, [
5280
+ 'inputTokenLimit',
5281
+ ]);
5282
+ if (fromInputTokenLimit != null) {
5283
+ setValueByPath(toObject, ['inputTokenLimit'], fromInputTokenLimit);
5284
+ }
5285
+ const fromOutputTokenLimit = getValueByPath(fromObject, [
5286
+ 'outputTokenLimit',
5287
+ ]);
5288
+ if (fromOutputTokenLimit != null) {
5289
+ setValueByPath(toObject, ['outputTokenLimit'], fromOutputTokenLimit);
5290
+ }
5291
+ const fromSupportedActions = getValueByPath(fromObject, [
5292
+ 'supportedGenerationMethods',
5293
+ ]);
5294
+ if (fromSupportedActions != null) {
5295
+ setValueByPath(toObject, ['supportedActions'], fromSupportedActions);
5296
+ }
5297
+ return toObject;
5298
+ }
5147
5299
  function countTokensResponseFromMldev(apiClient, fromObject) {
5148
5300
  const toObject = {};
5149
5301
  const fromTotalTokens = getValueByPath(fromObject, ['totalTokens']);
@@ -5232,9 +5384,12 @@ function generateVideosOperationFromMldev$1(apiClient, fromObject) {
5232
5384
  if (fromError != null) {
5233
5385
  setValueByPath(toObject, ['error'], fromError);
5234
5386
  }
5235
- const fromResponse = getValueByPath(fromObject, ['response']);
5387
+ const fromResponse = getValueByPath(fromObject, [
5388
+ 'response',
5389
+ 'generateVideoResponse',
5390
+ ]);
5236
5391
  if (fromResponse != null) {
5237
- setValueByPath(toObject, ['response'], fromResponse);
5392
+ setValueByPath(toObject, ['response'], generateVideosResponseFromMldev$1(apiClient, fromResponse));
5238
5393
  }
5239
5394
  const fromResult = getValueByPath(fromObject, [
5240
5395
  'response',
@@ -5550,6 +5705,78 @@ function generateImagesResponseFromVertex(apiClient, fromObject) {
5550
5705
  }
5551
5706
  return toObject;
5552
5707
  }
5708
+ function endpointFromVertex(apiClient, fromObject) {
5709
+ const toObject = {};
5710
+ const fromName = getValueByPath(fromObject, ['endpoint']);
5711
+ if (fromName != null) {
5712
+ setValueByPath(toObject, ['name'], fromName);
5713
+ }
5714
+ const fromDeployedModelId = getValueByPath(fromObject, [
5715
+ 'deployedModelId',
5716
+ ]);
5717
+ if (fromDeployedModelId != null) {
5718
+ setValueByPath(toObject, ['deployedModelId'], fromDeployedModelId);
5719
+ }
5720
+ return toObject;
5721
+ }
5722
+ function tunedModelInfoFromVertex(apiClient, fromObject) {
5723
+ const toObject = {};
5724
+ const fromBaseModel = getValueByPath(fromObject, [
5725
+ 'labels',
5726
+ 'google-vertex-llm-tuning-base-model-id',
5727
+ ]);
5728
+ if (fromBaseModel != null) {
5729
+ setValueByPath(toObject, ['baseModel'], fromBaseModel);
5730
+ }
5731
+ const fromCreateTime = getValueByPath(fromObject, ['createTime']);
5732
+ if (fromCreateTime != null) {
5733
+ setValueByPath(toObject, ['createTime'], fromCreateTime);
5734
+ }
5735
+ const fromUpdateTime = getValueByPath(fromObject, ['updateTime']);
5736
+ if (fromUpdateTime != null) {
5737
+ setValueByPath(toObject, ['updateTime'], fromUpdateTime);
5738
+ }
5739
+ return toObject;
5740
+ }
5741
+ function modelFromVertex(apiClient, fromObject) {
5742
+ const toObject = {};
5743
+ const fromName = getValueByPath(fromObject, ['name']);
5744
+ if (fromName != null) {
5745
+ setValueByPath(toObject, ['name'], fromName);
5746
+ }
5747
+ const fromDisplayName = getValueByPath(fromObject, ['displayName']);
5748
+ if (fromDisplayName != null) {
5749
+ setValueByPath(toObject, ['displayName'], fromDisplayName);
5750
+ }
5751
+ const fromDescription = getValueByPath(fromObject, ['description']);
5752
+ if (fromDescription != null) {
5753
+ setValueByPath(toObject, ['description'], fromDescription);
5754
+ }
5755
+ const fromVersion = getValueByPath(fromObject, ['versionId']);
5756
+ if (fromVersion != null) {
5757
+ setValueByPath(toObject, ['version'], fromVersion);
5758
+ }
5759
+ const fromEndpoints = getValueByPath(fromObject, ['deployedModels']);
5760
+ if (fromEndpoints != null) {
5761
+ if (Array.isArray(fromEndpoints)) {
5762
+ setValueByPath(toObject, ['endpoints'], fromEndpoints.map((item) => {
5763
+ return endpointFromVertex(apiClient, item);
5764
+ }));
5765
+ }
5766
+ else {
5767
+ setValueByPath(toObject, ['endpoints'], fromEndpoints);
5768
+ }
5769
+ }
5770
+ const fromLabels = getValueByPath(fromObject, ['labels']);
5771
+ if (fromLabels != null) {
5772
+ setValueByPath(toObject, ['labels'], fromLabels);
5773
+ }
5774
+ const fromTunedModelInfo = getValueByPath(fromObject, ['_self']);
5775
+ if (fromTunedModelInfo != null) {
5776
+ setValueByPath(toObject, ['tunedModelInfo'], tunedModelInfoFromVertex(apiClient, fromTunedModelInfo));
5777
+ }
5778
+ return toObject;
5779
+ }
5553
5780
  function countTokensResponseFromVertex(apiClient, fromObject) {
5554
5781
  const toObject = {};
5555
5782
  const fromTotalTokens = getValueByPath(fromObject, ['totalTokens']);
@@ -5639,7 +5866,7 @@ function generateVideosOperationFromVertex$1(apiClient, fromObject) {
5639
5866
  }
5640
5867
  const fromResponse = getValueByPath(fromObject, ['response']);
5641
5868
  if (fromResponse != null) {
5642
- setValueByPath(toObject, ['response'], fromResponse);
5869
+ setValueByPath(toObject, ['response'], generateVideosResponseFromVertex$1(apiClient, fromResponse));
5643
5870
  }
5644
5871
  const fromResult = getValueByPath(fromObject, ['response']);
5645
5872
  if (fromResult != null) {
@@ -5705,6 +5932,23 @@ function liveServerMessageFromMldev(apiClient, fromObject) {
5705
5932
  fromToolCallCancellation !== null) {
5706
5933
  setValueByPath(toObject, ['toolCallCancellation'], liveServerToolCallCancellationFromMldev(apiClient, fromToolCallCancellation));
5707
5934
  }
5935
+ const fromUsageMetadata = getValueByPath(fromObject, [
5936
+ 'usageMetadata',
5937
+ ]);
5938
+ if (fromUsageMetadata != undefined && fromUsageMetadata != null) {
5939
+ setValueByPath(toObject, ['usageMetadata'], usageMetadataFromMldev(apiClient, fromUsageMetadata));
5940
+ }
5941
+ const fromGoAway = getValueByPath(fromObject, ['goAway']);
5942
+ if (fromGoAway !== undefined && fromGoAway !== null) {
5943
+ setValueByPath(toObject, ['goAway'], liveServerGoAwayFromMldev(fromGoAway));
5944
+ }
5945
+ const fromSessionResumptionUpdate = getValueByPath(fromObject, [
5946
+ 'sessionResumptionUpdate',
5947
+ ]);
5948
+ if (fromSessionResumptionUpdate !== undefined &&
5949
+ fromSessionResumptionUpdate !== null) {
5950
+ setValueByPath(toObject, ['sessionResumptionUpdate'], liveServerSessionResumptionUpdateFromMldev(fromSessionResumptionUpdate));
5951
+ }
5708
5952
  return toObject;
5709
5953
  }
5710
5954
  function liveServerMessageFromVertex(apiClient, fromObject) {
@@ -5732,6 +5976,181 @@ function liveServerMessageFromVertex(apiClient, fromObject) {
5732
5976
  fromToolCallCancellation !== null) {
5733
5977
  setValueByPath(toObject, ['toolCallCancellation'], liveServerToolCallCancellationFromVertex(apiClient, fromToolCallCancellation));
5734
5978
  }
5979
+ const fromGoAway = getValueByPath(fromObject, ['goAway']);
5980
+ if (fromGoAway !== undefined && fromGoAway !== null) {
5981
+ setValueByPath(toObject, ['goAway'], liveServerGoAwayFromVertex(fromGoAway));
5982
+ }
5983
+ const fromSessionResumptionUpdate = getValueByPath(fromObject, [
5984
+ 'sessionResumptionUpdate',
5985
+ ]);
5986
+ if (fromSessionResumptionUpdate !== undefined &&
5987
+ fromSessionResumptionUpdate !== null) {
5988
+ setValueByPath(toObject, ['sessionResumptionUpdate'], liveServerSessionResumptionUpdateFromVertex(fromSessionResumptionUpdate));
5989
+ }
5990
+ const fromUsageMetadata = getValueByPath(fromObject, [
5991
+ 'usageMetadata',
5992
+ ]);
5993
+ if (fromUsageMetadata != undefined && fromUsageMetadata != null) {
5994
+ setValueByPath(toObject, ['usageMetadata'], usageMetadataFromVertex(apiClient, fromUsageMetadata));
5995
+ }
5996
+ return toObject;
5997
+ }
5998
+ function slidingWindowToMldev(fromObject) {
5999
+ const toObject = {};
6000
+ const fromTargetTokens = getValueByPath(fromObject, ['targetTokens']);
6001
+ if (fromTargetTokens !== undefined && fromTargetTokens !== null) {
6002
+ setValueByPath(toObject, ['targetTokens'], fromTargetTokens);
6003
+ }
6004
+ return toObject;
6005
+ }
6006
+ function slidingWindowToVertex(fromObject) {
6007
+ const toObject = {};
6008
+ const fromTargetTokens = getValueByPath(fromObject, ['targetTokens']);
6009
+ if (fromTargetTokens !== undefined && fromTargetTokens !== null) {
6010
+ setValueByPath(toObject, ['targetTokens'], fromTargetTokens);
6011
+ }
6012
+ return toObject;
6013
+ }
6014
+ function contextWindowCompressionToMldev(fromObject) {
6015
+ const toObject = {};
6016
+ const fromTriggerTokens = getValueByPath(fromObject, [
6017
+ 'triggerTokens',
6018
+ ]);
6019
+ if (fromTriggerTokens !== undefined && fromTriggerTokens !== null) {
6020
+ setValueByPath(toObject, ['triggerTokens'], fromTriggerTokens);
6021
+ }
6022
+ const fromSlidingWindow = getValueByPath(fromObject, [
6023
+ 'slidingWindow',
6024
+ ]);
6025
+ if (fromSlidingWindow !== undefined && fromSlidingWindow !== null) {
6026
+ setValueByPath(toObject, ['slidingWindow'], slidingWindowToMldev(fromSlidingWindow));
6027
+ }
6028
+ return toObject;
6029
+ }
6030
+ function contextWindowCompressionToVertex(fromObject) {
6031
+ const toObject = {};
6032
+ const fromTriggerTokens = getValueByPath(fromObject, [
6033
+ 'triggerTokens',
6034
+ ]);
6035
+ if (fromTriggerTokens !== undefined && fromTriggerTokens !== null) {
6036
+ setValueByPath(toObject, ['triggerTokens'], fromTriggerTokens);
6037
+ }
6038
+ const fromSlidingWindow = getValueByPath(fromObject, [
6039
+ 'slidingWindow',
6040
+ ]);
6041
+ if (fromSlidingWindow !== undefined && fromSlidingWindow !== null) {
6042
+ setValueByPath(toObject, ['slidingWindow'], slidingWindowToVertex(fromSlidingWindow));
6043
+ }
6044
+ return toObject;
6045
+ }
6046
+ function automaticActivityDetectionToMldev(fromObject) {
6047
+ const toObject = {};
6048
+ const fromDisabled = getValueByPath(fromObject, ['disabled']);
6049
+ if (fromDisabled !== undefined && fromDisabled !== null) {
6050
+ setValueByPath(toObject, ['disabled'], fromDisabled);
6051
+ }
6052
+ const fromStartOfSpeechSensitivity = getValueByPath(fromObject, [
6053
+ 'startOfSpeechSensitivity',
6054
+ ]);
6055
+ if (fromStartOfSpeechSensitivity !== undefined &&
6056
+ fromStartOfSpeechSensitivity !== null) {
6057
+ setValueByPath(toObject, ['startOfSpeechSensitivity'], fromStartOfSpeechSensitivity);
6058
+ }
6059
+ const fromEndOfSpeechSensitivity = getValueByPath(fromObject, [
6060
+ 'endOfSpeechSensitivity',
6061
+ ]);
6062
+ if (fromEndOfSpeechSensitivity !== undefined &&
6063
+ fromEndOfSpeechSensitivity !== null) {
6064
+ setValueByPath(toObject, ['endOfSpeechSensitivity'], fromEndOfSpeechSensitivity);
6065
+ }
6066
+ const fromPrefixPaddingMs = getValueByPath(fromObject, [
6067
+ 'prefixPaddingMs',
6068
+ ]);
6069
+ if (fromPrefixPaddingMs !== undefined && fromPrefixPaddingMs !== null) {
6070
+ setValueByPath(toObject, ['prefixPaddingMs'], fromPrefixPaddingMs);
6071
+ }
6072
+ const fromSilenceDurationMs = getValueByPath(fromObject, [
6073
+ 'silenceDurationMs',
6074
+ ]);
6075
+ if (fromSilenceDurationMs !== undefined && fromSilenceDurationMs !== null) {
6076
+ setValueByPath(toObject, ['silenceDurationMs'], fromSilenceDurationMs);
6077
+ }
6078
+ return toObject;
6079
+ }
6080
+ function automaticActivityDetectionToVertex(fromObject) {
6081
+ const toObject = {};
6082
+ const fromDisabled = getValueByPath(fromObject, ['disabled']);
6083
+ if (fromDisabled !== undefined && fromDisabled !== null) {
6084
+ setValueByPath(toObject, ['disabled'], fromDisabled);
6085
+ }
6086
+ const fromStartOfSpeechSensitivity = getValueByPath(fromObject, [
6087
+ 'startOfSpeechSensitivity',
6088
+ ]);
6089
+ if (fromStartOfSpeechSensitivity !== undefined &&
6090
+ fromStartOfSpeechSensitivity !== null) {
6091
+ setValueByPath(toObject, ['startOfSpeechSensitivity'], fromStartOfSpeechSensitivity);
6092
+ }
6093
+ const fromEndOfSpeechSensitivity = getValueByPath(fromObject, [
6094
+ 'endOfSpeechSensitivity',
6095
+ ]);
6096
+ if (fromEndOfSpeechSensitivity !== undefined &&
6097
+ fromEndOfSpeechSensitivity !== null) {
6098
+ setValueByPath(toObject, ['endOfSpeechSensitivity'], fromEndOfSpeechSensitivity);
6099
+ }
6100
+ const fromPrefixPaddingMs = getValueByPath(fromObject, [
6101
+ 'prefixPaddingMs',
6102
+ ]);
6103
+ if (fromPrefixPaddingMs !== undefined && fromPrefixPaddingMs !== null) {
6104
+ setValueByPath(toObject, ['prefixPaddingMs'], fromPrefixPaddingMs);
6105
+ }
6106
+ const fromSilenceDurationMs = getValueByPath(fromObject, [
6107
+ 'silenceDurationMs',
6108
+ ]);
6109
+ if (fromSilenceDurationMs !== undefined && fromSilenceDurationMs !== null) {
6110
+ setValueByPath(toObject, ['silenceDurationMs'], fromSilenceDurationMs);
6111
+ }
6112
+ return toObject;
6113
+ }
6114
+ function realtimeInputConfigToMldev(fromObject) {
6115
+ const toObject = {};
6116
+ const fromAutomaticActivityDetection = getValueByPath(fromObject, [
6117
+ 'automaticActivityDetection',
6118
+ ]);
6119
+ if (fromAutomaticActivityDetection !== undefined &&
6120
+ fromAutomaticActivityDetection !== null) {
6121
+ setValueByPath(toObject, ['automaticActivityDetection'], automaticActivityDetectionToMldev(fromAutomaticActivityDetection));
6122
+ }
6123
+ const fromActivityHandling = getValueByPath(fromObject, [
6124
+ 'activityHandling',
6125
+ ]);
6126
+ if (fromActivityHandling !== undefined && fromActivityHandling !== null) {
6127
+ setValueByPath(toObject, ['activityHandling'], fromActivityHandling);
6128
+ }
6129
+ const fromTurnCoverage = getValueByPath(fromObject, ['turnCoverage']);
6130
+ if (fromTurnCoverage !== undefined && fromTurnCoverage !== null) {
6131
+ setValueByPath(toObject, ['turnCoverage'], fromTurnCoverage);
6132
+ }
6133
+ return toObject;
6134
+ }
6135
+ function realtimeInputConfigToVertex(fromObject) {
6136
+ const toObject = {};
6137
+ const fromAutomaticActivityDetection = getValueByPath(fromObject, [
6138
+ 'automaticActivityDetection',
6139
+ ]);
6140
+ if (fromAutomaticActivityDetection !== undefined &&
6141
+ fromAutomaticActivityDetection !== null) {
6142
+ setValueByPath(toObject, ['automaticActivityDetection'], automaticActivityDetectionToVertex(fromAutomaticActivityDetection));
6143
+ }
6144
+ const fromActivityHandling = getValueByPath(fromObject, [
6145
+ 'activityHandling',
6146
+ ]);
6147
+ if (fromActivityHandling !== undefined && fromActivityHandling !== null) {
6148
+ setValueByPath(toObject, ['activityHandling'], fromActivityHandling);
6149
+ }
6150
+ const fromTurnCoverage = getValueByPath(fromObject, ['turnCoverage']);
6151
+ if (fromTurnCoverage !== undefined && fromTurnCoverage !== null) {
6152
+ setValueByPath(toObject, ['turnCoverage'], fromTurnCoverage);
6153
+ }
5735
6154
  return toObject;
5736
6155
  }
5737
6156
  function liveConnectConfigToMldev(apiClient, fromObject) {
@@ -5766,6 +6185,26 @@ function liveConnectConfigToMldev(apiClient, fromObject) {
5766
6185
  return toolToMldev(apiClient, item);
5767
6186
  }));
5768
6187
  }
6188
+ const fromSessionResumption = getValueByPath(fromObject, [
6189
+ 'sessionResumption',
6190
+ ]);
6191
+ if (fromSessionResumption !== undefined && fromSessionResumption !== null) {
6192
+ setValueByPath(toObject, ['sessionResumption'], liveClientSessionResumptionConfigToMldev(fromSessionResumption));
6193
+ }
6194
+ const fromContextWindowCompression = getValueByPath(fromObject, [
6195
+ 'contextWindowCompression',
6196
+ ]);
6197
+ if (fromContextWindowCompression !== undefined &&
6198
+ fromContextWindowCompression !== null) {
6199
+ setValueByPath(toObject, ['contextWindowCompression'], contextWindowCompressionToMldev(fromContextWindowCompression));
6200
+ }
6201
+ const fromRealtimeInputConfig = getValueByPath(fromObject, [
6202
+ 'realtimeInputConfig',
6203
+ ]);
6204
+ if (fromRealtimeInputConfig !== undefined &&
6205
+ fromRealtimeInputConfig !== null) {
6206
+ setValueByPath(toObject, ['realtimeInputConfig'], realtimeInputConfigToMldev(fromRealtimeInputConfig));
6207
+ }
5769
6208
  return toObject;
5770
6209
  }
5771
6210
  function liveConnectConfigToVertex(apiClient, fromObject) {
@@ -5804,6 +6243,26 @@ function liveConnectConfigToVertex(apiClient, fromObject) {
5804
6243
  return toolToVertex(apiClient, item);
5805
6244
  }));
5806
6245
  }
6246
+ const fromSessionResumption = getValueByPath(fromObject, [
6247
+ 'sessionResumption',
6248
+ ]);
6249
+ if (fromSessionResumption !== undefined && fromSessionResumption !== null) {
6250
+ setValueByPath(toObject, ['sessionResumption'], liveClientSessionResumptionConfigToVertex(fromSessionResumption));
6251
+ }
6252
+ const fromContextWindowCompression = getValueByPath(fromObject, [
6253
+ 'contextWindowCompression',
6254
+ ]);
6255
+ if (fromContextWindowCompression !== undefined &&
6256
+ fromContextWindowCompression !== null) {
6257
+ setValueByPath(toObject, ['contextWindowCompression'], contextWindowCompressionToVertex(fromContextWindowCompression));
6258
+ }
6259
+ const fromRealtimeInputConfig = getValueByPath(fromObject, [
6260
+ 'realtimeInputConfig',
6261
+ ]);
6262
+ if (fromRealtimeInputConfig !== undefined &&
6263
+ fromRealtimeInputConfig !== null) {
6264
+ setValueByPath(toObject, ['realtimeInputConfig'], realtimeInputConfigToVertex(fromRealtimeInputConfig));
6265
+ }
5807
6266
  return toObject;
5808
6267
  }
5809
6268
  function liveServerContentFromMldev(apiClient, fromObject) {
@@ -5820,6 +6279,12 @@ function liveServerContentFromMldev(apiClient, fromObject) {
5820
6279
  if (fromInterrupted !== undefined) {
5821
6280
  setValueByPath(toObject, ['interrupted'], fromInterrupted);
5822
6281
  }
6282
+ const fromGenerationComplete = getValueByPath(fromObject, [
6283
+ 'generationComplete',
6284
+ ]);
6285
+ if (fromGenerationComplete != null) {
6286
+ setValueByPath(toObject, ['generationComplete'], fromGenerationComplete);
6287
+ }
5823
6288
  return toObject;
5824
6289
  }
5825
6290
  function liveServerContentFromVertex(apiClient, fromObject) {
@@ -5836,6 +6301,12 @@ function liveServerContentFromVertex(apiClient, fromObject) {
5836
6301
  if (fromInterrupted !== undefined) {
5837
6302
  setValueByPath(toObject, ['interrupted'], fromInterrupted);
5838
6303
  }
6304
+ const fromGenerationComplete = getValueByPath(fromObject, [
6305
+ 'generationComplete',
6306
+ ]);
6307
+ if (fromGenerationComplete != null) {
6308
+ setValueByPath(toObject, ['generationComplete'], fromGenerationComplete);
6309
+ }
5839
6310
  return toObject;
5840
6311
  }
5841
6312
  function functionCallFromMldev(apiClient, fromObject) {
@@ -5910,6 +6381,293 @@ function liveServerToolCallCancellationFromVertex(apiClient, fromObject) {
5910
6381
  }
5911
6382
  return toObject;
5912
6383
  }
6384
+ function liveServerGoAwayFromMldev(fromObject) {
6385
+ const toObject = {};
6386
+ const fromTimeLeft = getValueByPath(fromObject, ['timeLeft']);
6387
+ if (fromTimeLeft !== undefined) {
6388
+ setValueByPath(toObject, ['timeLeft'], fromTimeLeft);
6389
+ }
6390
+ return toObject;
6391
+ }
6392
+ function liveServerGoAwayFromVertex(fromObject) {
6393
+ const toObject = {};
6394
+ const fromTimeLeft = getValueByPath(fromObject, ['timeLeft']);
6395
+ if (fromTimeLeft !== undefined) {
6396
+ setValueByPath(toObject, ['timeLeft'], fromTimeLeft);
6397
+ }
6398
+ return toObject;
6399
+ }
6400
+ function liveServerSessionResumptionUpdateFromMldev(fromObject) {
6401
+ const toObject = {};
6402
+ const fromNewHandle = getValueByPath(fromObject, ['newHandle']);
6403
+ if (fromNewHandle !== undefined) {
6404
+ setValueByPath(toObject, ['newHandle'], fromNewHandle);
6405
+ }
6406
+ const fromResumable = getValueByPath(fromObject, ['resumable']);
6407
+ if (fromResumable !== undefined) {
6408
+ setValueByPath(toObject, ['resumable'], fromResumable);
6409
+ }
6410
+ const fromLastConsumedClientMessageIndex = getValueByPath(fromObject, [
6411
+ 'lastConsumedClientMessageIndex',
6412
+ ]);
6413
+ if (fromLastConsumedClientMessageIndex !== undefined) {
6414
+ setValueByPath(toObject, ['lastConsumedClientMessageIndex'], fromLastConsumedClientMessageIndex);
6415
+ }
6416
+ return toObject;
6417
+ }
6418
+ function liveServerSessionResumptionUpdateFromVertex(fromObject) {
6419
+ const toObject = {};
6420
+ const fromNewHandle = getValueByPath(fromObject, ['newHandle']);
6421
+ if (fromNewHandle !== undefined) {
6422
+ setValueByPath(toObject, ['newHandle'], fromNewHandle);
6423
+ }
6424
+ const fromResumable = getValueByPath(fromObject, ['resumable']);
6425
+ if (fromResumable !== undefined) {
6426
+ setValueByPath(toObject, ['resumable'], fromResumable);
6427
+ }
6428
+ const fromLastConsumedClientMessageIndex = getValueByPath(fromObject, [
6429
+ 'lastConsumedClientMessageIndex',
6430
+ ]);
6431
+ if (fromLastConsumedClientMessageIndex !== undefined) {
6432
+ setValueByPath(toObject, ['lastConsumedClientMessageIndex'], fromLastConsumedClientMessageIndex);
6433
+ }
6434
+ return toObject;
6435
+ }
6436
+ function liveClientSessionResumptionConfigToMldev(fromObject) {
6437
+ const toObject = {};
6438
+ const fromHandle = getValueByPath(fromObject, ['handle']);
6439
+ if (fromHandle !== undefined) {
6440
+ setValueByPath(toObject, ['handle'], fromHandle);
6441
+ }
6442
+ if (getValueByPath(fromObject, ['transparent']) !== undefined) {
6443
+ throw new Error('transparent parameter is not supported in Gemini API.');
6444
+ }
6445
+ return toObject;
6446
+ }
6447
+ function liveClientSessionResumptionConfigToVertex(fromObject) {
6448
+ const toObject = {};
6449
+ const fromHandle = getValueByPath(fromObject, ['handle']);
6450
+ if (fromHandle !== undefined) {
6451
+ setValueByPath(toObject, ['handle'], fromHandle);
6452
+ }
6453
+ const fromTransparent = getValueByPath(fromObject, ['transparent']);
6454
+ if (fromTransparent !== undefined) {
6455
+ setValueByPath(toObject, ['transparent'], fromTransparent);
6456
+ }
6457
+ return toObject;
6458
+ }
6459
+ function modalityTokenCountFromMldev(apiClient, fromObject) {
6460
+ const toObject = {};
6461
+ const fromModality = getValueByPath(fromObject, ['modality']);
6462
+ if (fromModality != null) {
6463
+ setValueByPath(toObject, ['modality'], fromModality);
6464
+ }
6465
+ const fromTokenCount = getValueByPath(fromObject, ['tokenCount']);
6466
+ if (fromTokenCount != null) {
6467
+ setValueByPath(toObject, ['tokenCount'], fromTokenCount);
6468
+ }
6469
+ return toObject;
6470
+ }
6471
+ function usageMetadataFromMldev(apiClient, fromObject) {
6472
+ const toObject = {};
6473
+ const fromPromptTokenCount = getValueByPath(fromObject, [
6474
+ 'promptTokenCount',
6475
+ ]);
6476
+ if (fromPromptTokenCount != null) {
6477
+ setValueByPath(toObject, ['promptTokenCount'], fromPromptTokenCount);
6478
+ }
6479
+ const fromCachedContentTokenCount = getValueByPath(fromObject, [
6480
+ 'cachedContentTokenCount',
6481
+ ]);
6482
+ if (fromCachedContentTokenCount != null) {
6483
+ setValueByPath(toObject, ['cachedContentTokenCount'], fromCachedContentTokenCount);
6484
+ }
6485
+ const fromResponseTokenCount = getValueByPath(fromObject, [
6486
+ 'responseTokenCount',
6487
+ ]);
6488
+ if (fromResponseTokenCount != null) {
6489
+ setValueByPath(toObject, ['responseTokenCount'], fromResponseTokenCount);
6490
+ }
6491
+ const fromToolUsePromptTokenCount = getValueByPath(fromObject, [
6492
+ 'toolUsePromptTokenCount',
6493
+ ]);
6494
+ if (fromToolUsePromptTokenCount != null) {
6495
+ setValueByPath(toObject, ['toolUsePromptTokenCount'], fromToolUsePromptTokenCount);
6496
+ }
6497
+ const fromThoughtsTokenCount = getValueByPath(fromObject, [
6498
+ 'thoughtsTokenCount',
6499
+ ]);
6500
+ if (fromThoughtsTokenCount != null) {
6501
+ setValueByPath(toObject, ['thoughtsTokenCount'], fromThoughtsTokenCount);
6502
+ }
6503
+ const fromTotalTokenCount = getValueByPath(fromObject, [
6504
+ 'totalTokenCount',
6505
+ ]);
6506
+ if (fromTotalTokenCount != null) {
6507
+ setValueByPath(toObject, ['totalTokenCount'], fromTotalTokenCount);
6508
+ }
6509
+ const fromPromptTokensDetails = getValueByPath(fromObject, [
6510
+ 'promptTokensDetails',
6511
+ ]);
6512
+ if (fromPromptTokensDetails != null) {
6513
+ if (Array.isArray(fromPromptTokensDetails)) {
6514
+ setValueByPath(toObject, ['promptTokensDetails'], fromPromptTokensDetails.map((item) => {
6515
+ return modalityTokenCountFromMldev(apiClient, item);
6516
+ }));
6517
+ }
6518
+ else {
6519
+ setValueByPath(toObject, ['promptTokensDetails'], fromPromptTokensDetails);
6520
+ }
6521
+ }
6522
+ const fromCacheTokensDetails = getValueByPath(fromObject, [
6523
+ 'cacheTokensDetails',
6524
+ ]);
6525
+ if (fromCacheTokensDetails != null) {
6526
+ if (Array.isArray(fromCacheTokensDetails)) {
6527
+ setValueByPath(toObject, ['cacheTokensDetails'], fromCacheTokensDetails.map((item) => {
6528
+ return modalityTokenCountFromMldev(apiClient, item);
6529
+ }));
6530
+ }
6531
+ else {
6532
+ setValueByPath(toObject, ['cacheTokensDetails'], fromCacheTokensDetails);
6533
+ }
6534
+ }
6535
+ const fromResponseTokensDetails = getValueByPath(fromObject, [
6536
+ 'responseTokensDetails',
6537
+ ]);
6538
+ if (fromResponseTokensDetails != null) {
6539
+ if (Array.isArray(fromResponseTokensDetails)) {
6540
+ setValueByPath(toObject, ['responseTokensDetails'], fromResponseTokensDetails.map((item) => {
6541
+ return modalityTokenCountFromMldev(apiClient, item);
6542
+ }));
6543
+ }
6544
+ else {
6545
+ setValueByPath(toObject, ['responseTokensDetails'], fromResponseTokensDetails);
6546
+ }
6547
+ }
6548
+ const fromToolUsePromptTokensDetails = getValueByPath(fromObject, [
6549
+ 'toolUsePromptTokensDetails',
6550
+ ]);
6551
+ if (fromToolUsePromptTokensDetails != null) {
6552
+ if (Array.isArray(fromToolUsePromptTokensDetails)) {
6553
+ setValueByPath(toObject, ['toolUsePromptTokensDetails'], fromToolUsePromptTokensDetails.map((item) => {
6554
+ return modalityTokenCountFromMldev(apiClient, item);
6555
+ }));
6556
+ }
6557
+ else {
6558
+ setValueByPath(toObject, ['toolUsePromptTokensDetails'], fromToolUsePromptTokensDetails);
6559
+ }
6560
+ }
6561
+ return toObject;
6562
+ }
6563
+ function modalityTokenCountFromVertex(apiClient, fromObject) {
6564
+ const toObject = {};
6565
+ const fromModality = getValueByPath(fromObject, ['modality']);
6566
+ if (fromModality != null) {
6567
+ setValueByPath(toObject, ['modality'], fromModality);
6568
+ }
6569
+ const fromTokenCount = getValueByPath(fromObject, ['tokenCount']);
6570
+ if (fromTokenCount != null) {
6571
+ setValueByPath(toObject, ['tokenCount'], fromTokenCount);
6572
+ }
6573
+ return toObject;
6574
+ }
6575
+ function usageMetadataFromVertex(apiClient, fromObject) {
6576
+ const toObject = {};
6577
+ const fromPromptTokenCount = getValueByPath(fromObject, [
6578
+ 'promptTokenCount',
6579
+ ]);
6580
+ if (fromPromptTokenCount != null) {
6581
+ setValueByPath(toObject, ['promptTokenCount'], fromPromptTokenCount);
6582
+ }
6583
+ const fromCachedContentTokenCount = getValueByPath(fromObject, [
6584
+ 'cachedContentTokenCount',
6585
+ ]);
6586
+ if (fromCachedContentTokenCount != null) {
6587
+ setValueByPath(toObject, ['cachedContentTokenCount'], fromCachedContentTokenCount);
6588
+ }
6589
+ const fromResponseTokenCount = getValueByPath(fromObject, [
6590
+ 'candidatesTokenCount',
6591
+ ]);
6592
+ if (fromResponseTokenCount != null) {
6593
+ setValueByPath(toObject, ['responseTokenCount'], fromResponseTokenCount);
6594
+ }
6595
+ const fromToolUsePromptTokenCount = getValueByPath(fromObject, [
6596
+ 'toolUsePromptTokenCount',
6597
+ ]);
6598
+ if (fromToolUsePromptTokenCount != null) {
6599
+ setValueByPath(toObject, ['toolUsePromptTokenCount'], fromToolUsePromptTokenCount);
6600
+ }
6601
+ const fromThoughtsTokenCount = getValueByPath(fromObject, [
6602
+ 'thoughtsTokenCount',
6603
+ ]);
6604
+ if (fromThoughtsTokenCount != null) {
6605
+ setValueByPath(toObject, ['thoughtsTokenCount'], fromThoughtsTokenCount);
6606
+ }
6607
+ const fromTotalTokenCount = getValueByPath(fromObject, [
6608
+ 'totalTokenCount',
6609
+ ]);
6610
+ if (fromTotalTokenCount != null) {
6611
+ setValueByPath(toObject, ['totalTokenCount'], fromTotalTokenCount);
6612
+ }
6613
+ const fromPromptTokensDetails = getValueByPath(fromObject, [
6614
+ 'promptTokensDetails',
6615
+ ]);
6616
+ if (fromPromptTokensDetails != null) {
6617
+ if (Array.isArray(fromPromptTokensDetails)) {
6618
+ setValueByPath(toObject, ['promptTokensDetails'], fromPromptTokensDetails.map((item) => {
6619
+ return modalityTokenCountFromVertex(apiClient, item);
6620
+ }));
6621
+ }
6622
+ else {
6623
+ setValueByPath(toObject, ['promptTokensDetails'], fromPromptTokensDetails);
6624
+ }
6625
+ }
6626
+ const fromCacheTokensDetails = getValueByPath(fromObject, [
6627
+ 'cacheTokensDetails',
6628
+ ]);
6629
+ if (fromCacheTokensDetails != null) {
6630
+ if (Array.isArray(fromCacheTokensDetails)) {
6631
+ setValueByPath(toObject, ['cacheTokensDetails'], fromCacheTokensDetails.map((item) => {
6632
+ return modalityTokenCountFromVertex(apiClient, item);
6633
+ }));
6634
+ }
6635
+ else {
6636
+ setValueByPath(toObject, ['cacheTokensDetails'], fromCacheTokensDetails);
6637
+ }
6638
+ }
6639
+ const fromToolUsePromptTokensDetails = getValueByPath(fromObject, [
6640
+ 'toolUsePromptTokensDetails',
6641
+ ]);
6642
+ if (fromToolUsePromptTokensDetails != null) {
6643
+ if (Array.isArray(fromToolUsePromptTokensDetails)) {
6644
+ setValueByPath(toObject, ['toolUsePromptTokensDetails'], fromToolUsePromptTokensDetails.map((item) => {
6645
+ return modalityTokenCountFromVertex(apiClient, item);
6646
+ }));
6647
+ }
6648
+ else {
6649
+ setValueByPath(toObject, ['toolUsePromptTokensDetails'], fromToolUsePromptTokensDetails);
6650
+ }
6651
+ }
6652
+ const fromResponseTokensDetails = getValueByPath(fromObject, [
6653
+ 'candidatesTokensDetails',
6654
+ ]);
6655
+ if (fromResponseTokensDetails != null) {
6656
+ if (Array.isArray(fromResponseTokensDetails)) {
6657
+ setValueByPath(toObject, ['responseTokensDetails'], fromResponseTokensDetails.map((item) => {
6658
+ return modalityTokenCountFromVertex(apiClient, item);
6659
+ }));
6660
+ }
6661
+ else {
6662
+ setValueByPath(toObject, ['responseTokensDetails'], fromResponseTokensDetails);
6663
+ }
6664
+ }
6665
+ const fromTrafficType = getValueByPath(fromObject, ['trafficType']);
6666
+ if (fromTrafficType != null) {
6667
+ setValueByPath(toObject, ['trafficType'], fromTrafficType);
6668
+ }
6669
+ return toObject;
6670
+ }
5913
6671
 
5914
6672
  /**
5915
6673
  * @license
@@ -6102,7 +6860,13 @@ class Session {
6102
6860
  throw new Error(`Failed to convert realtime input "media", type: '${typeof params.media}'`);
6103
6861
  }
6104
6862
  // LiveClientRealtimeInput
6105
- clientMessage = { realtimeInput: { mediaChunks: [params.media] } };
6863
+ clientMessage = {
6864
+ realtimeInput: {
6865
+ mediaChunks: [params.media],
6866
+ activityStart: params.activityStart,
6867
+ activityEnd: params.activityEnd,
6868
+ },
6869
+ };
6106
6870
  return clientMessage;
6107
6871
  }
6108
6872
  tLiveClienttToolResponse(apiClient, params) {
@@ -6721,6 +7485,66 @@ class Models extends BaseModule {
6721
7485
  });
6722
7486
  }
6723
7487
  }
7488
+ /**
7489
+ * Fetches information about a model by name.
7490
+ *
7491
+ * @example
7492
+ * ```ts
7493
+ * const modelInfo = await ai.models.get({model: 'gemini-2.0-flash'});
7494
+ * ```
7495
+ */
7496
+ async get(params) {
7497
+ var _a, _b;
7498
+ let response;
7499
+ let path = '';
7500
+ let queryParams = {};
7501
+ if (this.apiClient.isVertexAI()) {
7502
+ const body = getModelParametersToVertex(this.apiClient, params);
7503
+ path = formatMap('{name}', body['_url']);
7504
+ queryParams = body['_query'];
7505
+ delete body['config'];
7506
+ delete body['_url'];
7507
+ delete body['_query'];
7508
+ response = this.apiClient
7509
+ .request({
7510
+ path: path,
7511
+ queryParams: queryParams,
7512
+ body: JSON.stringify(body),
7513
+ httpMethod: 'GET',
7514
+ httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
7515
+ })
7516
+ .then((httpResponse) => {
7517
+ return httpResponse.json();
7518
+ });
7519
+ return response.then((apiResponse) => {
7520
+ const resp = modelFromVertex(this.apiClient, apiResponse);
7521
+ return resp;
7522
+ });
7523
+ }
7524
+ else {
7525
+ const body = getModelParametersToMldev(this.apiClient, params);
7526
+ path = formatMap('{name}', body['_url']);
7527
+ queryParams = body['_query'];
7528
+ delete body['config'];
7529
+ delete body['_url'];
7530
+ delete body['_query'];
7531
+ response = this.apiClient
7532
+ .request({
7533
+ path: path,
7534
+ queryParams: queryParams,
7535
+ body: JSON.stringify(body),
7536
+ httpMethod: 'GET',
7537
+ httpOptions: (_b = params.config) === null || _b === void 0 ? void 0 : _b.httpOptions,
7538
+ })
7539
+ .then((httpResponse) => {
7540
+ return httpResponse.json();
7541
+ });
7542
+ return response.then((apiResponse) => {
7543
+ const resp = modelFromMldev(this.apiClient, apiResponse);
7544
+ return resp;
7545
+ });
7546
+ }
7547
+ }
6724
7548
  /**
6725
7549
  * Counts the number of tokens in the given contents. Multimodal input is
6726
7550
  * supported for Gemini models.
@@ -6862,10 +7686,10 @@ class Models extends BaseModule {
6862
7686
  *
6863
7687
  * while (!operation.done) {
6864
7688
  * await new Promise(resolve => setTimeout(resolve, 10000));
6865
- * operation = await ai.operations.get({operation: operation});
7689
+ * operation = await ai.operations.getVideosOperation({operation: operation});
6866
7690
  * }
6867
7691
  *
6868
- * console.log(operation.result?.generatedVideos?.[0]?.video?.uri);
7692
+ * console.log(operation.response?.generatedVideos?.[0]?.video?.uri);
6869
7693
  * ```
6870
7694
  */
6871
7695
  async generateVideos(params) {
@@ -7047,9 +7871,12 @@ function generateVideosOperationFromMldev(apiClient, fromObject) {
7047
7871
  if (fromError != null) {
7048
7872
  setValueByPath(toObject, ['error'], fromError);
7049
7873
  }
7050
- const fromResponse = getValueByPath(fromObject, ['response']);
7874
+ const fromResponse = getValueByPath(fromObject, [
7875
+ 'response',
7876
+ 'generateVideoResponse',
7877
+ ]);
7051
7878
  if (fromResponse != null) {
7052
- setValueByPath(toObject, ['response'], fromResponse);
7879
+ setValueByPath(toObject, ['response'], generateVideosResponseFromMldev(apiClient, fromResponse));
7053
7880
  }
7054
7881
  const fromResult = getValueByPath(fromObject, [
7055
7882
  'response',
@@ -7133,7 +7960,7 @@ function generateVideosOperationFromVertex(apiClient, fromObject) {
7133
7960
  }
7134
7961
  const fromResponse = getValueByPath(fromObject, ['response']);
7135
7962
  if (fromResponse != null) {
7136
- setValueByPath(toObject, ['response'], fromResponse);
7963
+ setValueByPath(toObject, ['response'], generateVideosResponseFromVertex(apiClient, fromResponse));
7137
7964
  }
7138
7965
  const fromResult = getValueByPath(fromObject, ['response']);
7139
7966
  if (fromResult != null) {
@@ -7155,10 +7982,10 @@ class Operations extends BaseModule {
7155
7982
  /**
7156
7983
  * Gets the status of a long-running operation.
7157
7984
  *
7158
- * @param operation The Operation object returned by a previous API call.
7985
+ * @param parameters The parameters for the get operation request.
7159
7986
  * @return The updated Operation object, with the latest status or result.
7160
7987
  */
7161
- async get(parameters) {
7988
+ async getVideosOperation(parameters) {
7162
7989
  const operation = parameters.operation;
7163
7990
  const config = parameters.config;
7164
7991
  if (operation.name === undefined || operation.name === '') {
@@ -7275,9 +8102,10 @@ class Operations extends BaseModule {
7275
8102
  * SPDX-License-Identifier: Apache-2.0
7276
8103
  */
7277
8104
  const CONTENT_TYPE_HEADER = 'Content-Type';
8105
+ const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
7278
8106
  const USER_AGENT_HEADER = 'User-Agent';
7279
8107
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
7280
- const SDK_VERSION = '0.7.0'; // x-release-please-version
8108
+ const SDK_VERSION = '0.8.0'; // x-release-please-version
7281
8109
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
7282
8110
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
7283
8111
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -7417,11 +8245,9 @@ class ApiClient {
7417
8245
  throw new Error('HTTP options are not correctly set.');
7418
8246
  }
7419
8247
  }
7420
- constructUrl(path, httpOptions) {
8248
+ constructUrl(path, httpOptions, prependProjectLocation) {
7421
8249
  const urlElement = [this.getRequestUrlInternal(httpOptions)];
7422
- if (this.clientOptions.vertexai &&
7423
- !this.clientOptions.apiKey &&
7424
- !path.startsWith('projects/')) {
8250
+ if (prependProjectLocation) {
7425
8251
  urlElement.push(this.getBaseResourcePath());
7426
8252
  }
7427
8253
  if (path !== '') {
@@ -7430,12 +8256,34 @@ class ApiClient {
7430
8256
  const url = new URL(`${urlElement.join('/')}`);
7431
8257
  return url;
7432
8258
  }
8259
+ shouldPrependVertexProjectPath(request) {
8260
+ if (this.clientOptions.apiKey) {
8261
+ return false;
8262
+ }
8263
+ if (!this.clientOptions.vertexai) {
8264
+ return false;
8265
+ }
8266
+ if (request.path.startsWith('projects/')) {
8267
+ // Assume the path already starts with
8268
+ // `projects/<project>/location/<location>`.
8269
+ return false;
8270
+ }
8271
+ if (request.httpMethod === 'GET' &&
8272
+ request.path.startsWith('publishers/google/models')) {
8273
+ // These paths are used by Vertex's models.get and models.list
8274
+ // calls. For base models Vertex does not accept a project/location
8275
+ // prefix (for tuned model the prefix is required).
8276
+ return false;
8277
+ }
8278
+ return true;
8279
+ }
7433
8280
  async request(request) {
7434
8281
  let patchedHttpOptions = this.clientOptions.httpOptions;
7435
8282
  if (request.httpOptions) {
7436
8283
  patchedHttpOptions = this.patchHttpOptions(this.clientOptions.httpOptions, request.httpOptions);
7437
8284
  }
7438
- const url = this.constructUrl(request.path, patchedHttpOptions);
8285
+ const prependProjectLocation = this.shouldPrependVertexProjectPath(request);
8286
+ const url = this.constructUrl(request.path, patchedHttpOptions, prependProjectLocation);
7439
8287
  if (request.queryParams) {
7440
8288
  for (const [key, value] of Object.entries(request.queryParams)) {
7441
8289
  url.searchParams.append(key, String(value));
@@ -7477,7 +8325,8 @@ class ApiClient {
7477
8325
  if (request.httpOptions) {
7478
8326
  patchedHttpOptions = this.patchHttpOptions(this.clientOptions.httpOptions, request.httpOptions);
7479
8327
  }
7480
- const url = this.constructUrl(request.path, patchedHttpOptions);
8328
+ const prependProjectLocation = this.shouldPrependVertexProjectPath(request);
8329
+ const url = this.constructUrl(request.path, patchedHttpOptions, prependProjectLocation);
7481
8330
  if (!url.searchParams.has('alt') || url.searchParams.get('alt') !== 'sse') {
7482
8331
  url.searchParams.set('alt', 'sse');
7483
8332
  }
@@ -7585,6 +8434,11 @@ class ApiClient {
7585
8434
  for (const [key, value] of Object.entries(httpOptions.headers)) {
7586
8435
  headers.append(key, value);
7587
8436
  }
8437
+ // Append a timeout header if it is set, note that the timeout option is
8438
+ // in milliseconds but the header is in seconds.
8439
+ if (httpOptions.timeout && httpOptions.timeout > 0) {
8440
+ headers.append(SERVER_TIMEOUT_HEADER, String(Math.ceil(httpOptions.timeout / 1000)));
8441
+ }
7588
8442
  }
7589
8443
  await this.clientOptions.auth.addAuthHeaders(headers);
7590
8444
  return headers;
@@ -7699,7 +8553,6 @@ async function throwErrorIfNotOK(response) {
7699
8553
  * SPDX-License-Identifier: Apache-2.0
7700
8554
  */
7701
8555
  const GOOGLE_API_KEY_HEADER = 'x-goog-api-key';
7702
- const AUTHORIZATION_HEADER = 'Authorization';
7703
8556
  const REQUIRED_VERTEX_AI_SCOPE = 'https://www.googleapis.com/auth/cloud-platform';
7704
8557
  class NodeAuth {
7705
8558
  constructor(opts) {
@@ -7729,17 +8582,19 @@ class NodeAuth {
7729
8582
  headers.append(GOOGLE_API_KEY_HEADER, this.apiKey);
7730
8583
  }
7731
8584
  async addGoogleAuthHeaders(headers) {
7732
- if (headers.get(AUTHORIZATION_HEADER) !== null) {
7733
- return;
7734
- }
7735
8585
  if (this.googleAuth === undefined) {
7736
8586
  // This should never happen, addGoogleAuthHeaders should only be
7737
8587
  // called when there is no apiKey set and in these cases googleAuth
7738
8588
  // is set.
7739
8589
  throw new Error('Trying to set google-auth headers but googleAuth is unset');
7740
8590
  }
7741
- const token = await this.googleAuth.getAccessToken();
7742
- headers.append(AUTHORIZATION_HEADER, `Bearer ${token}`);
8591
+ const authHeaders = await this.googleAuth.getRequestHeaders();
8592
+ for (const key in authHeaders) {
8593
+ if (headers.get(key) !== null) {
8594
+ continue;
8595
+ }
8596
+ headers.append(key, authHeaders[key]);
8597
+ }
7743
8598
  }
7744
8599
  }
7745
8600
  function buildGoogleAuthOptions(googleAuthOptions) {