@google/genai 1.27.0 → 1.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/genai.d.ts +898 -166
- package/dist/index.cjs +1815 -573
- package/dist/index.mjs +1809 -574
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +1927 -655
- package/dist/node/index.mjs +1922 -657
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +898 -166
- package/dist/web/index.mjs +1876 -643
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +898 -166
- package/package.json +12 -7
package/dist/index.cjs
CHANGED
|
@@ -432,6 +432,90 @@ function getOperationParametersToVertex(fromObject) {
|
|
|
432
432
|
}
|
|
433
433
|
return toObject;
|
|
434
434
|
}
|
|
435
|
+
function importFileOperationFromMldev$1(fromObject) {
|
|
436
|
+
const toObject = {};
|
|
437
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
438
|
+
if (fromName != null) {
|
|
439
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
440
|
+
}
|
|
441
|
+
const fromMetadata = getValueByPath(fromObject, ['metadata']);
|
|
442
|
+
if (fromMetadata != null) {
|
|
443
|
+
setValueByPath(toObject, ['metadata'], fromMetadata);
|
|
444
|
+
}
|
|
445
|
+
const fromDone = getValueByPath(fromObject, ['done']);
|
|
446
|
+
if (fromDone != null) {
|
|
447
|
+
setValueByPath(toObject, ['done'], fromDone);
|
|
448
|
+
}
|
|
449
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
450
|
+
if (fromError != null) {
|
|
451
|
+
setValueByPath(toObject, ['error'], fromError);
|
|
452
|
+
}
|
|
453
|
+
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
454
|
+
if (fromResponse != null) {
|
|
455
|
+
setValueByPath(toObject, ['response'], importFileResponseFromMldev$1(fromResponse));
|
|
456
|
+
}
|
|
457
|
+
return toObject;
|
|
458
|
+
}
|
|
459
|
+
function importFileResponseFromMldev$1(fromObject) {
|
|
460
|
+
const toObject = {};
|
|
461
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
462
|
+
'sdkHttpResponse',
|
|
463
|
+
]);
|
|
464
|
+
if (fromSdkHttpResponse != null) {
|
|
465
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
466
|
+
}
|
|
467
|
+
const fromParent = getValueByPath(fromObject, ['parent']);
|
|
468
|
+
if (fromParent != null) {
|
|
469
|
+
setValueByPath(toObject, ['parent'], fromParent);
|
|
470
|
+
}
|
|
471
|
+
const fromDocumentName = getValueByPath(fromObject, ['documentName']);
|
|
472
|
+
if (fromDocumentName != null) {
|
|
473
|
+
setValueByPath(toObject, ['documentName'], fromDocumentName);
|
|
474
|
+
}
|
|
475
|
+
return toObject;
|
|
476
|
+
}
|
|
477
|
+
function uploadToFileSearchStoreOperationFromMldev(fromObject) {
|
|
478
|
+
const toObject = {};
|
|
479
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
480
|
+
if (fromName != null) {
|
|
481
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
482
|
+
}
|
|
483
|
+
const fromMetadata = getValueByPath(fromObject, ['metadata']);
|
|
484
|
+
if (fromMetadata != null) {
|
|
485
|
+
setValueByPath(toObject, ['metadata'], fromMetadata);
|
|
486
|
+
}
|
|
487
|
+
const fromDone = getValueByPath(fromObject, ['done']);
|
|
488
|
+
if (fromDone != null) {
|
|
489
|
+
setValueByPath(toObject, ['done'], fromDone);
|
|
490
|
+
}
|
|
491
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
492
|
+
if (fromError != null) {
|
|
493
|
+
setValueByPath(toObject, ['error'], fromError);
|
|
494
|
+
}
|
|
495
|
+
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
496
|
+
if (fromResponse != null) {
|
|
497
|
+
setValueByPath(toObject, ['response'], uploadToFileSearchStoreResponseFromMldev(fromResponse));
|
|
498
|
+
}
|
|
499
|
+
return toObject;
|
|
500
|
+
}
|
|
501
|
+
function uploadToFileSearchStoreResponseFromMldev(fromObject) {
|
|
502
|
+
const toObject = {};
|
|
503
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
504
|
+
'sdkHttpResponse',
|
|
505
|
+
]);
|
|
506
|
+
if (fromSdkHttpResponse != null) {
|
|
507
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
508
|
+
}
|
|
509
|
+
const fromParent = getValueByPath(fromObject, ['parent']);
|
|
510
|
+
if (fromParent != null) {
|
|
511
|
+
setValueByPath(toObject, ['parent'], fromParent);
|
|
512
|
+
}
|
|
513
|
+
const fromDocumentName = getValueByPath(fromObject, ['documentName']);
|
|
514
|
+
if (fromDocumentName != null) {
|
|
515
|
+
setValueByPath(toObject, ['documentName'], fromDocumentName);
|
|
516
|
+
}
|
|
517
|
+
return toObject;
|
|
518
|
+
}
|
|
435
519
|
function videoFromMldev$1(fromObject) {
|
|
436
520
|
const toObject = {};
|
|
437
521
|
const fromUri = getValueByPath(fromObject, ['uri']);
|
|
@@ -472,7 +556,7 @@ function videoFromVertex$1(fromObject) {
|
|
|
472
556
|
* Copyright 2025 Google LLC
|
|
473
557
|
* SPDX-License-Identifier: Apache-2.0
|
|
474
558
|
*/
|
|
475
|
-
/**
|
|
559
|
+
/** Outcome of the code execution. */
|
|
476
560
|
exports.Outcome = void 0;
|
|
477
561
|
(function (Outcome) {
|
|
478
562
|
/**
|
|
@@ -492,7 +576,7 @@ exports.Outcome = void 0;
|
|
|
492
576
|
*/
|
|
493
577
|
Outcome["OUTCOME_DEADLINE_EXCEEDED"] = "OUTCOME_DEADLINE_EXCEEDED";
|
|
494
578
|
})(exports.Outcome || (exports.Outcome = {}));
|
|
495
|
-
/**
|
|
579
|
+
/** Programming language of the `code`. */
|
|
496
580
|
exports.Language = void 0;
|
|
497
581
|
(function (Language) {
|
|
498
582
|
/**
|
|
@@ -524,7 +608,7 @@ exports.FunctionResponseScheduling = void 0;
|
|
|
524
608
|
*/
|
|
525
609
|
FunctionResponseScheduling["INTERRUPT"] = "INTERRUPT";
|
|
526
610
|
})(exports.FunctionResponseScheduling || (exports.FunctionResponseScheduling = {}));
|
|
527
|
-
/**
|
|
611
|
+
/** The type of the data. */
|
|
528
612
|
exports.Type = void 0;
|
|
529
613
|
(function (Type) {
|
|
530
614
|
/**
|
|
@@ -560,7 +644,121 @@ exports.Type = void 0;
|
|
|
560
644
|
*/
|
|
561
645
|
Type["NULL"] = "NULL";
|
|
562
646
|
})(exports.Type || (exports.Type = {}));
|
|
563
|
-
/**
|
|
647
|
+
/** The mode of the predictor to be used in dynamic retrieval. */
|
|
648
|
+
exports.Mode = void 0;
|
|
649
|
+
(function (Mode) {
|
|
650
|
+
/**
|
|
651
|
+
* Always trigger retrieval.
|
|
652
|
+
*/
|
|
653
|
+
Mode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
654
|
+
/**
|
|
655
|
+
* Run retrieval only when system decides it is necessary.
|
|
656
|
+
*/
|
|
657
|
+
Mode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
|
|
658
|
+
})(exports.Mode || (exports.Mode = {}));
|
|
659
|
+
/** The API spec that the external API implements. This enum is not supported in Gemini API. */
|
|
660
|
+
exports.ApiSpec = void 0;
|
|
661
|
+
(function (ApiSpec) {
|
|
662
|
+
/**
|
|
663
|
+
* Unspecified API spec. This value should not be used.
|
|
664
|
+
*/
|
|
665
|
+
ApiSpec["API_SPEC_UNSPECIFIED"] = "API_SPEC_UNSPECIFIED";
|
|
666
|
+
/**
|
|
667
|
+
* Simple search API spec.
|
|
668
|
+
*/
|
|
669
|
+
ApiSpec["SIMPLE_SEARCH"] = "SIMPLE_SEARCH";
|
|
670
|
+
/**
|
|
671
|
+
* Elastic search API spec.
|
|
672
|
+
*/
|
|
673
|
+
ApiSpec["ELASTIC_SEARCH"] = "ELASTIC_SEARCH";
|
|
674
|
+
})(exports.ApiSpec || (exports.ApiSpec = {}));
|
|
675
|
+
/** Type of auth scheme. This enum is not supported in Gemini API. */
|
|
676
|
+
exports.AuthType = void 0;
|
|
677
|
+
(function (AuthType) {
|
|
678
|
+
AuthType["AUTH_TYPE_UNSPECIFIED"] = "AUTH_TYPE_UNSPECIFIED";
|
|
679
|
+
/**
|
|
680
|
+
* No Auth.
|
|
681
|
+
*/
|
|
682
|
+
AuthType["NO_AUTH"] = "NO_AUTH";
|
|
683
|
+
/**
|
|
684
|
+
* API Key Auth.
|
|
685
|
+
*/
|
|
686
|
+
AuthType["API_KEY_AUTH"] = "API_KEY_AUTH";
|
|
687
|
+
/**
|
|
688
|
+
* HTTP Basic Auth.
|
|
689
|
+
*/
|
|
690
|
+
AuthType["HTTP_BASIC_AUTH"] = "HTTP_BASIC_AUTH";
|
|
691
|
+
/**
|
|
692
|
+
* Google Service Account Auth.
|
|
693
|
+
*/
|
|
694
|
+
AuthType["GOOGLE_SERVICE_ACCOUNT_AUTH"] = "GOOGLE_SERVICE_ACCOUNT_AUTH";
|
|
695
|
+
/**
|
|
696
|
+
* OAuth auth.
|
|
697
|
+
*/
|
|
698
|
+
AuthType["OAUTH"] = "OAUTH";
|
|
699
|
+
/**
|
|
700
|
+
* OpenID Connect (OIDC) Auth.
|
|
701
|
+
*/
|
|
702
|
+
AuthType["OIDC_AUTH"] = "OIDC_AUTH";
|
|
703
|
+
})(exports.AuthType || (exports.AuthType = {}));
|
|
704
|
+
/** The location of the API key. This enum is not supported in Gemini API. */
|
|
705
|
+
exports.HttpElementLocation = void 0;
|
|
706
|
+
(function (HttpElementLocation) {
|
|
707
|
+
HttpElementLocation["HTTP_IN_UNSPECIFIED"] = "HTTP_IN_UNSPECIFIED";
|
|
708
|
+
/**
|
|
709
|
+
* Element is in the HTTP request query.
|
|
710
|
+
*/
|
|
711
|
+
HttpElementLocation["HTTP_IN_QUERY"] = "HTTP_IN_QUERY";
|
|
712
|
+
/**
|
|
713
|
+
* Element is in the HTTP request header.
|
|
714
|
+
*/
|
|
715
|
+
HttpElementLocation["HTTP_IN_HEADER"] = "HTTP_IN_HEADER";
|
|
716
|
+
/**
|
|
717
|
+
* Element is in the HTTP request path.
|
|
718
|
+
*/
|
|
719
|
+
HttpElementLocation["HTTP_IN_PATH"] = "HTTP_IN_PATH";
|
|
720
|
+
/**
|
|
721
|
+
* Element is in the HTTP request body.
|
|
722
|
+
*/
|
|
723
|
+
HttpElementLocation["HTTP_IN_BODY"] = "HTTP_IN_BODY";
|
|
724
|
+
/**
|
|
725
|
+
* Element is in the HTTP request cookie.
|
|
726
|
+
*/
|
|
727
|
+
HttpElementLocation["HTTP_IN_COOKIE"] = "HTTP_IN_COOKIE";
|
|
728
|
+
})(exports.HttpElementLocation || (exports.HttpElementLocation = {}));
|
|
729
|
+
/** Sites with confidence level chosen & above this value will be blocked from the search results. This enum is not supported in Gemini API. */
|
|
730
|
+
exports.PhishBlockThreshold = void 0;
|
|
731
|
+
(function (PhishBlockThreshold) {
|
|
732
|
+
/**
|
|
733
|
+
* Defaults to unspecified.
|
|
734
|
+
*/
|
|
735
|
+
PhishBlockThreshold["PHISH_BLOCK_THRESHOLD_UNSPECIFIED"] = "PHISH_BLOCK_THRESHOLD_UNSPECIFIED";
|
|
736
|
+
/**
|
|
737
|
+
* Blocks Low and above confidence URL that is risky.
|
|
738
|
+
*/
|
|
739
|
+
PhishBlockThreshold["BLOCK_LOW_AND_ABOVE"] = "BLOCK_LOW_AND_ABOVE";
|
|
740
|
+
/**
|
|
741
|
+
* Blocks Medium and above confidence URL that is risky.
|
|
742
|
+
*/
|
|
743
|
+
PhishBlockThreshold["BLOCK_MEDIUM_AND_ABOVE"] = "BLOCK_MEDIUM_AND_ABOVE";
|
|
744
|
+
/**
|
|
745
|
+
* Blocks High and above confidence URL that is risky.
|
|
746
|
+
*/
|
|
747
|
+
PhishBlockThreshold["BLOCK_HIGH_AND_ABOVE"] = "BLOCK_HIGH_AND_ABOVE";
|
|
748
|
+
/**
|
|
749
|
+
* Blocks Higher and above confidence URL that is risky.
|
|
750
|
+
*/
|
|
751
|
+
PhishBlockThreshold["BLOCK_HIGHER_AND_ABOVE"] = "BLOCK_HIGHER_AND_ABOVE";
|
|
752
|
+
/**
|
|
753
|
+
* Blocks Very high and above confidence URL that is risky.
|
|
754
|
+
*/
|
|
755
|
+
PhishBlockThreshold["BLOCK_VERY_HIGH_AND_ABOVE"] = "BLOCK_VERY_HIGH_AND_ABOVE";
|
|
756
|
+
/**
|
|
757
|
+
* Blocks Extremely high confidence URL that is risky.
|
|
758
|
+
*/
|
|
759
|
+
PhishBlockThreshold["BLOCK_ONLY_EXTREMELY_HIGH"] = "BLOCK_ONLY_EXTREMELY_HIGH";
|
|
760
|
+
})(exports.PhishBlockThreshold || (exports.PhishBlockThreshold = {}));
|
|
761
|
+
/** Harm category. */
|
|
564
762
|
exports.HarmCategory = void 0;
|
|
565
763
|
(function (HarmCategory) {
|
|
566
764
|
/**
|
|
@@ -608,7 +806,7 @@ exports.HarmCategory = void 0;
|
|
|
608
806
|
*/
|
|
609
807
|
HarmCategory["HARM_CATEGORY_JAILBREAK"] = "HARM_CATEGORY_JAILBREAK";
|
|
610
808
|
})(exports.HarmCategory || (exports.HarmCategory = {}));
|
|
611
|
-
/**
|
|
809
|
+
/** Specify if the threshold is used for probability or severity score. If not specified, the threshold is used for probability score. This enum is not supported in Gemini API. */
|
|
612
810
|
exports.HarmBlockMethod = void 0;
|
|
613
811
|
(function (HarmBlockMethod) {
|
|
614
812
|
/**
|
|
@@ -624,7 +822,7 @@ exports.HarmBlockMethod = void 0;
|
|
|
624
822
|
*/
|
|
625
823
|
HarmBlockMethod["PROBABILITY"] = "PROBABILITY";
|
|
626
824
|
})(exports.HarmBlockMethod || (exports.HarmBlockMethod = {}));
|
|
627
|
-
/**
|
|
825
|
+
/** The harm block threshold. */
|
|
628
826
|
exports.HarmBlockThreshold = void 0;
|
|
629
827
|
(function (HarmBlockThreshold) {
|
|
630
828
|
/**
|
|
@@ -652,87 +850,6 @@ exports.HarmBlockThreshold = void 0;
|
|
|
652
850
|
*/
|
|
653
851
|
HarmBlockThreshold["OFF"] = "OFF";
|
|
654
852
|
})(exports.HarmBlockThreshold || (exports.HarmBlockThreshold = {}));
|
|
655
|
-
/** The mode of the predictor to be used in dynamic retrieval. */
|
|
656
|
-
exports.Mode = void 0;
|
|
657
|
-
(function (Mode) {
|
|
658
|
-
/**
|
|
659
|
-
* Always trigger retrieval.
|
|
660
|
-
*/
|
|
661
|
-
Mode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
662
|
-
/**
|
|
663
|
-
* Run retrieval only when system decides it is necessary.
|
|
664
|
-
*/
|
|
665
|
-
Mode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
|
|
666
|
-
})(exports.Mode || (exports.Mode = {}));
|
|
667
|
-
/** Type of auth scheme. */
|
|
668
|
-
exports.AuthType = void 0;
|
|
669
|
-
(function (AuthType) {
|
|
670
|
-
AuthType["AUTH_TYPE_UNSPECIFIED"] = "AUTH_TYPE_UNSPECIFIED";
|
|
671
|
-
/**
|
|
672
|
-
* No Auth.
|
|
673
|
-
*/
|
|
674
|
-
AuthType["NO_AUTH"] = "NO_AUTH";
|
|
675
|
-
/**
|
|
676
|
-
* API Key Auth.
|
|
677
|
-
*/
|
|
678
|
-
AuthType["API_KEY_AUTH"] = "API_KEY_AUTH";
|
|
679
|
-
/**
|
|
680
|
-
* HTTP Basic Auth.
|
|
681
|
-
*/
|
|
682
|
-
AuthType["HTTP_BASIC_AUTH"] = "HTTP_BASIC_AUTH";
|
|
683
|
-
/**
|
|
684
|
-
* Google Service Account Auth.
|
|
685
|
-
*/
|
|
686
|
-
AuthType["GOOGLE_SERVICE_ACCOUNT_AUTH"] = "GOOGLE_SERVICE_ACCOUNT_AUTH";
|
|
687
|
-
/**
|
|
688
|
-
* OAuth auth.
|
|
689
|
-
*/
|
|
690
|
-
AuthType["OAUTH"] = "OAUTH";
|
|
691
|
-
/**
|
|
692
|
-
* OpenID Connect (OIDC) Auth.
|
|
693
|
-
*/
|
|
694
|
-
AuthType["OIDC_AUTH"] = "OIDC_AUTH";
|
|
695
|
-
})(exports.AuthType || (exports.AuthType = {}));
|
|
696
|
-
/** The API spec that the external API implements. */
|
|
697
|
-
exports.ApiSpec = void 0;
|
|
698
|
-
(function (ApiSpec) {
|
|
699
|
-
/**
|
|
700
|
-
* Unspecified API spec. This value should not be used.
|
|
701
|
-
*/
|
|
702
|
-
ApiSpec["API_SPEC_UNSPECIFIED"] = "API_SPEC_UNSPECIFIED";
|
|
703
|
-
/**
|
|
704
|
-
* Simple search API spec.
|
|
705
|
-
*/
|
|
706
|
-
ApiSpec["SIMPLE_SEARCH"] = "SIMPLE_SEARCH";
|
|
707
|
-
/**
|
|
708
|
-
* Elastic search API spec.
|
|
709
|
-
*/
|
|
710
|
-
ApiSpec["ELASTIC_SEARCH"] = "ELASTIC_SEARCH";
|
|
711
|
-
})(exports.ApiSpec || (exports.ApiSpec = {}));
|
|
712
|
-
/** Status of the url retrieval. */
|
|
713
|
-
exports.UrlRetrievalStatus = void 0;
|
|
714
|
-
(function (UrlRetrievalStatus) {
|
|
715
|
-
/**
|
|
716
|
-
* Default value. This value is unused
|
|
717
|
-
*/
|
|
718
|
-
UrlRetrievalStatus["URL_RETRIEVAL_STATUS_UNSPECIFIED"] = "URL_RETRIEVAL_STATUS_UNSPECIFIED";
|
|
719
|
-
/**
|
|
720
|
-
* Url retrieval is successful.
|
|
721
|
-
*/
|
|
722
|
-
UrlRetrievalStatus["URL_RETRIEVAL_STATUS_SUCCESS"] = "URL_RETRIEVAL_STATUS_SUCCESS";
|
|
723
|
-
/**
|
|
724
|
-
* Url retrieval is failed due to error.
|
|
725
|
-
*/
|
|
726
|
-
UrlRetrievalStatus["URL_RETRIEVAL_STATUS_ERROR"] = "URL_RETRIEVAL_STATUS_ERROR";
|
|
727
|
-
/**
|
|
728
|
-
* Url retrieval is failed because the content is behind paywall.
|
|
729
|
-
*/
|
|
730
|
-
UrlRetrievalStatus["URL_RETRIEVAL_STATUS_PAYWALL"] = "URL_RETRIEVAL_STATUS_PAYWALL";
|
|
731
|
-
/**
|
|
732
|
-
* Url retrieval is failed because the content is unsafe.
|
|
733
|
-
*/
|
|
734
|
-
UrlRetrievalStatus["URL_RETRIEVAL_STATUS_UNSAFE"] = "URL_RETRIEVAL_STATUS_UNSAFE";
|
|
735
|
-
})(exports.UrlRetrievalStatus || (exports.UrlRetrievalStatus = {}));
|
|
736
853
|
/** Output only. The reason why the model stopped generating tokens.
|
|
737
854
|
|
|
738
855
|
If empty, the model has not stopped generating the tokens. */
|
|
@@ -823,7 +940,7 @@ exports.HarmProbability = void 0;
|
|
|
823
940
|
*/
|
|
824
941
|
HarmProbability["HIGH"] = "HIGH";
|
|
825
942
|
})(exports.HarmProbability || (exports.HarmProbability = {}));
|
|
826
|
-
/** Output only. Harm severity levels in the content. */
|
|
943
|
+
/** Output only. Harm severity levels in the content. This enum is not supported in Gemini API. */
|
|
827
944
|
exports.HarmSeverity = void 0;
|
|
828
945
|
(function (HarmSeverity) {
|
|
829
946
|
/**
|
|
@@ -847,6 +964,30 @@ exports.HarmSeverity = void 0;
|
|
|
847
964
|
*/
|
|
848
965
|
HarmSeverity["HARM_SEVERITY_HIGH"] = "HARM_SEVERITY_HIGH";
|
|
849
966
|
})(exports.HarmSeverity || (exports.HarmSeverity = {}));
|
|
967
|
+
/** Status of the url retrieval. */
|
|
968
|
+
exports.UrlRetrievalStatus = void 0;
|
|
969
|
+
(function (UrlRetrievalStatus) {
|
|
970
|
+
/**
|
|
971
|
+
* Default value. This value is unused.
|
|
972
|
+
*/
|
|
973
|
+
UrlRetrievalStatus["URL_RETRIEVAL_STATUS_UNSPECIFIED"] = "URL_RETRIEVAL_STATUS_UNSPECIFIED";
|
|
974
|
+
/**
|
|
975
|
+
* Url retrieval is successful.
|
|
976
|
+
*/
|
|
977
|
+
UrlRetrievalStatus["URL_RETRIEVAL_STATUS_SUCCESS"] = "URL_RETRIEVAL_STATUS_SUCCESS";
|
|
978
|
+
/**
|
|
979
|
+
* Url retrieval is failed due to error.
|
|
980
|
+
*/
|
|
981
|
+
UrlRetrievalStatus["URL_RETRIEVAL_STATUS_ERROR"] = "URL_RETRIEVAL_STATUS_ERROR";
|
|
982
|
+
/**
|
|
983
|
+
* Url retrieval is failed because the content is behind paywall. This enum value is not supported in Vertex AI.
|
|
984
|
+
*/
|
|
985
|
+
UrlRetrievalStatus["URL_RETRIEVAL_STATUS_PAYWALL"] = "URL_RETRIEVAL_STATUS_PAYWALL";
|
|
986
|
+
/**
|
|
987
|
+
* Url retrieval is failed because the content is unsafe. This enum value is not supported in Vertex AI.
|
|
988
|
+
*/
|
|
989
|
+
UrlRetrievalStatus["URL_RETRIEVAL_STATUS_UNSAFE"] = "URL_RETRIEVAL_STATUS_UNSAFE";
|
|
990
|
+
})(exports.UrlRetrievalStatus || (exports.UrlRetrievalStatus = {}));
|
|
850
991
|
/** Output only. The reason why the prompt was blocked. */
|
|
851
992
|
exports.BlockedReason = void 0;
|
|
852
993
|
(function (BlockedReason) {
|
|
@@ -883,7 +1024,7 @@ exports.BlockedReason = void 0;
|
|
|
883
1024
|
*/
|
|
884
1025
|
BlockedReason["JAILBREAK"] = "JAILBREAK";
|
|
885
1026
|
})(exports.BlockedReason || (exports.BlockedReason = {}));
|
|
886
|
-
/** Output only.
|
|
1027
|
+
/** Output only. The traffic type for this request. This enum is not supported in Gemini API. */
|
|
887
1028
|
exports.TrafficType = void 0;
|
|
888
1029
|
(function (TrafficType) {
|
|
889
1030
|
/**
|
|
@@ -891,7 +1032,7 @@ exports.TrafficType = void 0;
|
|
|
891
1032
|
*/
|
|
892
1033
|
TrafficType["TRAFFIC_TYPE_UNSPECIFIED"] = "TRAFFIC_TYPE_UNSPECIFIED";
|
|
893
1034
|
/**
|
|
894
|
-
*
|
|
1035
|
+
* The request was processed using Pay-As-You-Go quota.
|
|
895
1036
|
*/
|
|
896
1037
|
TrafficType["ON_DEMAND"] = "ON_DEMAND";
|
|
897
1038
|
/**
|
|
@@ -939,17 +1080,65 @@ exports.MediaResolution = void 0;
|
|
|
939
1080
|
*/
|
|
940
1081
|
MediaResolution["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
|
|
941
1082
|
})(exports.MediaResolution || (exports.MediaResolution = {}));
|
|
942
|
-
/**
|
|
943
|
-
exports.
|
|
944
|
-
(function (
|
|
1083
|
+
/** Tuning mode. This enum is not supported in Gemini API. */
|
|
1084
|
+
exports.TuningMode = void 0;
|
|
1085
|
+
(function (TuningMode) {
|
|
945
1086
|
/**
|
|
946
|
-
*
|
|
1087
|
+
* Tuning mode is unspecified.
|
|
947
1088
|
*/
|
|
948
|
-
|
|
1089
|
+
TuningMode["TUNING_MODE_UNSPECIFIED"] = "TUNING_MODE_UNSPECIFIED";
|
|
949
1090
|
/**
|
|
950
|
-
*
|
|
1091
|
+
* Full fine-tuning mode.
|
|
951
1092
|
*/
|
|
952
|
-
|
|
1093
|
+
TuningMode["TUNING_MODE_FULL"] = "TUNING_MODE_FULL";
|
|
1094
|
+
/**
|
|
1095
|
+
* PEFT adapter tuning mode.
|
|
1096
|
+
*/
|
|
1097
|
+
TuningMode["TUNING_MODE_PEFT_ADAPTER"] = "TUNING_MODE_PEFT_ADAPTER";
|
|
1098
|
+
})(exports.TuningMode || (exports.TuningMode = {}));
|
|
1099
|
+
/** Adapter size for tuning. This enum is not supported in Gemini API. */
|
|
1100
|
+
exports.AdapterSize = void 0;
|
|
1101
|
+
(function (AdapterSize) {
|
|
1102
|
+
/**
|
|
1103
|
+
* Adapter size is unspecified.
|
|
1104
|
+
*/
|
|
1105
|
+
AdapterSize["ADAPTER_SIZE_UNSPECIFIED"] = "ADAPTER_SIZE_UNSPECIFIED";
|
|
1106
|
+
/**
|
|
1107
|
+
* Adapter size 1.
|
|
1108
|
+
*/
|
|
1109
|
+
AdapterSize["ADAPTER_SIZE_ONE"] = "ADAPTER_SIZE_ONE";
|
|
1110
|
+
/**
|
|
1111
|
+
* Adapter size 2.
|
|
1112
|
+
*/
|
|
1113
|
+
AdapterSize["ADAPTER_SIZE_TWO"] = "ADAPTER_SIZE_TWO";
|
|
1114
|
+
/**
|
|
1115
|
+
* Adapter size 4.
|
|
1116
|
+
*/
|
|
1117
|
+
AdapterSize["ADAPTER_SIZE_FOUR"] = "ADAPTER_SIZE_FOUR";
|
|
1118
|
+
/**
|
|
1119
|
+
* Adapter size 8.
|
|
1120
|
+
*/
|
|
1121
|
+
AdapterSize["ADAPTER_SIZE_EIGHT"] = "ADAPTER_SIZE_EIGHT";
|
|
1122
|
+
/**
|
|
1123
|
+
* Adapter size 16.
|
|
1124
|
+
*/
|
|
1125
|
+
AdapterSize["ADAPTER_SIZE_SIXTEEN"] = "ADAPTER_SIZE_SIXTEEN";
|
|
1126
|
+
/**
|
|
1127
|
+
* Adapter size 32.
|
|
1128
|
+
*/
|
|
1129
|
+
AdapterSize["ADAPTER_SIZE_THIRTY_TWO"] = "ADAPTER_SIZE_THIRTY_TWO";
|
|
1130
|
+
})(exports.AdapterSize || (exports.AdapterSize = {}));
|
|
1131
|
+
/** Job state. */
|
|
1132
|
+
exports.JobState = void 0;
|
|
1133
|
+
(function (JobState) {
|
|
1134
|
+
/**
|
|
1135
|
+
* The job state is unspecified.
|
|
1136
|
+
*/
|
|
1137
|
+
JobState["JOB_STATE_UNSPECIFIED"] = "JOB_STATE_UNSPECIFIED";
|
|
1138
|
+
/**
|
|
1139
|
+
* The job has been just created or resumed and processing has not yet begun.
|
|
1140
|
+
*/
|
|
1141
|
+
JobState["JOB_STATE_QUEUED"] = "JOB_STATE_QUEUED";
|
|
953
1142
|
/**
|
|
954
1143
|
* The service is preparing to run the job.
|
|
955
1144
|
*/
|
|
@@ -991,55 +1180,7 @@ exports.JobState = void 0;
|
|
|
991
1180
|
*/
|
|
992
1181
|
JobState["JOB_STATE_PARTIALLY_SUCCEEDED"] = "JOB_STATE_PARTIALLY_SUCCEEDED";
|
|
993
1182
|
})(exports.JobState || (exports.JobState = {}));
|
|
994
|
-
/**
|
|
995
|
-
exports.TuningMode = void 0;
|
|
996
|
-
(function (TuningMode) {
|
|
997
|
-
/**
|
|
998
|
-
* Tuning mode is unspecified.
|
|
999
|
-
*/
|
|
1000
|
-
TuningMode["TUNING_MODE_UNSPECIFIED"] = "TUNING_MODE_UNSPECIFIED";
|
|
1001
|
-
/**
|
|
1002
|
-
* Full fine-tuning mode.
|
|
1003
|
-
*/
|
|
1004
|
-
TuningMode["TUNING_MODE_FULL"] = "TUNING_MODE_FULL";
|
|
1005
|
-
/**
|
|
1006
|
-
* PEFT adapter tuning mode.
|
|
1007
|
-
*/
|
|
1008
|
-
TuningMode["TUNING_MODE_PEFT_ADAPTER"] = "TUNING_MODE_PEFT_ADAPTER";
|
|
1009
|
-
})(exports.TuningMode || (exports.TuningMode = {}));
|
|
1010
|
-
/** Optional. Adapter size for tuning. */
|
|
1011
|
-
exports.AdapterSize = void 0;
|
|
1012
|
-
(function (AdapterSize) {
|
|
1013
|
-
/**
|
|
1014
|
-
* Adapter size is unspecified.
|
|
1015
|
-
*/
|
|
1016
|
-
AdapterSize["ADAPTER_SIZE_UNSPECIFIED"] = "ADAPTER_SIZE_UNSPECIFIED";
|
|
1017
|
-
/**
|
|
1018
|
-
* Adapter size 1.
|
|
1019
|
-
*/
|
|
1020
|
-
AdapterSize["ADAPTER_SIZE_ONE"] = "ADAPTER_SIZE_ONE";
|
|
1021
|
-
/**
|
|
1022
|
-
* Adapter size 2.
|
|
1023
|
-
*/
|
|
1024
|
-
AdapterSize["ADAPTER_SIZE_TWO"] = "ADAPTER_SIZE_TWO";
|
|
1025
|
-
/**
|
|
1026
|
-
* Adapter size 4.
|
|
1027
|
-
*/
|
|
1028
|
-
AdapterSize["ADAPTER_SIZE_FOUR"] = "ADAPTER_SIZE_FOUR";
|
|
1029
|
-
/**
|
|
1030
|
-
* Adapter size 8.
|
|
1031
|
-
*/
|
|
1032
|
-
AdapterSize["ADAPTER_SIZE_EIGHT"] = "ADAPTER_SIZE_EIGHT";
|
|
1033
|
-
/**
|
|
1034
|
-
* Adapter size 16.
|
|
1035
|
-
*/
|
|
1036
|
-
AdapterSize["ADAPTER_SIZE_SIXTEEN"] = "ADAPTER_SIZE_SIXTEEN";
|
|
1037
|
-
/**
|
|
1038
|
-
* Adapter size 32.
|
|
1039
|
-
*/
|
|
1040
|
-
AdapterSize["ADAPTER_SIZE_THIRTY_TWO"] = "ADAPTER_SIZE_THIRTY_TWO";
|
|
1041
|
-
})(exports.AdapterSize || (exports.AdapterSize = {}));
|
|
1042
|
-
/** Optional. The tuning task. Either I2V or T2V. */
|
|
1183
|
+
/** The tuning task. Either I2V or T2V. This enum is not supported in Gemini API. */
|
|
1043
1184
|
exports.TuningTask = void 0;
|
|
1044
1185
|
(function (TuningTask) {
|
|
1045
1186
|
/**
|
|
@@ -1054,6 +1195,10 @@ exports.TuningTask = void 0;
|
|
|
1054
1195
|
* Tuning task for text to video.
|
|
1055
1196
|
*/
|
|
1056
1197
|
TuningTask["TUNING_TASK_T2V"] = "TUNING_TASK_T2V";
|
|
1198
|
+
/**
|
|
1199
|
+
* Tuning task for reference to video.
|
|
1200
|
+
*/
|
|
1201
|
+
TuningTask["TUNING_TASK_R2V"] = "TUNING_TASK_R2V";
|
|
1057
1202
|
})(exports.TuningTask || (exports.TuningTask = {}));
|
|
1058
1203
|
/** Options for feature selection preference. */
|
|
1059
1204
|
exports.FeatureSelectionPreference = void 0;
|
|
@@ -1289,6 +1434,26 @@ exports.VideoCompressionQuality = void 0;
|
|
|
1289
1434
|
*/
|
|
1290
1435
|
VideoCompressionQuality["LOSSLESS"] = "LOSSLESS";
|
|
1291
1436
|
})(exports.VideoCompressionQuality || (exports.VideoCompressionQuality = {}));
|
|
1437
|
+
/** Enum representing the tuning method. */
|
|
1438
|
+
exports.TuningMethod = void 0;
|
|
1439
|
+
(function (TuningMethod) {
|
|
1440
|
+
/**
|
|
1441
|
+
* Supervised fine tuning.
|
|
1442
|
+
*/
|
|
1443
|
+
TuningMethod["SUPERVISED_FINE_TUNING"] = "SUPERVISED_FINE_TUNING";
|
|
1444
|
+
/**
|
|
1445
|
+
* Preference optimization tuning.
|
|
1446
|
+
*/
|
|
1447
|
+
TuningMethod["PREFERENCE_TUNING"] = "PREFERENCE_TUNING";
|
|
1448
|
+
})(exports.TuningMethod || (exports.TuningMethod = {}));
|
|
1449
|
+
/** State for the lifecycle of a Document. */
|
|
1450
|
+
exports.DocumentState = void 0;
|
|
1451
|
+
(function (DocumentState) {
|
|
1452
|
+
DocumentState["STATE_UNSPECIFIED"] = "STATE_UNSPECIFIED";
|
|
1453
|
+
DocumentState["STATE_PENDING"] = "STATE_PENDING";
|
|
1454
|
+
DocumentState["STATE_ACTIVE"] = "STATE_ACTIVE";
|
|
1455
|
+
DocumentState["STATE_FAILED"] = "STATE_FAILED";
|
|
1456
|
+
})(exports.DocumentState || (exports.DocumentState = {}));
|
|
1292
1457
|
/** State for the lifecycle of a File. */
|
|
1293
1458
|
exports.FileState = void 0;
|
|
1294
1459
|
(function (FileState) {
|
|
@@ -1716,7 +1881,7 @@ class HttpResponse {
|
|
|
1716
1881
|
/** Content filter results for a prompt sent in the request. Note: This is sent only in the first stream chunk and only if no candidates were generated due to content violations. */
|
|
1717
1882
|
class GenerateContentResponsePromptFeedback {
|
|
1718
1883
|
}
|
|
1719
|
-
/** Usage metadata about response
|
|
1884
|
+
/** Usage metadata about the content generation request and response. This message provides a detailed breakdown of token usage and other relevant metrics. This data type is not supported in Gemini API. */
|
|
1720
1885
|
class GenerateContentResponseUsageMetadata {
|
|
1721
1886
|
}
|
|
1722
1887
|
/** Response message for PredictionService.GenerateContent. */
|
|
@@ -1981,11 +2146,11 @@ class GenerateVideosOperation {
|
|
|
1981
2146
|
* Instantiates an Operation of the same type as the one being called with the fields set from the API response.
|
|
1982
2147
|
* @internal
|
|
1983
2148
|
*/
|
|
1984
|
-
_fromAPIResponse({ apiResponse,
|
|
2149
|
+
_fromAPIResponse({ apiResponse, _isVertexAI, }) {
|
|
1985
2150
|
const operation = new GenerateVideosOperation();
|
|
1986
2151
|
let response;
|
|
1987
2152
|
const op = apiResponse;
|
|
1988
|
-
if (
|
|
2153
|
+
if (_isVertexAI) {
|
|
1989
2154
|
response = generateVideosOperationFromVertex$1(op);
|
|
1990
2155
|
}
|
|
1991
2156
|
else {
|
|
@@ -2003,6 +2168,32 @@ class DeleteCachedContentResponse {
|
|
|
2003
2168
|
}
|
|
2004
2169
|
class ListCachedContentsResponse {
|
|
2005
2170
|
}
|
|
2171
|
+
/** Config for documents.list return value. */
|
|
2172
|
+
class ListDocumentsResponse {
|
|
2173
|
+
}
|
|
2174
|
+
/** Config for file_search_stores.list return value. */
|
|
2175
|
+
class ListFileSearchStoresResponse {
|
|
2176
|
+
}
|
|
2177
|
+
/** Response for the resumable upload method. */
|
|
2178
|
+
class UploadToFileSearchStoreResumableResponse {
|
|
2179
|
+
}
|
|
2180
|
+
/** Response for ImportFile to import a File API file with a file search store. */
|
|
2181
|
+
class ImportFileResponse {
|
|
2182
|
+
}
|
|
2183
|
+
/** Long-running operation for importing a file to a FileSearchStore. */
|
|
2184
|
+
class ImportFileOperation {
|
|
2185
|
+
/**
|
|
2186
|
+
* Instantiates an Operation of the same type as the one being called with the fields set from the API response.
|
|
2187
|
+
* @internal
|
|
2188
|
+
*/
|
|
2189
|
+
_fromAPIResponse({ apiResponse, _isVertexAI, }) {
|
|
2190
|
+
const operation = new ImportFileOperation();
|
|
2191
|
+
const op = apiResponse;
|
|
2192
|
+
const response = importFileOperationFromMldev$1(op);
|
|
2193
|
+
Object.assign(operation, response);
|
|
2194
|
+
return operation;
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2006
2197
|
/** Response for the list files method. */
|
|
2007
2198
|
class ListFilesResponse {
|
|
2008
2199
|
}
|
|
@@ -2238,6 +2429,23 @@ class LiveMusicServerMessage {
|
|
|
2238
2429
|
return undefined;
|
|
2239
2430
|
}
|
|
2240
2431
|
}
|
|
2432
|
+
/** The response when long-running operation for uploading a file to a FileSearchStore complete. */
|
|
2433
|
+
class UploadToFileSearchStoreResponse {
|
|
2434
|
+
}
|
|
2435
|
+
/** Long-running operation for uploading a file to a FileSearchStore. */
|
|
2436
|
+
class UploadToFileSearchStoreOperation {
|
|
2437
|
+
/**
|
|
2438
|
+
* Instantiates an Operation of the same type as the one being called with the fields set from the API response.
|
|
2439
|
+
* @internal
|
|
2440
|
+
*/
|
|
2441
|
+
_fromAPIResponse({ apiResponse, _isVertexAI, }) {
|
|
2442
|
+
const operation = new UploadToFileSearchStoreOperation();
|
|
2443
|
+
const op = apiResponse;
|
|
2444
|
+
const response = uploadToFileSearchStoreOperationFromMldev(op);
|
|
2445
|
+
Object.assign(operation, response);
|
|
2446
|
+
return operation;
|
|
2447
|
+
}
|
|
2448
|
+
}
|
|
2241
2449
|
|
|
2242
2450
|
/**
|
|
2243
2451
|
* @license
|
|
@@ -3234,6 +3442,12 @@ function batchJobFromVertex(fromObject) {
|
|
|
3234
3442
|
if (fromDest != null) {
|
|
3235
3443
|
setValueByPath(toObject, ['dest'], batchJobDestinationFromVertex(tRecvBatchJobDestination(fromDest)));
|
|
3236
3444
|
}
|
|
3445
|
+
const fromCompletionStats = getValueByPath(fromObject, [
|
|
3446
|
+
'completionStats',
|
|
3447
|
+
]);
|
|
3448
|
+
if (fromCompletionStats != null) {
|
|
3449
|
+
setValueByPath(toObject, ['completionStats'], fromCompletionStats);
|
|
3450
|
+
}
|
|
3237
3451
|
return toObject;
|
|
3238
3452
|
}
|
|
3239
3453
|
function batchJobSourceFromVertex(fromObject) {
|
|
@@ -3308,13 +3522,13 @@ function batchJobSourceToVertex(fromObject) {
|
|
|
3308
3522
|
}
|
|
3309
3523
|
function blobToMldev$4(fromObject) {
|
|
3310
3524
|
const toObject = {};
|
|
3311
|
-
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
3312
|
-
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
3313
|
-
}
|
|
3314
3525
|
const fromData = getValueByPath(fromObject, ['data']);
|
|
3315
3526
|
if (fromData != null) {
|
|
3316
3527
|
setValueByPath(toObject, ['data'], fromData);
|
|
3317
3528
|
}
|
|
3529
|
+
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
3530
|
+
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
3531
|
+
}
|
|
3318
3532
|
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
3319
3533
|
if (fromMimeType != null) {
|
|
3320
3534
|
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
@@ -3357,12 +3571,6 @@ function candidateFromMldev$1(fromObject) {
|
|
|
3357
3571
|
if (fromFinishReason != null) {
|
|
3358
3572
|
setValueByPath(toObject, ['finishReason'], fromFinishReason);
|
|
3359
3573
|
}
|
|
3360
|
-
const fromUrlContextMetadata = getValueByPath(fromObject, [
|
|
3361
|
-
'urlContextMetadata',
|
|
3362
|
-
]);
|
|
3363
|
-
if (fromUrlContextMetadata != null) {
|
|
3364
|
-
setValueByPath(toObject, ['urlContextMetadata'], fromUrlContextMetadata);
|
|
3365
|
-
}
|
|
3366
3574
|
const fromAvgLogprobs = getValueByPath(fromObject, ['avgLogprobs']);
|
|
3367
3575
|
if (fromAvgLogprobs != null) {
|
|
3368
3576
|
setValueByPath(toObject, ['avgLogprobs'], fromAvgLogprobs);
|
|
@@ -3395,6 +3603,12 @@ function candidateFromMldev$1(fromObject) {
|
|
|
3395
3603
|
}
|
|
3396
3604
|
setValueByPath(toObject, ['safetyRatings'], transformedList);
|
|
3397
3605
|
}
|
|
3606
|
+
const fromUrlContextMetadata = getValueByPath(fromObject, [
|
|
3607
|
+
'urlContextMetadata',
|
|
3608
|
+
]);
|
|
3609
|
+
if (fromUrlContextMetadata != null) {
|
|
3610
|
+
setValueByPath(toObject, ['urlContextMetadata'], fromUrlContextMetadata);
|
|
3611
|
+
}
|
|
3398
3612
|
return toObject;
|
|
3399
3613
|
}
|
|
3400
3614
|
function citationMetadataFromMldev$1(fromObject) {
|
|
@@ -3863,15 +4077,18 @@ function googleMapsToMldev$4(fromObject) {
|
|
|
3863
4077
|
}
|
|
3864
4078
|
function googleSearchToMldev$4(fromObject) {
|
|
3865
4079
|
const toObject = {};
|
|
4080
|
+
if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
|
|
4081
|
+
throw new Error('excludeDomains parameter is not supported in Gemini API.');
|
|
4082
|
+
}
|
|
4083
|
+
if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
|
|
4084
|
+
throw new Error('blockingConfidence parameter is not supported in Gemini API.');
|
|
4085
|
+
}
|
|
3866
4086
|
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
3867
4087
|
'timeRangeFilter',
|
|
3868
4088
|
]);
|
|
3869
4089
|
if (fromTimeRangeFilter != null) {
|
|
3870
4090
|
setValueByPath(toObject, ['timeRangeFilter'], fromTimeRangeFilter);
|
|
3871
4091
|
}
|
|
3872
|
-
if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
|
|
3873
|
-
throw new Error('excludeDomains parameter is not supported in Gemini API.');
|
|
3874
|
-
}
|
|
3875
4092
|
return toObject;
|
|
3876
4093
|
}
|
|
3877
4094
|
function inlinedRequestToMldev(apiClient, fromObject) {
|
|
@@ -4015,30 +4232,6 @@ function listBatchJobsResponseFromVertex(fromObject) {
|
|
|
4015
4232
|
}
|
|
4016
4233
|
function partToMldev$4(fromObject) {
|
|
4017
4234
|
const toObject = {};
|
|
4018
|
-
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
4019
|
-
'videoMetadata',
|
|
4020
|
-
]);
|
|
4021
|
-
if (fromVideoMetadata != null) {
|
|
4022
|
-
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
4023
|
-
}
|
|
4024
|
-
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
4025
|
-
if (fromThought != null) {
|
|
4026
|
-
setValueByPath(toObject, ['thought'], fromThought);
|
|
4027
|
-
}
|
|
4028
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
4029
|
-
if (fromInlineData != null) {
|
|
4030
|
-
setValueByPath(toObject, ['inlineData'], blobToMldev$4(fromInlineData));
|
|
4031
|
-
}
|
|
4032
|
-
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
4033
|
-
if (fromFileData != null) {
|
|
4034
|
-
setValueByPath(toObject, ['fileData'], fileDataToMldev$4(fromFileData));
|
|
4035
|
-
}
|
|
4036
|
-
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
4037
|
-
'thoughtSignature',
|
|
4038
|
-
]);
|
|
4039
|
-
if (fromThoughtSignature != null) {
|
|
4040
|
-
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
4041
|
-
}
|
|
4042
4235
|
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
4043
4236
|
if (fromFunctionCall != null) {
|
|
4044
4237
|
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
@@ -4055,27 +4248,51 @@ function partToMldev$4(fromObject) {
|
|
|
4055
4248
|
if (fromExecutableCode != null) {
|
|
4056
4249
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
4057
4250
|
}
|
|
4251
|
+
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
4252
|
+
if (fromFileData != null) {
|
|
4253
|
+
setValueByPath(toObject, ['fileData'], fileDataToMldev$4(fromFileData));
|
|
4254
|
+
}
|
|
4058
4255
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
4059
4256
|
'functionResponse',
|
|
4060
4257
|
]);
|
|
4061
4258
|
if (fromFunctionResponse != null) {
|
|
4062
4259
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
4063
4260
|
}
|
|
4261
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
4262
|
+
if (fromInlineData != null) {
|
|
4263
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev$4(fromInlineData));
|
|
4264
|
+
}
|
|
4064
4265
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
4065
4266
|
if (fromText != null) {
|
|
4066
4267
|
setValueByPath(toObject, ['text'], fromText);
|
|
4067
4268
|
}
|
|
4269
|
+
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
4270
|
+
if (fromThought != null) {
|
|
4271
|
+
setValueByPath(toObject, ['thought'], fromThought);
|
|
4272
|
+
}
|
|
4273
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
4274
|
+
'thoughtSignature',
|
|
4275
|
+
]);
|
|
4276
|
+
if (fromThoughtSignature != null) {
|
|
4277
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
4278
|
+
}
|
|
4279
|
+
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
4280
|
+
'videoMetadata',
|
|
4281
|
+
]);
|
|
4282
|
+
if (fromVideoMetadata != null) {
|
|
4283
|
+
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
4284
|
+
}
|
|
4068
4285
|
return toObject;
|
|
4069
4286
|
}
|
|
4070
4287
|
function safetySettingToMldev$1(fromObject) {
|
|
4071
4288
|
const toObject = {};
|
|
4072
|
-
if (getValueByPath(fromObject, ['method']) !== undefined) {
|
|
4073
|
-
throw new Error('method parameter is not supported in Gemini API.');
|
|
4074
|
-
}
|
|
4075
4289
|
const fromCategory = getValueByPath(fromObject, ['category']);
|
|
4076
4290
|
if (fromCategory != null) {
|
|
4077
4291
|
setValueByPath(toObject, ['category'], fromCategory);
|
|
4078
4292
|
}
|
|
4293
|
+
if (getValueByPath(fromObject, ['method']) !== undefined) {
|
|
4294
|
+
throw new Error('method parameter is not supported in Gemini API.');
|
|
4295
|
+
}
|
|
4079
4296
|
const fromThreshold = getValueByPath(fromObject, ['threshold']);
|
|
4080
4297
|
if (fromThreshold != null) {
|
|
4081
4298
|
setValueByPath(toObject, ['threshold'], fromThreshold);
|
|
@@ -4099,16 +4316,26 @@ function toolToMldev$4(fromObject) {
|
|
|
4099
4316
|
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
4100
4317
|
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
4101
4318
|
}
|
|
4102
|
-
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
4103
|
-
if (fromGoogleSearch != null) {
|
|
4104
|
-
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$4(fromGoogleSearch));
|
|
4105
|
-
}
|
|
4106
4319
|
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
4107
4320
|
'googleSearchRetrieval',
|
|
4108
4321
|
]);
|
|
4109
4322
|
if (fromGoogleSearchRetrieval != null) {
|
|
4110
4323
|
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
4111
4324
|
}
|
|
4325
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
4326
|
+
if (fromComputerUse != null) {
|
|
4327
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
4328
|
+
}
|
|
4329
|
+
const fromFileSearch = getValueByPath(fromObject, ['fileSearch']);
|
|
4330
|
+
if (fromFileSearch != null) {
|
|
4331
|
+
setValueByPath(toObject, ['fileSearch'], fromFileSearch);
|
|
4332
|
+
}
|
|
4333
|
+
const fromCodeExecution = getValueByPath(fromObject, [
|
|
4334
|
+
'codeExecution',
|
|
4335
|
+
]);
|
|
4336
|
+
if (fromCodeExecution != null) {
|
|
4337
|
+
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
4338
|
+
}
|
|
4112
4339
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
4113
4340
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
4114
4341
|
}
|
|
@@ -4116,20 +4343,14 @@ function toolToMldev$4(fromObject) {
|
|
|
4116
4343
|
if (fromGoogleMaps != null) {
|
|
4117
4344
|
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$4(fromGoogleMaps));
|
|
4118
4345
|
}
|
|
4346
|
+
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
4347
|
+
if (fromGoogleSearch != null) {
|
|
4348
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$4(fromGoogleSearch));
|
|
4349
|
+
}
|
|
4119
4350
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
4120
4351
|
if (fromUrlContext != null) {
|
|
4121
4352
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
4122
4353
|
}
|
|
4123
|
-
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
4124
|
-
if (fromComputerUse != null) {
|
|
4125
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
4126
|
-
}
|
|
4127
|
-
const fromCodeExecution = getValueByPath(fromObject, [
|
|
4128
|
-
'codeExecution',
|
|
4129
|
-
]);
|
|
4130
|
-
if (fromCodeExecution != null) {
|
|
4131
|
-
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
4132
|
-
}
|
|
4133
4354
|
return toObject;
|
|
4134
4355
|
}
|
|
4135
4356
|
|
|
@@ -4145,6 +4366,8 @@ exports.PagedItem = void 0;
|
|
|
4145
4366
|
PagedItem["PAGED_ITEM_TUNING_JOBS"] = "tuningJobs";
|
|
4146
4367
|
PagedItem["PAGED_ITEM_FILES"] = "files";
|
|
4147
4368
|
PagedItem["PAGED_ITEM_CACHED_CONTENTS"] = "cachedContents";
|
|
4369
|
+
PagedItem["PAGED_ITEM_FILE_SEARCH_STORES"] = "fileSearchStores";
|
|
4370
|
+
PagedItem["PAGED_ITEM_DOCUMENTS"] = "documents";
|
|
4148
4371
|
})(exports.PagedItem || (exports.PagedItem = {}));
|
|
4149
4372
|
/**
|
|
4150
4373
|
* Pager class for iterating through paginated results.
|
|
@@ -4825,13 +5048,13 @@ class Batches extends BaseModule {
|
|
|
4825
5048
|
*/
|
|
4826
5049
|
function blobToMldev$3(fromObject) {
|
|
4827
5050
|
const toObject = {};
|
|
4828
|
-
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
4829
|
-
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
4830
|
-
}
|
|
4831
5051
|
const fromData = getValueByPath(fromObject, ['data']);
|
|
4832
5052
|
if (fromData != null) {
|
|
4833
5053
|
setValueByPath(toObject, ['data'], fromData);
|
|
4834
5054
|
}
|
|
5055
|
+
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
5056
|
+
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
5057
|
+
}
|
|
4835
5058
|
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
4836
5059
|
if (fromMimeType != null) {
|
|
4837
5060
|
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
@@ -5094,15 +5317,18 @@ function googleMapsToMldev$3(fromObject) {
|
|
|
5094
5317
|
}
|
|
5095
5318
|
function googleSearchToMldev$3(fromObject) {
|
|
5096
5319
|
const toObject = {};
|
|
5320
|
+
if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
|
|
5321
|
+
throw new Error('excludeDomains parameter is not supported in Gemini API.');
|
|
5322
|
+
}
|
|
5323
|
+
if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
|
|
5324
|
+
throw new Error('blockingConfidence parameter is not supported in Gemini API.');
|
|
5325
|
+
}
|
|
5097
5326
|
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
5098
5327
|
'timeRangeFilter',
|
|
5099
5328
|
]);
|
|
5100
5329
|
if (fromTimeRangeFilter != null) {
|
|
5101
5330
|
setValueByPath(toObject, ['timeRangeFilter'], fromTimeRangeFilter);
|
|
5102
5331
|
}
|
|
5103
|
-
if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
|
|
5104
|
-
throw new Error('excludeDomains parameter is not supported in Gemini API.');
|
|
5105
|
-
}
|
|
5106
5332
|
return toObject;
|
|
5107
5333
|
}
|
|
5108
5334
|
function listCachedContentsConfigToMldev(fromObject, parentObject) {
|
|
@@ -5203,39 +5429,15 @@ function listCachedContentsResponseFromVertex(fromObject) {
|
|
|
5203
5429
|
}
|
|
5204
5430
|
function partToMldev$3(fromObject) {
|
|
5205
5431
|
const toObject = {};
|
|
5206
|
-
const
|
|
5207
|
-
|
|
5432
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
5433
|
+
if (fromFunctionCall != null) {
|
|
5434
|
+
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
5435
|
+
}
|
|
5436
|
+
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
5437
|
+
'codeExecutionResult',
|
|
5208
5438
|
]);
|
|
5209
|
-
if (
|
|
5210
|
-
setValueByPath(toObject, ['
|
|
5211
|
-
}
|
|
5212
|
-
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
5213
|
-
if (fromThought != null) {
|
|
5214
|
-
setValueByPath(toObject, ['thought'], fromThought);
|
|
5215
|
-
}
|
|
5216
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
5217
|
-
if (fromInlineData != null) {
|
|
5218
|
-
setValueByPath(toObject, ['inlineData'], blobToMldev$3(fromInlineData));
|
|
5219
|
-
}
|
|
5220
|
-
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
5221
|
-
if (fromFileData != null) {
|
|
5222
|
-
setValueByPath(toObject, ['fileData'], fileDataToMldev$3(fromFileData));
|
|
5223
|
-
}
|
|
5224
|
-
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
5225
|
-
'thoughtSignature',
|
|
5226
|
-
]);
|
|
5227
|
-
if (fromThoughtSignature != null) {
|
|
5228
|
-
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
5229
|
-
}
|
|
5230
|
-
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
5231
|
-
if (fromFunctionCall != null) {
|
|
5232
|
-
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
5233
|
-
}
|
|
5234
|
-
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
5235
|
-
'codeExecutionResult',
|
|
5236
|
-
]);
|
|
5237
|
-
if (fromCodeExecutionResult != null) {
|
|
5238
|
-
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
5439
|
+
if (fromCodeExecutionResult != null) {
|
|
5440
|
+
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
5239
5441
|
}
|
|
5240
5442
|
const fromExecutableCode = getValueByPath(fromObject, [
|
|
5241
5443
|
'executableCode',
|
|
@@ -5243,16 +5445,40 @@ function partToMldev$3(fromObject) {
|
|
|
5243
5445
|
if (fromExecutableCode != null) {
|
|
5244
5446
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
5245
5447
|
}
|
|
5448
|
+
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
5449
|
+
if (fromFileData != null) {
|
|
5450
|
+
setValueByPath(toObject, ['fileData'], fileDataToMldev$3(fromFileData));
|
|
5451
|
+
}
|
|
5246
5452
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
5247
5453
|
'functionResponse',
|
|
5248
5454
|
]);
|
|
5249
5455
|
if (fromFunctionResponse != null) {
|
|
5250
5456
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
5251
5457
|
}
|
|
5458
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
5459
|
+
if (fromInlineData != null) {
|
|
5460
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev$3(fromInlineData));
|
|
5461
|
+
}
|
|
5252
5462
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
5253
5463
|
if (fromText != null) {
|
|
5254
5464
|
setValueByPath(toObject, ['text'], fromText);
|
|
5255
5465
|
}
|
|
5466
|
+
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
5467
|
+
if (fromThought != null) {
|
|
5468
|
+
setValueByPath(toObject, ['thought'], fromThought);
|
|
5469
|
+
}
|
|
5470
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
5471
|
+
'thoughtSignature',
|
|
5472
|
+
]);
|
|
5473
|
+
if (fromThoughtSignature != null) {
|
|
5474
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
5475
|
+
}
|
|
5476
|
+
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
5477
|
+
'videoMetadata',
|
|
5478
|
+
]);
|
|
5479
|
+
if (fromVideoMetadata != null) {
|
|
5480
|
+
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
5481
|
+
}
|
|
5256
5482
|
return toObject;
|
|
5257
5483
|
}
|
|
5258
5484
|
function toolToMldev$3(fromObject) {
|
|
@@ -5272,16 +5498,26 @@ function toolToMldev$3(fromObject) {
|
|
|
5272
5498
|
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
5273
5499
|
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
5274
5500
|
}
|
|
5275
|
-
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
5276
|
-
if (fromGoogleSearch != null) {
|
|
5277
|
-
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$3(fromGoogleSearch));
|
|
5278
|
-
}
|
|
5279
5501
|
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
5280
5502
|
'googleSearchRetrieval',
|
|
5281
5503
|
]);
|
|
5282
5504
|
if (fromGoogleSearchRetrieval != null) {
|
|
5283
5505
|
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
5284
5506
|
}
|
|
5507
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
5508
|
+
if (fromComputerUse != null) {
|
|
5509
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
5510
|
+
}
|
|
5511
|
+
const fromFileSearch = getValueByPath(fromObject, ['fileSearch']);
|
|
5512
|
+
if (fromFileSearch != null) {
|
|
5513
|
+
setValueByPath(toObject, ['fileSearch'], fromFileSearch);
|
|
5514
|
+
}
|
|
5515
|
+
const fromCodeExecution = getValueByPath(fromObject, [
|
|
5516
|
+
'codeExecution',
|
|
5517
|
+
]);
|
|
5518
|
+
if (fromCodeExecution != null) {
|
|
5519
|
+
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
5520
|
+
}
|
|
5285
5521
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
5286
5522
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
5287
5523
|
}
|
|
@@ -5289,20 +5525,14 @@ function toolToMldev$3(fromObject) {
|
|
|
5289
5525
|
if (fromGoogleMaps != null) {
|
|
5290
5526
|
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$3(fromGoogleMaps));
|
|
5291
5527
|
}
|
|
5528
|
+
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
5529
|
+
if (fromGoogleSearch != null) {
|
|
5530
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$3(fromGoogleSearch));
|
|
5531
|
+
}
|
|
5292
5532
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
5293
5533
|
if (fromUrlContext != null) {
|
|
5294
5534
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
5295
5535
|
}
|
|
5296
|
-
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
5297
|
-
if (fromComputerUse != null) {
|
|
5298
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
5299
|
-
}
|
|
5300
|
-
const fromCodeExecution = getValueByPath(fromObject, [
|
|
5301
|
-
'codeExecution',
|
|
5302
|
-
]);
|
|
5303
|
-
if (fromCodeExecution != null) {
|
|
5304
|
-
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
5305
|
-
}
|
|
5306
5536
|
return toObject;
|
|
5307
5537
|
}
|
|
5308
5538
|
function toolToVertex$2(fromObject) {
|
|
@@ -5323,16 +5553,25 @@ function toolToVertex$2(fromObject) {
|
|
|
5323
5553
|
if (fromRetrieval != null) {
|
|
5324
5554
|
setValueByPath(toObject, ['retrieval'], fromRetrieval);
|
|
5325
5555
|
}
|
|
5326
|
-
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
5327
|
-
if (fromGoogleSearch != null) {
|
|
5328
|
-
setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
|
|
5329
|
-
}
|
|
5330
5556
|
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
5331
5557
|
'googleSearchRetrieval',
|
|
5332
5558
|
]);
|
|
5333
5559
|
if (fromGoogleSearchRetrieval != null) {
|
|
5334
5560
|
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
5335
5561
|
}
|
|
5562
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
5563
|
+
if (fromComputerUse != null) {
|
|
5564
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
5565
|
+
}
|
|
5566
|
+
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
5567
|
+
throw new Error('fileSearch parameter is not supported in Vertex AI.');
|
|
5568
|
+
}
|
|
5569
|
+
const fromCodeExecution = getValueByPath(fromObject, [
|
|
5570
|
+
'codeExecution',
|
|
5571
|
+
]);
|
|
5572
|
+
if (fromCodeExecution != null) {
|
|
5573
|
+
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
5574
|
+
}
|
|
5336
5575
|
const fromEnterpriseWebSearch = getValueByPath(fromObject, [
|
|
5337
5576
|
'enterpriseWebSearch',
|
|
5338
5577
|
]);
|
|
@@ -5343,20 +5582,14 @@ function toolToVertex$2(fromObject) {
|
|
|
5343
5582
|
if (fromGoogleMaps != null) {
|
|
5344
5583
|
setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
|
|
5345
5584
|
}
|
|
5585
|
+
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
5586
|
+
if (fromGoogleSearch != null) {
|
|
5587
|
+
setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
|
|
5588
|
+
}
|
|
5346
5589
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
5347
5590
|
if (fromUrlContext != null) {
|
|
5348
5591
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
5349
5592
|
}
|
|
5350
|
-
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
5351
|
-
if (fromComputerUse != null) {
|
|
5352
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
5353
|
-
}
|
|
5354
|
-
const fromCodeExecution = getValueByPath(fromObject, [
|
|
5355
|
-
'codeExecution',
|
|
5356
|
-
]);
|
|
5357
|
-
if (fromCodeExecution != null) {
|
|
5358
|
-
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
5359
|
-
}
|
|
5360
5593
|
return toObject;
|
|
5361
5594
|
}
|
|
5362
5595
|
function updateCachedContentConfigToMldev(fromObject, parentObject) {
|
|
@@ -6193,7 +6426,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
6193
6426
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
6194
6427
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
6195
6428
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
6196
|
-
const SDK_VERSION = '1.
|
|
6429
|
+
const SDK_VERSION = '1.29.0'; // x-release-please-version
|
|
6197
6430
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
6198
6431
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
6199
6432
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -6571,13 +6804,22 @@ class ApiClient {
|
|
|
6571
6804
|
await this.clientOptions.auth.addAuthHeaders(headers, url);
|
|
6572
6805
|
return headers;
|
|
6573
6806
|
}
|
|
6807
|
+
getFileName(file) {
|
|
6808
|
+
var _a;
|
|
6809
|
+
let fileName = '';
|
|
6810
|
+
if (typeof file === 'string') {
|
|
6811
|
+
fileName = file.replace(/[/\\]+$/, '');
|
|
6812
|
+
fileName = (_a = fileName.split(/[/\\]/).pop()) !== null && _a !== void 0 ? _a : '';
|
|
6813
|
+
}
|
|
6814
|
+
return fileName;
|
|
6815
|
+
}
|
|
6574
6816
|
/**
|
|
6575
6817
|
* Uploads a file asynchronously using Gemini API only, this is not supported
|
|
6576
6818
|
* in Vertex AI.
|
|
6577
6819
|
*
|
|
6578
6820
|
* @param file The string path to the file to be uploaded or a Blob object.
|
|
6579
6821
|
* @param config Optional parameters specified in the `UploadFileConfig`
|
|
6580
|
-
* interface. @see {@link UploadFileConfig}
|
|
6822
|
+
* interface. @see {@link types.UploadFileConfig}
|
|
6581
6823
|
* @return A promise that resolves to a `File` object.
|
|
6582
6824
|
* @throws An error if called on a Vertex AI client.
|
|
6583
6825
|
* @throws An error if the `mimeType` is not provided and can not be inferred,
|
|
@@ -6601,42 +6843,71 @@ class ApiClient {
|
|
|
6601
6843
|
throw new Error('Can not determine mimeType. Please provide mimeType in the config.');
|
|
6602
6844
|
}
|
|
6603
6845
|
fileToUpload.mimeType = mimeType;
|
|
6604
|
-
const
|
|
6846
|
+
const body = {
|
|
6847
|
+
file: fileToUpload,
|
|
6848
|
+
};
|
|
6849
|
+
const fileName = this.getFileName(file);
|
|
6850
|
+
const path = formatMap('upload/v1beta/files', body['_url']);
|
|
6851
|
+
const uploadUrl = await this.fetchUploadUrl(path, fileToUpload.sizeBytes, fileToUpload.mimeType, fileName, body, config === null || config === void 0 ? void 0 : config.httpOptions);
|
|
6605
6852
|
return uploader.upload(file, uploadUrl, this);
|
|
6606
6853
|
}
|
|
6854
|
+
/**
|
|
6855
|
+
* Uploads a file to a given file search store asynchronously using Gemini API only, this is not supported
|
|
6856
|
+
* in Vertex AI.
|
|
6857
|
+
*
|
|
6858
|
+
* @param fileSearchStoreName The name of the file search store to upload the file to.
|
|
6859
|
+
* @param file The string path to the file to be uploaded or a Blob object.
|
|
6860
|
+
* @param config Optional parameters specified in the `UploadFileConfig`
|
|
6861
|
+
* interface. @see {@link UploadFileConfig}
|
|
6862
|
+
* @return A promise that resolves to a `File` object.
|
|
6863
|
+
* @throws An error if called on a Vertex AI client.
|
|
6864
|
+
* @throws An error if the `mimeType` is not provided and can not be inferred,
|
|
6865
|
+
*/
|
|
6866
|
+
async uploadFileToFileSearchStore(fileSearchStoreName, file, config) {
|
|
6867
|
+
var _a;
|
|
6868
|
+
const uploader = this.clientOptions.uploader;
|
|
6869
|
+
const fileStat = await uploader.stat(file);
|
|
6870
|
+
const sizeBytes = String(fileStat.size);
|
|
6871
|
+
const mimeType = (_a = config === null || config === void 0 ? void 0 : config.mimeType) !== null && _a !== void 0 ? _a : fileStat.type;
|
|
6872
|
+
if (mimeType === undefined || mimeType === '') {
|
|
6873
|
+
throw new Error('Can not determine mimeType. Please provide mimeType in the config.');
|
|
6874
|
+
}
|
|
6875
|
+
const path = `upload/v1beta/${fileSearchStoreName}:uploadToFileSearchStore`;
|
|
6876
|
+
const fileName = this.getFileName(file);
|
|
6877
|
+
const body = {};
|
|
6878
|
+
if (config === null || config === void 0 ? void 0 : config.customMetadata) {
|
|
6879
|
+
body['customMetadata'] = config.customMetadata;
|
|
6880
|
+
}
|
|
6881
|
+
if (config === null || config === void 0 ? void 0 : config.chunkingConfig) {
|
|
6882
|
+
body['chunkingConfig'] = config.chunkingConfig;
|
|
6883
|
+
}
|
|
6884
|
+
const uploadUrl = await this.fetchUploadUrl(path, sizeBytes, mimeType, fileName, body, config === null || config === void 0 ? void 0 : config.httpOptions);
|
|
6885
|
+
return uploader.uploadToFileSearchStore(file, uploadUrl, this);
|
|
6886
|
+
}
|
|
6607
6887
|
/**
|
|
6608
6888
|
* Downloads a file asynchronously to the specified path.
|
|
6609
6889
|
*
|
|
6610
6890
|
* @params params - The parameters for the download request, see {@link
|
|
6611
|
-
* DownloadFileParameters}
|
|
6891
|
+
* types.DownloadFileParameters}
|
|
6612
6892
|
*/
|
|
6613
6893
|
async downloadFile(params) {
|
|
6614
6894
|
const downloader = this.clientOptions.downloader;
|
|
6615
6895
|
await downloader.download(params, this);
|
|
6616
6896
|
}
|
|
6617
|
-
async fetchUploadUrl(
|
|
6897
|
+
async fetchUploadUrl(path, sizeBytes, mimeType, fileName, body, configHttpOptions) {
|
|
6618
6898
|
var _a;
|
|
6619
6899
|
let httpOptions = {};
|
|
6620
|
-
if (
|
|
6621
|
-
httpOptions =
|
|
6900
|
+
if (configHttpOptions) {
|
|
6901
|
+
httpOptions = configHttpOptions;
|
|
6622
6902
|
}
|
|
6623
6903
|
else {
|
|
6624
6904
|
httpOptions = {
|
|
6625
6905
|
apiVersion: '',
|
|
6626
|
-
headers: {
|
|
6627
|
-
'Content-Type': 'application/json',
|
|
6628
|
-
'X-Goog-Upload-Protocol': 'resumable',
|
|
6629
|
-
'X-Goog-Upload-Command': 'start',
|
|
6630
|
-
'X-Goog-Upload-Header-Content-Length': `${file.sizeBytes}`,
|
|
6631
|
-
'X-Goog-Upload-Header-Content-Type': `${file.mimeType}`,
|
|
6632
|
-
},
|
|
6906
|
+
headers: Object.assign({ 'Content-Type': 'application/json', 'X-Goog-Upload-Protocol': 'resumable', 'X-Goog-Upload-Command': 'start', 'X-Goog-Upload-Header-Content-Length': `${sizeBytes}`, 'X-Goog-Upload-Header-Content-Type': `${mimeType}` }, (fileName ? { 'X-Goog-Upload-File-Name': fileName } : {})),
|
|
6633
6907
|
};
|
|
6634
6908
|
}
|
|
6635
|
-
const body = {
|
|
6636
|
-
'file': file,
|
|
6637
|
-
};
|
|
6638
6909
|
const httpResponse = await this.request({
|
|
6639
|
-
path
|
|
6910
|
+
path,
|
|
6640
6911
|
body: JSON.stringify(body),
|
|
6641
6912
|
httpMethod: 'POST',
|
|
6642
6913
|
httpOptions,
|
|
@@ -6798,6 +7069,14 @@ class CrossUploader {
|
|
|
6798
7069
|
return uploadBlob(file, uploadUrl, apiClient);
|
|
6799
7070
|
}
|
|
6800
7071
|
}
|
|
7072
|
+
async uploadToFileSearchStore(file, uploadUrl, apiClient) {
|
|
7073
|
+
if (typeof file === 'string') {
|
|
7074
|
+
throw crossError();
|
|
7075
|
+
}
|
|
7076
|
+
else {
|
|
7077
|
+
return uploadBlobToFileSearchStore(file, uploadUrl, apiClient);
|
|
7078
|
+
}
|
|
7079
|
+
}
|
|
6801
7080
|
async stat(file) {
|
|
6802
7081
|
if (typeof file === 'string') {
|
|
6803
7082
|
throw crossError();
|
|
@@ -6808,7 +7087,28 @@ class CrossUploader {
|
|
|
6808
7087
|
}
|
|
6809
7088
|
}
|
|
6810
7089
|
async function uploadBlob(file, uploadUrl, apiClient) {
|
|
6811
|
-
var _a
|
|
7090
|
+
var _a;
|
|
7091
|
+
const response = await uploadBlobInternal(file, uploadUrl, apiClient);
|
|
7092
|
+
const responseJson = (await (response === null || response === void 0 ? void 0 : response.json()));
|
|
7093
|
+
if (((_a = response === null || response === void 0 ? void 0 : response.headers) === null || _a === void 0 ? void 0 : _a[X_GOOG_UPLOAD_STATUS_HEADER_FIELD]) !== 'final') {
|
|
7094
|
+
throw new Error('Failed to upload file: Upload status is not finalized.');
|
|
7095
|
+
}
|
|
7096
|
+
return responseJson['file'];
|
|
7097
|
+
}
|
|
7098
|
+
async function uploadBlobToFileSearchStore(file, uploadUrl, apiClient) {
|
|
7099
|
+
var _a;
|
|
7100
|
+
const response = await uploadBlobInternal(file, uploadUrl, apiClient);
|
|
7101
|
+
const responseJson = (await (response === null || response === void 0 ? void 0 : response.json()));
|
|
7102
|
+
if (((_a = response === null || response === void 0 ? void 0 : response.headers) === null || _a === void 0 ? void 0 : _a[X_GOOG_UPLOAD_STATUS_HEADER_FIELD]) !== 'final') {
|
|
7103
|
+
throw new Error('Failed to upload file: Upload status is not finalized.');
|
|
7104
|
+
}
|
|
7105
|
+
const resp = uploadToFileSearchStoreOperationFromMldev(responseJson);
|
|
7106
|
+
const typedResp = new UploadToFileSearchStoreOperation();
|
|
7107
|
+
Object.assign(typedResp, resp);
|
|
7108
|
+
return typedResp;
|
|
7109
|
+
}
|
|
7110
|
+
async function uploadBlobInternal(file, uploadUrl, apiClient) {
|
|
7111
|
+
var _a, _b;
|
|
6812
7112
|
let fileSize = 0;
|
|
6813
7113
|
let offset = 0;
|
|
6814
7114
|
let response = new HttpResponse(new Response());
|
|
@@ -6856,11 +7156,7 @@ async function uploadBlob(file, uploadUrl, apiClient) {
|
|
|
6856
7156
|
throw new Error('All content has been uploaded, but the upload status is not finalized.');
|
|
6857
7157
|
}
|
|
6858
7158
|
}
|
|
6859
|
-
|
|
6860
|
-
if (((_c = response === null || response === void 0 ? void 0 : response.headers) === null || _c === void 0 ? void 0 : _c[X_GOOG_UPLOAD_STATUS_HEADER_FIELD]) !== 'final') {
|
|
6861
|
-
throw new Error('Failed to upload file: Upload status is not finalized.');
|
|
6862
|
-
}
|
|
6863
|
-
return responseJson['file'];
|
|
7159
|
+
return response;
|
|
6864
7160
|
}
|
|
6865
7161
|
async function getBlobStat(file) {
|
|
6866
7162
|
const fileStat = { size: file.size, type: file.type };
|
|
@@ -7154,22 +7450,777 @@ class Files extends BaseModule {
|
|
|
7154
7450
|
});
|
|
7155
7451
|
}
|
|
7156
7452
|
}
|
|
7157
|
-
/**
|
|
7158
|
-
* Retrieves the file information from the service.
|
|
7159
|
-
*
|
|
7160
|
-
* @param params - The parameters for the get request
|
|
7161
|
-
* @return The Promise that resolves to the types.File object requested.
|
|
7162
|
-
*
|
|
7163
|
-
* @example
|
|
7164
|
-
* ```ts
|
|
7165
|
-
* const config: GetFileParameters = {
|
|
7166
|
-
* name: fileName,
|
|
7167
|
-
* };
|
|
7168
|
-
* file = await ai.files.get(config);
|
|
7169
|
-
* console.log(file.name);
|
|
7170
|
-
* ```
|
|
7171
|
-
*/
|
|
7172
|
-
async get(params) {
|
|
7453
|
+
/**
|
|
7454
|
+
* Retrieves the file information from the service.
|
|
7455
|
+
*
|
|
7456
|
+
* @param params - The parameters for the get request
|
|
7457
|
+
* @return The Promise that resolves to the types.File object requested.
|
|
7458
|
+
*
|
|
7459
|
+
* @example
|
|
7460
|
+
* ```ts
|
|
7461
|
+
* const config: GetFileParameters = {
|
|
7462
|
+
* name: fileName,
|
|
7463
|
+
* };
|
|
7464
|
+
* file = await ai.files.get(config);
|
|
7465
|
+
* console.log(file.name);
|
|
7466
|
+
* ```
|
|
7467
|
+
*/
|
|
7468
|
+
async get(params) {
|
|
7469
|
+
var _a, _b;
|
|
7470
|
+
let response;
|
|
7471
|
+
let path = '';
|
|
7472
|
+
let queryParams = {};
|
|
7473
|
+
if (this.apiClient.isVertexAI()) {
|
|
7474
|
+
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
7475
|
+
}
|
|
7476
|
+
else {
|
|
7477
|
+
const body = getFileParametersToMldev(params);
|
|
7478
|
+
path = formatMap('files/{file}', body['_url']);
|
|
7479
|
+
queryParams = body['_query'];
|
|
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
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
7490
|
+
})
|
|
7491
|
+
.then((httpResponse) => {
|
|
7492
|
+
return httpResponse.json();
|
|
7493
|
+
});
|
|
7494
|
+
return response.then((resp) => {
|
|
7495
|
+
return resp;
|
|
7496
|
+
});
|
|
7497
|
+
}
|
|
7498
|
+
}
|
|
7499
|
+
/**
|
|
7500
|
+
* Deletes a remotely stored file.
|
|
7501
|
+
*
|
|
7502
|
+
* @param params - The parameters for the delete request.
|
|
7503
|
+
* @return The DeleteFileResponse, the response for the delete method.
|
|
7504
|
+
*
|
|
7505
|
+
* @example
|
|
7506
|
+
* The following code deletes an example file named "files/mehozpxf877d".
|
|
7507
|
+
*
|
|
7508
|
+
* ```ts
|
|
7509
|
+
* await ai.files.delete({name: file.name});
|
|
7510
|
+
* ```
|
|
7511
|
+
*/
|
|
7512
|
+
async delete(params) {
|
|
7513
|
+
var _a, _b;
|
|
7514
|
+
let response;
|
|
7515
|
+
let path = '';
|
|
7516
|
+
let queryParams = {};
|
|
7517
|
+
if (this.apiClient.isVertexAI()) {
|
|
7518
|
+
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
7519
|
+
}
|
|
7520
|
+
else {
|
|
7521
|
+
const body = deleteFileParametersToMldev(params);
|
|
7522
|
+
path = formatMap('files/{file}', body['_url']);
|
|
7523
|
+
queryParams = body['_query'];
|
|
7524
|
+
delete body['_url'];
|
|
7525
|
+
delete body['_query'];
|
|
7526
|
+
response = this.apiClient
|
|
7527
|
+
.request({
|
|
7528
|
+
path: path,
|
|
7529
|
+
queryParams: queryParams,
|
|
7530
|
+
body: JSON.stringify(body),
|
|
7531
|
+
httpMethod: 'DELETE',
|
|
7532
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
7533
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
7534
|
+
})
|
|
7535
|
+
.then((httpResponse) => {
|
|
7536
|
+
return httpResponse.json().then((jsonResponse) => {
|
|
7537
|
+
const response = jsonResponse;
|
|
7538
|
+
response.sdkHttpResponse = {
|
|
7539
|
+
headers: httpResponse.headers,
|
|
7540
|
+
};
|
|
7541
|
+
return response;
|
|
7542
|
+
});
|
|
7543
|
+
});
|
|
7544
|
+
return response.then((apiResponse) => {
|
|
7545
|
+
const resp = deleteFileResponseFromMldev(apiResponse);
|
|
7546
|
+
const typedResp = new DeleteFileResponse();
|
|
7547
|
+
Object.assign(typedResp, resp);
|
|
7548
|
+
return typedResp;
|
|
7549
|
+
});
|
|
7550
|
+
}
|
|
7551
|
+
}
|
|
7552
|
+
}
|
|
7553
|
+
|
|
7554
|
+
/**
|
|
7555
|
+
* @license
|
|
7556
|
+
* Copyright 2025 Google LLC
|
|
7557
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
7558
|
+
*/
|
|
7559
|
+
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
|
|
7560
|
+
function createFileSearchStoreConfigToMldev(fromObject, parentObject) {
|
|
7561
|
+
const toObject = {};
|
|
7562
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
7563
|
+
if (parentObject !== undefined && fromDisplayName != null) {
|
|
7564
|
+
setValueByPath(parentObject, ['displayName'], fromDisplayName);
|
|
7565
|
+
}
|
|
7566
|
+
return toObject;
|
|
7567
|
+
}
|
|
7568
|
+
function createFileSearchStoreParametersToMldev(fromObject) {
|
|
7569
|
+
const toObject = {};
|
|
7570
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
7571
|
+
if (fromConfig != null) {
|
|
7572
|
+
createFileSearchStoreConfigToMldev(fromConfig, toObject);
|
|
7573
|
+
}
|
|
7574
|
+
return toObject;
|
|
7575
|
+
}
|
|
7576
|
+
function deleteFileSearchStoreConfigToMldev(fromObject, parentObject) {
|
|
7577
|
+
const toObject = {};
|
|
7578
|
+
const fromForce = getValueByPath(fromObject, ['force']);
|
|
7579
|
+
if (parentObject !== undefined && fromForce != null) {
|
|
7580
|
+
setValueByPath(parentObject, ['_query', 'force'], fromForce);
|
|
7581
|
+
}
|
|
7582
|
+
return toObject;
|
|
7583
|
+
}
|
|
7584
|
+
function deleteFileSearchStoreParametersToMldev(fromObject) {
|
|
7585
|
+
const toObject = {};
|
|
7586
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
7587
|
+
if (fromName != null) {
|
|
7588
|
+
setValueByPath(toObject, ['_url', 'name'], fromName);
|
|
7589
|
+
}
|
|
7590
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
7591
|
+
if (fromConfig != null) {
|
|
7592
|
+
deleteFileSearchStoreConfigToMldev(fromConfig, toObject);
|
|
7593
|
+
}
|
|
7594
|
+
return toObject;
|
|
7595
|
+
}
|
|
7596
|
+
function getFileSearchStoreParametersToMldev(fromObject) {
|
|
7597
|
+
const toObject = {};
|
|
7598
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
7599
|
+
if (fromName != null) {
|
|
7600
|
+
setValueByPath(toObject, ['_url', 'name'], fromName);
|
|
7601
|
+
}
|
|
7602
|
+
return toObject;
|
|
7603
|
+
}
|
|
7604
|
+
function importFileConfigToMldev(fromObject, parentObject) {
|
|
7605
|
+
const toObject = {};
|
|
7606
|
+
const fromCustomMetadata = getValueByPath(fromObject, [
|
|
7607
|
+
'customMetadata',
|
|
7608
|
+
]);
|
|
7609
|
+
if (parentObject !== undefined && fromCustomMetadata != null) {
|
|
7610
|
+
let transformedList = fromCustomMetadata;
|
|
7611
|
+
if (Array.isArray(transformedList)) {
|
|
7612
|
+
transformedList = transformedList.map((item) => {
|
|
7613
|
+
return item;
|
|
7614
|
+
});
|
|
7615
|
+
}
|
|
7616
|
+
setValueByPath(parentObject, ['customMetadata'], transformedList);
|
|
7617
|
+
}
|
|
7618
|
+
const fromChunkingConfig = getValueByPath(fromObject, [
|
|
7619
|
+
'chunkingConfig',
|
|
7620
|
+
]);
|
|
7621
|
+
if (parentObject !== undefined && fromChunkingConfig != null) {
|
|
7622
|
+
setValueByPath(parentObject, ['chunkingConfig'], fromChunkingConfig);
|
|
7623
|
+
}
|
|
7624
|
+
return toObject;
|
|
7625
|
+
}
|
|
7626
|
+
function importFileOperationFromMldev(fromObject) {
|
|
7627
|
+
const toObject = {};
|
|
7628
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
7629
|
+
if (fromName != null) {
|
|
7630
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
7631
|
+
}
|
|
7632
|
+
const fromMetadata = getValueByPath(fromObject, ['metadata']);
|
|
7633
|
+
if (fromMetadata != null) {
|
|
7634
|
+
setValueByPath(toObject, ['metadata'], fromMetadata);
|
|
7635
|
+
}
|
|
7636
|
+
const fromDone = getValueByPath(fromObject, ['done']);
|
|
7637
|
+
if (fromDone != null) {
|
|
7638
|
+
setValueByPath(toObject, ['done'], fromDone);
|
|
7639
|
+
}
|
|
7640
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
7641
|
+
if (fromError != null) {
|
|
7642
|
+
setValueByPath(toObject, ['error'], fromError);
|
|
7643
|
+
}
|
|
7644
|
+
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
7645
|
+
if (fromResponse != null) {
|
|
7646
|
+
setValueByPath(toObject, ['response'], importFileResponseFromMldev(fromResponse));
|
|
7647
|
+
}
|
|
7648
|
+
return toObject;
|
|
7649
|
+
}
|
|
7650
|
+
function importFileParametersToMldev(fromObject) {
|
|
7651
|
+
const toObject = {};
|
|
7652
|
+
const fromFileSearchStoreName = getValueByPath(fromObject, [
|
|
7653
|
+
'fileSearchStoreName',
|
|
7654
|
+
]);
|
|
7655
|
+
if (fromFileSearchStoreName != null) {
|
|
7656
|
+
setValueByPath(toObject, ['_url', 'file_search_store_name'], fromFileSearchStoreName);
|
|
7657
|
+
}
|
|
7658
|
+
const fromFileName = getValueByPath(fromObject, ['fileName']);
|
|
7659
|
+
if (fromFileName != null) {
|
|
7660
|
+
setValueByPath(toObject, ['fileName'], fromFileName);
|
|
7661
|
+
}
|
|
7662
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
7663
|
+
if (fromConfig != null) {
|
|
7664
|
+
importFileConfigToMldev(fromConfig, toObject);
|
|
7665
|
+
}
|
|
7666
|
+
return toObject;
|
|
7667
|
+
}
|
|
7668
|
+
function importFileResponseFromMldev(fromObject) {
|
|
7669
|
+
const toObject = {};
|
|
7670
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
7671
|
+
'sdkHttpResponse',
|
|
7672
|
+
]);
|
|
7673
|
+
if (fromSdkHttpResponse != null) {
|
|
7674
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
7675
|
+
}
|
|
7676
|
+
const fromParent = getValueByPath(fromObject, ['parent']);
|
|
7677
|
+
if (fromParent != null) {
|
|
7678
|
+
setValueByPath(toObject, ['parent'], fromParent);
|
|
7679
|
+
}
|
|
7680
|
+
const fromDocumentName = getValueByPath(fromObject, ['documentName']);
|
|
7681
|
+
if (fromDocumentName != null) {
|
|
7682
|
+
setValueByPath(toObject, ['documentName'], fromDocumentName);
|
|
7683
|
+
}
|
|
7684
|
+
return toObject;
|
|
7685
|
+
}
|
|
7686
|
+
function listFileSearchStoresConfigToMldev(fromObject, parentObject) {
|
|
7687
|
+
const toObject = {};
|
|
7688
|
+
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
7689
|
+
if (parentObject !== undefined && fromPageSize != null) {
|
|
7690
|
+
setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
|
|
7691
|
+
}
|
|
7692
|
+
const fromPageToken = getValueByPath(fromObject, ['pageToken']);
|
|
7693
|
+
if (parentObject !== undefined && fromPageToken != null) {
|
|
7694
|
+
setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
|
|
7695
|
+
}
|
|
7696
|
+
return toObject;
|
|
7697
|
+
}
|
|
7698
|
+
function listFileSearchStoresParametersToMldev(fromObject) {
|
|
7699
|
+
const toObject = {};
|
|
7700
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
7701
|
+
if (fromConfig != null) {
|
|
7702
|
+
listFileSearchStoresConfigToMldev(fromConfig, toObject);
|
|
7703
|
+
}
|
|
7704
|
+
return toObject;
|
|
7705
|
+
}
|
|
7706
|
+
function listFileSearchStoresResponseFromMldev(fromObject) {
|
|
7707
|
+
const toObject = {};
|
|
7708
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
7709
|
+
'sdkHttpResponse',
|
|
7710
|
+
]);
|
|
7711
|
+
if (fromSdkHttpResponse != null) {
|
|
7712
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
7713
|
+
}
|
|
7714
|
+
const fromNextPageToken = getValueByPath(fromObject, [
|
|
7715
|
+
'nextPageToken',
|
|
7716
|
+
]);
|
|
7717
|
+
if (fromNextPageToken != null) {
|
|
7718
|
+
setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
|
|
7719
|
+
}
|
|
7720
|
+
const fromFileSearchStores = getValueByPath(fromObject, [
|
|
7721
|
+
'fileSearchStores',
|
|
7722
|
+
]);
|
|
7723
|
+
if (fromFileSearchStores != null) {
|
|
7724
|
+
let transformedList = fromFileSearchStores;
|
|
7725
|
+
if (Array.isArray(transformedList)) {
|
|
7726
|
+
transformedList = transformedList.map((item) => {
|
|
7727
|
+
return item;
|
|
7728
|
+
});
|
|
7729
|
+
}
|
|
7730
|
+
setValueByPath(toObject, ['fileSearchStores'], transformedList);
|
|
7731
|
+
}
|
|
7732
|
+
return toObject;
|
|
7733
|
+
}
|
|
7734
|
+
function uploadToFileSearchStoreConfigToMldev(fromObject, parentObject) {
|
|
7735
|
+
const toObject = {};
|
|
7736
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
7737
|
+
if (parentObject !== undefined && fromMimeType != null) {
|
|
7738
|
+
setValueByPath(parentObject, ['mimeType'], fromMimeType);
|
|
7739
|
+
}
|
|
7740
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
7741
|
+
if (parentObject !== undefined && fromDisplayName != null) {
|
|
7742
|
+
setValueByPath(parentObject, ['displayName'], fromDisplayName);
|
|
7743
|
+
}
|
|
7744
|
+
const fromCustomMetadata = getValueByPath(fromObject, [
|
|
7745
|
+
'customMetadata',
|
|
7746
|
+
]);
|
|
7747
|
+
if (parentObject !== undefined && fromCustomMetadata != null) {
|
|
7748
|
+
let transformedList = fromCustomMetadata;
|
|
7749
|
+
if (Array.isArray(transformedList)) {
|
|
7750
|
+
transformedList = transformedList.map((item) => {
|
|
7751
|
+
return item;
|
|
7752
|
+
});
|
|
7753
|
+
}
|
|
7754
|
+
setValueByPath(parentObject, ['customMetadata'], transformedList);
|
|
7755
|
+
}
|
|
7756
|
+
const fromChunkingConfig = getValueByPath(fromObject, [
|
|
7757
|
+
'chunkingConfig',
|
|
7758
|
+
]);
|
|
7759
|
+
if (parentObject !== undefined && fromChunkingConfig != null) {
|
|
7760
|
+
setValueByPath(parentObject, ['chunkingConfig'], fromChunkingConfig);
|
|
7761
|
+
}
|
|
7762
|
+
return toObject;
|
|
7763
|
+
}
|
|
7764
|
+
function uploadToFileSearchStoreParametersToMldev(fromObject) {
|
|
7765
|
+
const toObject = {};
|
|
7766
|
+
const fromFileSearchStoreName = getValueByPath(fromObject, [
|
|
7767
|
+
'fileSearchStoreName',
|
|
7768
|
+
]);
|
|
7769
|
+
if (fromFileSearchStoreName != null) {
|
|
7770
|
+
setValueByPath(toObject, ['_url', 'file_search_store_name'], fromFileSearchStoreName);
|
|
7771
|
+
}
|
|
7772
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
7773
|
+
if (fromConfig != null) {
|
|
7774
|
+
uploadToFileSearchStoreConfigToMldev(fromConfig, toObject);
|
|
7775
|
+
}
|
|
7776
|
+
return toObject;
|
|
7777
|
+
}
|
|
7778
|
+
function uploadToFileSearchStoreResumableResponseFromMldev(fromObject) {
|
|
7779
|
+
const toObject = {};
|
|
7780
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
7781
|
+
'sdkHttpResponse',
|
|
7782
|
+
]);
|
|
7783
|
+
if (fromSdkHttpResponse != null) {
|
|
7784
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
7785
|
+
}
|
|
7786
|
+
return toObject;
|
|
7787
|
+
}
|
|
7788
|
+
|
|
7789
|
+
/**
|
|
7790
|
+
* @license
|
|
7791
|
+
* Copyright 2025 Google LLC
|
|
7792
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
7793
|
+
*/
|
|
7794
|
+
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
|
|
7795
|
+
function deleteDocumentConfigToMldev(fromObject, parentObject) {
|
|
7796
|
+
const toObject = {};
|
|
7797
|
+
const fromForce = getValueByPath(fromObject, ['force']);
|
|
7798
|
+
if (parentObject !== undefined && fromForce != null) {
|
|
7799
|
+
setValueByPath(parentObject, ['_query', 'force'], fromForce);
|
|
7800
|
+
}
|
|
7801
|
+
return toObject;
|
|
7802
|
+
}
|
|
7803
|
+
function deleteDocumentParametersToMldev(fromObject) {
|
|
7804
|
+
const toObject = {};
|
|
7805
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
7806
|
+
if (fromName != null) {
|
|
7807
|
+
setValueByPath(toObject, ['_url', 'name'], fromName);
|
|
7808
|
+
}
|
|
7809
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
7810
|
+
if (fromConfig != null) {
|
|
7811
|
+
deleteDocumentConfigToMldev(fromConfig, toObject);
|
|
7812
|
+
}
|
|
7813
|
+
return toObject;
|
|
7814
|
+
}
|
|
7815
|
+
function getDocumentParametersToMldev(fromObject) {
|
|
7816
|
+
const toObject = {};
|
|
7817
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
7818
|
+
if (fromName != null) {
|
|
7819
|
+
setValueByPath(toObject, ['_url', 'name'], fromName);
|
|
7820
|
+
}
|
|
7821
|
+
return toObject;
|
|
7822
|
+
}
|
|
7823
|
+
function listDocumentsConfigToMldev(fromObject, parentObject) {
|
|
7824
|
+
const toObject = {};
|
|
7825
|
+
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
7826
|
+
if (parentObject !== undefined && fromPageSize != null) {
|
|
7827
|
+
setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
|
|
7828
|
+
}
|
|
7829
|
+
const fromPageToken = getValueByPath(fromObject, ['pageToken']);
|
|
7830
|
+
if (parentObject !== undefined && fromPageToken != null) {
|
|
7831
|
+
setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
|
|
7832
|
+
}
|
|
7833
|
+
return toObject;
|
|
7834
|
+
}
|
|
7835
|
+
function listDocumentsParametersToMldev(fromObject) {
|
|
7836
|
+
const toObject = {};
|
|
7837
|
+
const fromParent = getValueByPath(fromObject, ['parent']);
|
|
7838
|
+
if (fromParent != null) {
|
|
7839
|
+
setValueByPath(toObject, ['_url', 'parent'], fromParent);
|
|
7840
|
+
}
|
|
7841
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
7842
|
+
if (fromConfig != null) {
|
|
7843
|
+
listDocumentsConfigToMldev(fromConfig, toObject);
|
|
7844
|
+
}
|
|
7845
|
+
return toObject;
|
|
7846
|
+
}
|
|
7847
|
+
function listDocumentsResponseFromMldev(fromObject) {
|
|
7848
|
+
const toObject = {};
|
|
7849
|
+
const fromSdkHttpResponse = getValueByPath(fromObject, [
|
|
7850
|
+
'sdkHttpResponse',
|
|
7851
|
+
]);
|
|
7852
|
+
if (fromSdkHttpResponse != null) {
|
|
7853
|
+
setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
|
|
7854
|
+
}
|
|
7855
|
+
const fromNextPageToken = getValueByPath(fromObject, [
|
|
7856
|
+
'nextPageToken',
|
|
7857
|
+
]);
|
|
7858
|
+
if (fromNextPageToken != null) {
|
|
7859
|
+
setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
|
|
7860
|
+
}
|
|
7861
|
+
const fromDocuments = getValueByPath(fromObject, ['documents']);
|
|
7862
|
+
if (fromDocuments != null) {
|
|
7863
|
+
let transformedList = fromDocuments;
|
|
7864
|
+
if (Array.isArray(transformedList)) {
|
|
7865
|
+
transformedList = transformedList.map((item) => {
|
|
7866
|
+
return item;
|
|
7867
|
+
});
|
|
7868
|
+
}
|
|
7869
|
+
setValueByPath(toObject, ['documents'], transformedList);
|
|
7870
|
+
}
|
|
7871
|
+
return toObject;
|
|
7872
|
+
}
|
|
7873
|
+
|
|
7874
|
+
/**
|
|
7875
|
+
* @license
|
|
7876
|
+
* Copyright 2025 Google LLC
|
|
7877
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
7878
|
+
*/
|
|
7879
|
+
class Documents extends BaseModule {
|
|
7880
|
+
constructor(apiClient) {
|
|
7881
|
+
super();
|
|
7882
|
+
this.apiClient = apiClient;
|
|
7883
|
+
/**
|
|
7884
|
+
* Lists documents.
|
|
7885
|
+
*
|
|
7886
|
+
* @param params - The parameters for the list request.
|
|
7887
|
+
* @return - A pager of documents.
|
|
7888
|
+
*
|
|
7889
|
+
* @example
|
|
7890
|
+
* ```ts
|
|
7891
|
+
* const documents = await ai.documents.list({config: {'pageSize': 2}});
|
|
7892
|
+
* for await (const document of documents) {
|
|
7893
|
+
* console.log(document);
|
|
7894
|
+
* }
|
|
7895
|
+
* ```
|
|
7896
|
+
*/
|
|
7897
|
+
this.list = async (params) => {
|
|
7898
|
+
return new Pager(exports.PagedItem.PAGED_ITEM_DOCUMENTS, (x) => this.listInternal({
|
|
7899
|
+
parent: params.parent,
|
|
7900
|
+
config: x.config,
|
|
7901
|
+
}), await this.listInternal(params), params);
|
|
7902
|
+
};
|
|
7903
|
+
}
|
|
7904
|
+
/**
|
|
7905
|
+
* Gets a Document.
|
|
7906
|
+
*
|
|
7907
|
+
* @param params - The parameters for getting a document.
|
|
7908
|
+
* @return Document.
|
|
7909
|
+
*/
|
|
7910
|
+
async get(params) {
|
|
7911
|
+
var _a, _b;
|
|
7912
|
+
let response;
|
|
7913
|
+
let path = '';
|
|
7914
|
+
let queryParams = {};
|
|
7915
|
+
if (this.apiClient.isVertexAI()) {
|
|
7916
|
+
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
7917
|
+
}
|
|
7918
|
+
else {
|
|
7919
|
+
const body = getDocumentParametersToMldev(params);
|
|
7920
|
+
path = formatMap('{name}', body['_url']);
|
|
7921
|
+
queryParams = body['_query'];
|
|
7922
|
+
delete body['_url'];
|
|
7923
|
+
delete body['_query'];
|
|
7924
|
+
response = this.apiClient
|
|
7925
|
+
.request({
|
|
7926
|
+
path: path,
|
|
7927
|
+
queryParams: queryParams,
|
|
7928
|
+
body: JSON.stringify(body),
|
|
7929
|
+
httpMethod: 'GET',
|
|
7930
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
7931
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
7932
|
+
})
|
|
7933
|
+
.then((httpResponse) => {
|
|
7934
|
+
return httpResponse.json();
|
|
7935
|
+
});
|
|
7936
|
+
return response.then((resp) => {
|
|
7937
|
+
return resp;
|
|
7938
|
+
});
|
|
7939
|
+
}
|
|
7940
|
+
}
|
|
7941
|
+
/**
|
|
7942
|
+
* Deletes a Document.
|
|
7943
|
+
*
|
|
7944
|
+
* @param params - The parameters for deleting a document.
|
|
7945
|
+
*/
|
|
7946
|
+
async delete(params) {
|
|
7947
|
+
var _a, _b;
|
|
7948
|
+
let path = '';
|
|
7949
|
+
let queryParams = {};
|
|
7950
|
+
if (this.apiClient.isVertexAI()) {
|
|
7951
|
+
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
7952
|
+
}
|
|
7953
|
+
else {
|
|
7954
|
+
const body = deleteDocumentParametersToMldev(params);
|
|
7955
|
+
path = formatMap('{name}', body['_url']);
|
|
7956
|
+
queryParams = body['_query'];
|
|
7957
|
+
delete body['_url'];
|
|
7958
|
+
delete body['_query'];
|
|
7959
|
+
await this.apiClient.request({
|
|
7960
|
+
path: path,
|
|
7961
|
+
queryParams: queryParams,
|
|
7962
|
+
body: JSON.stringify(body),
|
|
7963
|
+
httpMethod: 'DELETE',
|
|
7964
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
7965
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
7966
|
+
});
|
|
7967
|
+
}
|
|
7968
|
+
}
|
|
7969
|
+
/**
|
|
7970
|
+
* Lists all Documents in a FileSearchStore.
|
|
7971
|
+
*
|
|
7972
|
+
* @param params - The parameters for listing documents.
|
|
7973
|
+
* @return ListDocumentsResponse.
|
|
7974
|
+
*/
|
|
7975
|
+
async listInternal(params) {
|
|
7976
|
+
var _a, _b;
|
|
7977
|
+
let response;
|
|
7978
|
+
let path = '';
|
|
7979
|
+
let queryParams = {};
|
|
7980
|
+
if (this.apiClient.isVertexAI()) {
|
|
7981
|
+
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
7982
|
+
}
|
|
7983
|
+
else {
|
|
7984
|
+
const body = listDocumentsParametersToMldev(params);
|
|
7985
|
+
path = formatMap('{parent}/documents', body['_url']);
|
|
7986
|
+
queryParams = body['_query'];
|
|
7987
|
+
delete body['_url'];
|
|
7988
|
+
delete body['_query'];
|
|
7989
|
+
response = this.apiClient
|
|
7990
|
+
.request({
|
|
7991
|
+
path: path,
|
|
7992
|
+
queryParams: queryParams,
|
|
7993
|
+
body: JSON.stringify(body),
|
|
7994
|
+
httpMethod: 'GET',
|
|
7995
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
7996
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
7997
|
+
})
|
|
7998
|
+
.then((httpResponse) => {
|
|
7999
|
+
return httpResponse.json();
|
|
8000
|
+
});
|
|
8001
|
+
return response.then((apiResponse) => {
|
|
8002
|
+
const resp = listDocumentsResponseFromMldev(apiResponse);
|
|
8003
|
+
const typedResp = new ListDocumentsResponse();
|
|
8004
|
+
Object.assign(typedResp, resp);
|
|
8005
|
+
return typedResp;
|
|
8006
|
+
});
|
|
8007
|
+
}
|
|
8008
|
+
}
|
|
8009
|
+
}
|
|
8010
|
+
|
|
8011
|
+
/**
|
|
8012
|
+
* @license
|
|
8013
|
+
* Copyright 2025 Google LLC
|
|
8014
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
8015
|
+
*/
|
|
8016
|
+
class FileSearchStores extends BaseModule {
|
|
8017
|
+
constructor(apiClient, documents = new Documents(apiClient)) {
|
|
8018
|
+
super();
|
|
8019
|
+
this.apiClient = apiClient;
|
|
8020
|
+
this.documents = documents;
|
|
8021
|
+
/**
|
|
8022
|
+
* Lists file search stores.
|
|
8023
|
+
*
|
|
8024
|
+
* @param params - The parameters for the list request.
|
|
8025
|
+
* @return - A pager of file search stores.
|
|
8026
|
+
*
|
|
8027
|
+
* @example
|
|
8028
|
+
* ```ts
|
|
8029
|
+
* const fileSearchStores = await ai.fileSearchStores.list({config: {'pageSize': 2}});
|
|
8030
|
+
* for await (const fileSearchStore of fileSearchStores) {
|
|
8031
|
+
* console.log(fileSearchStore);
|
|
8032
|
+
* }
|
|
8033
|
+
* ```
|
|
8034
|
+
*/
|
|
8035
|
+
this.list = async (params = {}) => {
|
|
8036
|
+
return new Pager(exports.PagedItem.PAGED_ITEM_FILE_SEARCH_STORES, (x) => this.listInternal(x), await this.listInternal(params), params);
|
|
8037
|
+
};
|
|
8038
|
+
}
|
|
8039
|
+
/**
|
|
8040
|
+
* Uploads a file asynchronously to a given File Search Store.
|
|
8041
|
+
* This method is not available in Vertex AI.
|
|
8042
|
+
* Supported upload sources:
|
|
8043
|
+
* - Node.js: File path (string) or Blob object.
|
|
8044
|
+
* - Browser: Blob object (e.g., File).
|
|
8045
|
+
*
|
|
8046
|
+
* @remarks
|
|
8047
|
+
* The `mimeType` can be specified in the `config` parameter. If omitted:
|
|
8048
|
+
* - For file path (string) inputs, the `mimeType` will be inferred from the
|
|
8049
|
+
* file extension.
|
|
8050
|
+
* - For Blob object inputs, the `mimeType` will be set to the Blob's `type`
|
|
8051
|
+
* property.
|
|
8052
|
+
*
|
|
8053
|
+
* This section can contain multiple paragraphs and code examples.
|
|
8054
|
+
*
|
|
8055
|
+
* @param params - Optional parameters specified in the
|
|
8056
|
+
* `types.UploadToFileSearchStoreParameters` interface.
|
|
8057
|
+
* @see {@link types.UploadToFileSearchStoreParameters#config} for the optional
|
|
8058
|
+
* config in the parameters.
|
|
8059
|
+
* @return A promise that resolves to a long running operation.
|
|
8060
|
+
* @throws An error if called on a Vertex AI client.
|
|
8061
|
+
* @throws An error if the `mimeType` is not provided and can not be inferred,
|
|
8062
|
+
* the `mimeType` can be provided in the `params.config` parameter.
|
|
8063
|
+
* @throws An error occurs if a suitable upload location cannot be established.
|
|
8064
|
+
*
|
|
8065
|
+
* @example
|
|
8066
|
+
* The following code uploads a file to a given file search store.
|
|
8067
|
+
*
|
|
8068
|
+
* ```ts
|
|
8069
|
+
* const operation = await ai.fileSearchStores.upload({fileSearchStoreName: 'fileSearchStores/foo-bar', file: 'file.txt', config: {
|
|
8070
|
+
* mimeType: 'text/plain',
|
|
8071
|
+
* }});
|
|
8072
|
+
* console.log(operation.name);
|
|
8073
|
+
* ```
|
|
8074
|
+
*/
|
|
8075
|
+
async uploadToFileSearchStore(params) {
|
|
8076
|
+
if (this.apiClient.isVertexAI()) {
|
|
8077
|
+
throw new Error('Vertex AI does not support uploading files to a file search store.');
|
|
8078
|
+
}
|
|
8079
|
+
return this.apiClient.uploadFileToFileSearchStore(params.fileSearchStoreName, params.file, params.config);
|
|
8080
|
+
}
|
|
8081
|
+
/**
|
|
8082
|
+
* Creates a File Search Store.
|
|
8083
|
+
*
|
|
8084
|
+
* @param params - The parameters for creating a File Search Store.
|
|
8085
|
+
* @return FileSearchStore.
|
|
8086
|
+
*/
|
|
8087
|
+
async create(params) {
|
|
8088
|
+
var _a, _b;
|
|
8089
|
+
let response;
|
|
8090
|
+
let path = '';
|
|
8091
|
+
let queryParams = {};
|
|
8092
|
+
if (this.apiClient.isVertexAI()) {
|
|
8093
|
+
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
8094
|
+
}
|
|
8095
|
+
else {
|
|
8096
|
+
const body = createFileSearchStoreParametersToMldev(params);
|
|
8097
|
+
path = formatMap('fileSearchStores', body['_url']);
|
|
8098
|
+
queryParams = body['_query'];
|
|
8099
|
+
delete body['_url'];
|
|
8100
|
+
delete body['_query'];
|
|
8101
|
+
response = this.apiClient
|
|
8102
|
+
.request({
|
|
8103
|
+
path: path,
|
|
8104
|
+
queryParams: queryParams,
|
|
8105
|
+
body: JSON.stringify(body),
|
|
8106
|
+
httpMethod: 'POST',
|
|
8107
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
8108
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
8109
|
+
})
|
|
8110
|
+
.then((httpResponse) => {
|
|
8111
|
+
return httpResponse.json();
|
|
8112
|
+
});
|
|
8113
|
+
return response.then((resp) => {
|
|
8114
|
+
return resp;
|
|
8115
|
+
});
|
|
8116
|
+
}
|
|
8117
|
+
}
|
|
8118
|
+
/**
|
|
8119
|
+
* Gets a File Search Store.
|
|
8120
|
+
*
|
|
8121
|
+
* @param params - The parameters for getting a File Search Store.
|
|
8122
|
+
* @return FileSearchStore.
|
|
8123
|
+
*/
|
|
8124
|
+
async get(params) {
|
|
8125
|
+
var _a, _b;
|
|
8126
|
+
let response;
|
|
8127
|
+
let path = '';
|
|
8128
|
+
let queryParams = {};
|
|
8129
|
+
if (this.apiClient.isVertexAI()) {
|
|
8130
|
+
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
8131
|
+
}
|
|
8132
|
+
else {
|
|
8133
|
+
const body = getFileSearchStoreParametersToMldev(params);
|
|
8134
|
+
path = formatMap('{name}', body['_url']);
|
|
8135
|
+
queryParams = body['_query'];
|
|
8136
|
+
delete body['_url'];
|
|
8137
|
+
delete body['_query'];
|
|
8138
|
+
response = this.apiClient
|
|
8139
|
+
.request({
|
|
8140
|
+
path: path,
|
|
8141
|
+
queryParams: queryParams,
|
|
8142
|
+
body: JSON.stringify(body),
|
|
8143
|
+
httpMethod: 'GET',
|
|
8144
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
8145
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
8146
|
+
})
|
|
8147
|
+
.then((httpResponse) => {
|
|
8148
|
+
return httpResponse.json();
|
|
8149
|
+
});
|
|
8150
|
+
return response.then((resp) => {
|
|
8151
|
+
return resp;
|
|
8152
|
+
});
|
|
8153
|
+
}
|
|
8154
|
+
}
|
|
8155
|
+
/**
|
|
8156
|
+
* Deletes a File Search Store.
|
|
8157
|
+
*
|
|
8158
|
+
* @param params - The parameters for deleting a File Search Store.
|
|
8159
|
+
*/
|
|
8160
|
+
async delete(params) {
|
|
8161
|
+
var _a, _b;
|
|
8162
|
+
let path = '';
|
|
8163
|
+
let queryParams = {};
|
|
8164
|
+
if (this.apiClient.isVertexAI()) {
|
|
8165
|
+
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
8166
|
+
}
|
|
8167
|
+
else {
|
|
8168
|
+
const body = deleteFileSearchStoreParametersToMldev(params);
|
|
8169
|
+
path = formatMap('{name}', body['_url']);
|
|
8170
|
+
queryParams = body['_query'];
|
|
8171
|
+
delete body['_url'];
|
|
8172
|
+
delete body['_query'];
|
|
8173
|
+
await this.apiClient.request({
|
|
8174
|
+
path: path,
|
|
8175
|
+
queryParams: queryParams,
|
|
8176
|
+
body: JSON.stringify(body),
|
|
8177
|
+
httpMethod: 'DELETE',
|
|
8178
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
8179
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
8180
|
+
});
|
|
8181
|
+
}
|
|
8182
|
+
}
|
|
8183
|
+
/**
|
|
8184
|
+
* Lists all FileSearchStore owned by the user.
|
|
8185
|
+
*
|
|
8186
|
+
* @param params - The parameters for listing file search stores.
|
|
8187
|
+
* @return ListFileSearchStoresResponse.
|
|
8188
|
+
*/
|
|
8189
|
+
async listInternal(params) {
|
|
8190
|
+
var _a, _b;
|
|
8191
|
+
let response;
|
|
8192
|
+
let path = '';
|
|
8193
|
+
let queryParams = {};
|
|
8194
|
+
if (this.apiClient.isVertexAI()) {
|
|
8195
|
+
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
8196
|
+
}
|
|
8197
|
+
else {
|
|
8198
|
+
const body = listFileSearchStoresParametersToMldev(params);
|
|
8199
|
+
path = formatMap('fileSearchStores', body['_url']);
|
|
8200
|
+
queryParams = body['_query'];
|
|
8201
|
+
delete body['_url'];
|
|
8202
|
+
delete body['_query'];
|
|
8203
|
+
response = this.apiClient
|
|
8204
|
+
.request({
|
|
8205
|
+
path: path,
|
|
8206
|
+
queryParams: queryParams,
|
|
8207
|
+
body: JSON.stringify(body),
|
|
8208
|
+
httpMethod: 'GET',
|
|
8209
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
8210
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
8211
|
+
})
|
|
8212
|
+
.then((httpResponse) => {
|
|
8213
|
+
return httpResponse.json();
|
|
8214
|
+
});
|
|
8215
|
+
return response.then((apiResponse) => {
|
|
8216
|
+
const resp = listFileSearchStoresResponseFromMldev(apiResponse);
|
|
8217
|
+
const typedResp = new ListFileSearchStoresResponse();
|
|
8218
|
+
Object.assign(typedResp, resp);
|
|
8219
|
+
return typedResp;
|
|
8220
|
+
});
|
|
8221
|
+
}
|
|
8222
|
+
}
|
|
8223
|
+
async uploadToFileSearchStoreInternal(params) {
|
|
7173
8224
|
var _a, _b;
|
|
7174
8225
|
let response;
|
|
7175
8226
|
let path = '';
|
|
@@ -7178,8 +8229,8 @@ class Files extends BaseModule {
|
|
|
7178
8229
|
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
7179
8230
|
}
|
|
7180
8231
|
else {
|
|
7181
|
-
const body =
|
|
7182
|
-
path = formatMap('
|
|
8232
|
+
const body = uploadToFileSearchStoreParametersToMldev(params);
|
|
8233
|
+
path = formatMap('upload/v1beta/{file_search_store_name}:uploadToFileSearchStore', body['_url']);
|
|
7183
8234
|
queryParams = body['_query'];
|
|
7184
8235
|
delete body['_url'];
|
|
7185
8236
|
delete body['_query'];
|
|
@@ -7188,32 +8239,30 @@ class Files extends BaseModule {
|
|
|
7188
8239
|
path: path,
|
|
7189
8240
|
queryParams: queryParams,
|
|
7190
8241
|
body: JSON.stringify(body),
|
|
7191
|
-
httpMethod: '
|
|
8242
|
+
httpMethod: 'POST',
|
|
7192
8243
|
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
7193
8244
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
7194
8245
|
})
|
|
7195
8246
|
.then((httpResponse) => {
|
|
7196
8247
|
return httpResponse.json();
|
|
7197
8248
|
});
|
|
7198
|
-
return response.then((
|
|
7199
|
-
|
|
8249
|
+
return response.then((apiResponse) => {
|
|
8250
|
+
const resp = uploadToFileSearchStoreResumableResponseFromMldev(apiResponse);
|
|
8251
|
+
const typedResp = new UploadToFileSearchStoreResumableResponse();
|
|
8252
|
+
Object.assign(typedResp, resp);
|
|
8253
|
+
return typedResp;
|
|
7200
8254
|
});
|
|
7201
8255
|
}
|
|
7202
8256
|
}
|
|
7203
8257
|
/**
|
|
7204
|
-
*
|
|
7205
|
-
*
|
|
7206
|
-
* @param params - The parameters for the delete request.
|
|
7207
|
-
* @return The DeleteFileResponse, the response for the delete method.
|
|
8258
|
+
* Imports a File from File Service to a FileSearchStore.
|
|
7208
8259
|
*
|
|
7209
|
-
*
|
|
7210
|
-
* The following code deletes an example file named "files/mehozpxf877d".
|
|
8260
|
+
* This is a long-running operation, see aip.dev/151
|
|
7211
8261
|
*
|
|
7212
|
-
*
|
|
7213
|
-
*
|
|
7214
|
-
* ```
|
|
8262
|
+
* @param params - The parameters for importing a file to a file search store.
|
|
8263
|
+
* @return ImportFileOperation.
|
|
7215
8264
|
*/
|
|
7216
|
-
async
|
|
8265
|
+
async importFile(params) {
|
|
7217
8266
|
var _a, _b;
|
|
7218
8267
|
let response;
|
|
7219
8268
|
let path = '';
|
|
@@ -7222,8 +8271,8 @@ class Files extends BaseModule {
|
|
|
7222
8271
|
throw new Error('This method is only supported by the Gemini Developer API.');
|
|
7223
8272
|
}
|
|
7224
8273
|
else {
|
|
7225
|
-
const body =
|
|
7226
|
-
path = formatMap('
|
|
8274
|
+
const body = importFileParametersToMldev(params);
|
|
8275
|
+
path = formatMap('{file_search_store_name}:importFile', body['_url']);
|
|
7227
8276
|
queryParams = body['_query'];
|
|
7228
8277
|
delete body['_url'];
|
|
7229
8278
|
delete body['_query'];
|
|
@@ -7232,22 +8281,16 @@ class Files extends BaseModule {
|
|
|
7232
8281
|
path: path,
|
|
7233
8282
|
queryParams: queryParams,
|
|
7234
8283
|
body: JSON.stringify(body),
|
|
7235
|
-
httpMethod: '
|
|
8284
|
+
httpMethod: 'POST',
|
|
7236
8285
|
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
7237
8286
|
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
7238
8287
|
})
|
|
7239
8288
|
.then((httpResponse) => {
|
|
7240
|
-
return httpResponse.json()
|
|
7241
|
-
const response = jsonResponse;
|
|
7242
|
-
response.sdkHttpResponse = {
|
|
7243
|
-
headers: httpResponse.headers,
|
|
7244
|
-
};
|
|
7245
|
-
return response;
|
|
7246
|
-
});
|
|
8289
|
+
return httpResponse.json();
|
|
7247
8290
|
});
|
|
7248
8291
|
return response.then((apiResponse) => {
|
|
7249
|
-
const resp =
|
|
7250
|
-
const typedResp = new
|
|
8292
|
+
const resp = importFileOperationFromMldev(apiResponse);
|
|
8293
|
+
const typedResp = new ImportFileOperation();
|
|
7251
8294
|
Object.assign(typedResp, resp);
|
|
7252
8295
|
return typedResp;
|
|
7253
8296
|
});
|
|
@@ -7262,13 +8305,13 @@ class Files extends BaseModule {
|
|
|
7262
8305
|
*/
|
|
7263
8306
|
function blobToMldev$2(fromObject) {
|
|
7264
8307
|
const toObject = {};
|
|
7265
|
-
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
7266
|
-
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
7267
|
-
}
|
|
7268
8308
|
const fromData = getValueByPath(fromObject, ['data']);
|
|
7269
8309
|
if (fromData != null) {
|
|
7270
8310
|
setValueByPath(toObject, ['data'], fromData);
|
|
7271
8311
|
}
|
|
8312
|
+
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
8313
|
+
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
8314
|
+
}
|
|
7272
8315
|
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
7273
8316
|
if (fromMimeType != null) {
|
|
7274
8317
|
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
@@ -7351,6 +8394,12 @@ function generationConfigToVertex$1(fromObject) {
|
|
|
7351
8394
|
if (fromModelSelectionConfig != null) {
|
|
7352
8395
|
setValueByPath(toObject, ['modelConfig'], fromModelSelectionConfig);
|
|
7353
8396
|
}
|
|
8397
|
+
const fromResponseJsonSchema = getValueByPath(fromObject, [
|
|
8398
|
+
'responseJsonSchema',
|
|
8399
|
+
]);
|
|
8400
|
+
if (fromResponseJsonSchema != null) {
|
|
8401
|
+
setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
|
|
8402
|
+
}
|
|
7354
8403
|
const fromAudioTimestamp = getValueByPath(fromObject, [
|
|
7355
8404
|
'audioTimestamp',
|
|
7356
8405
|
]);
|
|
@@ -7397,12 +8446,6 @@ function generationConfigToVertex$1(fromObject) {
|
|
|
7397
8446
|
if (fromPresencePenalty != null) {
|
|
7398
8447
|
setValueByPath(toObject, ['presencePenalty'], fromPresencePenalty);
|
|
7399
8448
|
}
|
|
7400
|
-
const fromResponseJsonSchema = getValueByPath(fromObject, [
|
|
7401
|
-
'responseJsonSchema',
|
|
7402
|
-
]);
|
|
7403
|
-
if (fromResponseJsonSchema != null) {
|
|
7404
|
-
setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
|
|
7405
|
-
}
|
|
7406
8449
|
const fromResponseLogprobs = getValueByPath(fromObject, [
|
|
7407
8450
|
'responseLogprobs',
|
|
7408
8451
|
]);
|
|
@@ -7484,15 +8527,18 @@ function googleMapsToMldev$2(fromObject) {
|
|
|
7484
8527
|
}
|
|
7485
8528
|
function googleSearchToMldev$2(fromObject) {
|
|
7486
8529
|
const toObject = {};
|
|
8530
|
+
if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
|
|
8531
|
+
throw new Error('excludeDomains parameter is not supported in Gemini API.');
|
|
8532
|
+
}
|
|
8533
|
+
if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
|
|
8534
|
+
throw new Error('blockingConfidence parameter is not supported in Gemini API.');
|
|
8535
|
+
}
|
|
7487
8536
|
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
7488
8537
|
'timeRangeFilter',
|
|
7489
8538
|
]);
|
|
7490
8539
|
if (fromTimeRangeFilter != null) {
|
|
7491
8540
|
setValueByPath(toObject, ['timeRangeFilter'], fromTimeRangeFilter);
|
|
7492
8541
|
}
|
|
7493
|
-
if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
|
|
7494
|
-
throw new Error('excludeDomains parameter is not supported in Gemini API.');
|
|
7495
|
-
}
|
|
7496
8542
|
return toObject;
|
|
7497
8543
|
}
|
|
7498
8544
|
function liveConnectConfigToMldev$1(fromObject, parentObject) {
|
|
@@ -7893,30 +8939,6 @@ function liveServerMessageFromVertex(fromObject) {
|
|
|
7893
8939
|
}
|
|
7894
8940
|
function partToMldev$2(fromObject) {
|
|
7895
8941
|
const toObject = {};
|
|
7896
|
-
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
7897
|
-
'videoMetadata',
|
|
7898
|
-
]);
|
|
7899
|
-
if (fromVideoMetadata != null) {
|
|
7900
|
-
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
7901
|
-
}
|
|
7902
|
-
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
7903
|
-
if (fromThought != null) {
|
|
7904
|
-
setValueByPath(toObject, ['thought'], fromThought);
|
|
7905
|
-
}
|
|
7906
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
7907
|
-
if (fromInlineData != null) {
|
|
7908
|
-
setValueByPath(toObject, ['inlineData'], blobToMldev$2(fromInlineData));
|
|
7909
|
-
}
|
|
7910
|
-
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
7911
|
-
if (fromFileData != null) {
|
|
7912
|
-
setValueByPath(toObject, ['fileData'], fileDataToMldev$2(fromFileData));
|
|
7913
|
-
}
|
|
7914
|
-
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
7915
|
-
'thoughtSignature',
|
|
7916
|
-
]);
|
|
7917
|
-
if (fromThoughtSignature != null) {
|
|
7918
|
-
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
7919
|
-
}
|
|
7920
8942
|
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
7921
8943
|
if (fromFunctionCall != null) {
|
|
7922
8944
|
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
@@ -7933,16 +8955,40 @@ function partToMldev$2(fromObject) {
|
|
|
7933
8955
|
if (fromExecutableCode != null) {
|
|
7934
8956
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
7935
8957
|
}
|
|
8958
|
+
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
8959
|
+
if (fromFileData != null) {
|
|
8960
|
+
setValueByPath(toObject, ['fileData'], fileDataToMldev$2(fromFileData));
|
|
8961
|
+
}
|
|
7936
8962
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
7937
8963
|
'functionResponse',
|
|
7938
8964
|
]);
|
|
7939
8965
|
if (fromFunctionResponse != null) {
|
|
7940
8966
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
7941
8967
|
}
|
|
8968
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
8969
|
+
if (fromInlineData != null) {
|
|
8970
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev$2(fromInlineData));
|
|
8971
|
+
}
|
|
7942
8972
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
7943
8973
|
if (fromText != null) {
|
|
7944
8974
|
setValueByPath(toObject, ['text'], fromText);
|
|
7945
8975
|
}
|
|
8976
|
+
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
8977
|
+
if (fromThought != null) {
|
|
8978
|
+
setValueByPath(toObject, ['thought'], fromThought);
|
|
8979
|
+
}
|
|
8980
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
8981
|
+
'thoughtSignature',
|
|
8982
|
+
]);
|
|
8983
|
+
if (fromThoughtSignature != null) {
|
|
8984
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
8985
|
+
}
|
|
8986
|
+
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
8987
|
+
'videoMetadata',
|
|
8988
|
+
]);
|
|
8989
|
+
if (fromVideoMetadata != null) {
|
|
8990
|
+
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
8991
|
+
}
|
|
7946
8992
|
return toObject;
|
|
7947
8993
|
}
|
|
7948
8994
|
function sessionResumptionConfigToMldev$1(fromObject) {
|
|
@@ -7958,6 +9004,10 @@ function sessionResumptionConfigToMldev$1(fromObject) {
|
|
|
7958
9004
|
}
|
|
7959
9005
|
function speechConfigToVertex$1(fromObject) {
|
|
7960
9006
|
const toObject = {};
|
|
9007
|
+
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
9008
|
+
if (fromLanguageCode != null) {
|
|
9009
|
+
setValueByPath(toObject, ['languageCode'], fromLanguageCode);
|
|
9010
|
+
}
|
|
7961
9011
|
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
7962
9012
|
if (fromVoiceConfig != null) {
|
|
7963
9013
|
setValueByPath(toObject, ['voiceConfig'], fromVoiceConfig);
|
|
@@ -7965,10 +9015,6 @@ function speechConfigToVertex$1(fromObject) {
|
|
|
7965
9015
|
if (getValueByPath(fromObject, ['multiSpeakerVoiceConfig']) !== undefined) {
|
|
7966
9016
|
throw new Error('multiSpeakerVoiceConfig parameter is not supported in Vertex AI.');
|
|
7967
9017
|
}
|
|
7968
|
-
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
7969
|
-
if (fromLanguageCode != null) {
|
|
7970
|
-
setValueByPath(toObject, ['languageCode'], fromLanguageCode);
|
|
7971
|
-
}
|
|
7972
9018
|
return toObject;
|
|
7973
9019
|
}
|
|
7974
9020
|
function toolToMldev$2(fromObject) {
|
|
@@ -7988,16 +9034,26 @@ function toolToMldev$2(fromObject) {
|
|
|
7988
9034
|
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
7989
9035
|
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
7990
9036
|
}
|
|
7991
|
-
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
7992
|
-
if (fromGoogleSearch != null) {
|
|
7993
|
-
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$2(fromGoogleSearch));
|
|
7994
|
-
}
|
|
7995
9037
|
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
7996
9038
|
'googleSearchRetrieval',
|
|
7997
9039
|
]);
|
|
7998
9040
|
if (fromGoogleSearchRetrieval != null) {
|
|
7999
9041
|
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
8000
9042
|
}
|
|
9043
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
9044
|
+
if (fromComputerUse != null) {
|
|
9045
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
9046
|
+
}
|
|
9047
|
+
const fromFileSearch = getValueByPath(fromObject, ['fileSearch']);
|
|
9048
|
+
if (fromFileSearch != null) {
|
|
9049
|
+
setValueByPath(toObject, ['fileSearch'], fromFileSearch);
|
|
9050
|
+
}
|
|
9051
|
+
const fromCodeExecution = getValueByPath(fromObject, [
|
|
9052
|
+
'codeExecution',
|
|
9053
|
+
]);
|
|
9054
|
+
if (fromCodeExecution != null) {
|
|
9055
|
+
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
9056
|
+
}
|
|
8001
9057
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
8002
9058
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
8003
9059
|
}
|
|
@@ -8005,20 +9061,14 @@ function toolToMldev$2(fromObject) {
|
|
|
8005
9061
|
if (fromGoogleMaps != null) {
|
|
8006
9062
|
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$2(fromGoogleMaps));
|
|
8007
9063
|
}
|
|
9064
|
+
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
9065
|
+
if (fromGoogleSearch != null) {
|
|
9066
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$2(fromGoogleSearch));
|
|
9067
|
+
}
|
|
8008
9068
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
8009
9069
|
if (fromUrlContext != null) {
|
|
8010
9070
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
8011
9071
|
}
|
|
8012
|
-
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
8013
|
-
if (fromComputerUse != null) {
|
|
8014
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
8015
|
-
}
|
|
8016
|
-
const fromCodeExecution = getValueByPath(fromObject, [
|
|
8017
|
-
'codeExecution',
|
|
8018
|
-
]);
|
|
8019
|
-
if (fromCodeExecution != null) {
|
|
8020
|
-
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
8021
|
-
}
|
|
8022
9072
|
return toObject;
|
|
8023
9073
|
}
|
|
8024
9074
|
function toolToVertex$1(fromObject) {
|
|
@@ -8039,16 +9089,25 @@ function toolToVertex$1(fromObject) {
|
|
|
8039
9089
|
if (fromRetrieval != null) {
|
|
8040
9090
|
setValueByPath(toObject, ['retrieval'], fromRetrieval);
|
|
8041
9091
|
}
|
|
8042
|
-
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
8043
|
-
if (fromGoogleSearch != null) {
|
|
8044
|
-
setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
|
|
8045
|
-
}
|
|
8046
9092
|
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
8047
9093
|
'googleSearchRetrieval',
|
|
8048
9094
|
]);
|
|
8049
9095
|
if (fromGoogleSearchRetrieval != null) {
|
|
8050
9096
|
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
8051
9097
|
}
|
|
9098
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
9099
|
+
if (fromComputerUse != null) {
|
|
9100
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
9101
|
+
}
|
|
9102
|
+
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
9103
|
+
throw new Error('fileSearch parameter is not supported in Vertex AI.');
|
|
9104
|
+
}
|
|
9105
|
+
const fromCodeExecution = getValueByPath(fromObject, [
|
|
9106
|
+
'codeExecution',
|
|
9107
|
+
]);
|
|
9108
|
+
if (fromCodeExecution != null) {
|
|
9109
|
+
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
9110
|
+
}
|
|
8052
9111
|
const fromEnterpriseWebSearch = getValueByPath(fromObject, [
|
|
8053
9112
|
'enterpriseWebSearch',
|
|
8054
9113
|
]);
|
|
@@ -8059,20 +9118,14 @@ function toolToVertex$1(fromObject) {
|
|
|
8059
9118
|
if (fromGoogleMaps != null) {
|
|
8060
9119
|
setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
|
|
8061
9120
|
}
|
|
9121
|
+
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
9122
|
+
if (fromGoogleSearch != null) {
|
|
9123
|
+
setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
|
|
9124
|
+
}
|
|
8062
9125
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
8063
9126
|
if (fromUrlContext != null) {
|
|
8064
9127
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
8065
9128
|
}
|
|
8066
|
-
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
8067
|
-
if (fromComputerUse != null) {
|
|
8068
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
8069
|
-
}
|
|
8070
|
-
const fromCodeExecution = getValueByPath(fromObject, [
|
|
8071
|
-
'codeExecution',
|
|
8072
|
-
]);
|
|
8073
|
-
if (fromCodeExecution != null) {
|
|
8074
|
-
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
8075
|
-
}
|
|
8076
9129
|
return toObject;
|
|
8077
9130
|
}
|
|
8078
9131
|
function usageMetadataFromVertex(fromObject) {
|
|
@@ -8175,13 +9228,13 @@ function usageMetadataFromVertex(fromObject) {
|
|
|
8175
9228
|
*/
|
|
8176
9229
|
function blobToMldev$1(fromObject) {
|
|
8177
9230
|
const toObject = {};
|
|
8178
|
-
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
8179
|
-
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
8180
|
-
}
|
|
8181
9231
|
const fromData = getValueByPath(fromObject, ['data']);
|
|
8182
9232
|
if (fromData != null) {
|
|
8183
9233
|
setValueByPath(toObject, ['data'], fromData);
|
|
8184
9234
|
}
|
|
9235
|
+
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
9236
|
+
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
9237
|
+
}
|
|
8185
9238
|
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
8186
9239
|
if (fromMimeType != null) {
|
|
8187
9240
|
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
@@ -8208,12 +9261,6 @@ function candidateFromMldev(fromObject) {
|
|
|
8208
9261
|
if (fromFinishReason != null) {
|
|
8209
9262
|
setValueByPath(toObject, ['finishReason'], fromFinishReason);
|
|
8210
9263
|
}
|
|
8211
|
-
const fromUrlContextMetadata = getValueByPath(fromObject, [
|
|
8212
|
-
'urlContextMetadata',
|
|
8213
|
-
]);
|
|
8214
|
-
if (fromUrlContextMetadata != null) {
|
|
8215
|
-
setValueByPath(toObject, ['urlContextMetadata'], fromUrlContextMetadata);
|
|
8216
|
-
}
|
|
8217
9264
|
const fromAvgLogprobs = getValueByPath(fromObject, ['avgLogprobs']);
|
|
8218
9265
|
if (fromAvgLogprobs != null) {
|
|
8219
9266
|
setValueByPath(toObject, ['avgLogprobs'], fromAvgLogprobs);
|
|
@@ -8246,6 +9293,12 @@ function candidateFromMldev(fromObject) {
|
|
|
8246
9293
|
}
|
|
8247
9294
|
setValueByPath(toObject, ['safetyRatings'], transformedList);
|
|
8248
9295
|
}
|
|
9296
|
+
const fromUrlContextMetadata = getValueByPath(fromObject, [
|
|
9297
|
+
'urlContextMetadata',
|
|
9298
|
+
]);
|
|
9299
|
+
if (fromUrlContextMetadata != null) {
|
|
9300
|
+
setValueByPath(toObject, ['urlContextMetadata'], fromUrlContextMetadata);
|
|
9301
|
+
}
|
|
8249
9302
|
return toObject;
|
|
8250
9303
|
}
|
|
8251
9304
|
function citationMetadataFromMldev(fromObject) {
|
|
@@ -10014,6 +11067,12 @@ function generationConfigToVertex(fromObject) {
|
|
|
10014
11067
|
if (fromModelSelectionConfig != null) {
|
|
10015
11068
|
setValueByPath(toObject, ['modelConfig'], fromModelSelectionConfig);
|
|
10016
11069
|
}
|
|
11070
|
+
const fromResponseJsonSchema = getValueByPath(fromObject, [
|
|
11071
|
+
'responseJsonSchema',
|
|
11072
|
+
]);
|
|
11073
|
+
if (fromResponseJsonSchema != null) {
|
|
11074
|
+
setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
|
|
11075
|
+
}
|
|
10017
11076
|
const fromAudioTimestamp = getValueByPath(fromObject, [
|
|
10018
11077
|
'audioTimestamp',
|
|
10019
11078
|
]);
|
|
@@ -10060,12 +11119,6 @@ function generationConfigToVertex(fromObject) {
|
|
|
10060
11119
|
if (fromPresencePenalty != null) {
|
|
10061
11120
|
setValueByPath(toObject, ['presencePenalty'], fromPresencePenalty);
|
|
10062
11121
|
}
|
|
10063
|
-
const fromResponseJsonSchema = getValueByPath(fromObject, [
|
|
10064
|
-
'responseJsonSchema',
|
|
10065
|
-
]);
|
|
10066
|
-
if (fromResponseJsonSchema != null) {
|
|
10067
|
-
setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
|
|
10068
|
-
}
|
|
10069
11122
|
const fromResponseLogprobs = getValueByPath(fromObject, [
|
|
10070
11123
|
'responseLogprobs',
|
|
10071
11124
|
]);
|
|
@@ -10163,15 +11216,18 @@ function googleMapsToMldev$1(fromObject) {
|
|
|
10163
11216
|
}
|
|
10164
11217
|
function googleSearchToMldev$1(fromObject) {
|
|
10165
11218
|
const toObject = {};
|
|
11219
|
+
if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
|
|
11220
|
+
throw new Error('excludeDomains parameter is not supported in Gemini API.');
|
|
11221
|
+
}
|
|
11222
|
+
if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
|
|
11223
|
+
throw new Error('blockingConfidence parameter is not supported in Gemini API.');
|
|
11224
|
+
}
|
|
10166
11225
|
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
10167
11226
|
'timeRangeFilter',
|
|
10168
11227
|
]);
|
|
10169
11228
|
if (fromTimeRangeFilter != null) {
|
|
10170
11229
|
setValueByPath(toObject, ['timeRangeFilter'], fromTimeRangeFilter);
|
|
10171
11230
|
}
|
|
10172
|
-
if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
|
|
10173
|
-
throw new Error('excludeDomains parameter is not supported in Gemini API.');
|
|
10174
|
-
}
|
|
10175
11231
|
return toObject;
|
|
10176
11232
|
}
|
|
10177
11233
|
function imageFromMldev(fromObject) {
|
|
@@ -10454,37 +11510,13 @@ function modelFromVertex(fromObject) {
|
|
|
10454
11510
|
transformedList = transformedList.map((item) => {
|
|
10455
11511
|
return item;
|
|
10456
11512
|
});
|
|
10457
|
-
}
|
|
10458
|
-
setValueByPath(toObject, ['checkpoints'], transformedList);
|
|
10459
|
-
}
|
|
10460
|
-
return toObject;
|
|
10461
|
-
}
|
|
10462
|
-
function partToMldev$1(fromObject) {
|
|
10463
|
-
const toObject = {};
|
|
10464
|
-
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
10465
|
-
'videoMetadata',
|
|
10466
|
-
]);
|
|
10467
|
-
if (fromVideoMetadata != null) {
|
|
10468
|
-
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
10469
|
-
}
|
|
10470
|
-
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
10471
|
-
if (fromThought != null) {
|
|
10472
|
-
setValueByPath(toObject, ['thought'], fromThought);
|
|
10473
|
-
}
|
|
10474
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
10475
|
-
if (fromInlineData != null) {
|
|
10476
|
-
setValueByPath(toObject, ['inlineData'], blobToMldev$1(fromInlineData));
|
|
10477
|
-
}
|
|
10478
|
-
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
10479
|
-
if (fromFileData != null) {
|
|
10480
|
-
setValueByPath(toObject, ['fileData'], fileDataToMldev$1(fromFileData));
|
|
10481
|
-
}
|
|
10482
|
-
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
10483
|
-
'thoughtSignature',
|
|
10484
|
-
]);
|
|
10485
|
-
if (fromThoughtSignature != null) {
|
|
10486
|
-
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
11513
|
+
}
|
|
11514
|
+
setValueByPath(toObject, ['checkpoints'], transformedList);
|
|
10487
11515
|
}
|
|
11516
|
+
return toObject;
|
|
11517
|
+
}
|
|
11518
|
+
function partToMldev$1(fromObject) {
|
|
11519
|
+
const toObject = {};
|
|
10488
11520
|
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
10489
11521
|
if (fromFunctionCall != null) {
|
|
10490
11522
|
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
@@ -10501,16 +11533,40 @@ function partToMldev$1(fromObject) {
|
|
|
10501
11533
|
if (fromExecutableCode != null) {
|
|
10502
11534
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
10503
11535
|
}
|
|
11536
|
+
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
11537
|
+
if (fromFileData != null) {
|
|
11538
|
+
setValueByPath(toObject, ['fileData'], fileDataToMldev$1(fromFileData));
|
|
11539
|
+
}
|
|
10504
11540
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
10505
11541
|
'functionResponse',
|
|
10506
11542
|
]);
|
|
10507
11543
|
if (fromFunctionResponse != null) {
|
|
10508
11544
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
10509
11545
|
}
|
|
11546
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
11547
|
+
if (fromInlineData != null) {
|
|
11548
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev$1(fromInlineData));
|
|
11549
|
+
}
|
|
10510
11550
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
10511
11551
|
if (fromText != null) {
|
|
10512
11552
|
setValueByPath(toObject, ['text'], fromText);
|
|
10513
11553
|
}
|
|
11554
|
+
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
11555
|
+
if (fromThought != null) {
|
|
11556
|
+
setValueByPath(toObject, ['thought'], fromThought);
|
|
11557
|
+
}
|
|
11558
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
11559
|
+
'thoughtSignature',
|
|
11560
|
+
]);
|
|
11561
|
+
if (fromThoughtSignature != null) {
|
|
11562
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
11563
|
+
}
|
|
11564
|
+
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
11565
|
+
'videoMetadata',
|
|
11566
|
+
]);
|
|
11567
|
+
if (fromVideoMetadata != null) {
|
|
11568
|
+
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
11569
|
+
}
|
|
10514
11570
|
return toObject;
|
|
10515
11571
|
}
|
|
10516
11572
|
function productImageToVertex(fromObject) {
|
|
@@ -10727,13 +11783,13 @@ function safetyAttributesFromVertex(fromObject) {
|
|
|
10727
11783
|
}
|
|
10728
11784
|
function safetySettingToMldev(fromObject) {
|
|
10729
11785
|
const toObject = {};
|
|
10730
|
-
if (getValueByPath(fromObject, ['method']) !== undefined) {
|
|
10731
|
-
throw new Error('method parameter is not supported in Gemini API.');
|
|
10732
|
-
}
|
|
10733
11786
|
const fromCategory = getValueByPath(fromObject, ['category']);
|
|
10734
11787
|
if (fromCategory != null) {
|
|
10735
11788
|
setValueByPath(toObject, ['category'], fromCategory);
|
|
10736
11789
|
}
|
|
11790
|
+
if (getValueByPath(fromObject, ['method']) !== undefined) {
|
|
11791
|
+
throw new Error('method parameter is not supported in Gemini API.');
|
|
11792
|
+
}
|
|
10737
11793
|
const fromThreshold = getValueByPath(fromObject, ['threshold']);
|
|
10738
11794
|
if (fromThreshold != null) {
|
|
10739
11795
|
setValueByPath(toObject, ['threshold'], fromThreshold);
|
|
@@ -10832,6 +11888,10 @@ function segmentImageSourceToVertex(fromObject, parentObject) {
|
|
|
10832
11888
|
}
|
|
10833
11889
|
function speechConfigToVertex(fromObject) {
|
|
10834
11890
|
const toObject = {};
|
|
11891
|
+
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
11892
|
+
if (fromLanguageCode != null) {
|
|
11893
|
+
setValueByPath(toObject, ['languageCode'], fromLanguageCode);
|
|
11894
|
+
}
|
|
10835
11895
|
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
10836
11896
|
if (fromVoiceConfig != null) {
|
|
10837
11897
|
setValueByPath(toObject, ['voiceConfig'], fromVoiceConfig);
|
|
@@ -10839,10 +11899,6 @@ function speechConfigToVertex(fromObject) {
|
|
|
10839
11899
|
if (getValueByPath(fromObject, ['multiSpeakerVoiceConfig']) !== undefined) {
|
|
10840
11900
|
throw new Error('multiSpeakerVoiceConfig parameter is not supported in Vertex AI.');
|
|
10841
11901
|
}
|
|
10842
|
-
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
10843
|
-
if (fromLanguageCode != null) {
|
|
10844
|
-
setValueByPath(toObject, ['languageCode'], fromLanguageCode);
|
|
10845
|
-
}
|
|
10846
11902
|
return toObject;
|
|
10847
11903
|
}
|
|
10848
11904
|
function toolToMldev$1(fromObject) {
|
|
@@ -10862,16 +11918,26 @@ function toolToMldev$1(fromObject) {
|
|
|
10862
11918
|
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
10863
11919
|
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
10864
11920
|
}
|
|
10865
|
-
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
10866
|
-
if (fromGoogleSearch != null) {
|
|
10867
|
-
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$1(fromGoogleSearch));
|
|
10868
|
-
}
|
|
10869
11921
|
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
10870
11922
|
'googleSearchRetrieval',
|
|
10871
11923
|
]);
|
|
10872
11924
|
if (fromGoogleSearchRetrieval != null) {
|
|
10873
11925
|
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
10874
11926
|
}
|
|
11927
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
11928
|
+
if (fromComputerUse != null) {
|
|
11929
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
11930
|
+
}
|
|
11931
|
+
const fromFileSearch = getValueByPath(fromObject, ['fileSearch']);
|
|
11932
|
+
if (fromFileSearch != null) {
|
|
11933
|
+
setValueByPath(toObject, ['fileSearch'], fromFileSearch);
|
|
11934
|
+
}
|
|
11935
|
+
const fromCodeExecution = getValueByPath(fromObject, [
|
|
11936
|
+
'codeExecution',
|
|
11937
|
+
]);
|
|
11938
|
+
if (fromCodeExecution != null) {
|
|
11939
|
+
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
11940
|
+
}
|
|
10875
11941
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
10876
11942
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
10877
11943
|
}
|
|
@@ -10879,20 +11945,14 @@ function toolToMldev$1(fromObject) {
|
|
|
10879
11945
|
if (fromGoogleMaps != null) {
|
|
10880
11946
|
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$1(fromGoogleMaps));
|
|
10881
11947
|
}
|
|
11948
|
+
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
11949
|
+
if (fromGoogleSearch != null) {
|
|
11950
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$1(fromGoogleSearch));
|
|
11951
|
+
}
|
|
10882
11952
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
10883
11953
|
if (fromUrlContext != null) {
|
|
10884
11954
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
10885
11955
|
}
|
|
10886
|
-
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
10887
|
-
if (fromComputerUse != null) {
|
|
10888
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
10889
|
-
}
|
|
10890
|
-
const fromCodeExecution = getValueByPath(fromObject, [
|
|
10891
|
-
'codeExecution',
|
|
10892
|
-
]);
|
|
10893
|
-
if (fromCodeExecution != null) {
|
|
10894
|
-
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
10895
|
-
}
|
|
10896
11956
|
return toObject;
|
|
10897
11957
|
}
|
|
10898
11958
|
function toolToVertex(fromObject) {
|
|
@@ -10913,16 +11973,25 @@ function toolToVertex(fromObject) {
|
|
|
10913
11973
|
if (fromRetrieval != null) {
|
|
10914
11974
|
setValueByPath(toObject, ['retrieval'], fromRetrieval);
|
|
10915
11975
|
}
|
|
10916
|
-
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
10917
|
-
if (fromGoogleSearch != null) {
|
|
10918
|
-
setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
|
|
10919
|
-
}
|
|
10920
11976
|
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
10921
11977
|
'googleSearchRetrieval',
|
|
10922
11978
|
]);
|
|
10923
11979
|
if (fromGoogleSearchRetrieval != null) {
|
|
10924
11980
|
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
10925
11981
|
}
|
|
11982
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
11983
|
+
if (fromComputerUse != null) {
|
|
11984
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
11985
|
+
}
|
|
11986
|
+
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
11987
|
+
throw new Error('fileSearch parameter is not supported in Vertex AI.');
|
|
11988
|
+
}
|
|
11989
|
+
const fromCodeExecution = getValueByPath(fromObject, [
|
|
11990
|
+
'codeExecution',
|
|
11991
|
+
]);
|
|
11992
|
+
if (fromCodeExecution != null) {
|
|
11993
|
+
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
11994
|
+
}
|
|
10926
11995
|
const fromEnterpriseWebSearch = getValueByPath(fromObject, [
|
|
10927
11996
|
'enterpriseWebSearch',
|
|
10928
11997
|
]);
|
|
@@ -10933,20 +12002,14 @@ function toolToVertex(fromObject) {
|
|
|
10933
12002
|
if (fromGoogleMaps != null) {
|
|
10934
12003
|
setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
|
|
10935
12004
|
}
|
|
12005
|
+
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
12006
|
+
if (fromGoogleSearch != null) {
|
|
12007
|
+
setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
|
|
12008
|
+
}
|
|
10936
12009
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
10937
12010
|
if (fromUrlContext != null) {
|
|
10938
12011
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
10939
12012
|
}
|
|
10940
|
-
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
10941
|
-
if (fromComputerUse != null) {
|
|
10942
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
10943
|
-
}
|
|
10944
|
-
const fromCodeExecution = getValueByPath(fromObject, [
|
|
10945
|
-
'codeExecution',
|
|
10946
|
-
]);
|
|
10947
|
-
if (fromCodeExecution != null) {
|
|
10948
|
-
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
10949
|
-
}
|
|
10950
12013
|
return toObject;
|
|
10951
12014
|
}
|
|
10952
12015
|
function tunedModelInfoFromMldev(fromObject) {
|
|
@@ -11050,6 +12113,18 @@ function upscaleImageAPIConfigInternalToVertex(fromObject, parentObject) {
|
|
|
11050
12113
|
if (parentObject !== undefined && fromOutputGcsUri != null) {
|
|
11051
12114
|
setValueByPath(parentObject, ['parameters', 'storageUri'], fromOutputGcsUri);
|
|
11052
12115
|
}
|
|
12116
|
+
const fromSafetyFilterLevel = getValueByPath(fromObject, [
|
|
12117
|
+
'safetyFilterLevel',
|
|
12118
|
+
]);
|
|
12119
|
+
if (parentObject !== undefined && fromSafetyFilterLevel != null) {
|
|
12120
|
+
setValueByPath(parentObject, ['parameters', 'safetySetting'], fromSafetyFilterLevel);
|
|
12121
|
+
}
|
|
12122
|
+
const fromPersonGeneration = getValueByPath(fromObject, [
|
|
12123
|
+
'personGeneration',
|
|
12124
|
+
]);
|
|
12125
|
+
if (parentObject !== undefined && fromPersonGeneration != null) {
|
|
12126
|
+
setValueByPath(parentObject, ['parameters', 'personGeneration'], fromPersonGeneration);
|
|
12127
|
+
}
|
|
11053
12128
|
const fromIncludeRaiReason = getValueByPath(fromObject, [
|
|
11054
12129
|
'includeRaiReason',
|
|
11055
12130
|
]);
|
|
@@ -12129,11 +13204,27 @@ function hasCallableTools(params) {
|
|
|
12129
13204
|
var _a, _b, _c;
|
|
12130
13205
|
return (_c = (_b = (_a = params.config) === null || _a === void 0 ? void 0 : _a.tools) === null || _b === void 0 ? void 0 : _b.some((tool) => isCallableTool(tool))) !== null && _c !== void 0 ? _c : false;
|
|
12131
13206
|
}
|
|
12132
|
-
|
|
12133
|
-
|
|
12134
|
-
|
|
12135
|
-
|
|
12136
|
-
|
|
13207
|
+
/**
|
|
13208
|
+
* Returns the indexes of the tools that are not compatible with AFC.
|
|
13209
|
+
*/
|
|
13210
|
+
function findAfcIncompatibleToolIndexes(params) {
|
|
13211
|
+
var _a;
|
|
13212
|
+
// Use number[] for an array of numbers in TypeScript
|
|
13213
|
+
const afcIncompatibleToolIndexes = [];
|
|
13214
|
+
if (!((_a = params === null || params === void 0 ? void 0 : params.config) === null || _a === void 0 ? void 0 : _a.tools)) {
|
|
13215
|
+
return afcIncompatibleToolIndexes;
|
|
13216
|
+
}
|
|
13217
|
+
params.config.tools.forEach((tool, index) => {
|
|
13218
|
+
if (isCallableTool(tool)) {
|
|
13219
|
+
return;
|
|
13220
|
+
}
|
|
13221
|
+
const geminiTool = tool;
|
|
13222
|
+
if (geminiTool.functionDeclarations &&
|
|
13223
|
+
geminiTool.functionDeclarations.length > 0) {
|
|
13224
|
+
afcIncompatibleToolIndexes.push(index);
|
|
13225
|
+
}
|
|
13226
|
+
});
|
|
13227
|
+
return afcIncompatibleToolIndexes;
|
|
12137
13228
|
}
|
|
12138
13229
|
/**
|
|
12139
13230
|
* Returns whether to append automatic function calling history to the
|
|
@@ -12198,8 +13289,12 @@ class Models extends BaseModule {
|
|
|
12198
13289
|
if (!hasCallableTools(params) || shouldDisableAfc(params.config)) {
|
|
12199
13290
|
return await this.generateContentInternal(transformedParams);
|
|
12200
13291
|
}
|
|
12201
|
-
|
|
12202
|
-
|
|
13292
|
+
const incompatibleToolIndexes = findAfcIncompatibleToolIndexes(params);
|
|
13293
|
+
if (incompatibleToolIndexes.length > 0) {
|
|
13294
|
+
const formattedIndexes = incompatibleToolIndexes
|
|
13295
|
+
.map((index) => `tools[${index}]`)
|
|
13296
|
+
.join(', ');
|
|
13297
|
+
throw new Error(`Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations is not yet supported. Incompatible tools found at ${formattedIndexes}.`);
|
|
12203
13298
|
}
|
|
12204
13299
|
let response;
|
|
12205
13300
|
let functionResponseContent;
|
|
@@ -12286,9 +13381,14 @@ class Models extends BaseModule {
|
|
|
12286
13381
|
const transformedParams = await this.processParamsMaybeAddMcpUsage(params);
|
|
12287
13382
|
return await this.generateContentStreamInternal(transformedParams);
|
|
12288
13383
|
}
|
|
12289
|
-
|
|
12290
|
-
|
|
13384
|
+
const incompatibleToolIndexes = findAfcIncompatibleToolIndexes(params);
|
|
13385
|
+
if (incompatibleToolIndexes.length > 0) {
|
|
13386
|
+
const formattedIndexes = incompatibleToolIndexes
|
|
13387
|
+
.map((index) => `tools[${index}]`)
|
|
13388
|
+
.join(', ');
|
|
13389
|
+
throw new Error(`Incompatible tools found at ${formattedIndexes}. Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations" is not yet supported.`);
|
|
12291
13390
|
}
|
|
13391
|
+
return await this.processAfcStream(params);
|
|
12292
13392
|
};
|
|
12293
13393
|
/**
|
|
12294
13394
|
* Generates an image based on a text description and configuration.
|
|
@@ -13684,7 +14784,7 @@ class Operations extends BaseModule {
|
|
|
13684
14784
|
});
|
|
13685
14785
|
return operation._fromAPIResponse({
|
|
13686
14786
|
apiResponse: rawOperation,
|
|
13687
|
-
|
|
14787
|
+
_isVertexAI: true,
|
|
13688
14788
|
});
|
|
13689
14789
|
}
|
|
13690
14790
|
else {
|
|
@@ -13694,7 +14794,7 @@ class Operations extends BaseModule {
|
|
|
13694
14794
|
});
|
|
13695
14795
|
return operation._fromAPIResponse({
|
|
13696
14796
|
apiResponse: rawOperation,
|
|
13697
|
-
|
|
14797
|
+
_isVertexAI: false,
|
|
13698
14798
|
});
|
|
13699
14799
|
}
|
|
13700
14800
|
}
|
|
@@ -13723,7 +14823,7 @@ class Operations extends BaseModule {
|
|
|
13723
14823
|
});
|
|
13724
14824
|
return operation._fromAPIResponse({
|
|
13725
14825
|
apiResponse: rawOperation,
|
|
13726
|
-
|
|
14826
|
+
_isVertexAI: true,
|
|
13727
14827
|
});
|
|
13728
14828
|
}
|
|
13729
14829
|
else {
|
|
@@ -13733,7 +14833,7 @@ class Operations extends BaseModule {
|
|
|
13733
14833
|
});
|
|
13734
14834
|
return operation._fromAPIResponse({
|
|
13735
14835
|
apiResponse: rawOperation,
|
|
13736
|
-
|
|
14836
|
+
_isVertexAI: false,
|
|
13737
14837
|
});
|
|
13738
14838
|
}
|
|
13739
14839
|
}
|
|
@@ -13821,13 +14921,13 @@ class Operations extends BaseModule {
|
|
|
13821
14921
|
*/
|
|
13822
14922
|
function blobToMldev(fromObject) {
|
|
13823
14923
|
const toObject = {};
|
|
13824
|
-
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
13825
|
-
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
13826
|
-
}
|
|
13827
14924
|
const fromData = getValueByPath(fromObject, ['data']);
|
|
13828
14925
|
if (fromData != null) {
|
|
13829
14926
|
setValueByPath(toObject, ['data'], fromData);
|
|
13830
14927
|
}
|
|
14928
|
+
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
14929
|
+
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
14930
|
+
}
|
|
13831
14931
|
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
13832
14932
|
if (fromMimeType != null) {
|
|
13833
14933
|
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
@@ -13918,15 +15018,18 @@ function googleMapsToMldev(fromObject) {
|
|
|
13918
15018
|
}
|
|
13919
15019
|
function googleSearchToMldev(fromObject) {
|
|
13920
15020
|
const toObject = {};
|
|
15021
|
+
if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
|
|
15022
|
+
throw new Error('excludeDomains parameter is not supported in Gemini API.');
|
|
15023
|
+
}
|
|
15024
|
+
if (getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
|
|
15025
|
+
throw new Error('blockingConfidence parameter is not supported in Gemini API.');
|
|
15026
|
+
}
|
|
13921
15027
|
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
13922
15028
|
'timeRangeFilter',
|
|
13923
15029
|
]);
|
|
13924
15030
|
if (fromTimeRangeFilter != null) {
|
|
13925
15031
|
setValueByPath(toObject, ['timeRangeFilter'], fromTimeRangeFilter);
|
|
13926
15032
|
}
|
|
13927
|
-
if (getValueByPath(fromObject, ['excludeDomains']) !== undefined) {
|
|
13928
|
-
throw new Error('excludeDomains parameter is not supported in Gemini API.');
|
|
13929
|
-
}
|
|
13930
15033
|
return toObject;
|
|
13931
15034
|
}
|
|
13932
15035
|
function liveConnectConfigToMldev(fromObject, parentObject) {
|
|
@@ -14053,30 +15156,6 @@ function liveConnectConstraintsToMldev(apiClient, fromObject) {
|
|
|
14053
15156
|
}
|
|
14054
15157
|
function partToMldev(fromObject) {
|
|
14055
15158
|
const toObject = {};
|
|
14056
|
-
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
14057
|
-
'videoMetadata',
|
|
14058
|
-
]);
|
|
14059
|
-
if (fromVideoMetadata != null) {
|
|
14060
|
-
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
14061
|
-
}
|
|
14062
|
-
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
14063
|
-
if (fromThought != null) {
|
|
14064
|
-
setValueByPath(toObject, ['thought'], fromThought);
|
|
14065
|
-
}
|
|
14066
|
-
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
14067
|
-
if (fromInlineData != null) {
|
|
14068
|
-
setValueByPath(toObject, ['inlineData'], blobToMldev(fromInlineData));
|
|
14069
|
-
}
|
|
14070
|
-
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
14071
|
-
if (fromFileData != null) {
|
|
14072
|
-
setValueByPath(toObject, ['fileData'], fileDataToMldev(fromFileData));
|
|
14073
|
-
}
|
|
14074
|
-
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
14075
|
-
'thoughtSignature',
|
|
14076
|
-
]);
|
|
14077
|
-
if (fromThoughtSignature != null) {
|
|
14078
|
-
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
14079
|
-
}
|
|
14080
15159
|
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
14081
15160
|
if (fromFunctionCall != null) {
|
|
14082
15161
|
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
@@ -14093,16 +15172,40 @@ function partToMldev(fromObject) {
|
|
|
14093
15172
|
if (fromExecutableCode != null) {
|
|
14094
15173
|
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
14095
15174
|
}
|
|
15175
|
+
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
15176
|
+
if (fromFileData != null) {
|
|
15177
|
+
setValueByPath(toObject, ['fileData'], fileDataToMldev(fromFileData));
|
|
15178
|
+
}
|
|
14096
15179
|
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
14097
15180
|
'functionResponse',
|
|
14098
15181
|
]);
|
|
14099
15182
|
if (fromFunctionResponse != null) {
|
|
14100
15183
|
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
14101
15184
|
}
|
|
15185
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
15186
|
+
if (fromInlineData != null) {
|
|
15187
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev(fromInlineData));
|
|
15188
|
+
}
|
|
14102
15189
|
const fromText = getValueByPath(fromObject, ['text']);
|
|
14103
15190
|
if (fromText != null) {
|
|
14104
15191
|
setValueByPath(toObject, ['text'], fromText);
|
|
14105
15192
|
}
|
|
15193
|
+
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
15194
|
+
if (fromThought != null) {
|
|
15195
|
+
setValueByPath(toObject, ['thought'], fromThought);
|
|
15196
|
+
}
|
|
15197
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
15198
|
+
'thoughtSignature',
|
|
15199
|
+
]);
|
|
15200
|
+
if (fromThoughtSignature != null) {
|
|
15201
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
15202
|
+
}
|
|
15203
|
+
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
15204
|
+
'videoMetadata',
|
|
15205
|
+
]);
|
|
15206
|
+
if (fromVideoMetadata != null) {
|
|
15207
|
+
setValueByPath(toObject, ['videoMetadata'], fromVideoMetadata);
|
|
15208
|
+
}
|
|
14106
15209
|
return toObject;
|
|
14107
15210
|
}
|
|
14108
15211
|
function sessionResumptionConfigToMldev(fromObject) {
|
|
@@ -14133,16 +15236,26 @@ function toolToMldev(fromObject) {
|
|
|
14133
15236
|
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
14134
15237
|
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
14135
15238
|
}
|
|
14136
|
-
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
14137
|
-
if (fromGoogleSearch != null) {
|
|
14138
|
-
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev(fromGoogleSearch));
|
|
14139
|
-
}
|
|
14140
15239
|
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
14141
15240
|
'googleSearchRetrieval',
|
|
14142
15241
|
]);
|
|
14143
15242
|
if (fromGoogleSearchRetrieval != null) {
|
|
14144
15243
|
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
14145
15244
|
}
|
|
15245
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
15246
|
+
if (fromComputerUse != null) {
|
|
15247
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
15248
|
+
}
|
|
15249
|
+
const fromFileSearch = getValueByPath(fromObject, ['fileSearch']);
|
|
15250
|
+
if (fromFileSearch != null) {
|
|
15251
|
+
setValueByPath(toObject, ['fileSearch'], fromFileSearch);
|
|
15252
|
+
}
|
|
15253
|
+
const fromCodeExecution = getValueByPath(fromObject, [
|
|
15254
|
+
'codeExecution',
|
|
15255
|
+
]);
|
|
15256
|
+
if (fromCodeExecution != null) {
|
|
15257
|
+
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
15258
|
+
}
|
|
14146
15259
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
14147
15260
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
14148
15261
|
}
|
|
@@ -14150,20 +15263,14 @@ function toolToMldev(fromObject) {
|
|
|
14150
15263
|
if (fromGoogleMaps != null) {
|
|
14151
15264
|
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev(fromGoogleMaps));
|
|
14152
15265
|
}
|
|
15266
|
+
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
15267
|
+
if (fromGoogleSearch != null) {
|
|
15268
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev(fromGoogleSearch));
|
|
15269
|
+
}
|
|
14153
15270
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
14154
15271
|
if (fromUrlContext != null) {
|
|
14155
15272
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
14156
15273
|
}
|
|
14157
|
-
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
14158
|
-
if (fromComputerUse != null) {
|
|
14159
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
14160
|
-
}
|
|
14161
|
-
const fromCodeExecution = getValueByPath(fromObject, [
|
|
14162
|
-
'codeExecution',
|
|
14163
|
-
]);
|
|
14164
|
-
if (fromCodeExecution != null) {
|
|
14165
|
-
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
14166
|
-
}
|
|
14167
15274
|
return toObject;
|
|
14168
15275
|
}
|
|
14169
15276
|
|
|
@@ -14505,15 +15612,35 @@ function createTuningJobConfigToMldev(fromObject, parentObject, _rootObject) {
|
|
|
14505
15612
|
if (getValueByPath(fromObject, ['labels']) !== undefined) {
|
|
14506
15613
|
throw new Error('labels parameter is not supported in Gemini API.');
|
|
14507
15614
|
}
|
|
15615
|
+
if (getValueByPath(fromObject, ['beta']) !== undefined) {
|
|
15616
|
+
throw new Error('beta parameter is not supported in Gemini API.');
|
|
15617
|
+
}
|
|
14508
15618
|
return toObject;
|
|
14509
15619
|
}
|
|
14510
15620
|
function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
14511
15621
|
const toObject = {};
|
|
14512
|
-
|
|
14513
|
-
'
|
|
15622
|
+
let discriminatorValidationDataset = getValueByPath(rootObject, [
|
|
15623
|
+
'config',
|
|
15624
|
+
'method',
|
|
14514
15625
|
]);
|
|
14515
|
-
if (
|
|
14516
|
-
|
|
15626
|
+
if (discriminatorValidationDataset === undefined) {
|
|
15627
|
+
discriminatorValidationDataset = 'SUPERVISED_FINE_TUNING';
|
|
15628
|
+
}
|
|
15629
|
+
if (discriminatorValidationDataset === 'SUPERVISED_FINE_TUNING') {
|
|
15630
|
+
const fromValidationDataset = getValueByPath(fromObject, [
|
|
15631
|
+
'validationDataset',
|
|
15632
|
+
]);
|
|
15633
|
+
if (parentObject !== undefined && fromValidationDataset != null) {
|
|
15634
|
+
setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
|
|
15635
|
+
}
|
|
15636
|
+
}
|
|
15637
|
+
else if (discriminatorValidationDataset === 'PREFERENCE_TUNING') {
|
|
15638
|
+
const fromValidationDataset = getValueByPath(fromObject, [
|
|
15639
|
+
'validationDataset',
|
|
15640
|
+
]);
|
|
15641
|
+
if (parentObject !== undefined && fromValidationDataset != null) {
|
|
15642
|
+
setValueByPath(parentObject, ['preferenceOptimizationSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
|
|
15643
|
+
}
|
|
14517
15644
|
}
|
|
14518
15645
|
const fromTunedModelDisplayName = getValueByPath(fromObject, [
|
|
14519
15646
|
'tunedModelDisplayName',
|
|
@@ -14525,25 +15652,90 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
14525
15652
|
if (parentObject !== undefined && fromDescription != null) {
|
|
14526
15653
|
setValueByPath(parentObject, ['description'], fromDescription);
|
|
14527
15654
|
}
|
|
14528
|
-
|
|
14529
|
-
|
|
14530
|
-
|
|
15655
|
+
let discriminatorEpochCount = getValueByPath(rootObject, [
|
|
15656
|
+
'config',
|
|
15657
|
+
'method',
|
|
15658
|
+
]);
|
|
15659
|
+
if (discriminatorEpochCount === undefined) {
|
|
15660
|
+
discriminatorEpochCount = 'SUPERVISED_FINE_TUNING';
|
|
14531
15661
|
}
|
|
14532
|
-
|
|
14533
|
-
'
|
|
15662
|
+
if (discriminatorEpochCount === 'SUPERVISED_FINE_TUNING') {
|
|
15663
|
+
const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
|
|
15664
|
+
if (parentObject !== undefined && fromEpochCount != null) {
|
|
15665
|
+
setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
|
|
15666
|
+
}
|
|
15667
|
+
}
|
|
15668
|
+
else if (discriminatorEpochCount === 'PREFERENCE_TUNING') {
|
|
15669
|
+
const fromEpochCount = getValueByPath(fromObject, ['epochCount']);
|
|
15670
|
+
if (parentObject !== undefined && fromEpochCount != null) {
|
|
15671
|
+
setValueByPath(parentObject, ['preferenceOptimizationSpec', 'hyperParameters', 'epochCount'], fromEpochCount);
|
|
15672
|
+
}
|
|
15673
|
+
}
|
|
15674
|
+
let discriminatorLearningRateMultiplier = getValueByPath(rootObject, [
|
|
15675
|
+
'config',
|
|
15676
|
+
'method',
|
|
14534
15677
|
]);
|
|
14535
|
-
if (
|
|
14536
|
-
|
|
15678
|
+
if (discriminatorLearningRateMultiplier === undefined) {
|
|
15679
|
+
discriminatorLearningRateMultiplier = 'SUPERVISED_FINE_TUNING';
|
|
15680
|
+
}
|
|
15681
|
+
if (discriminatorLearningRateMultiplier === 'SUPERVISED_FINE_TUNING') {
|
|
15682
|
+
const fromLearningRateMultiplier = getValueByPath(fromObject, [
|
|
15683
|
+
'learningRateMultiplier',
|
|
15684
|
+
]);
|
|
15685
|
+
if (parentObject !== undefined && fromLearningRateMultiplier != null) {
|
|
15686
|
+
setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'learningRateMultiplier'], fromLearningRateMultiplier);
|
|
15687
|
+
}
|
|
15688
|
+
}
|
|
15689
|
+
else if (discriminatorLearningRateMultiplier === 'PREFERENCE_TUNING') {
|
|
15690
|
+
const fromLearningRateMultiplier = getValueByPath(fromObject, [
|
|
15691
|
+
'learningRateMultiplier',
|
|
15692
|
+
]);
|
|
15693
|
+
if (parentObject !== undefined && fromLearningRateMultiplier != null) {
|
|
15694
|
+
setValueByPath(parentObject, [
|
|
15695
|
+
'preferenceOptimizationSpec',
|
|
15696
|
+
'hyperParameters',
|
|
15697
|
+
'learningRateMultiplier',
|
|
15698
|
+
], fromLearningRateMultiplier);
|
|
15699
|
+
}
|
|
15700
|
+
}
|
|
15701
|
+
let discriminatorExportLastCheckpointOnly = getValueByPath(rootObject, ['config', 'method']);
|
|
15702
|
+
if (discriminatorExportLastCheckpointOnly === undefined) {
|
|
15703
|
+
discriminatorExportLastCheckpointOnly = 'SUPERVISED_FINE_TUNING';
|
|
15704
|
+
}
|
|
15705
|
+
if (discriminatorExportLastCheckpointOnly === 'SUPERVISED_FINE_TUNING') {
|
|
15706
|
+
const fromExportLastCheckpointOnly = getValueByPath(fromObject, [
|
|
15707
|
+
'exportLastCheckpointOnly',
|
|
15708
|
+
]);
|
|
15709
|
+
if (parentObject !== undefined && fromExportLastCheckpointOnly != null) {
|
|
15710
|
+
setValueByPath(parentObject, ['supervisedTuningSpec', 'exportLastCheckpointOnly'], fromExportLastCheckpointOnly);
|
|
15711
|
+
}
|
|
14537
15712
|
}
|
|
14538
|
-
|
|
14539
|
-
|
|
15713
|
+
else if (discriminatorExportLastCheckpointOnly === 'PREFERENCE_TUNING') {
|
|
15714
|
+
const fromExportLastCheckpointOnly = getValueByPath(fromObject, [
|
|
15715
|
+
'exportLastCheckpointOnly',
|
|
15716
|
+
]);
|
|
15717
|
+
if (parentObject !== undefined && fromExportLastCheckpointOnly != null) {
|
|
15718
|
+
setValueByPath(parentObject, ['preferenceOptimizationSpec', 'exportLastCheckpointOnly'], fromExportLastCheckpointOnly);
|
|
15719
|
+
}
|
|
15720
|
+
}
|
|
15721
|
+
let discriminatorAdapterSize = getValueByPath(rootObject, [
|
|
15722
|
+
'config',
|
|
15723
|
+
'method',
|
|
14540
15724
|
]);
|
|
14541
|
-
if (
|
|
14542
|
-
|
|
15725
|
+
if (discriminatorAdapterSize === undefined) {
|
|
15726
|
+
discriminatorAdapterSize = 'SUPERVISED_FINE_TUNING';
|
|
15727
|
+
}
|
|
15728
|
+
if (discriminatorAdapterSize === 'SUPERVISED_FINE_TUNING') {
|
|
15729
|
+
const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
|
|
15730
|
+
if (parentObject !== undefined && fromAdapterSize != null) {
|
|
15731
|
+
setValueByPath(parentObject, ['supervisedTuningSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
|
|
15732
|
+
}
|
|
14543
15733
|
}
|
|
14544
|
-
|
|
14545
|
-
|
|
14546
|
-
|
|
15734
|
+
else if (discriminatorAdapterSize === 'PREFERENCE_TUNING') {
|
|
15735
|
+
const fromAdapterSize = getValueByPath(fromObject, ['adapterSize']);
|
|
15736
|
+
if (parentObject !== undefined && fromAdapterSize != null) {
|
|
15737
|
+
setValueByPath(parentObject, ['preferenceOptimizationSpec', 'hyperParameters', 'adapterSize'], fromAdapterSize);
|
|
15738
|
+
}
|
|
14547
15739
|
}
|
|
14548
15740
|
if (getValueByPath(fromObject, ['batchSize']) !== undefined) {
|
|
14549
15741
|
throw new Error('batchSize parameter is not supported in Vertex AI.');
|
|
@@ -14555,6 +15747,10 @@ function createTuningJobConfigToVertex(fromObject, parentObject, rootObject) {
|
|
|
14555
15747
|
if (parentObject !== undefined && fromLabels != null) {
|
|
14556
15748
|
setValueByPath(parentObject, ['labels'], fromLabels);
|
|
14557
15749
|
}
|
|
15750
|
+
const fromBeta = getValueByPath(fromObject, ['beta']);
|
|
15751
|
+
if (parentObject !== undefined && fromBeta != null) {
|
|
15752
|
+
setValueByPath(parentObject, ['preferenceOptimizationSpec', 'hyperParameters', 'beta'], fromBeta);
|
|
15753
|
+
}
|
|
14558
15754
|
return toObject;
|
|
14559
15755
|
}
|
|
14560
15756
|
function createTuningJobParametersPrivateToMldev(fromObject, rootObject) {
|
|
@@ -14573,7 +15769,7 @@ function createTuningJobParametersPrivateToMldev(fromObject, rootObject) {
|
|
|
14573
15769
|
'trainingDataset',
|
|
14574
15770
|
]);
|
|
14575
15771
|
if (fromTrainingDataset != null) {
|
|
14576
|
-
|
|
15772
|
+
tuningDatasetToMldev(fromTrainingDataset);
|
|
14577
15773
|
}
|
|
14578
15774
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
14579
15775
|
if (fromConfig != null) {
|
|
@@ -14597,11 +15793,11 @@ function createTuningJobParametersPrivateToVertex(fromObject, rootObject) {
|
|
|
14597
15793
|
'trainingDataset',
|
|
14598
15794
|
]);
|
|
14599
15795
|
if (fromTrainingDataset != null) {
|
|
14600
|
-
tuningDatasetToVertex(fromTrainingDataset, toObject);
|
|
15796
|
+
tuningDatasetToVertex(fromTrainingDataset, toObject, rootObject);
|
|
14601
15797
|
}
|
|
14602
15798
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
14603
15799
|
if (fromConfig != null) {
|
|
14604
|
-
createTuningJobConfigToVertex(fromConfig, toObject);
|
|
15800
|
+
createTuningJobConfigToVertex(fromConfig, toObject, rootObject);
|
|
14605
15801
|
}
|
|
14606
15802
|
return toObject;
|
|
14607
15803
|
}
|
|
@@ -14753,17 +15949,49 @@ function tuningDatasetToMldev(fromObject, _rootObject) {
|
|
|
14753
15949
|
}
|
|
14754
15950
|
return toObject;
|
|
14755
15951
|
}
|
|
14756
|
-
function tuningDatasetToVertex(fromObject, parentObject,
|
|
15952
|
+
function tuningDatasetToVertex(fromObject, parentObject, rootObject) {
|
|
14757
15953
|
const toObject = {};
|
|
14758
|
-
|
|
14759
|
-
|
|
14760
|
-
|
|
15954
|
+
let discriminatorGcsUri = getValueByPath(rootObject, [
|
|
15955
|
+
'config',
|
|
15956
|
+
'method',
|
|
15957
|
+
]);
|
|
15958
|
+
if (discriminatorGcsUri === undefined) {
|
|
15959
|
+
discriminatorGcsUri = 'SUPERVISED_FINE_TUNING';
|
|
14761
15960
|
}
|
|
14762
|
-
|
|
14763
|
-
'
|
|
15961
|
+
if (discriminatorGcsUri === 'SUPERVISED_FINE_TUNING') {
|
|
15962
|
+
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
15963
|
+
if (parentObject !== undefined && fromGcsUri != null) {
|
|
15964
|
+
setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromGcsUri);
|
|
15965
|
+
}
|
|
15966
|
+
}
|
|
15967
|
+
else if (discriminatorGcsUri === 'PREFERENCE_TUNING') {
|
|
15968
|
+
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
15969
|
+
if (parentObject !== undefined && fromGcsUri != null) {
|
|
15970
|
+
setValueByPath(parentObject, ['preferenceOptimizationSpec', 'trainingDatasetUri'], fromGcsUri);
|
|
15971
|
+
}
|
|
15972
|
+
}
|
|
15973
|
+
let discriminatorVertexDatasetResource = getValueByPath(rootObject, [
|
|
15974
|
+
'config',
|
|
15975
|
+
'method',
|
|
14764
15976
|
]);
|
|
14765
|
-
if (
|
|
14766
|
-
|
|
15977
|
+
if (discriminatorVertexDatasetResource === undefined) {
|
|
15978
|
+
discriminatorVertexDatasetResource = 'SUPERVISED_FINE_TUNING';
|
|
15979
|
+
}
|
|
15980
|
+
if (discriminatorVertexDatasetResource === 'SUPERVISED_FINE_TUNING') {
|
|
15981
|
+
const fromVertexDatasetResource = getValueByPath(fromObject, [
|
|
15982
|
+
'vertexDatasetResource',
|
|
15983
|
+
]);
|
|
15984
|
+
if (parentObject !== undefined && fromVertexDatasetResource != null) {
|
|
15985
|
+
setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
|
|
15986
|
+
}
|
|
15987
|
+
}
|
|
15988
|
+
else if (discriminatorVertexDatasetResource === 'PREFERENCE_TUNING') {
|
|
15989
|
+
const fromVertexDatasetResource = getValueByPath(fromObject, [
|
|
15990
|
+
'vertexDatasetResource',
|
|
15991
|
+
]);
|
|
15992
|
+
if (parentObject !== undefined && fromVertexDatasetResource != null) {
|
|
15993
|
+
setValueByPath(parentObject, ['preferenceOptimizationSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
|
|
15994
|
+
}
|
|
14767
15995
|
}
|
|
14768
15996
|
if (getValueByPath(fromObject, ['examples']) !== undefined) {
|
|
14769
15997
|
throw new Error('examples parameter is not supported in Vertex AI.');
|
|
@@ -14882,6 +16110,12 @@ function tuningJobFromVertex(fromObject, _rootObject) {
|
|
|
14882
16110
|
if (fromSupervisedTuningSpec != null) {
|
|
14883
16111
|
setValueByPath(toObject, ['supervisedTuningSpec'], fromSupervisedTuningSpec);
|
|
14884
16112
|
}
|
|
16113
|
+
const fromPreferenceOptimizationSpec = getValueByPath(fromObject, [
|
|
16114
|
+
'preferenceOptimizationSpec',
|
|
16115
|
+
]);
|
|
16116
|
+
if (fromPreferenceOptimizationSpec != null) {
|
|
16117
|
+
setValueByPath(toObject, ['preferenceOptimizationSpec'], fromPreferenceOptimizationSpec);
|
|
16118
|
+
}
|
|
14885
16119
|
const fromTuningDataStats = getValueByPath(fromObject, [
|
|
14886
16120
|
'tuningDataStats',
|
|
14887
16121
|
]);
|
|
@@ -15248,7 +16482,7 @@ class Tunings extends BaseModule {
|
|
|
15248
16482
|
let path = '';
|
|
15249
16483
|
let queryParams = {};
|
|
15250
16484
|
if (this.apiClient.isVertexAI()) {
|
|
15251
|
-
const body = createTuningJobParametersPrivateToVertex(params);
|
|
16485
|
+
const body = createTuningJobParametersPrivateToVertex(params, params);
|
|
15252
16486
|
path = formatMap('tuningJobs', body['_url']);
|
|
15253
16487
|
queryParams = body['_query'];
|
|
15254
16488
|
delete body['_url'];
|
|
@@ -15413,6 +16647,7 @@ class GoogleGenAI {
|
|
|
15413
16647
|
this.operations = new Operations(this.apiClient);
|
|
15414
16648
|
this.authTokens = new Tokens(this.apiClient);
|
|
15415
16649
|
this.tunings = new Tunings(this.apiClient);
|
|
16650
|
+
this.fileSearchStores = new FileSearchStores(this.apiClient);
|
|
15416
16651
|
}
|
|
15417
16652
|
}
|
|
15418
16653
|
|
|
@@ -15444,10 +16679,14 @@ exports.GenerateVideosOperation = GenerateVideosOperation;
|
|
|
15444
16679
|
exports.GenerateVideosResponse = GenerateVideosResponse;
|
|
15445
16680
|
exports.GoogleGenAI = GoogleGenAI;
|
|
15446
16681
|
exports.HttpResponse = HttpResponse;
|
|
16682
|
+
exports.ImportFileOperation = ImportFileOperation;
|
|
16683
|
+
exports.ImportFileResponse = ImportFileResponse;
|
|
15447
16684
|
exports.InlinedEmbedContentResponse = InlinedEmbedContentResponse;
|
|
15448
16685
|
exports.InlinedResponse = InlinedResponse;
|
|
15449
16686
|
exports.ListBatchJobsResponse = ListBatchJobsResponse;
|
|
15450
16687
|
exports.ListCachedContentsResponse = ListCachedContentsResponse;
|
|
16688
|
+
exports.ListDocumentsResponse = ListDocumentsResponse;
|
|
16689
|
+
exports.ListFileSearchStoresResponse = ListFileSearchStoresResponse;
|
|
15451
16690
|
exports.ListFilesResponse = ListFilesResponse;
|
|
15452
16691
|
exports.ListModelsResponse = ListModelsResponse;
|
|
15453
16692
|
exports.ListTuningJobsResponse = ListTuningJobsResponse;
|
|
@@ -15469,6 +16708,9 @@ exports.SingleEmbedContentResponse = SingleEmbedContentResponse;
|
|
|
15469
16708
|
exports.StyleReferenceImage = StyleReferenceImage;
|
|
15470
16709
|
exports.SubjectReferenceImage = SubjectReferenceImage;
|
|
15471
16710
|
exports.Tokens = Tokens;
|
|
16711
|
+
exports.UploadToFileSearchStoreOperation = UploadToFileSearchStoreOperation;
|
|
16712
|
+
exports.UploadToFileSearchStoreResponse = UploadToFileSearchStoreResponse;
|
|
16713
|
+
exports.UploadToFileSearchStoreResumableResponse = UploadToFileSearchStoreResumableResponse;
|
|
15472
16714
|
exports.UpscaleImageResponse = UpscaleImageResponse;
|
|
15473
16715
|
exports.createFunctionResponsePartFromBase64 = createFunctionResponsePartFromBase64;
|
|
15474
16716
|
exports.createFunctionResponsePartFromUri = createFunctionResponsePartFromUri;
|