@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.
- package/dist/genai.d.ts +367 -45
- package/dist/index.js +887 -33
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +888 -34
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.js +894 -39
- package/dist/node/index.js.map +1 -1
- package/dist/node/node.d.ts +367 -45
- package/dist/web/index.mjs +888 -34
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +367 -45
- package/package.json +3 -1
package/dist/web/index.mjs
CHANGED
|
@@ -1512,6 +1512,7 @@ class Pager {
|
|
|
1512
1512
|
* SPDX-License-Identifier: Apache-2.0
|
|
1513
1513
|
*/
|
|
1514
1514
|
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
|
|
1515
|
+
/** Required. Outcome of the code execution. */
|
|
1515
1516
|
var Outcome;
|
|
1516
1517
|
(function (Outcome) {
|
|
1517
1518
|
Outcome["OUTCOME_UNSPECIFIED"] = "OUTCOME_UNSPECIFIED";
|
|
@@ -1519,11 +1520,13 @@ var Outcome;
|
|
|
1519
1520
|
Outcome["OUTCOME_FAILED"] = "OUTCOME_FAILED";
|
|
1520
1521
|
Outcome["OUTCOME_DEADLINE_EXCEEDED"] = "OUTCOME_DEADLINE_EXCEEDED";
|
|
1521
1522
|
})(Outcome || (Outcome = {}));
|
|
1523
|
+
/** Required. Programming language of the `code`. */
|
|
1522
1524
|
var Language;
|
|
1523
1525
|
(function (Language) {
|
|
1524
1526
|
Language["LANGUAGE_UNSPECIFIED"] = "LANGUAGE_UNSPECIFIED";
|
|
1525
1527
|
Language["PYTHON"] = "PYTHON";
|
|
1526
1528
|
})(Language || (Language = {}));
|
|
1529
|
+
/** Optional. The type of the data. */
|
|
1527
1530
|
var Type;
|
|
1528
1531
|
(function (Type) {
|
|
1529
1532
|
Type["TYPE_UNSPECIFIED"] = "TYPE_UNSPECIFIED";
|
|
@@ -1534,6 +1537,7 @@ var Type;
|
|
|
1534
1537
|
Type["ARRAY"] = "ARRAY";
|
|
1535
1538
|
Type["OBJECT"] = "OBJECT";
|
|
1536
1539
|
})(Type || (Type = {}));
|
|
1540
|
+
/** Required. Harm category. */
|
|
1537
1541
|
var HarmCategory;
|
|
1538
1542
|
(function (HarmCategory) {
|
|
1539
1543
|
HarmCategory["HARM_CATEGORY_UNSPECIFIED"] = "HARM_CATEGORY_UNSPECIFIED";
|
|
@@ -1543,12 +1547,14 @@ var HarmCategory;
|
|
|
1543
1547
|
HarmCategory["HARM_CATEGORY_SEXUALLY_EXPLICIT"] = "HARM_CATEGORY_SEXUALLY_EXPLICIT";
|
|
1544
1548
|
HarmCategory["HARM_CATEGORY_CIVIC_INTEGRITY"] = "HARM_CATEGORY_CIVIC_INTEGRITY";
|
|
1545
1549
|
})(HarmCategory || (HarmCategory = {}));
|
|
1550
|
+
/** Optional. Specify if the threshold is used for probability or severity score. If not specified, the threshold is used for probability score. */
|
|
1546
1551
|
var HarmBlockMethod;
|
|
1547
1552
|
(function (HarmBlockMethod) {
|
|
1548
1553
|
HarmBlockMethod["HARM_BLOCK_METHOD_UNSPECIFIED"] = "HARM_BLOCK_METHOD_UNSPECIFIED";
|
|
1549
1554
|
HarmBlockMethod["SEVERITY"] = "SEVERITY";
|
|
1550
1555
|
HarmBlockMethod["PROBABILITY"] = "PROBABILITY";
|
|
1551
1556
|
})(HarmBlockMethod || (HarmBlockMethod = {}));
|
|
1557
|
+
/** Required. The harm block threshold. */
|
|
1552
1558
|
var HarmBlockThreshold;
|
|
1553
1559
|
(function (HarmBlockThreshold) {
|
|
1554
1560
|
HarmBlockThreshold["HARM_BLOCK_THRESHOLD_UNSPECIFIED"] = "HARM_BLOCK_THRESHOLD_UNSPECIFIED";
|
|
@@ -1558,11 +1564,16 @@ var HarmBlockThreshold;
|
|
|
1558
1564
|
HarmBlockThreshold["BLOCK_NONE"] = "BLOCK_NONE";
|
|
1559
1565
|
HarmBlockThreshold["OFF"] = "OFF";
|
|
1560
1566
|
})(HarmBlockThreshold || (HarmBlockThreshold = {}));
|
|
1567
|
+
/** The mode of the predictor to be used in dynamic retrieval. */
|
|
1561
1568
|
var Mode;
|
|
1562
1569
|
(function (Mode) {
|
|
1563
1570
|
Mode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
1564
1571
|
Mode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
|
|
1565
1572
|
})(Mode || (Mode = {}));
|
|
1573
|
+
/** Output only. The reason why the model stopped generating tokens.
|
|
1574
|
+
|
|
1575
|
+
If empty, the model has not stopped generating the tokens.
|
|
1576
|
+
*/
|
|
1566
1577
|
var FinishReason;
|
|
1567
1578
|
(function (FinishReason) {
|
|
1568
1579
|
FinishReason["FINISH_REASON_UNSPECIFIED"] = "FINISH_REASON_UNSPECIFIED";
|
|
@@ -1577,6 +1588,7 @@ var FinishReason;
|
|
|
1577
1588
|
FinishReason["MALFORMED_FUNCTION_CALL"] = "MALFORMED_FUNCTION_CALL";
|
|
1578
1589
|
FinishReason["IMAGE_SAFETY"] = "IMAGE_SAFETY";
|
|
1579
1590
|
})(FinishReason || (FinishReason = {}));
|
|
1591
|
+
/** Output only. Harm probability levels in the content. */
|
|
1580
1592
|
var HarmProbability;
|
|
1581
1593
|
(function (HarmProbability) {
|
|
1582
1594
|
HarmProbability["HARM_PROBABILITY_UNSPECIFIED"] = "HARM_PROBABILITY_UNSPECIFIED";
|
|
@@ -1585,6 +1597,7 @@ var HarmProbability;
|
|
|
1585
1597
|
HarmProbability["MEDIUM"] = "MEDIUM";
|
|
1586
1598
|
HarmProbability["HIGH"] = "HIGH";
|
|
1587
1599
|
})(HarmProbability || (HarmProbability = {}));
|
|
1600
|
+
/** Output only. Harm severity levels in the content. */
|
|
1588
1601
|
var HarmSeverity;
|
|
1589
1602
|
(function (HarmSeverity) {
|
|
1590
1603
|
HarmSeverity["HARM_SEVERITY_UNSPECIFIED"] = "HARM_SEVERITY_UNSPECIFIED";
|
|
@@ -1593,6 +1606,7 @@ var HarmSeverity;
|
|
|
1593
1606
|
HarmSeverity["HARM_SEVERITY_MEDIUM"] = "HARM_SEVERITY_MEDIUM";
|
|
1594
1607
|
HarmSeverity["HARM_SEVERITY_HIGH"] = "HARM_SEVERITY_HIGH";
|
|
1595
1608
|
})(HarmSeverity || (HarmSeverity = {}));
|
|
1609
|
+
/** Output only. Blocked reason. */
|
|
1596
1610
|
var BlockedReason;
|
|
1597
1611
|
(function (BlockedReason) {
|
|
1598
1612
|
BlockedReason["BLOCKED_REASON_UNSPECIFIED"] = "BLOCKED_REASON_UNSPECIFIED";
|
|
@@ -1601,6 +1615,14 @@ var BlockedReason;
|
|
|
1601
1615
|
BlockedReason["BLOCKLIST"] = "BLOCKLIST";
|
|
1602
1616
|
BlockedReason["PROHIBITED_CONTENT"] = "PROHIBITED_CONTENT";
|
|
1603
1617
|
})(BlockedReason || (BlockedReason = {}));
|
|
1618
|
+
/** Output only. Traffic type. This shows whether a request consumes Pay-As-You-Go or Provisioned Throughput quota. */
|
|
1619
|
+
var TrafficType;
|
|
1620
|
+
(function (TrafficType) {
|
|
1621
|
+
TrafficType["TRAFFIC_TYPE_UNSPECIFIED"] = "TRAFFIC_TYPE_UNSPECIFIED";
|
|
1622
|
+
TrafficType["ON_DEMAND"] = "ON_DEMAND";
|
|
1623
|
+
TrafficType["PROVISIONED_THROUGHPUT"] = "PROVISIONED_THROUGHPUT";
|
|
1624
|
+
})(TrafficType || (TrafficType = {}));
|
|
1625
|
+
/** Server content modalities. */
|
|
1604
1626
|
var Modality;
|
|
1605
1627
|
(function (Modality) {
|
|
1606
1628
|
Modality["MODALITY_UNSPECIFIED"] = "MODALITY_UNSPECIFIED";
|
|
@@ -1608,17 +1630,21 @@ var Modality;
|
|
|
1608
1630
|
Modality["IMAGE"] = "IMAGE";
|
|
1609
1631
|
Modality["AUDIO"] = "AUDIO";
|
|
1610
1632
|
})(Modality || (Modality = {}));
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1633
|
+
/** The media resolution to use. */
|
|
1634
|
+
var MediaResolution;
|
|
1635
|
+
(function (MediaResolution) {
|
|
1636
|
+
MediaResolution["MEDIA_RESOLUTION_UNSPECIFIED"] = "MEDIA_RESOLUTION_UNSPECIFIED";
|
|
1637
|
+
MediaResolution["MEDIA_RESOLUTION_LOW"] = "MEDIA_RESOLUTION_LOW";
|
|
1638
|
+
MediaResolution["MEDIA_RESOLUTION_MEDIUM"] = "MEDIA_RESOLUTION_MEDIUM";
|
|
1639
|
+
MediaResolution["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
|
|
1640
|
+
})(MediaResolution || (MediaResolution = {}));
|
|
1641
|
+
/** Config for the dynamic retrieval config mode. */
|
|
1617
1642
|
var DynamicRetrievalConfigMode;
|
|
1618
1643
|
(function (DynamicRetrievalConfigMode) {
|
|
1619
1644
|
DynamicRetrievalConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
1620
1645
|
DynamicRetrievalConfigMode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
|
|
1621
1646
|
})(DynamicRetrievalConfigMode || (DynamicRetrievalConfigMode = {}));
|
|
1647
|
+
/** Config for the function calling config mode. */
|
|
1622
1648
|
var FunctionCallingConfigMode;
|
|
1623
1649
|
(function (FunctionCallingConfigMode) {
|
|
1624
1650
|
FunctionCallingConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
@@ -1626,13 +1652,7 @@ var FunctionCallingConfigMode;
|
|
|
1626
1652
|
FunctionCallingConfigMode["ANY"] = "ANY";
|
|
1627
1653
|
FunctionCallingConfigMode["NONE"] = "NONE";
|
|
1628
1654
|
})(FunctionCallingConfigMode || (FunctionCallingConfigMode = {}));
|
|
1629
|
-
|
|
1630
|
-
(function (MediaResolution) {
|
|
1631
|
-
MediaResolution["MEDIA_RESOLUTION_UNSPECIFIED"] = "MEDIA_RESOLUTION_UNSPECIFIED";
|
|
1632
|
-
MediaResolution["MEDIA_RESOLUTION_LOW"] = "MEDIA_RESOLUTION_LOW";
|
|
1633
|
-
MediaResolution["MEDIA_RESOLUTION_MEDIUM"] = "MEDIA_RESOLUTION_MEDIUM";
|
|
1634
|
-
MediaResolution["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
|
|
1635
|
-
})(MediaResolution || (MediaResolution = {}));
|
|
1655
|
+
/** Enum that controls the safety filter level for objectionable content. */
|
|
1636
1656
|
var SafetyFilterLevel;
|
|
1637
1657
|
(function (SafetyFilterLevel) {
|
|
1638
1658
|
SafetyFilterLevel["BLOCK_LOW_AND_ABOVE"] = "BLOCK_LOW_AND_ABOVE";
|
|
@@ -1640,12 +1660,14 @@ var SafetyFilterLevel;
|
|
|
1640
1660
|
SafetyFilterLevel["BLOCK_ONLY_HIGH"] = "BLOCK_ONLY_HIGH";
|
|
1641
1661
|
SafetyFilterLevel["BLOCK_NONE"] = "BLOCK_NONE";
|
|
1642
1662
|
})(SafetyFilterLevel || (SafetyFilterLevel = {}));
|
|
1663
|
+
/** Enum that controls the generation of people. */
|
|
1643
1664
|
var PersonGeneration;
|
|
1644
1665
|
(function (PersonGeneration) {
|
|
1645
1666
|
PersonGeneration["DONT_ALLOW"] = "DONT_ALLOW";
|
|
1646
1667
|
PersonGeneration["ALLOW_ADULT"] = "ALLOW_ADULT";
|
|
1647
1668
|
PersonGeneration["ALLOW_ALL"] = "ALLOW_ALL";
|
|
1648
1669
|
})(PersonGeneration || (PersonGeneration = {}));
|
|
1670
|
+
/** Enum that specifies the language of the text in the prompt. */
|
|
1649
1671
|
var ImagePromptLanguage;
|
|
1650
1672
|
(function (ImagePromptLanguage) {
|
|
1651
1673
|
ImagePromptLanguage["auto"] = "auto";
|
|
@@ -1654,6 +1676,7 @@ var ImagePromptLanguage;
|
|
|
1654
1676
|
ImagePromptLanguage["ko"] = "ko";
|
|
1655
1677
|
ImagePromptLanguage["hi"] = "hi";
|
|
1656
1678
|
})(ImagePromptLanguage || (ImagePromptLanguage = {}));
|
|
1679
|
+
/** State for the lifecycle of a File. */
|
|
1657
1680
|
var FileState;
|
|
1658
1681
|
(function (FileState) {
|
|
1659
1682
|
FileState["STATE_UNSPECIFIED"] = "STATE_UNSPECIFIED";
|
|
@@ -1661,12 +1684,14 @@ var FileState;
|
|
|
1661
1684
|
FileState["ACTIVE"] = "ACTIVE";
|
|
1662
1685
|
FileState["FAILED"] = "FAILED";
|
|
1663
1686
|
})(FileState || (FileState = {}));
|
|
1687
|
+
/** Source of the File. */
|
|
1664
1688
|
var FileSource;
|
|
1665
1689
|
(function (FileSource) {
|
|
1666
1690
|
FileSource["SOURCE_UNSPECIFIED"] = "SOURCE_UNSPECIFIED";
|
|
1667
1691
|
FileSource["UPLOADED"] = "UPLOADED";
|
|
1668
1692
|
FileSource["GENERATED"] = "GENERATED";
|
|
1669
1693
|
})(FileSource || (FileSource = {}));
|
|
1694
|
+
/** Enum representing the mask mode of a mask reference image. */
|
|
1670
1695
|
var MaskReferenceMode;
|
|
1671
1696
|
(function (MaskReferenceMode) {
|
|
1672
1697
|
MaskReferenceMode["MASK_MODE_DEFAULT"] = "MASK_MODE_DEFAULT";
|
|
@@ -1675,6 +1700,7 @@ var MaskReferenceMode;
|
|
|
1675
1700
|
MaskReferenceMode["MASK_MODE_FOREGROUND"] = "MASK_MODE_FOREGROUND";
|
|
1676
1701
|
MaskReferenceMode["MASK_MODE_SEMANTIC"] = "MASK_MODE_SEMANTIC";
|
|
1677
1702
|
})(MaskReferenceMode || (MaskReferenceMode = {}));
|
|
1703
|
+
/** Enum representing the control type of a control reference image. */
|
|
1678
1704
|
var ControlReferenceType;
|
|
1679
1705
|
(function (ControlReferenceType) {
|
|
1680
1706
|
ControlReferenceType["CONTROL_TYPE_DEFAULT"] = "CONTROL_TYPE_DEFAULT";
|
|
@@ -1682,6 +1708,7 @@ var ControlReferenceType;
|
|
|
1682
1708
|
ControlReferenceType["CONTROL_TYPE_SCRIBBLE"] = "CONTROL_TYPE_SCRIBBLE";
|
|
1683
1709
|
ControlReferenceType["CONTROL_TYPE_FACE_MESH"] = "CONTROL_TYPE_FACE_MESH";
|
|
1684
1710
|
})(ControlReferenceType || (ControlReferenceType = {}));
|
|
1711
|
+
/** Enum representing the subject type of a subject reference image. */
|
|
1685
1712
|
var SubjectReferenceType;
|
|
1686
1713
|
(function (SubjectReferenceType) {
|
|
1687
1714
|
SubjectReferenceType["SUBJECT_TYPE_DEFAULT"] = "SUBJECT_TYPE_DEFAULT";
|
|
@@ -1689,6 +1716,7 @@ var SubjectReferenceType;
|
|
|
1689
1716
|
SubjectReferenceType["SUBJECT_TYPE_ANIMAL"] = "SUBJECT_TYPE_ANIMAL";
|
|
1690
1717
|
SubjectReferenceType["SUBJECT_TYPE_PRODUCT"] = "SUBJECT_TYPE_PRODUCT";
|
|
1691
1718
|
})(SubjectReferenceType || (SubjectReferenceType = {}));
|
|
1719
|
+
/** Server content modalities. */
|
|
1692
1720
|
var MediaModality;
|
|
1693
1721
|
(function (MediaModality) {
|
|
1694
1722
|
MediaModality["MODALITY_UNSPECIFIED"] = "MODALITY_UNSPECIFIED";
|
|
@@ -1698,6 +1726,34 @@ var MediaModality;
|
|
|
1698
1726
|
MediaModality["AUDIO"] = "AUDIO";
|
|
1699
1727
|
MediaModality["DOCUMENT"] = "DOCUMENT";
|
|
1700
1728
|
})(MediaModality || (MediaModality = {}));
|
|
1729
|
+
/** Start of speech sensitivity. */
|
|
1730
|
+
var StartSensitivity;
|
|
1731
|
+
(function (StartSensitivity) {
|
|
1732
|
+
StartSensitivity["START_SENSITIVITY_UNSPECIFIED"] = "START_SENSITIVITY_UNSPECIFIED";
|
|
1733
|
+
StartSensitivity["START_SENSITIVITY_HIGH"] = "START_SENSITIVITY_HIGH";
|
|
1734
|
+
StartSensitivity["START_SENSITIVITY_LOW"] = "START_SENSITIVITY_LOW";
|
|
1735
|
+
})(StartSensitivity || (StartSensitivity = {}));
|
|
1736
|
+
/** End of speech sensitivity. */
|
|
1737
|
+
var EndSensitivity;
|
|
1738
|
+
(function (EndSensitivity) {
|
|
1739
|
+
EndSensitivity["END_SENSITIVITY_UNSPECIFIED"] = "END_SENSITIVITY_UNSPECIFIED";
|
|
1740
|
+
EndSensitivity["END_SENSITIVITY_HIGH"] = "END_SENSITIVITY_HIGH";
|
|
1741
|
+
EndSensitivity["END_SENSITIVITY_LOW"] = "END_SENSITIVITY_LOW";
|
|
1742
|
+
})(EndSensitivity || (EndSensitivity = {}));
|
|
1743
|
+
/** The different ways of handling user activity. */
|
|
1744
|
+
var ActivityHandling;
|
|
1745
|
+
(function (ActivityHandling) {
|
|
1746
|
+
ActivityHandling["ACTIVITY_HANDLING_UNSPECIFIED"] = "ACTIVITY_HANDLING_UNSPECIFIED";
|
|
1747
|
+
ActivityHandling["START_OF_ACTIVITY_INTERRUPTS"] = "START_OF_ACTIVITY_INTERRUPTS";
|
|
1748
|
+
ActivityHandling["NO_INTERRUPTION"] = "NO_INTERRUPTION";
|
|
1749
|
+
})(ActivityHandling || (ActivityHandling = {}));
|
|
1750
|
+
/** Options about which input is included in the user's turn. */
|
|
1751
|
+
var TurnCoverage;
|
|
1752
|
+
(function (TurnCoverage) {
|
|
1753
|
+
TurnCoverage["TURN_COVERAGE_UNSPECIFIED"] = "TURN_COVERAGE_UNSPECIFIED";
|
|
1754
|
+
TurnCoverage["TURN_INCLUDES_ONLY_ACTIVITY"] = "TURN_INCLUDES_ONLY_ACTIVITY";
|
|
1755
|
+
TurnCoverage["TURN_INCLUDES_ALL_INPUT"] = "TURN_INCLUDES_ALL_INPUT";
|
|
1756
|
+
})(TurnCoverage || (TurnCoverage = {}));
|
|
1701
1757
|
/** A function response. */
|
|
1702
1758
|
class FunctionResponse {
|
|
1703
1759
|
}
|
|
@@ -1744,7 +1800,7 @@ function createPartFromFunctionResponse(id, name, response) {
|
|
|
1744
1800
|
};
|
|
1745
1801
|
}
|
|
1746
1802
|
/**
|
|
1747
|
-
* Creates a `Part` object from a `base64` `string`.
|
|
1803
|
+
* Creates a `Part` object from a `base64` encoded `string`.
|
|
1748
1804
|
*/
|
|
1749
1805
|
function createPartFromBase64(data, mimeType) {
|
|
1750
1806
|
return {
|
|
@@ -3126,7 +3182,9 @@ class Files extends BaseModule {
|
|
|
3126
3182
|
* This section can contain multiple paragraphs and code examples.
|
|
3127
3183
|
*
|
|
3128
3184
|
* @param params - Optional parameters specified in the
|
|
3129
|
-
* `
|
|
3185
|
+
* `types.UploadFileParameters` interface.
|
|
3186
|
+
* @see {@link types.UploadFileParameters#config} for the optional
|
|
3187
|
+
* config in the parameters.
|
|
3130
3188
|
* @return A promise that resolves to a `types.File` object.
|
|
3131
3189
|
* @throws An error if called on a Vertex AI client.
|
|
3132
3190
|
* @throws An error if the `mimeType` is not provided and can not be inferred,
|
|
@@ -3630,6 +3688,12 @@ function thinkingConfigToMldev(apiClient, fromObject) {
|
|
|
3630
3688
|
if (fromIncludeThoughts != null) {
|
|
3631
3689
|
setValueByPath(toObject, ['includeThoughts'], fromIncludeThoughts);
|
|
3632
3690
|
}
|
|
3691
|
+
const fromThinkingBudget = getValueByPath(fromObject, [
|
|
3692
|
+
'thinkingBudget',
|
|
3693
|
+
]);
|
|
3694
|
+
if (fromThinkingBudget != null) {
|
|
3695
|
+
setValueByPath(toObject, ['thinkingBudget'], fromThinkingBudget);
|
|
3696
|
+
}
|
|
3633
3697
|
return toObject;
|
|
3634
3698
|
}
|
|
3635
3699
|
function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
@@ -3933,6 +3997,18 @@ function generateImagesParametersToMldev(apiClient, fromObject) {
|
|
|
3933
3997
|
}
|
|
3934
3998
|
return toObject;
|
|
3935
3999
|
}
|
|
4000
|
+
function getModelParametersToMldev(apiClient, fromObject) {
|
|
4001
|
+
const toObject = {};
|
|
4002
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
4003
|
+
if (fromModel != null) {
|
|
4004
|
+
setValueByPath(toObject, ['_url', 'name'], tModel(apiClient, fromModel));
|
|
4005
|
+
}
|
|
4006
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
4007
|
+
if (fromConfig != null) {
|
|
4008
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
4009
|
+
}
|
|
4010
|
+
return toObject;
|
|
4011
|
+
}
|
|
3936
4012
|
function countTokensConfigToMldev(apiClient, fromObject) {
|
|
3937
4013
|
const toObject = {};
|
|
3938
4014
|
if (getValueByPath(fromObject, ['systemInstruction']) !== undefined) {
|
|
@@ -4378,6 +4454,12 @@ function thinkingConfigToVertex(apiClient, fromObject) {
|
|
|
4378
4454
|
if (fromIncludeThoughts != null) {
|
|
4379
4455
|
setValueByPath(toObject, ['includeThoughts'], fromIncludeThoughts);
|
|
4380
4456
|
}
|
|
4457
|
+
const fromThinkingBudget = getValueByPath(fromObject, [
|
|
4458
|
+
'thinkingBudget',
|
|
4459
|
+
]);
|
|
4460
|
+
if (fromThinkingBudget != null) {
|
|
4461
|
+
setValueByPath(toObject, ['thinkingBudget'], fromThinkingBudget);
|
|
4462
|
+
}
|
|
4381
4463
|
return toObject;
|
|
4382
4464
|
}
|
|
4383
4465
|
function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
|
|
@@ -4695,6 +4777,18 @@ function generateImagesParametersToVertex(apiClient, fromObject) {
|
|
|
4695
4777
|
}
|
|
4696
4778
|
return toObject;
|
|
4697
4779
|
}
|
|
4780
|
+
function getModelParametersToVertex(apiClient, fromObject) {
|
|
4781
|
+
const toObject = {};
|
|
4782
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
4783
|
+
if (fromModel != null) {
|
|
4784
|
+
setValueByPath(toObject, ['_url', 'name'], tModel(apiClient, fromModel));
|
|
4785
|
+
}
|
|
4786
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
4787
|
+
if (fromConfig != null) {
|
|
4788
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
4789
|
+
}
|
|
4790
|
+
return toObject;
|
|
4791
|
+
}
|
|
4698
4792
|
function countTokensConfigToVertex(apiClient, fromObject, parentObject) {
|
|
4699
4793
|
const toObject = {};
|
|
4700
4794
|
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
@@ -5118,6 +5212,64 @@ function generateImagesResponseFromMldev(apiClient, fromObject) {
|
|
|
5118
5212
|
}
|
|
5119
5213
|
return toObject;
|
|
5120
5214
|
}
|
|
5215
|
+
function tunedModelInfoFromMldev(apiClient, fromObject) {
|
|
5216
|
+
const toObject = {};
|
|
5217
|
+
const fromBaseModel = getValueByPath(fromObject, ['baseModel']);
|
|
5218
|
+
if (fromBaseModel != null) {
|
|
5219
|
+
setValueByPath(toObject, ['baseModel'], fromBaseModel);
|
|
5220
|
+
}
|
|
5221
|
+
const fromCreateTime = getValueByPath(fromObject, ['createTime']);
|
|
5222
|
+
if (fromCreateTime != null) {
|
|
5223
|
+
setValueByPath(toObject, ['createTime'], fromCreateTime);
|
|
5224
|
+
}
|
|
5225
|
+
const fromUpdateTime = getValueByPath(fromObject, ['updateTime']);
|
|
5226
|
+
if (fromUpdateTime != null) {
|
|
5227
|
+
setValueByPath(toObject, ['updateTime'], fromUpdateTime);
|
|
5228
|
+
}
|
|
5229
|
+
return toObject;
|
|
5230
|
+
}
|
|
5231
|
+
function modelFromMldev(apiClient, fromObject) {
|
|
5232
|
+
const toObject = {};
|
|
5233
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
5234
|
+
if (fromName != null) {
|
|
5235
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
5236
|
+
}
|
|
5237
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
5238
|
+
if (fromDisplayName != null) {
|
|
5239
|
+
setValueByPath(toObject, ['displayName'], fromDisplayName);
|
|
5240
|
+
}
|
|
5241
|
+
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
5242
|
+
if (fromDescription != null) {
|
|
5243
|
+
setValueByPath(toObject, ['description'], fromDescription);
|
|
5244
|
+
}
|
|
5245
|
+
const fromVersion = getValueByPath(fromObject, ['version']);
|
|
5246
|
+
if (fromVersion != null) {
|
|
5247
|
+
setValueByPath(toObject, ['version'], fromVersion);
|
|
5248
|
+
}
|
|
5249
|
+
const fromTunedModelInfo = getValueByPath(fromObject, ['_self']);
|
|
5250
|
+
if (fromTunedModelInfo != null) {
|
|
5251
|
+
setValueByPath(toObject, ['tunedModelInfo'], tunedModelInfoFromMldev(apiClient, fromTunedModelInfo));
|
|
5252
|
+
}
|
|
5253
|
+
const fromInputTokenLimit = getValueByPath(fromObject, [
|
|
5254
|
+
'inputTokenLimit',
|
|
5255
|
+
]);
|
|
5256
|
+
if (fromInputTokenLimit != null) {
|
|
5257
|
+
setValueByPath(toObject, ['inputTokenLimit'], fromInputTokenLimit);
|
|
5258
|
+
}
|
|
5259
|
+
const fromOutputTokenLimit = getValueByPath(fromObject, [
|
|
5260
|
+
'outputTokenLimit',
|
|
5261
|
+
]);
|
|
5262
|
+
if (fromOutputTokenLimit != null) {
|
|
5263
|
+
setValueByPath(toObject, ['outputTokenLimit'], fromOutputTokenLimit);
|
|
5264
|
+
}
|
|
5265
|
+
const fromSupportedActions = getValueByPath(fromObject, [
|
|
5266
|
+
'supportedGenerationMethods',
|
|
5267
|
+
]);
|
|
5268
|
+
if (fromSupportedActions != null) {
|
|
5269
|
+
setValueByPath(toObject, ['supportedActions'], fromSupportedActions);
|
|
5270
|
+
}
|
|
5271
|
+
return toObject;
|
|
5272
|
+
}
|
|
5121
5273
|
function countTokensResponseFromMldev(apiClient, fromObject) {
|
|
5122
5274
|
const toObject = {};
|
|
5123
5275
|
const fromTotalTokens = getValueByPath(fromObject, ['totalTokens']);
|
|
@@ -5206,9 +5358,12 @@ function generateVideosOperationFromMldev$1(apiClient, fromObject) {
|
|
|
5206
5358
|
if (fromError != null) {
|
|
5207
5359
|
setValueByPath(toObject, ['error'], fromError);
|
|
5208
5360
|
}
|
|
5209
|
-
const fromResponse = getValueByPath(fromObject, [
|
|
5361
|
+
const fromResponse = getValueByPath(fromObject, [
|
|
5362
|
+
'response',
|
|
5363
|
+
'generateVideoResponse',
|
|
5364
|
+
]);
|
|
5210
5365
|
if (fromResponse != null) {
|
|
5211
|
-
setValueByPath(toObject, ['response'], fromResponse);
|
|
5366
|
+
setValueByPath(toObject, ['response'], generateVideosResponseFromMldev$1(apiClient, fromResponse));
|
|
5212
5367
|
}
|
|
5213
5368
|
const fromResult = getValueByPath(fromObject, [
|
|
5214
5369
|
'response',
|
|
@@ -5524,6 +5679,78 @@ function generateImagesResponseFromVertex(apiClient, fromObject) {
|
|
|
5524
5679
|
}
|
|
5525
5680
|
return toObject;
|
|
5526
5681
|
}
|
|
5682
|
+
function endpointFromVertex(apiClient, fromObject) {
|
|
5683
|
+
const toObject = {};
|
|
5684
|
+
const fromName = getValueByPath(fromObject, ['endpoint']);
|
|
5685
|
+
if (fromName != null) {
|
|
5686
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
5687
|
+
}
|
|
5688
|
+
const fromDeployedModelId = getValueByPath(fromObject, [
|
|
5689
|
+
'deployedModelId',
|
|
5690
|
+
]);
|
|
5691
|
+
if (fromDeployedModelId != null) {
|
|
5692
|
+
setValueByPath(toObject, ['deployedModelId'], fromDeployedModelId);
|
|
5693
|
+
}
|
|
5694
|
+
return toObject;
|
|
5695
|
+
}
|
|
5696
|
+
function tunedModelInfoFromVertex(apiClient, fromObject) {
|
|
5697
|
+
const toObject = {};
|
|
5698
|
+
const fromBaseModel = getValueByPath(fromObject, [
|
|
5699
|
+
'labels',
|
|
5700
|
+
'google-vertex-llm-tuning-base-model-id',
|
|
5701
|
+
]);
|
|
5702
|
+
if (fromBaseModel != null) {
|
|
5703
|
+
setValueByPath(toObject, ['baseModel'], fromBaseModel);
|
|
5704
|
+
}
|
|
5705
|
+
const fromCreateTime = getValueByPath(fromObject, ['createTime']);
|
|
5706
|
+
if (fromCreateTime != null) {
|
|
5707
|
+
setValueByPath(toObject, ['createTime'], fromCreateTime);
|
|
5708
|
+
}
|
|
5709
|
+
const fromUpdateTime = getValueByPath(fromObject, ['updateTime']);
|
|
5710
|
+
if (fromUpdateTime != null) {
|
|
5711
|
+
setValueByPath(toObject, ['updateTime'], fromUpdateTime);
|
|
5712
|
+
}
|
|
5713
|
+
return toObject;
|
|
5714
|
+
}
|
|
5715
|
+
function modelFromVertex(apiClient, fromObject) {
|
|
5716
|
+
const toObject = {};
|
|
5717
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
5718
|
+
if (fromName != null) {
|
|
5719
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
5720
|
+
}
|
|
5721
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
5722
|
+
if (fromDisplayName != null) {
|
|
5723
|
+
setValueByPath(toObject, ['displayName'], fromDisplayName);
|
|
5724
|
+
}
|
|
5725
|
+
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
5726
|
+
if (fromDescription != null) {
|
|
5727
|
+
setValueByPath(toObject, ['description'], fromDescription);
|
|
5728
|
+
}
|
|
5729
|
+
const fromVersion = getValueByPath(fromObject, ['versionId']);
|
|
5730
|
+
if (fromVersion != null) {
|
|
5731
|
+
setValueByPath(toObject, ['version'], fromVersion);
|
|
5732
|
+
}
|
|
5733
|
+
const fromEndpoints = getValueByPath(fromObject, ['deployedModels']);
|
|
5734
|
+
if (fromEndpoints != null) {
|
|
5735
|
+
if (Array.isArray(fromEndpoints)) {
|
|
5736
|
+
setValueByPath(toObject, ['endpoints'], fromEndpoints.map((item) => {
|
|
5737
|
+
return endpointFromVertex(apiClient, item);
|
|
5738
|
+
}));
|
|
5739
|
+
}
|
|
5740
|
+
else {
|
|
5741
|
+
setValueByPath(toObject, ['endpoints'], fromEndpoints);
|
|
5742
|
+
}
|
|
5743
|
+
}
|
|
5744
|
+
const fromLabels = getValueByPath(fromObject, ['labels']);
|
|
5745
|
+
if (fromLabels != null) {
|
|
5746
|
+
setValueByPath(toObject, ['labels'], fromLabels);
|
|
5747
|
+
}
|
|
5748
|
+
const fromTunedModelInfo = getValueByPath(fromObject, ['_self']);
|
|
5749
|
+
if (fromTunedModelInfo != null) {
|
|
5750
|
+
setValueByPath(toObject, ['tunedModelInfo'], tunedModelInfoFromVertex(apiClient, fromTunedModelInfo));
|
|
5751
|
+
}
|
|
5752
|
+
return toObject;
|
|
5753
|
+
}
|
|
5527
5754
|
function countTokensResponseFromVertex(apiClient, fromObject) {
|
|
5528
5755
|
const toObject = {};
|
|
5529
5756
|
const fromTotalTokens = getValueByPath(fromObject, ['totalTokens']);
|
|
@@ -5613,7 +5840,7 @@ function generateVideosOperationFromVertex$1(apiClient, fromObject) {
|
|
|
5613
5840
|
}
|
|
5614
5841
|
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
5615
5842
|
if (fromResponse != null) {
|
|
5616
|
-
setValueByPath(toObject, ['response'], fromResponse);
|
|
5843
|
+
setValueByPath(toObject, ['response'], generateVideosResponseFromVertex$1(apiClient, fromResponse));
|
|
5617
5844
|
}
|
|
5618
5845
|
const fromResult = getValueByPath(fromObject, ['response']);
|
|
5619
5846
|
if (fromResult != null) {
|
|
@@ -5679,6 +5906,23 @@ function liveServerMessageFromMldev(apiClient, fromObject) {
|
|
|
5679
5906
|
fromToolCallCancellation !== null) {
|
|
5680
5907
|
setValueByPath(toObject, ['toolCallCancellation'], liveServerToolCallCancellationFromMldev(apiClient, fromToolCallCancellation));
|
|
5681
5908
|
}
|
|
5909
|
+
const fromUsageMetadata = getValueByPath(fromObject, [
|
|
5910
|
+
'usageMetadata',
|
|
5911
|
+
]);
|
|
5912
|
+
if (fromUsageMetadata != undefined && fromUsageMetadata != null) {
|
|
5913
|
+
setValueByPath(toObject, ['usageMetadata'], usageMetadataFromMldev(apiClient, fromUsageMetadata));
|
|
5914
|
+
}
|
|
5915
|
+
const fromGoAway = getValueByPath(fromObject, ['goAway']);
|
|
5916
|
+
if (fromGoAway !== undefined && fromGoAway !== null) {
|
|
5917
|
+
setValueByPath(toObject, ['goAway'], liveServerGoAwayFromMldev(fromGoAway));
|
|
5918
|
+
}
|
|
5919
|
+
const fromSessionResumptionUpdate = getValueByPath(fromObject, [
|
|
5920
|
+
'sessionResumptionUpdate',
|
|
5921
|
+
]);
|
|
5922
|
+
if (fromSessionResumptionUpdate !== undefined &&
|
|
5923
|
+
fromSessionResumptionUpdate !== null) {
|
|
5924
|
+
setValueByPath(toObject, ['sessionResumptionUpdate'], liveServerSessionResumptionUpdateFromMldev(fromSessionResumptionUpdate));
|
|
5925
|
+
}
|
|
5682
5926
|
return toObject;
|
|
5683
5927
|
}
|
|
5684
5928
|
function liveServerMessageFromVertex(apiClient, fromObject) {
|
|
@@ -5706,6 +5950,181 @@ function liveServerMessageFromVertex(apiClient, fromObject) {
|
|
|
5706
5950
|
fromToolCallCancellation !== null) {
|
|
5707
5951
|
setValueByPath(toObject, ['toolCallCancellation'], liveServerToolCallCancellationFromVertex(apiClient, fromToolCallCancellation));
|
|
5708
5952
|
}
|
|
5953
|
+
const fromGoAway = getValueByPath(fromObject, ['goAway']);
|
|
5954
|
+
if (fromGoAway !== undefined && fromGoAway !== null) {
|
|
5955
|
+
setValueByPath(toObject, ['goAway'], liveServerGoAwayFromVertex(fromGoAway));
|
|
5956
|
+
}
|
|
5957
|
+
const fromSessionResumptionUpdate = getValueByPath(fromObject, [
|
|
5958
|
+
'sessionResumptionUpdate',
|
|
5959
|
+
]);
|
|
5960
|
+
if (fromSessionResumptionUpdate !== undefined &&
|
|
5961
|
+
fromSessionResumptionUpdate !== null) {
|
|
5962
|
+
setValueByPath(toObject, ['sessionResumptionUpdate'], liveServerSessionResumptionUpdateFromVertex(fromSessionResumptionUpdate));
|
|
5963
|
+
}
|
|
5964
|
+
const fromUsageMetadata = getValueByPath(fromObject, [
|
|
5965
|
+
'usageMetadata',
|
|
5966
|
+
]);
|
|
5967
|
+
if (fromUsageMetadata != undefined && fromUsageMetadata != null) {
|
|
5968
|
+
setValueByPath(toObject, ['usageMetadata'], usageMetadataFromVertex(apiClient, fromUsageMetadata));
|
|
5969
|
+
}
|
|
5970
|
+
return toObject;
|
|
5971
|
+
}
|
|
5972
|
+
function slidingWindowToMldev(fromObject) {
|
|
5973
|
+
const toObject = {};
|
|
5974
|
+
const fromTargetTokens = getValueByPath(fromObject, ['targetTokens']);
|
|
5975
|
+
if (fromTargetTokens !== undefined && fromTargetTokens !== null) {
|
|
5976
|
+
setValueByPath(toObject, ['targetTokens'], fromTargetTokens);
|
|
5977
|
+
}
|
|
5978
|
+
return toObject;
|
|
5979
|
+
}
|
|
5980
|
+
function slidingWindowToVertex(fromObject) {
|
|
5981
|
+
const toObject = {};
|
|
5982
|
+
const fromTargetTokens = getValueByPath(fromObject, ['targetTokens']);
|
|
5983
|
+
if (fromTargetTokens !== undefined && fromTargetTokens !== null) {
|
|
5984
|
+
setValueByPath(toObject, ['targetTokens'], fromTargetTokens);
|
|
5985
|
+
}
|
|
5986
|
+
return toObject;
|
|
5987
|
+
}
|
|
5988
|
+
function contextWindowCompressionToMldev(fromObject) {
|
|
5989
|
+
const toObject = {};
|
|
5990
|
+
const fromTriggerTokens = getValueByPath(fromObject, [
|
|
5991
|
+
'triggerTokens',
|
|
5992
|
+
]);
|
|
5993
|
+
if (fromTriggerTokens !== undefined && fromTriggerTokens !== null) {
|
|
5994
|
+
setValueByPath(toObject, ['triggerTokens'], fromTriggerTokens);
|
|
5995
|
+
}
|
|
5996
|
+
const fromSlidingWindow = getValueByPath(fromObject, [
|
|
5997
|
+
'slidingWindow',
|
|
5998
|
+
]);
|
|
5999
|
+
if (fromSlidingWindow !== undefined && fromSlidingWindow !== null) {
|
|
6000
|
+
setValueByPath(toObject, ['slidingWindow'], slidingWindowToMldev(fromSlidingWindow));
|
|
6001
|
+
}
|
|
6002
|
+
return toObject;
|
|
6003
|
+
}
|
|
6004
|
+
function contextWindowCompressionToVertex(fromObject) {
|
|
6005
|
+
const toObject = {};
|
|
6006
|
+
const fromTriggerTokens = getValueByPath(fromObject, [
|
|
6007
|
+
'triggerTokens',
|
|
6008
|
+
]);
|
|
6009
|
+
if (fromTriggerTokens !== undefined && fromTriggerTokens !== null) {
|
|
6010
|
+
setValueByPath(toObject, ['triggerTokens'], fromTriggerTokens);
|
|
6011
|
+
}
|
|
6012
|
+
const fromSlidingWindow = getValueByPath(fromObject, [
|
|
6013
|
+
'slidingWindow',
|
|
6014
|
+
]);
|
|
6015
|
+
if (fromSlidingWindow !== undefined && fromSlidingWindow !== null) {
|
|
6016
|
+
setValueByPath(toObject, ['slidingWindow'], slidingWindowToVertex(fromSlidingWindow));
|
|
6017
|
+
}
|
|
6018
|
+
return toObject;
|
|
6019
|
+
}
|
|
6020
|
+
function automaticActivityDetectionToMldev(fromObject) {
|
|
6021
|
+
const toObject = {};
|
|
6022
|
+
const fromDisabled = getValueByPath(fromObject, ['disabled']);
|
|
6023
|
+
if (fromDisabled !== undefined && fromDisabled !== null) {
|
|
6024
|
+
setValueByPath(toObject, ['disabled'], fromDisabled);
|
|
6025
|
+
}
|
|
6026
|
+
const fromStartOfSpeechSensitivity = getValueByPath(fromObject, [
|
|
6027
|
+
'startOfSpeechSensitivity',
|
|
6028
|
+
]);
|
|
6029
|
+
if (fromStartOfSpeechSensitivity !== undefined &&
|
|
6030
|
+
fromStartOfSpeechSensitivity !== null) {
|
|
6031
|
+
setValueByPath(toObject, ['startOfSpeechSensitivity'], fromStartOfSpeechSensitivity);
|
|
6032
|
+
}
|
|
6033
|
+
const fromEndOfSpeechSensitivity = getValueByPath(fromObject, [
|
|
6034
|
+
'endOfSpeechSensitivity',
|
|
6035
|
+
]);
|
|
6036
|
+
if (fromEndOfSpeechSensitivity !== undefined &&
|
|
6037
|
+
fromEndOfSpeechSensitivity !== null) {
|
|
6038
|
+
setValueByPath(toObject, ['endOfSpeechSensitivity'], fromEndOfSpeechSensitivity);
|
|
6039
|
+
}
|
|
6040
|
+
const fromPrefixPaddingMs = getValueByPath(fromObject, [
|
|
6041
|
+
'prefixPaddingMs',
|
|
6042
|
+
]);
|
|
6043
|
+
if (fromPrefixPaddingMs !== undefined && fromPrefixPaddingMs !== null) {
|
|
6044
|
+
setValueByPath(toObject, ['prefixPaddingMs'], fromPrefixPaddingMs);
|
|
6045
|
+
}
|
|
6046
|
+
const fromSilenceDurationMs = getValueByPath(fromObject, [
|
|
6047
|
+
'silenceDurationMs',
|
|
6048
|
+
]);
|
|
6049
|
+
if (fromSilenceDurationMs !== undefined && fromSilenceDurationMs !== null) {
|
|
6050
|
+
setValueByPath(toObject, ['silenceDurationMs'], fromSilenceDurationMs);
|
|
6051
|
+
}
|
|
6052
|
+
return toObject;
|
|
6053
|
+
}
|
|
6054
|
+
function automaticActivityDetectionToVertex(fromObject) {
|
|
6055
|
+
const toObject = {};
|
|
6056
|
+
const fromDisabled = getValueByPath(fromObject, ['disabled']);
|
|
6057
|
+
if (fromDisabled !== undefined && fromDisabled !== null) {
|
|
6058
|
+
setValueByPath(toObject, ['disabled'], fromDisabled);
|
|
6059
|
+
}
|
|
6060
|
+
const fromStartOfSpeechSensitivity = getValueByPath(fromObject, [
|
|
6061
|
+
'startOfSpeechSensitivity',
|
|
6062
|
+
]);
|
|
6063
|
+
if (fromStartOfSpeechSensitivity !== undefined &&
|
|
6064
|
+
fromStartOfSpeechSensitivity !== null) {
|
|
6065
|
+
setValueByPath(toObject, ['startOfSpeechSensitivity'], fromStartOfSpeechSensitivity);
|
|
6066
|
+
}
|
|
6067
|
+
const fromEndOfSpeechSensitivity = getValueByPath(fromObject, [
|
|
6068
|
+
'endOfSpeechSensitivity',
|
|
6069
|
+
]);
|
|
6070
|
+
if (fromEndOfSpeechSensitivity !== undefined &&
|
|
6071
|
+
fromEndOfSpeechSensitivity !== null) {
|
|
6072
|
+
setValueByPath(toObject, ['endOfSpeechSensitivity'], fromEndOfSpeechSensitivity);
|
|
6073
|
+
}
|
|
6074
|
+
const fromPrefixPaddingMs = getValueByPath(fromObject, [
|
|
6075
|
+
'prefixPaddingMs',
|
|
6076
|
+
]);
|
|
6077
|
+
if (fromPrefixPaddingMs !== undefined && fromPrefixPaddingMs !== null) {
|
|
6078
|
+
setValueByPath(toObject, ['prefixPaddingMs'], fromPrefixPaddingMs);
|
|
6079
|
+
}
|
|
6080
|
+
const fromSilenceDurationMs = getValueByPath(fromObject, [
|
|
6081
|
+
'silenceDurationMs',
|
|
6082
|
+
]);
|
|
6083
|
+
if (fromSilenceDurationMs !== undefined && fromSilenceDurationMs !== null) {
|
|
6084
|
+
setValueByPath(toObject, ['silenceDurationMs'], fromSilenceDurationMs);
|
|
6085
|
+
}
|
|
6086
|
+
return toObject;
|
|
6087
|
+
}
|
|
6088
|
+
function realtimeInputConfigToMldev(fromObject) {
|
|
6089
|
+
const toObject = {};
|
|
6090
|
+
const fromAutomaticActivityDetection = getValueByPath(fromObject, [
|
|
6091
|
+
'automaticActivityDetection',
|
|
6092
|
+
]);
|
|
6093
|
+
if (fromAutomaticActivityDetection !== undefined &&
|
|
6094
|
+
fromAutomaticActivityDetection !== null) {
|
|
6095
|
+
setValueByPath(toObject, ['automaticActivityDetection'], automaticActivityDetectionToMldev(fromAutomaticActivityDetection));
|
|
6096
|
+
}
|
|
6097
|
+
const fromActivityHandling = getValueByPath(fromObject, [
|
|
6098
|
+
'activityHandling',
|
|
6099
|
+
]);
|
|
6100
|
+
if (fromActivityHandling !== undefined && fromActivityHandling !== null) {
|
|
6101
|
+
setValueByPath(toObject, ['activityHandling'], fromActivityHandling);
|
|
6102
|
+
}
|
|
6103
|
+
const fromTurnCoverage = getValueByPath(fromObject, ['turnCoverage']);
|
|
6104
|
+
if (fromTurnCoverage !== undefined && fromTurnCoverage !== null) {
|
|
6105
|
+
setValueByPath(toObject, ['turnCoverage'], fromTurnCoverage);
|
|
6106
|
+
}
|
|
6107
|
+
return toObject;
|
|
6108
|
+
}
|
|
6109
|
+
function realtimeInputConfigToVertex(fromObject) {
|
|
6110
|
+
const toObject = {};
|
|
6111
|
+
const fromAutomaticActivityDetection = getValueByPath(fromObject, [
|
|
6112
|
+
'automaticActivityDetection',
|
|
6113
|
+
]);
|
|
6114
|
+
if (fromAutomaticActivityDetection !== undefined &&
|
|
6115
|
+
fromAutomaticActivityDetection !== null) {
|
|
6116
|
+
setValueByPath(toObject, ['automaticActivityDetection'], automaticActivityDetectionToVertex(fromAutomaticActivityDetection));
|
|
6117
|
+
}
|
|
6118
|
+
const fromActivityHandling = getValueByPath(fromObject, [
|
|
6119
|
+
'activityHandling',
|
|
6120
|
+
]);
|
|
6121
|
+
if (fromActivityHandling !== undefined && fromActivityHandling !== null) {
|
|
6122
|
+
setValueByPath(toObject, ['activityHandling'], fromActivityHandling);
|
|
6123
|
+
}
|
|
6124
|
+
const fromTurnCoverage = getValueByPath(fromObject, ['turnCoverage']);
|
|
6125
|
+
if (fromTurnCoverage !== undefined && fromTurnCoverage !== null) {
|
|
6126
|
+
setValueByPath(toObject, ['turnCoverage'], fromTurnCoverage);
|
|
6127
|
+
}
|
|
5709
6128
|
return toObject;
|
|
5710
6129
|
}
|
|
5711
6130
|
function liveConnectConfigToMldev(apiClient, fromObject) {
|
|
@@ -5740,6 +6159,26 @@ function liveConnectConfigToMldev(apiClient, fromObject) {
|
|
|
5740
6159
|
return toolToMldev(apiClient, item);
|
|
5741
6160
|
}));
|
|
5742
6161
|
}
|
|
6162
|
+
const fromSessionResumption = getValueByPath(fromObject, [
|
|
6163
|
+
'sessionResumption',
|
|
6164
|
+
]);
|
|
6165
|
+
if (fromSessionResumption !== undefined && fromSessionResumption !== null) {
|
|
6166
|
+
setValueByPath(toObject, ['sessionResumption'], liveClientSessionResumptionConfigToMldev(fromSessionResumption));
|
|
6167
|
+
}
|
|
6168
|
+
const fromContextWindowCompression = getValueByPath(fromObject, [
|
|
6169
|
+
'contextWindowCompression',
|
|
6170
|
+
]);
|
|
6171
|
+
if (fromContextWindowCompression !== undefined &&
|
|
6172
|
+
fromContextWindowCompression !== null) {
|
|
6173
|
+
setValueByPath(toObject, ['contextWindowCompression'], contextWindowCompressionToMldev(fromContextWindowCompression));
|
|
6174
|
+
}
|
|
6175
|
+
const fromRealtimeInputConfig = getValueByPath(fromObject, [
|
|
6176
|
+
'realtimeInputConfig',
|
|
6177
|
+
]);
|
|
6178
|
+
if (fromRealtimeInputConfig !== undefined &&
|
|
6179
|
+
fromRealtimeInputConfig !== null) {
|
|
6180
|
+
setValueByPath(toObject, ['realtimeInputConfig'], realtimeInputConfigToMldev(fromRealtimeInputConfig));
|
|
6181
|
+
}
|
|
5743
6182
|
return toObject;
|
|
5744
6183
|
}
|
|
5745
6184
|
function liveConnectConfigToVertex(apiClient, fromObject) {
|
|
@@ -5778,6 +6217,26 @@ function liveConnectConfigToVertex(apiClient, fromObject) {
|
|
|
5778
6217
|
return toolToVertex(apiClient, item);
|
|
5779
6218
|
}));
|
|
5780
6219
|
}
|
|
6220
|
+
const fromSessionResumption = getValueByPath(fromObject, [
|
|
6221
|
+
'sessionResumption',
|
|
6222
|
+
]);
|
|
6223
|
+
if (fromSessionResumption !== undefined && fromSessionResumption !== null) {
|
|
6224
|
+
setValueByPath(toObject, ['sessionResumption'], liveClientSessionResumptionConfigToVertex(fromSessionResumption));
|
|
6225
|
+
}
|
|
6226
|
+
const fromContextWindowCompression = getValueByPath(fromObject, [
|
|
6227
|
+
'contextWindowCompression',
|
|
6228
|
+
]);
|
|
6229
|
+
if (fromContextWindowCompression !== undefined &&
|
|
6230
|
+
fromContextWindowCompression !== null) {
|
|
6231
|
+
setValueByPath(toObject, ['contextWindowCompression'], contextWindowCompressionToVertex(fromContextWindowCompression));
|
|
6232
|
+
}
|
|
6233
|
+
const fromRealtimeInputConfig = getValueByPath(fromObject, [
|
|
6234
|
+
'realtimeInputConfig',
|
|
6235
|
+
]);
|
|
6236
|
+
if (fromRealtimeInputConfig !== undefined &&
|
|
6237
|
+
fromRealtimeInputConfig !== null) {
|
|
6238
|
+
setValueByPath(toObject, ['realtimeInputConfig'], realtimeInputConfigToVertex(fromRealtimeInputConfig));
|
|
6239
|
+
}
|
|
5781
6240
|
return toObject;
|
|
5782
6241
|
}
|
|
5783
6242
|
function liveServerContentFromMldev(apiClient, fromObject) {
|
|
@@ -5794,6 +6253,12 @@ function liveServerContentFromMldev(apiClient, fromObject) {
|
|
|
5794
6253
|
if (fromInterrupted !== undefined) {
|
|
5795
6254
|
setValueByPath(toObject, ['interrupted'], fromInterrupted);
|
|
5796
6255
|
}
|
|
6256
|
+
const fromGenerationComplete = getValueByPath(fromObject, [
|
|
6257
|
+
'generationComplete',
|
|
6258
|
+
]);
|
|
6259
|
+
if (fromGenerationComplete != null) {
|
|
6260
|
+
setValueByPath(toObject, ['generationComplete'], fromGenerationComplete);
|
|
6261
|
+
}
|
|
5797
6262
|
return toObject;
|
|
5798
6263
|
}
|
|
5799
6264
|
function liveServerContentFromVertex(apiClient, fromObject) {
|
|
@@ -5810,6 +6275,12 @@ function liveServerContentFromVertex(apiClient, fromObject) {
|
|
|
5810
6275
|
if (fromInterrupted !== undefined) {
|
|
5811
6276
|
setValueByPath(toObject, ['interrupted'], fromInterrupted);
|
|
5812
6277
|
}
|
|
6278
|
+
const fromGenerationComplete = getValueByPath(fromObject, [
|
|
6279
|
+
'generationComplete',
|
|
6280
|
+
]);
|
|
6281
|
+
if (fromGenerationComplete != null) {
|
|
6282
|
+
setValueByPath(toObject, ['generationComplete'], fromGenerationComplete);
|
|
6283
|
+
}
|
|
5813
6284
|
return toObject;
|
|
5814
6285
|
}
|
|
5815
6286
|
function functionCallFromMldev(apiClient, fromObject) {
|
|
@@ -5884,6 +6355,293 @@ function liveServerToolCallCancellationFromVertex(apiClient, fromObject) {
|
|
|
5884
6355
|
}
|
|
5885
6356
|
return toObject;
|
|
5886
6357
|
}
|
|
6358
|
+
function liveServerGoAwayFromMldev(fromObject) {
|
|
6359
|
+
const toObject = {};
|
|
6360
|
+
const fromTimeLeft = getValueByPath(fromObject, ['timeLeft']);
|
|
6361
|
+
if (fromTimeLeft !== undefined) {
|
|
6362
|
+
setValueByPath(toObject, ['timeLeft'], fromTimeLeft);
|
|
6363
|
+
}
|
|
6364
|
+
return toObject;
|
|
6365
|
+
}
|
|
6366
|
+
function liveServerGoAwayFromVertex(fromObject) {
|
|
6367
|
+
const toObject = {};
|
|
6368
|
+
const fromTimeLeft = getValueByPath(fromObject, ['timeLeft']);
|
|
6369
|
+
if (fromTimeLeft !== undefined) {
|
|
6370
|
+
setValueByPath(toObject, ['timeLeft'], fromTimeLeft);
|
|
6371
|
+
}
|
|
6372
|
+
return toObject;
|
|
6373
|
+
}
|
|
6374
|
+
function liveServerSessionResumptionUpdateFromMldev(fromObject) {
|
|
6375
|
+
const toObject = {};
|
|
6376
|
+
const fromNewHandle = getValueByPath(fromObject, ['newHandle']);
|
|
6377
|
+
if (fromNewHandle !== undefined) {
|
|
6378
|
+
setValueByPath(toObject, ['newHandle'], fromNewHandle);
|
|
6379
|
+
}
|
|
6380
|
+
const fromResumable = getValueByPath(fromObject, ['resumable']);
|
|
6381
|
+
if (fromResumable !== undefined) {
|
|
6382
|
+
setValueByPath(toObject, ['resumable'], fromResumable);
|
|
6383
|
+
}
|
|
6384
|
+
const fromLastConsumedClientMessageIndex = getValueByPath(fromObject, [
|
|
6385
|
+
'lastConsumedClientMessageIndex',
|
|
6386
|
+
]);
|
|
6387
|
+
if (fromLastConsumedClientMessageIndex !== undefined) {
|
|
6388
|
+
setValueByPath(toObject, ['lastConsumedClientMessageIndex'], fromLastConsumedClientMessageIndex);
|
|
6389
|
+
}
|
|
6390
|
+
return toObject;
|
|
6391
|
+
}
|
|
6392
|
+
function liveServerSessionResumptionUpdateFromVertex(fromObject) {
|
|
6393
|
+
const toObject = {};
|
|
6394
|
+
const fromNewHandle = getValueByPath(fromObject, ['newHandle']);
|
|
6395
|
+
if (fromNewHandle !== undefined) {
|
|
6396
|
+
setValueByPath(toObject, ['newHandle'], fromNewHandle);
|
|
6397
|
+
}
|
|
6398
|
+
const fromResumable = getValueByPath(fromObject, ['resumable']);
|
|
6399
|
+
if (fromResumable !== undefined) {
|
|
6400
|
+
setValueByPath(toObject, ['resumable'], fromResumable);
|
|
6401
|
+
}
|
|
6402
|
+
const fromLastConsumedClientMessageIndex = getValueByPath(fromObject, [
|
|
6403
|
+
'lastConsumedClientMessageIndex',
|
|
6404
|
+
]);
|
|
6405
|
+
if (fromLastConsumedClientMessageIndex !== undefined) {
|
|
6406
|
+
setValueByPath(toObject, ['lastConsumedClientMessageIndex'], fromLastConsumedClientMessageIndex);
|
|
6407
|
+
}
|
|
6408
|
+
return toObject;
|
|
6409
|
+
}
|
|
6410
|
+
function liveClientSessionResumptionConfigToMldev(fromObject) {
|
|
6411
|
+
const toObject = {};
|
|
6412
|
+
const fromHandle = getValueByPath(fromObject, ['handle']);
|
|
6413
|
+
if (fromHandle !== undefined) {
|
|
6414
|
+
setValueByPath(toObject, ['handle'], fromHandle);
|
|
6415
|
+
}
|
|
6416
|
+
if (getValueByPath(fromObject, ['transparent']) !== undefined) {
|
|
6417
|
+
throw new Error('transparent parameter is not supported in Gemini API.');
|
|
6418
|
+
}
|
|
6419
|
+
return toObject;
|
|
6420
|
+
}
|
|
6421
|
+
function liveClientSessionResumptionConfigToVertex(fromObject) {
|
|
6422
|
+
const toObject = {};
|
|
6423
|
+
const fromHandle = getValueByPath(fromObject, ['handle']);
|
|
6424
|
+
if (fromHandle !== undefined) {
|
|
6425
|
+
setValueByPath(toObject, ['handle'], fromHandle);
|
|
6426
|
+
}
|
|
6427
|
+
const fromTransparent = getValueByPath(fromObject, ['transparent']);
|
|
6428
|
+
if (fromTransparent !== undefined) {
|
|
6429
|
+
setValueByPath(toObject, ['transparent'], fromTransparent);
|
|
6430
|
+
}
|
|
6431
|
+
return toObject;
|
|
6432
|
+
}
|
|
6433
|
+
function modalityTokenCountFromMldev(apiClient, fromObject) {
|
|
6434
|
+
const toObject = {};
|
|
6435
|
+
const fromModality = getValueByPath(fromObject, ['modality']);
|
|
6436
|
+
if (fromModality != null) {
|
|
6437
|
+
setValueByPath(toObject, ['modality'], fromModality);
|
|
6438
|
+
}
|
|
6439
|
+
const fromTokenCount = getValueByPath(fromObject, ['tokenCount']);
|
|
6440
|
+
if (fromTokenCount != null) {
|
|
6441
|
+
setValueByPath(toObject, ['tokenCount'], fromTokenCount);
|
|
6442
|
+
}
|
|
6443
|
+
return toObject;
|
|
6444
|
+
}
|
|
6445
|
+
function usageMetadataFromMldev(apiClient, fromObject) {
|
|
6446
|
+
const toObject = {};
|
|
6447
|
+
const fromPromptTokenCount = getValueByPath(fromObject, [
|
|
6448
|
+
'promptTokenCount',
|
|
6449
|
+
]);
|
|
6450
|
+
if (fromPromptTokenCount != null) {
|
|
6451
|
+
setValueByPath(toObject, ['promptTokenCount'], fromPromptTokenCount);
|
|
6452
|
+
}
|
|
6453
|
+
const fromCachedContentTokenCount = getValueByPath(fromObject, [
|
|
6454
|
+
'cachedContentTokenCount',
|
|
6455
|
+
]);
|
|
6456
|
+
if (fromCachedContentTokenCount != null) {
|
|
6457
|
+
setValueByPath(toObject, ['cachedContentTokenCount'], fromCachedContentTokenCount);
|
|
6458
|
+
}
|
|
6459
|
+
const fromResponseTokenCount = getValueByPath(fromObject, [
|
|
6460
|
+
'responseTokenCount',
|
|
6461
|
+
]);
|
|
6462
|
+
if (fromResponseTokenCount != null) {
|
|
6463
|
+
setValueByPath(toObject, ['responseTokenCount'], fromResponseTokenCount);
|
|
6464
|
+
}
|
|
6465
|
+
const fromToolUsePromptTokenCount = getValueByPath(fromObject, [
|
|
6466
|
+
'toolUsePromptTokenCount',
|
|
6467
|
+
]);
|
|
6468
|
+
if (fromToolUsePromptTokenCount != null) {
|
|
6469
|
+
setValueByPath(toObject, ['toolUsePromptTokenCount'], fromToolUsePromptTokenCount);
|
|
6470
|
+
}
|
|
6471
|
+
const fromThoughtsTokenCount = getValueByPath(fromObject, [
|
|
6472
|
+
'thoughtsTokenCount',
|
|
6473
|
+
]);
|
|
6474
|
+
if (fromThoughtsTokenCount != null) {
|
|
6475
|
+
setValueByPath(toObject, ['thoughtsTokenCount'], fromThoughtsTokenCount);
|
|
6476
|
+
}
|
|
6477
|
+
const fromTotalTokenCount = getValueByPath(fromObject, [
|
|
6478
|
+
'totalTokenCount',
|
|
6479
|
+
]);
|
|
6480
|
+
if (fromTotalTokenCount != null) {
|
|
6481
|
+
setValueByPath(toObject, ['totalTokenCount'], fromTotalTokenCount);
|
|
6482
|
+
}
|
|
6483
|
+
const fromPromptTokensDetails = getValueByPath(fromObject, [
|
|
6484
|
+
'promptTokensDetails',
|
|
6485
|
+
]);
|
|
6486
|
+
if (fromPromptTokensDetails != null) {
|
|
6487
|
+
if (Array.isArray(fromPromptTokensDetails)) {
|
|
6488
|
+
setValueByPath(toObject, ['promptTokensDetails'], fromPromptTokensDetails.map((item) => {
|
|
6489
|
+
return modalityTokenCountFromMldev(apiClient, item);
|
|
6490
|
+
}));
|
|
6491
|
+
}
|
|
6492
|
+
else {
|
|
6493
|
+
setValueByPath(toObject, ['promptTokensDetails'], fromPromptTokensDetails);
|
|
6494
|
+
}
|
|
6495
|
+
}
|
|
6496
|
+
const fromCacheTokensDetails = getValueByPath(fromObject, [
|
|
6497
|
+
'cacheTokensDetails',
|
|
6498
|
+
]);
|
|
6499
|
+
if (fromCacheTokensDetails != null) {
|
|
6500
|
+
if (Array.isArray(fromCacheTokensDetails)) {
|
|
6501
|
+
setValueByPath(toObject, ['cacheTokensDetails'], fromCacheTokensDetails.map((item) => {
|
|
6502
|
+
return modalityTokenCountFromMldev(apiClient, item);
|
|
6503
|
+
}));
|
|
6504
|
+
}
|
|
6505
|
+
else {
|
|
6506
|
+
setValueByPath(toObject, ['cacheTokensDetails'], fromCacheTokensDetails);
|
|
6507
|
+
}
|
|
6508
|
+
}
|
|
6509
|
+
const fromResponseTokensDetails = getValueByPath(fromObject, [
|
|
6510
|
+
'responseTokensDetails',
|
|
6511
|
+
]);
|
|
6512
|
+
if (fromResponseTokensDetails != null) {
|
|
6513
|
+
if (Array.isArray(fromResponseTokensDetails)) {
|
|
6514
|
+
setValueByPath(toObject, ['responseTokensDetails'], fromResponseTokensDetails.map((item) => {
|
|
6515
|
+
return modalityTokenCountFromMldev(apiClient, item);
|
|
6516
|
+
}));
|
|
6517
|
+
}
|
|
6518
|
+
else {
|
|
6519
|
+
setValueByPath(toObject, ['responseTokensDetails'], fromResponseTokensDetails);
|
|
6520
|
+
}
|
|
6521
|
+
}
|
|
6522
|
+
const fromToolUsePromptTokensDetails = getValueByPath(fromObject, [
|
|
6523
|
+
'toolUsePromptTokensDetails',
|
|
6524
|
+
]);
|
|
6525
|
+
if (fromToolUsePromptTokensDetails != null) {
|
|
6526
|
+
if (Array.isArray(fromToolUsePromptTokensDetails)) {
|
|
6527
|
+
setValueByPath(toObject, ['toolUsePromptTokensDetails'], fromToolUsePromptTokensDetails.map((item) => {
|
|
6528
|
+
return modalityTokenCountFromMldev(apiClient, item);
|
|
6529
|
+
}));
|
|
6530
|
+
}
|
|
6531
|
+
else {
|
|
6532
|
+
setValueByPath(toObject, ['toolUsePromptTokensDetails'], fromToolUsePromptTokensDetails);
|
|
6533
|
+
}
|
|
6534
|
+
}
|
|
6535
|
+
return toObject;
|
|
6536
|
+
}
|
|
6537
|
+
function modalityTokenCountFromVertex(apiClient, fromObject) {
|
|
6538
|
+
const toObject = {};
|
|
6539
|
+
const fromModality = getValueByPath(fromObject, ['modality']);
|
|
6540
|
+
if (fromModality != null) {
|
|
6541
|
+
setValueByPath(toObject, ['modality'], fromModality);
|
|
6542
|
+
}
|
|
6543
|
+
const fromTokenCount = getValueByPath(fromObject, ['tokenCount']);
|
|
6544
|
+
if (fromTokenCount != null) {
|
|
6545
|
+
setValueByPath(toObject, ['tokenCount'], fromTokenCount);
|
|
6546
|
+
}
|
|
6547
|
+
return toObject;
|
|
6548
|
+
}
|
|
6549
|
+
function usageMetadataFromVertex(apiClient, fromObject) {
|
|
6550
|
+
const toObject = {};
|
|
6551
|
+
const fromPromptTokenCount = getValueByPath(fromObject, [
|
|
6552
|
+
'promptTokenCount',
|
|
6553
|
+
]);
|
|
6554
|
+
if (fromPromptTokenCount != null) {
|
|
6555
|
+
setValueByPath(toObject, ['promptTokenCount'], fromPromptTokenCount);
|
|
6556
|
+
}
|
|
6557
|
+
const fromCachedContentTokenCount = getValueByPath(fromObject, [
|
|
6558
|
+
'cachedContentTokenCount',
|
|
6559
|
+
]);
|
|
6560
|
+
if (fromCachedContentTokenCount != null) {
|
|
6561
|
+
setValueByPath(toObject, ['cachedContentTokenCount'], fromCachedContentTokenCount);
|
|
6562
|
+
}
|
|
6563
|
+
const fromResponseTokenCount = getValueByPath(fromObject, [
|
|
6564
|
+
'candidatesTokenCount',
|
|
6565
|
+
]);
|
|
6566
|
+
if (fromResponseTokenCount != null) {
|
|
6567
|
+
setValueByPath(toObject, ['responseTokenCount'], fromResponseTokenCount);
|
|
6568
|
+
}
|
|
6569
|
+
const fromToolUsePromptTokenCount = getValueByPath(fromObject, [
|
|
6570
|
+
'toolUsePromptTokenCount',
|
|
6571
|
+
]);
|
|
6572
|
+
if (fromToolUsePromptTokenCount != null) {
|
|
6573
|
+
setValueByPath(toObject, ['toolUsePromptTokenCount'], fromToolUsePromptTokenCount);
|
|
6574
|
+
}
|
|
6575
|
+
const fromThoughtsTokenCount = getValueByPath(fromObject, [
|
|
6576
|
+
'thoughtsTokenCount',
|
|
6577
|
+
]);
|
|
6578
|
+
if (fromThoughtsTokenCount != null) {
|
|
6579
|
+
setValueByPath(toObject, ['thoughtsTokenCount'], fromThoughtsTokenCount);
|
|
6580
|
+
}
|
|
6581
|
+
const fromTotalTokenCount = getValueByPath(fromObject, [
|
|
6582
|
+
'totalTokenCount',
|
|
6583
|
+
]);
|
|
6584
|
+
if (fromTotalTokenCount != null) {
|
|
6585
|
+
setValueByPath(toObject, ['totalTokenCount'], fromTotalTokenCount);
|
|
6586
|
+
}
|
|
6587
|
+
const fromPromptTokensDetails = getValueByPath(fromObject, [
|
|
6588
|
+
'promptTokensDetails',
|
|
6589
|
+
]);
|
|
6590
|
+
if (fromPromptTokensDetails != null) {
|
|
6591
|
+
if (Array.isArray(fromPromptTokensDetails)) {
|
|
6592
|
+
setValueByPath(toObject, ['promptTokensDetails'], fromPromptTokensDetails.map((item) => {
|
|
6593
|
+
return modalityTokenCountFromVertex(apiClient, item);
|
|
6594
|
+
}));
|
|
6595
|
+
}
|
|
6596
|
+
else {
|
|
6597
|
+
setValueByPath(toObject, ['promptTokensDetails'], fromPromptTokensDetails);
|
|
6598
|
+
}
|
|
6599
|
+
}
|
|
6600
|
+
const fromCacheTokensDetails = getValueByPath(fromObject, [
|
|
6601
|
+
'cacheTokensDetails',
|
|
6602
|
+
]);
|
|
6603
|
+
if (fromCacheTokensDetails != null) {
|
|
6604
|
+
if (Array.isArray(fromCacheTokensDetails)) {
|
|
6605
|
+
setValueByPath(toObject, ['cacheTokensDetails'], fromCacheTokensDetails.map((item) => {
|
|
6606
|
+
return modalityTokenCountFromVertex(apiClient, item);
|
|
6607
|
+
}));
|
|
6608
|
+
}
|
|
6609
|
+
else {
|
|
6610
|
+
setValueByPath(toObject, ['cacheTokensDetails'], fromCacheTokensDetails);
|
|
6611
|
+
}
|
|
6612
|
+
}
|
|
6613
|
+
const fromToolUsePromptTokensDetails = getValueByPath(fromObject, [
|
|
6614
|
+
'toolUsePromptTokensDetails',
|
|
6615
|
+
]);
|
|
6616
|
+
if (fromToolUsePromptTokensDetails != null) {
|
|
6617
|
+
if (Array.isArray(fromToolUsePromptTokensDetails)) {
|
|
6618
|
+
setValueByPath(toObject, ['toolUsePromptTokensDetails'], fromToolUsePromptTokensDetails.map((item) => {
|
|
6619
|
+
return modalityTokenCountFromVertex(apiClient, item);
|
|
6620
|
+
}));
|
|
6621
|
+
}
|
|
6622
|
+
else {
|
|
6623
|
+
setValueByPath(toObject, ['toolUsePromptTokensDetails'], fromToolUsePromptTokensDetails);
|
|
6624
|
+
}
|
|
6625
|
+
}
|
|
6626
|
+
const fromResponseTokensDetails = getValueByPath(fromObject, [
|
|
6627
|
+
'candidatesTokensDetails',
|
|
6628
|
+
]);
|
|
6629
|
+
if (fromResponseTokensDetails != null) {
|
|
6630
|
+
if (Array.isArray(fromResponseTokensDetails)) {
|
|
6631
|
+
setValueByPath(toObject, ['responseTokensDetails'], fromResponseTokensDetails.map((item) => {
|
|
6632
|
+
return modalityTokenCountFromVertex(apiClient, item);
|
|
6633
|
+
}));
|
|
6634
|
+
}
|
|
6635
|
+
else {
|
|
6636
|
+
setValueByPath(toObject, ['responseTokensDetails'], fromResponseTokensDetails);
|
|
6637
|
+
}
|
|
6638
|
+
}
|
|
6639
|
+
const fromTrafficType = getValueByPath(fromObject, ['trafficType']);
|
|
6640
|
+
if (fromTrafficType != null) {
|
|
6641
|
+
setValueByPath(toObject, ['trafficType'], fromTrafficType);
|
|
6642
|
+
}
|
|
6643
|
+
return toObject;
|
|
6644
|
+
}
|
|
5887
6645
|
|
|
5888
6646
|
/**
|
|
5889
6647
|
* @license
|
|
@@ -6076,7 +6834,13 @@ class Session {
|
|
|
6076
6834
|
throw new Error(`Failed to convert realtime input "media", type: '${typeof params.media}'`);
|
|
6077
6835
|
}
|
|
6078
6836
|
// LiveClientRealtimeInput
|
|
6079
|
-
clientMessage = {
|
|
6837
|
+
clientMessage = {
|
|
6838
|
+
realtimeInput: {
|
|
6839
|
+
mediaChunks: [params.media],
|
|
6840
|
+
activityStart: params.activityStart,
|
|
6841
|
+
activityEnd: params.activityEnd,
|
|
6842
|
+
},
|
|
6843
|
+
};
|
|
6080
6844
|
return clientMessage;
|
|
6081
6845
|
}
|
|
6082
6846
|
tLiveClienttToolResponse(apiClient, params) {
|
|
@@ -6695,6 +7459,66 @@ class Models extends BaseModule {
|
|
|
6695
7459
|
});
|
|
6696
7460
|
}
|
|
6697
7461
|
}
|
|
7462
|
+
/**
|
|
7463
|
+
* Fetches information about a model by name.
|
|
7464
|
+
*
|
|
7465
|
+
* @example
|
|
7466
|
+
* ```ts
|
|
7467
|
+
* const modelInfo = await ai.models.get({model: 'gemini-2.0-flash'});
|
|
7468
|
+
* ```
|
|
7469
|
+
*/
|
|
7470
|
+
async get(params) {
|
|
7471
|
+
var _a, _b;
|
|
7472
|
+
let response;
|
|
7473
|
+
let path = '';
|
|
7474
|
+
let queryParams = {};
|
|
7475
|
+
if (this.apiClient.isVertexAI()) {
|
|
7476
|
+
const body = getModelParametersToVertex(this.apiClient, params);
|
|
7477
|
+
path = formatMap('{name}', body['_url']);
|
|
7478
|
+
queryParams = body['_query'];
|
|
7479
|
+
delete body['config'];
|
|
7480
|
+
delete body['_url'];
|
|
7481
|
+
delete body['_query'];
|
|
7482
|
+
response = this.apiClient
|
|
7483
|
+
.request({
|
|
7484
|
+
path: path,
|
|
7485
|
+
queryParams: queryParams,
|
|
7486
|
+
body: JSON.stringify(body),
|
|
7487
|
+
httpMethod: 'GET',
|
|
7488
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
7489
|
+
})
|
|
7490
|
+
.then((httpResponse) => {
|
|
7491
|
+
return httpResponse.json();
|
|
7492
|
+
});
|
|
7493
|
+
return response.then((apiResponse) => {
|
|
7494
|
+
const resp = modelFromVertex(this.apiClient, apiResponse);
|
|
7495
|
+
return resp;
|
|
7496
|
+
});
|
|
7497
|
+
}
|
|
7498
|
+
else {
|
|
7499
|
+
const body = getModelParametersToMldev(this.apiClient, params);
|
|
7500
|
+
path = formatMap('{name}', body['_url']);
|
|
7501
|
+
queryParams = body['_query'];
|
|
7502
|
+
delete body['config'];
|
|
7503
|
+
delete body['_url'];
|
|
7504
|
+
delete body['_query'];
|
|
7505
|
+
response = this.apiClient
|
|
7506
|
+
.request({
|
|
7507
|
+
path: path,
|
|
7508
|
+
queryParams: queryParams,
|
|
7509
|
+
body: JSON.stringify(body),
|
|
7510
|
+
httpMethod: 'GET',
|
|
7511
|
+
httpOptions: (_b = params.config) === null || _b === void 0 ? void 0 : _b.httpOptions,
|
|
7512
|
+
})
|
|
7513
|
+
.then((httpResponse) => {
|
|
7514
|
+
return httpResponse.json();
|
|
7515
|
+
});
|
|
7516
|
+
return response.then((apiResponse) => {
|
|
7517
|
+
const resp = modelFromMldev(this.apiClient, apiResponse);
|
|
7518
|
+
return resp;
|
|
7519
|
+
});
|
|
7520
|
+
}
|
|
7521
|
+
}
|
|
6698
7522
|
/**
|
|
6699
7523
|
* Counts the number of tokens in the given contents. Multimodal input is
|
|
6700
7524
|
* supported for Gemini models.
|
|
@@ -6836,10 +7660,10 @@ class Models extends BaseModule {
|
|
|
6836
7660
|
*
|
|
6837
7661
|
* while (!operation.done) {
|
|
6838
7662
|
* await new Promise(resolve => setTimeout(resolve, 10000));
|
|
6839
|
-
* operation = await ai.operations.
|
|
7663
|
+
* operation = await ai.operations.getVideosOperation({operation: operation});
|
|
6840
7664
|
* }
|
|
6841
7665
|
*
|
|
6842
|
-
* console.log(operation.
|
|
7666
|
+
* console.log(operation.response?.generatedVideos?.[0]?.video?.uri);
|
|
6843
7667
|
* ```
|
|
6844
7668
|
*/
|
|
6845
7669
|
async generateVideos(params) {
|
|
@@ -7021,9 +7845,12 @@ function generateVideosOperationFromMldev(apiClient, fromObject) {
|
|
|
7021
7845
|
if (fromError != null) {
|
|
7022
7846
|
setValueByPath(toObject, ['error'], fromError);
|
|
7023
7847
|
}
|
|
7024
|
-
const fromResponse = getValueByPath(fromObject, [
|
|
7848
|
+
const fromResponse = getValueByPath(fromObject, [
|
|
7849
|
+
'response',
|
|
7850
|
+
'generateVideoResponse',
|
|
7851
|
+
]);
|
|
7025
7852
|
if (fromResponse != null) {
|
|
7026
|
-
setValueByPath(toObject, ['response'], fromResponse);
|
|
7853
|
+
setValueByPath(toObject, ['response'], generateVideosResponseFromMldev(apiClient, fromResponse));
|
|
7027
7854
|
}
|
|
7028
7855
|
const fromResult = getValueByPath(fromObject, [
|
|
7029
7856
|
'response',
|
|
@@ -7107,7 +7934,7 @@ function generateVideosOperationFromVertex(apiClient, fromObject) {
|
|
|
7107
7934
|
}
|
|
7108
7935
|
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
7109
7936
|
if (fromResponse != null) {
|
|
7110
|
-
setValueByPath(toObject, ['response'], fromResponse);
|
|
7937
|
+
setValueByPath(toObject, ['response'], generateVideosResponseFromVertex(apiClient, fromResponse));
|
|
7111
7938
|
}
|
|
7112
7939
|
const fromResult = getValueByPath(fromObject, ['response']);
|
|
7113
7940
|
if (fromResult != null) {
|
|
@@ -7129,10 +7956,10 @@ class Operations extends BaseModule {
|
|
|
7129
7956
|
/**
|
|
7130
7957
|
* Gets the status of a long-running operation.
|
|
7131
7958
|
*
|
|
7132
|
-
* @param
|
|
7959
|
+
* @param parameters The parameters for the get operation request.
|
|
7133
7960
|
* @return The updated Operation object, with the latest status or result.
|
|
7134
7961
|
*/
|
|
7135
|
-
async
|
|
7962
|
+
async getVideosOperation(parameters) {
|
|
7136
7963
|
const operation = parameters.operation;
|
|
7137
7964
|
const config = parameters.config;
|
|
7138
7965
|
if (operation.name === undefined || operation.name === '') {
|
|
@@ -7249,9 +8076,10 @@ class Operations extends BaseModule {
|
|
|
7249
8076
|
* SPDX-License-Identifier: Apache-2.0
|
|
7250
8077
|
*/
|
|
7251
8078
|
const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
8079
|
+
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
7252
8080
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
7253
8081
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
7254
|
-
const SDK_VERSION = '0.
|
|
8082
|
+
const SDK_VERSION = '0.8.0'; // x-release-please-version
|
|
7255
8083
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
7256
8084
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
7257
8085
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -7391,11 +8219,9 @@ class ApiClient {
|
|
|
7391
8219
|
throw new Error('HTTP options are not correctly set.');
|
|
7392
8220
|
}
|
|
7393
8221
|
}
|
|
7394
|
-
constructUrl(path, httpOptions) {
|
|
8222
|
+
constructUrl(path, httpOptions, prependProjectLocation) {
|
|
7395
8223
|
const urlElement = [this.getRequestUrlInternal(httpOptions)];
|
|
7396
|
-
if (
|
|
7397
|
-
!this.clientOptions.apiKey &&
|
|
7398
|
-
!path.startsWith('projects/')) {
|
|
8224
|
+
if (prependProjectLocation) {
|
|
7399
8225
|
urlElement.push(this.getBaseResourcePath());
|
|
7400
8226
|
}
|
|
7401
8227
|
if (path !== '') {
|
|
@@ -7404,12 +8230,34 @@ class ApiClient {
|
|
|
7404
8230
|
const url = new URL(`${urlElement.join('/')}`);
|
|
7405
8231
|
return url;
|
|
7406
8232
|
}
|
|
8233
|
+
shouldPrependVertexProjectPath(request) {
|
|
8234
|
+
if (this.clientOptions.apiKey) {
|
|
8235
|
+
return false;
|
|
8236
|
+
}
|
|
8237
|
+
if (!this.clientOptions.vertexai) {
|
|
8238
|
+
return false;
|
|
8239
|
+
}
|
|
8240
|
+
if (request.path.startsWith('projects/')) {
|
|
8241
|
+
// Assume the path already starts with
|
|
8242
|
+
// `projects/<project>/location/<location>`.
|
|
8243
|
+
return false;
|
|
8244
|
+
}
|
|
8245
|
+
if (request.httpMethod === 'GET' &&
|
|
8246
|
+
request.path.startsWith('publishers/google/models')) {
|
|
8247
|
+
// These paths are used by Vertex's models.get and models.list
|
|
8248
|
+
// calls. For base models Vertex does not accept a project/location
|
|
8249
|
+
// prefix (for tuned model the prefix is required).
|
|
8250
|
+
return false;
|
|
8251
|
+
}
|
|
8252
|
+
return true;
|
|
8253
|
+
}
|
|
7407
8254
|
async request(request) {
|
|
7408
8255
|
let patchedHttpOptions = this.clientOptions.httpOptions;
|
|
7409
8256
|
if (request.httpOptions) {
|
|
7410
8257
|
patchedHttpOptions = this.patchHttpOptions(this.clientOptions.httpOptions, request.httpOptions);
|
|
7411
8258
|
}
|
|
7412
|
-
const
|
|
8259
|
+
const prependProjectLocation = this.shouldPrependVertexProjectPath(request);
|
|
8260
|
+
const url = this.constructUrl(request.path, patchedHttpOptions, prependProjectLocation);
|
|
7413
8261
|
if (request.queryParams) {
|
|
7414
8262
|
for (const [key, value] of Object.entries(request.queryParams)) {
|
|
7415
8263
|
url.searchParams.append(key, String(value));
|
|
@@ -7451,7 +8299,8 @@ class ApiClient {
|
|
|
7451
8299
|
if (request.httpOptions) {
|
|
7452
8300
|
patchedHttpOptions = this.patchHttpOptions(this.clientOptions.httpOptions, request.httpOptions);
|
|
7453
8301
|
}
|
|
7454
|
-
const
|
|
8302
|
+
const prependProjectLocation = this.shouldPrependVertexProjectPath(request);
|
|
8303
|
+
const url = this.constructUrl(request.path, patchedHttpOptions, prependProjectLocation);
|
|
7455
8304
|
if (!url.searchParams.has('alt') || url.searchParams.get('alt') !== 'sse') {
|
|
7456
8305
|
url.searchParams.set('alt', 'sse');
|
|
7457
8306
|
}
|
|
@@ -7559,6 +8408,11 @@ class ApiClient {
|
|
|
7559
8408
|
for (const [key, value] of Object.entries(httpOptions.headers)) {
|
|
7560
8409
|
headers.append(key, value);
|
|
7561
8410
|
}
|
|
8411
|
+
// Append a timeout header if it is set, note that the timeout option is
|
|
8412
|
+
// in milliseconds but the header is in seconds.
|
|
8413
|
+
if (httpOptions.timeout && httpOptions.timeout > 0) {
|
|
8414
|
+
headers.append(SERVER_TIMEOUT_HEADER, String(Math.ceil(httpOptions.timeout / 1000)));
|
|
8415
|
+
}
|
|
7562
8416
|
}
|
|
7563
8417
|
await this.clientOptions.auth.addAuthHeaders(headers);
|
|
7564
8418
|
return headers;
|
|
@@ -7868,5 +8722,5 @@ class GoogleGenAI {
|
|
|
7868
8722
|
}
|
|
7869
8723
|
}
|
|
7870
8724
|
|
|
7871
|
-
export { BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DynamicRetrievalConfigMode, EmbedContentResponse, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, Language, ListCachedContentsResponse, ListFilesResponse, Live, LiveClientToolResponse, LiveSendToolResponseParameters, MaskReferenceMode, MediaModality, MediaResolution, Modality, Mode, Models, Operations, Outcome, PagedItem, Pager, PersonGeneration, ReplayResponse, SafetyFilterLevel, Session,
|
|
8725
|
+
export { ActivityHandling, BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DynamicRetrievalConfigMode, EmbedContentResponse, EndSensitivity, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, Language, ListCachedContentsResponse, ListFilesResponse, Live, LiveClientToolResponse, LiveSendToolResponseParameters, MaskReferenceMode, MediaModality, MediaResolution, Modality, Mode, Models, Operations, Outcome, PagedItem, Pager, PersonGeneration, ReplayResponse, SafetyFilterLevel, Session, StartSensitivity, SubjectReferenceType, TrafficType, TurnCoverage, Type, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent };
|
|
7872
8726
|
//# sourceMappingURL=index.mjs.map
|