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