@google/genai 1.6.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -0
- package/dist/genai.d.ts +568 -23
- package/dist/index.cjs +2300 -216
- package/dist/index.mjs +2298 -217
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +2300 -216
- package/dist/node/index.mjs +2298 -217
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +568 -23
- package/dist/web/index.mjs +2298 -217
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +568 -23
- package/package.json +1 -1
package/dist/node/index.mjs
CHANGED
|
@@ -292,6 +292,22 @@ var HarmCategory;
|
|
|
292
292
|
* Deprecated: Election filter is not longer supported. The harm category is civic integrity.
|
|
293
293
|
*/
|
|
294
294
|
HarmCategory["HARM_CATEGORY_CIVIC_INTEGRITY"] = "HARM_CATEGORY_CIVIC_INTEGRITY";
|
|
295
|
+
/**
|
|
296
|
+
* The harm category is image hate.
|
|
297
|
+
*/
|
|
298
|
+
HarmCategory["HARM_CATEGORY_IMAGE_HATE"] = "HARM_CATEGORY_IMAGE_HATE";
|
|
299
|
+
/**
|
|
300
|
+
* The harm category is image dangerous content.
|
|
301
|
+
*/
|
|
302
|
+
HarmCategory["HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT"] = "HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT";
|
|
303
|
+
/**
|
|
304
|
+
* The harm category is image harassment.
|
|
305
|
+
*/
|
|
306
|
+
HarmCategory["HARM_CATEGORY_IMAGE_HARASSMENT"] = "HARM_CATEGORY_IMAGE_HARASSMENT";
|
|
307
|
+
/**
|
|
308
|
+
* The harm category is image sexually explicit content.
|
|
309
|
+
*/
|
|
310
|
+
HarmCategory["HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT"] = "HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT";
|
|
295
311
|
})(HarmCategory || (HarmCategory = {}));
|
|
296
312
|
/** Optional. Specify if the threshold is used for probability or severity score. If not specified, the threshold is used for probability score. */
|
|
297
313
|
var HarmBlockMethod;
|
|
@@ -378,6 +394,50 @@ var AuthType;
|
|
|
378
394
|
*/
|
|
379
395
|
AuthType["OIDC_AUTH"] = "OIDC_AUTH";
|
|
380
396
|
})(AuthType || (AuthType = {}));
|
|
397
|
+
/** The API spec that the external API implements. */
|
|
398
|
+
var ApiSpec;
|
|
399
|
+
(function (ApiSpec) {
|
|
400
|
+
/**
|
|
401
|
+
* Unspecified API spec. This value should not be used.
|
|
402
|
+
*/
|
|
403
|
+
ApiSpec["API_SPEC_UNSPECIFIED"] = "API_SPEC_UNSPECIFIED";
|
|
404
|
+
/**
|
|
405
|
+
* Simple search API spec.
|
|
406
|
+
*/
|
|
407
|
+
ApiSpec["SIMPLE_SEARCH"] = "SIMPLE_SEARCH";
|
|
408
|
+
/**
|
|
409
|
+
* Elastic search API spec.
|
|
410
|
+
*/
|
|
411
|
+
ApiSpec["ELASTIC_SEARCH"] = "ELASTIC_SEARCH";
|
|
412
|
+
})(ApiSpec || (ApiSpec = {}));
|
|
413
|
+
/** Required. The environment being operated. */
|
|
414
|
+
var Environment;
|
|
415
|
+
(function (Environment) {
|
|
416
|
+
/**
|
|
417
|
+
* Defaults to browser.
|
|
418
|
+
*/
|
|
419
|
+
Environment["ENVIRONMENT_UNSPECIFIED"] = "ENVIRONMENT_UNSPECIFIED";
|
|
420
|
+
/**
|
|
421
|
+
* Operates in a web browser.
|
|
422
|
+
*/
|
|
423
|
+
Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
|
|
424
|
+
})(Environment || (Environment = {}));
|
|
425
|
+
/** Status of the url retrieval. */
|
|
426
|
+
var UrlRetrievalStatus;
|
|
427
|
+
(function (UrlRetrievalStatus) {
|
|
428
|
+
/**
|
|
429
|
+
* Default value. This value is unused
|
|
430
|
+
*/
|
|
431
|
+
UrlRetrievalStatus["URL_RETRIEVAL_STATUS_UNSPECIFIED"] = "URL_RETRIEVAL_STATUS_UNSPECIFIED";
|
|
432
|
+
/**
|
|
433
|
+
* Url retrieval is successful.
|
|
434
|
+
*/
|
|
435
|
+
UrlRetrievalStatus["URL_RETRIEVAL_STATUS_SUCCESS"] = "URL_RETRIEVAL_STATUS_SUCCESS";
|
|
436
|
+
/**
|
|
437
|
+
* Url retrieval is failed due to error.
|
|
438
|
+
*/
|
|
439
|
+
UrlRetrievalStatus["URL_RETRIEVAL_STATUS_ERROR"] = "URL_RETRIEVAL_STATUS_ERROR";
|
|
440
|
+
})(UrlRetrievalStatus || (UrlRetrievalStatus = {}));
|
|
381
441
|
/** Output only. The reason why the model stopped generating tokens.
|
|
382
442
|
|
|
383
443
|
If empty, the model has not stopped generating the tokens.
|
|
@@ -508,6 +568,10 @@ var BlockedReason;
|
|
|
508
568
|
* Candidates blocked due to prohibited content.
|
|
509
569
|
*/
|
|
510
570
|
BlockedReason["PROHIBITED_CONTENT"] = "PROHIBITED_CONTENT";
|
|
571
|
+
/**
|
|
572
|
+
* Candidates blocked due to unsafe image generation content.
|
|
573
|
+
*/
|
|
574
|
+
BlockedReason["IMAGE_SAFETY"] = "IMAGE_SAFETY";
|
|
511
575
|
})(BlockedReason || (BlockedReason = {}));
|
|
512
576
|
/** Output only. Traffic type. This shows whether a request consumes Pay-As-You-Go or Provisioned Throughput quota. */
|
|
513
577
|
var TrafficType;
|
|
@@ -565,7 +629,7 @@ var MediaResolution;
|
|
|
565
629
|
*/
|
|
566
630
|
MediaResolution["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
|
|
567
631
|
})(MediaResolution || (MediaResolution = {}));
|
|
568
|
-
/**
|
|
632
|
+
/** Job state. */
|
|
569
633
|
var JobState;
|
|
570
634
|
(function (JobState) {
|
|
571
635
|
/**
|
|
@@ -609,7 +673,7 @@ var JobState;
|
|
|
609
673
|
*/
|
|
610
674
|
JobState["JOB_STATE_EXPIRED"] = "JOB_STATE_EXPIRED";
|
|
611
675
|
/**
|
|
612
|
-
* The job is being updated. Only jobs in the `
|
|
676
|
+
* The job is being updated. Only jobs in the `JOB_STATE_RUNNING` state can be updated. After updating, the job goes back to the `JOB_STATE_RUNNING` state.
|
|
613
677
|
*/
|
|
614
678
|
JobState["JOB_STATE_UPDATING"] = "JOB_STATE_UPDATING";
|
|
615
679
|
/**
|
|
@@ -705,22 +769,6 @@ var FunctionCallingConfigMode;
|
|
|
705
769
|
*/
|
|
706
770
|
FunctionCallingConfigMode["NONE"] = "NONE";
|
|
707
771
|
})(FunctionCallingConfigMode || (FunctionCallingConfigMode = {}));
|
|
708
|
-
/** Status of the url retrieval. */
|
|
709
|
-
var UrlRetrievalStatus;
|
|
710
|
-
(function (UrlRetrievalStatus) {
|
|
711
|
-
/**
|
|
712
|
-
* Default value. This value is unused
|
|
713
|
-
*/
|
|
714
|
-
UrlRetrievalStatus["URL_RETRIEVAL_STATUS_UNSPECIFIED"] = "URL_RETRIEVAL_STATUS_UNSPECIFIED";
|
|
715
|
-
/**
|
|
716
|
-
* Url retrieval is successful.
|
|
717
|
-
*/
|
|
718
|
-
UrlRetrievalStatus["URL_RETRIEVAL_STATUS_SUCCESS"] = "URL_RETRIEVAL_STATUS_SUCCESS";
|
|
719
|
-
/**
|
|
720
|
-
* Url retrieval is failed due to error.
|
|
721
|
-
*/
|
|
722
|
-
UrlRetrievalStatus["URL_RETRIEVAL_STATUS_ERROR"] = "URL_RETRIEVAL_STATUS_ERROR";
|
|
723
|
-
})(UrlRetrievalStatus || (UrlRetrievalStatus = {}));
|
|
724
772
|
/** Enum that controls the safety filter level for objectionable content. */
|
|
725
773
|
var SafetyFilterLevel;
|
|
726
774
|
(function (SafetyFilterLevel) {
|
|
@@ -732,8 +780,17 @@ var SafetyFilterLevel;
|
|
|
732
780
|
/** Enum that controls the generation of people. */
|
|
733
781
|
var PersonGeneration;
|
|
734
782
|
(function (PersonGeneration) {
|
|
783
|
+
/**
|
|
784
|
+
* Block generation of images of people.
|
|
785
|
+
*/
|
|
735
786
|
PersonGeneration["DONT_ALLOW"] = "DONT_ALLOW";
|
|
787
|
+
/**
|
|
788
|
+
* Generate images of adults, but not children.
|
|
789
|
+
*/
|
|
736
790
|
PersonGeneration["ALLOW_ADULT"] = "ALLOW_ADULT";
|
|
791
|
+
/**
|
|
792
|
+
* Generate images that include adults and children.
|
|
793
|
+
*/
|
|
737
794
|
PersonGeneration["ALLOW_ALL"] = "ALLOW_ALL";
|
|
738
795
|
})(PersonGeneration || (PersonGeneration = {}));
|
|
739
796
|
/** Enum that specifies the language of the text in the prompt. */
|
|
@@ -782,6 +839,20 @@ var EditMode;
|
|
|
782
839
|
EditMode["EDIT_MODE_BGSWAP"] = "EDIT_MODE_BGSWAP";
|
|
783
840
|
EditMode["EDIT_MODE_PRODUCT_IMAGE"] = "EDIT_MODE_PRODUCT_IMAGE";
|
|
784
841
|
})(EditMode || (EditMode = {}));
|
|
842
|
+
/** Enum that controls the compression quality of the generated videos. */
|
|
843
|
+
var VideoCompressionQuality;
|
|
844
|
+
(function (VideoCompressionQuality) {
|
|
845
|
+
/**
|
|
846
|
+
* Optimized video compression quality. This will produce videos
|
|
847
|
+
with a compressed, smaller file size.
|
|
848
|
+
*/
|
|
849
|
+
VideoCompressionQuality["OPTIMIZED"] = "OPTIMIZED";
|
|
850
|
+
/**
|
|
851
|
+
* Lossless video compression quality. This will produce videos
|
|
852
|
+
with a larger file size.
|
|
853
|
+
*/
|
|
854
|
+
VideoCompressionQuality["LOSSLESS"] = "LOSSLESS";
|
|
855
|
+
})(VideoCompressionQuality || (VideoCompressionQuality = {}));
|
|
785
856
|
/** State for the lifecycle of a File. */
|
|
786
857
|
var FileState;
|
|
787
858
|
(function (FileState) {
|
|
@@ -1418,6 +1489,12 @@ class CreateFileResponse {
|
|
|
1418
1489
|
/** Response for the delete file method. */
|
|
1419
1490
|
class DeleteFileResponse {
|
|
1420
1491
|
}
|
|
1492
|
+
/** Config for `inlined_responses` parameter. */
|
|
1493
|
+
class InlinedResponse {
|
|
1494
|
+
}
|
|
1495
|
+
/** Config for batches.list return value. */
|
|
1496
|
+
class ListBatchJobsResponse {
|
|
1497
|
+
}
|
|
1421
1498
|
/** Represents a single response in a replay. */
|
|
1422
1499
|
class ReplayResponse {
|
|
1423
1500
|
}
|
|
@@ -2414,11 +2491,2088 @@ function filterToJsonSchema(schema) {
|
|
|
2414
2491
|
? typeValue
|
|
2415
2492
|
: Type.TYPE_UNSPECIFIED;
|
|
2416
2493
|
}
|
|
2417
|
-
else if (supportedJsonSchemaFields.has(fieldName)) {
|
|
2418
|
-
filteredSchema[fieldName] = fieldValue;
|
|
2494
|
+
else if (supportedJsonSchemaFields.has(fieldName)) {
|
|
2495
|
+
filteredSchema[fieldName] = fieldValue;
|
|
2496
|
+
}
|
|
2497
|
+
}
|
|
2498
|
+
return filteredSchema;
|
|
2499
|
+
}
|
|
2500
|
+
// Transforms a source input into a BatchJobSource object with validation.
|
|
2501
|
+
function tBatchJobSource(apiClient, src) {
|
|
2502
|
+
if (typeof src !== 'string' && !Array.isArray(src)) {
|
|
2503
|
+
if (apiClient && apiClient.isVertexAI()) {
|
|
2504
|
+
if (src.gcsUri && src.bigqueryUri) {
|
|
2505
|
+
throw new Error('Only one of `gcsUri` or `bigqueryUri` can be set.');
|
|
2506
|
+
}
|
|
2507
|
+
else if (!src.gcsUri && !src.bigqueryUri) {
|
|
2508
|
+
throw new Error('One of `gcsUri` or `bigqueryUri` must be set.');
|
|
2509
|
+
}
|
|
2510
|
+
}
|
|
2511
|
+
else {
|
|
2512
|
+
// Logic for non-Vertex AI client (inlined_requests, file_name)
|
|
2513
|
+
if (src.inlinedRequests && src.fileName) {
|
|
2514
|
+
throw new Error('Only one of `inlinedRequests` or `fileName` can be set.');
|
|
2515
|
+
}
|
|
2516
|
+
else if (!src.inlinedRequests && !src.fileName) {
|
|
2517
|
+
throw new Error('One of `inlinedRequests` or `fileName` must be set.');
|
|
2518
|
+
}
|
|
2519
|
+
}
|
|
2520
|
+
return src;
|
|
2521
|
+
}
|
|
2522
|
+
// If src is an array (list in Python)
|
|
2523
|
+
else if (Array.isArray(src)) {
|
|
2524
|
+
return { inlinedRequests: src };
|
|
2525
|
+
}
|
|
2526
|
+
else if (typeof src === 'string') {
|
|
2527
|
+
if (src.startsWith('gs://')) {
|
|
2528
|
+
return {
|
|
2529
|
+
format: 'jsonl',
|
|
2530
|
+
gcsUri: [src], // GCS URI is expected as an array
|
|
2531
|
+
};
|
|
2532
|
+
}
|
|
2533
|
+
else if (src.startsWith('bq://')) {
|
|
2534
|
+
return {
|
|
2535
|
+
format: 'bigquery',
|
|
2536
|
+
bigqueryUri: src,
|
|
2537
|
+
};
|
|
2538
|
+
}
|
|
2539
|
+
else if (src.startsWith('files/')) {
|
|
2540
|
+
return {
|
|
2541
|
+
fileName: src,
|
|
2542
|
+
};
|
|
2543
|
+
}
|
|
2544
|
+
}
|
|
2545
|
+
throw new Error(`Unsupported source: ${src}`);
|
|
2546
|
+
}
|
|
2547
|
+
function tBatchJobDestination(dest) {
|
|
2548
|
+
const destString = dest;
|
|
2549
|
+
if (destString.startsWith('gs://')) {
|
|
2550
|
+
return {
|
|
2551
|
+
format: 'jsonl',
|
|
2552
|
+
gcsUri: destString,
|
|
2553
|
+
};
|
|
2554
|
+
}
|
|
2555
|
+
else if (destString.startsWith('bq://')) {
|
|
2556
|
+
return {
|
|
2557
|
+
format: 'bigquery',
|
|
2558
|
+
bigqueryUri: destString,
|
|
2559
|
+
};
|
|
2560
|
+
}
|
|
2561
|
+
else {
|
|
2562
|
+
throw new Error(`Unsupported destination: ${destString}`);
|
|
2563
|
+
}
|
|
2564
|
+
}
|
|
2565
|
+
function tBatchJobName(apiClient, name) {
|
|
2566
|
+
const nameString = name;
|
|
2567
|
+
if (!apiClient.isVertexAI()) {
|
|
2568
|
+
const mldevPattern = /batches\/[^/]+$/;
|
|
2569
|
+
if (mldevPattern.test(nameString)) {
|
|
2570
|
+
return nameString.split('/').pop();
|
|
2571
|
+
}
|
|
2572
|
+
else {
|
|
2573
|
+
throw new Error(`Invalid batch job name: ${nameString}.`);
|
|
2574
|
+
}
|
|
2575
|
+
}
|
|
2576
|
+
const vertexPattern = /^projects\/[^/]+\/locations\/[^/]+\/batchPredictionJobs\/[^/]+$/;
|
|
2577
|
+
if (vertexPattern.test(nameString)) {
|
|
2578
|
+
return nameString.split('/').pop();
|
|
2579
|
+
}
|
|
2580
|
+
else if (/^\d+$/.test(nameString)) {
|
|
2581
|
+
return nameString;
|
|
2582
|
+
}
|
|
2583
|
+
else {
|
|
2584
|
+
throw new Error(`Invalid batch job name: ${nameString}.`);
|
|
2585
|
+
}
|
|
2586
|
+
}
|
|
2587
|
+
function tJobState(state) {
|
|
2588
|
+
const stateString = state;
|
|
2589
|
+
if (stateString === 'BATCH_STATE_UNSPECIFIED') {
|
|
2590
|
+
return 'JOB_STATE_UNSPECIFIED';
|
|
2591
|
+
}
|
|
2592
|
+
else if (stateString === 'BATCH_STATE_PENDING') {
|
|
2593
|
+
return 'JOB_STATE_PENDING';
|
|
2594
|
+
}
|
|
2595
|
+
else if (stateString === 'BATCH_STATE_SUCCEEDED') {
|
|
2596
|
+
return 'JOB_STATE_SUCCEEDED';
|
|
2597
|
+
}
|
|
2598
|
+
else if (stateString === 'BATCH_STATE_FAILED') {
|
|
2599
|
+
return 'JOB_STATE_FAILED';
|
|
2600
|
+
}
|
|
2601
|
+
else if (stateString === 'BATCH_STATE_CANCELLED') {
|
|
2602
|
+
return 'JOB_STATE_CANCELLED';
|
|
2603
|
+
}
|
|
2604
|
+
else {
|
|
2605
|
+
return stateString;
|
|
2606
|
+
}
|
|
2607
|
+
}
|
|
2608
|
+
|
|
2609
|
+
/**
|
|
2610
|
+
* @license
|
|
2611
|
+
* Copyright 2025 Google LLC
|
|
2612
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
2613
|
+
*/
|
|
2614
|
+
function videoMetadataToMldev$4(fromObject) {
|
|
2615
|
+
const toObject = {};
|
|
2616
|
+
const fromFps = getValueByPath(fromObject, ['fps']);
|
|
2617
|
+
if (fromFps != null) {
|
|
2618
|
+
setValueByPath(toObject, ['fps'], fromFps);
|
|
2619
|
+
}
|
|
2620
|
+
const fromEndOffset = getValueByPath(fromObject, ['endOffset']);
|
|
2621
|
+
if (fromEndOffset != null) {
|
|
2622
|
+
setValueByPath(toObject, ['endOffset'], fromEndOffset);
|
|
2623
|
+
}
|
|
2624
|
+
const fromStartOffset = getValueByPath(fromObject, ['startOffset']);
|
|
2625
|
+
if (fromStartOffset != null) {
|
|
2626
|
+
setValueByPath(toObject, ['startOffset'], fromStartOffset);
|
|
2627
|
+
}
|
|
2628
|
+
return toObject;
|
|
2629
|
+
}
|
|
2630
|
+
function blobToMldev$4(fromObject) {
|
|
2631
|
+
const toObject = {};
|
|
2632
|
+
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
2633
|
+
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
2634
|
+
}
|
|
2635
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
2636
|
+
if (fromData != null) {
|
|
2637
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
2638
|
+
}
|
|
2639
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
2640
|
+
if (fromMimeType != null) {
|
|
2641
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
2642
|
+
}
|
|
2643
|
+
return toObject;
|
|
2644
|
+
}
|
|
2645
|
+
function fileDataToMldev$4(fromObject) {
|
|
2646
|
+
const toObject = {};
|
|
2647
|
+
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
2648
|
+
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
2649
|
+
}
|
|
2650
|
+
const fromFileUri = getValueByPath(fromObject, ['fileUri']);
|
|
2651
|
+
if (fromFileUri != null) {
|
|
2652
|
+
setValueByPath(toObject, ['fileUri'], fromFileUri);
|
|
2653
|
+
}
|
|
2654
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
2655
|
+
if (fromMimeType != null) {
|
|
2656
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
2657
|
+
}
|
|
2658
|
+
return toObject;
|
|
2659
|
+
}
|
|
2660
|
+
function partToMldev$4(fromObject) {
|
|
2661
|
+
const toObject = {};
|
|
2662
|
+
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
2663
|
+
'videoMetadata',
|
|
2664
|
+
]);
|
|
2665
|
+
if (fromVideoMetadata != null) {
|
|
2666
|
+
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$4(fromVideoMetadata));
|
|
2667
|
+
}
|
|
2668
|
+
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
2669
|
+
if (fromThought != null) {
|
|
2670
|
+
setValueByPath(toObject, ['thought'], fromThought);
|
|
2671
|
+
}
|
|
2672
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
2673
|
+
if (fromInlineData != null) {
|
|
2674
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev$4(fromInlineData));
|
|
2675
|
+
}
|
|
2676
|
+
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
2677
|
+
if (fromFileData != null) {
|
|
2678
|
+
setValueByPath(toObject, ['fileData'], fileDataToMldev$4(fromFileData));
|
|
2679
|
+
}
|
|
2680
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
2681
|
+
'thoughtSignature',
|
|
2682
|
+
]);
|
|
2683
|
+
if (fromThoughtSignature != null) {
|
|
2684
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
2685
|
+
}
|
|
2686
|
+
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
2687
|
+
'codeExecutionResult',
|
|
2688
|
+
]);
|
|
2689
|
+
if (fromCodeExecutionResult != null) {
|
|
2690
|
+
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
2691
|
+
}
|
|
2692
|
+
const fromExecutableCode = getValueByPath(fromObject, [
|
|
2693
|
+
'executableCode',
|
|
2694
|
+
]);
|
|
2695
|
+
if (fromExecutableCode != null) {
|
|
2696
|
+
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
2697
|
+
}
|
|
2698
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
2699
|
+
if (fromFunctionCall != null) {
|
|
2700
|
+
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
2701
|
+
}
|
|
2702
|
+
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
2703
|
+
'functionResponse',
|
|
2704
|
+
]);
|
|
2705
|
+
if (fromFunctionResponse != null) {
|
|
2706
|
+
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
2707
|
+
}
|
|
2708
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
2709
|
+
if (fromText != null) {
|
|
2710
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
2711
|
+
}
|
|
2712
|
+
return toObject;
|
|
2713
|
+
}
|
|
2714
|
+
function contentToMldev$4(fromObject) {
|
|
2715
|
+
const toObject = {};
|
|
2716
|
+
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
2717
|
+
if (fromParts != null) {
|
|
2718
|
+
let transformedList = fromParts;
|
|
2719
|
+
if (Array.isArray(transformedList)) {
|
|
2720
|
+
transformedList = transformedList.map((item) => {
|
|
2721
|
+
return partToMldev$4(item);
|
|
2722
|
+
});
|
|
2723
|
+
}
|
|
2724
|
+
setValueByPath(toObject, ['parts'], transformedList);
|
|
2725
|
+
}
|
|
2726
|
+
const fromRole = getValueByPath(fromObject, ['role']);
|
|
2727
|
+
if (fromRole != null) {
|
|
2728
|
+
setValueByPath(toObject, ['role'], fromRole);
|
|
2729
|
+
}
|
|
2730
|
+
return toObject;
|
|
2731
|
+
}
|
|
2732
|
+
function schemaToMldev$1(fromObject) {
|
|
2733
|
+
const toObject = {};
|
|
2734
|
+
const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
|
|
2735
|
+
if (fromAnyOf != null) {
|
|
2736
|
+
setValueByPath(toObject, ['anyOf'], fromAnyOf);
|
|
2737
|
+
}
|
|
2738
|
+
const fromDefault = getValueByPath(fromObject, ['default']);
|
|
2739
|
+
if (fromDefault != null) {
|
|
2740
|
+
setValueByPath(toObject, ['default'], fromDefault);
|
|
2741
|
+
}
|
|
2742
|
+
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
2743
|
+
if (fromDescription != null) {
|
|
2744
|
+
setValueByPath(toObject, ['description'], fromDescription);
|
|
2745
|
+
}
|
|
2746
|
+
const fromEnum = getValueByPath(fromObject, ['enum']);
|
|
2747
|
+
if (fromEnum != null) {
|
|
2748
|
+
setValueByPath(toObject, ['enum'], fromEnum);
|
|
2749
|
+
}
|
|
2750
|
+
const fromExample = getValueByPath(fromObject, ['example']);
|
|
2751
|
+
if (fromExample != null) {
|
|
2752
|
+
setValueByPath(toObject, ['example'], fromExample);
|
|
2753
|
+
}
|
|
2754
|
+
const fromFormat = getValueByPath(fromObject, ['format']);
|
|
2755
|
+
if (fromFormat != null) {
|
|
2756
|
+
setValueByPath(toObject, ['format'], fromFormat);
|
|
2757
|
+
}
|
|
2758
|
+
const fromItems = getValueByPath(fromObject, ['items']);
|
|
2759
|
+
if (fromItems != null) {
|
|
2760
|
+
setValueByPath(toObject, ['items'], fromItems);
|
|
2761
|
+
}
|
|
2762
|
+
const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
|
|
2763
|
+
if (fromMaxItems != null) {
|
|
2764
|
+
setValueByPath(toObject, ['maxItems'], fromMaxItems);
|
|
2765
|
+
}
|
|
2766
|
+
const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
|
|
2767
|
+
if (fromMaxLength != null) {
|
|
2768
|
+
setValueByPath(toObject, ['maxLength'], fromMaxLength);
|
|
2769
|
+
}
|
|
2770
|
+
const fromMaxProperties = getValueByPath(fromObject, [
|
|
2771
|
+
'maxProperties',
|
|
2772
|
+
]);
|
|
2773
|
+
if (fromMaxProperties != null) {
|
|
2774
|
+
setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
|
|
2775
|
+
}
|
|
2776
|
+
const fromMaximum = getValueByPath(fromObject, ['maximum']);
|
|
2777
|
+
if (fromMaximum != null) {
|
|
2778
|
+
setValueByPath(toObject, ['maximum'], fromMaximum);
|
|
2779
|
+
}
|
|
2780
|
+
const fromMinItems = getValueByPath(fromObject, ['minItems']);
|
|
2781
|
+
if (fromMinItems != null) {
|
|
2782
|
+
setValueByPath(toObject, ['minItems'], fromMinItems);
|
|
2783
|
+
}
|
|
2784
|
+
const fromMinLength = getValueByPath(fromObject, ['minLength']);
|
|
2785
|
+
if (fromMinLength != null) {
|
|
2786
|
+
setValueByPath(toObject, ['minLength'], fromMinLength);
|
|
2787
|
+
}
|
|
2788
|
+
const fromMinProperties = getValueByPath(fromObject, [
|
|
2789
|
+
'minProperties',
|
|
2790
|
+
]);
|
|
2791
|
+
if (fromMinProperties != null) {
|
|
2792
|
+
setValueByPath(toObject, ['minProperties'], fromMinProperties);
|
|
2793
|
+
}
|
|
2794
|
+
const fromMinimum = getValueByPath(fromObject, ['minimum']);
|
|
2795
|
+
if (fromMinimum != null) {
|
|
2796
|
+
setValueByPath(toObject, ['minimum'], fromMinimum);
|
|
2797
|
+
}
|
|
2798
|
+
const fromNullable = getValueByPath(fromObject, ['nullable']);
|
|
2799
|
+
if (fromNullable != null) {
|
|
2800
|
+
setValueByPath(toObject, ['nullable'], fromNullable);
|
|
2801
|
+
}
|
|
2802
|
+
const fromPattern = getValueByPath(fromObject, ['pattern']);
|
|
2803
|
+
if (fromPattern != null) {
|
|
2804
|
+
setValueByPath(toObject, ['pattern'], fromPattern);
|
|
2805
|
+
}
|
|
2806
|
+
const fromProperties = getValueByPath(fromObject, ['properties']);
|
|
2807
|
+
if (fromProperties != null) {
|
|
2808
|
+
setValueByPath(toObject, ['properties'], fromProperties);
|
|
2809
|
+
}
|
|
2810
|
+
const fromPropertyOrdering = getValueByPath(fromObject, [
|
|
2811
|
+
'propertyOrdering',
|
|
2812
|
+
]);
|
|
2813
|
+
if (fromPropertyOrdering != null) {
|
|
2814
|
+
setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
|
|
2815
|
+
}
|
|
2816
|
+
const fromRequired = getValueByPath(fromObject, ['required']);
|
|
2817
|
+
if (fromRequired != null) {
|
|
2818
|
+
setValueByPath(toObject, ['required'], fromRequired);
|
|
2819
|
+
}
|
|
2820
|
+
const fromTitle = getValueByPath(fromObject, ['title']);
|
|
2821
|
+
if (fromTitle != null) {
|
|
2822
|
+
setValueByPath(toObject, ['title'], fromTitle);
|
|
2823
|
+
}
|
|
2824
|
+
const fromType = getValueByPath(fromObject, ['type']);
|
|
2825
|
+
if (fromType != null) {
|
|
2826
|
+
setValueByPath(toObject, ['type'], fromType);
|
|
2827
|
+
}
|
|
2828
|
+
return toObject;
|
|
2829
|
+
}
|
|
2830
|
+
function safetySettingToMldev$1(fromObject) {
|
|
2831
|
+
const toObject = {};
|
|
2832
|
+
if (getValueByPath(fromObject, ['method']) !== undefined) {
|
|
2833
|
+
throw new Error('method parameter is not supported in Gemini API.');
|
|
2834
|
+
}
|
|
2835
|
+
const fromCategory = getValueByPath(fromObject, ['category']);
|
|
2836
|
+
if (fromCategory != null) {
|
|
2837
|
+
setValueByPath(toObject, ['category'], fromCategory);
|
|
2838
|
+
}
|
|
2839
|
+
const fromThreshold = getValueByPath(fromObject, ['threshold']);
|
|
2840
|
+
if (fromThreshold != null) {
|
|
2841
|
+
setValueByPath(toObject, ['threshold'], fromThreshold);
|
|
2842
|
+
}
|
|
2843
|
+
return toObject;
|
|
2844
|
+
}
|
|
2845
|
+
function functionDeclarationToMldev$4(fromObject) {
|
|
2846
|
+
const toObject = {};
|
|
2847
|
+
const fromBehavior = getValueByPath(fromObject, ['behavior']);
|
|
2848
|
+
if (fromBehavior != null) {
|
|
2849
|
+
setValueByPath(toObject, ['behavior'], fromBehavior);
|
|
2850
|
+
}
|
|
2851
|
+
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
2852
|
+
if (fromDescription != null) {
|
|
2853
|
+
setValueByPath(toObject, ['description'], fromDescription);
|
|
2854
|
+
}
|
|
2855
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
2856
|
+
if (fromName != null) {
|
|
2857
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
2858
|
+
}
|
|
2859
|
+
const fromParameters = getValueByPath(fromObject, ['parameters']);
|
|
2860
|
+
if (fromParameters != null) {
|
|
2861
|
+
setValueByPath(toObject, ['parameters'], fromParameters);
|
|
2862
|
+
}
|
|
2863
|
+
const fromParametersJsonSchema = getValueByPath(fromObject, [
|
|
2864
|
+
'parametersJsonSchema',
|
|
2865
|
+
]);
|
|
2866
|
+
if (fromParametersJsonSchema != null) {
|
|
2867
|
+
setValueByPath(toObject, ['parametersJsonSchema'], fromParametersJsonSchema);
|
|
2868
|
+
}
|
|
2869
|
+
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
2870
|
+
if (fromResponse != null) {
|
|
2871
|
+
setValueByPath(toObject, ['response'], fromResponse);
|
|
2872
|
+
}
|
|
2873
|
+
const fromResponseJsonSchema = getValueByPath(fromObject, [
|
|
2874
|
+
'responseJsonSchema',
|
|
2875
|
+
]);
|
|
2876
|
+
if (fromResponseJsonSchema != null) {
|
|
2877
|
+
setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
|
|
2878
|
+
}
|
|
2879
|
+
return toObject;
|
|
2880
|
+
}
|
|
2881
|
+
function intervalToMldev$4(fromObject) {
|
|
2882
|
+
const toObject = {};
|
|
2883
|
+
const fromStartTime = getValueByPath(fromObject, ['startTime']);
|
|
2884
|
+
if (fromStartTime != null) {
|
|
2885
|
+
setValueByPath(toObject, ['startTime'], fromStartTime);
|
|
2886
|
+
}
|
|
2887
|
+
const fromEndTime = getValueByPath(fromObject, ['endTime']);
|
|
2888
|
+
if (fromEndTime != null) {
|
|
2889
|
+
setValueByPath(toObject, ['endTime'], fromEndTime);
|
|
2890
|
+
}
|
|
2891
|
+
return toObject;
|
|
2892
|
+
}
|
|
2893
|
+
function googleSearchToMldev$4(fromObject) {
|
|
2894
|
+
const toObject = {};
|
|
2895
|
+
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
2896
|
+
'timeRangeFilter',
|
|
2897
|
+
]);
|
|
2898
|
+
if (fromTimeRangeFilter != null) {
|
|
2899
|
+
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$4(fromTimeRangeFilter));
|
|
2900
|
+
}
|
|
2901
|
+
return toObject;
|
|
2902
|
+
}
|
|
2903
|
+
function dynamicRetrievalConfigToMldev$4(fromObject) {
|
|
2904
|
+
const toObject = {};
|
|
2905
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
2906
|
+
if (fromMode != null) {
|
|
2907
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
2908
|
+
}
|
|
2909
|
+
const fromDynamicThreshold = getValueByPath(fromObject, [
|
|
2910
|
+
'dynamicThreshold',
|
|
2911
|
+
]);
|
|
2912
|
+
if (fromDynamicThreshold != null) {
|
|
2913
|
+
setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
|
|
2914
|
+
}
|
|
2915
|
+
return toObject;
|
|
2916
|
+
}
|
|
2917
|
+
function googleSearchRetrievalToMldev$4(fromObject) {
|
|
2918
|
+
const toObject = {};
|
|
2919
|
+
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
2920
|
+
'dynamicRetrievalConfig',
|
|
2921
|
+
]);
|
|
2922
|
+
if (fromDynamicRetrievalConfig != null) {
|
|
2923
|
+
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$4(fromDynamicRetrievalConfig));
|
|
2924
|
+
}
|
|
2925
|
+
return toObject;
|
|
2926
|
+
}
|
|
2927
|
+
function urlContextToMldev$4() {
|
|
2928
|
+
const toObject = {};
|
|
2929
|
+
return toObject;
|
|
2930
|
+
}
|
|
2931
|
+
function toolToMldev$4(fromObject) {
|
|
2932
|
+
const toObject = {};
|
|
2933
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
2934
|
+
'functionDeclarations',
|
|
2935
|
+
]);
|
|
2936
|
+
if (fromFunctionDeclarations != null) {
|
|
2937
|
+
let transformedList = fromFunctionDeclarations;
|
|
2938
|
+
if (Array.isArray(transformedList)) {
|
|
2939
|
+
transformedList = transformedList.map((item) => {
|
|
2940
|
+
return functionDeclarationToMldev$4(item);
|
|
2941
|
+
});
|
|
2942
|
+
}
|
|
2943
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
2944
|
+
}
|
|
2945
|
+
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
2946
|
+
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
2947
|
+
}
|
|
2948
|
+
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
2949
|
+
if (fromGoogleSearch != null) {
|
|
2950
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$4(fromGoogleSearch));
|
|
2951
|
+
}
|
|
2952
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
2953
|
+
'googleSearchRetrieval',
|
|
2954
|
+
]);
|
|
2955
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
2956
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$4(fromGoogleSearchRetrieval));
|
|
2957
|
+
}
|
|
2958
|
+
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
2959
|
+
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
2960
|
+
}
|
|
2961
|
+
if (getValueByPath(fromObject, ['googleMaps']) !== undefined) {
|
|
2962
|
+
throw new Error('googleMaps parameter is not supported in Gemini API.');
|
|
2963
|
+
}
|
|
2964
|
+
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
2965
|
+
if (fromUrlContext != null) {
|
|
2966
|
+
setValueByPath(toObject, ['urlContext'], urlContextToMldev$4());
|
|
2967
|
+
}
|
|
2968
|
+
const fromCodeExecution = getValueByPath(fromObject, [
|
|
2969
|
+
'codeExecution',
|
|
2970
|
+
]);
|
|
2971
|
+
if (fromCodeExecution != null) {
|
|
2972
|
+
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
2973
|
+
}
|
|
2974
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
2975
|
+
if (fromComputerUse != null) {
|
|
2976
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
2977
|
+
}
|
|
2978
|
+
return toObject;
|
|
2979
|
+
}
|
|
2980
|
+
function functionCallingConfigToMldev$2(fromObject) {
|
|
2981
|
+
const toObject = {};
|
|
2982
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
2983
|
+
if (fromMode != null) {
|
|
2984
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
2985
|
+
}
|
|
2986
|
+
const fromAllowedFunctionNames = getValueByPath(fromObject, [
|
|
2987
|
+
'allowedFunctionNames',
|
|
2988
|
+
]);
|
|
2989
|
+
if (fromAllowedFunctionNames != null) {
|
|
2990
|
+
setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
|
|
2991
|
+
}
|
|
2992
|
+
return toObject;
|
|
2993
|
+
}
|
|
2994
|
+
function latLngToMldev$2(fromObject) {
|
|
2995
|
+
const toObject = {};
|
|
2996
|
+
const fromLatitude = getValueByPath(fromObject, ['latitude']);
|
|
2997
|
+
if (fromLatitude != null) {
|
|
2998
|
+
setValueByPath(toObject, ['latitude'], fromLatitude);
|
|
2999
|
+
}
|
|
3000
|
+
const fromLongitude = getValueByPath(fromObject, ['longitude']);
|
|
3001
|
+
if (fromLongitude != null) {
|
|
3002
|
+
setValueByPath(toObject, ['longitude'], fromLongitude);
|
|
3003
|
+
}
|
|
3004
|
+
return toObject;
|
|
3005
|
+
}
|
|
3006
|
+
function retrievalConfigToMldev$2(fromObject) {
|
|
3007
|
+
const toObject = {};
|
|
3008
|
+
const fromLatLng = getValueByPath(fromObject, ['latLng']);
|
|
3009
|
+
if (fromLatLng != null) {
|
|
3010
|
+
setValueByPath(toObject, ['latLng'], latLngToMldev$2(fromLatLng));
|
|
3011
|
+
}
|
|
3012
|
+
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
3013
|
+
if (fromLanguageCode != null) {
|
|
3014
|
+
setValueByPath(toObject, ['languageCode'], fromLanguageCode);
|
|
3015
|
+
}
|
|
3016
|
+
return toObject;
|
|
3017
|
+
}
|
|
3018
|
+
function toolConfigToMldev$2(fromObject) {
|
|
3019
|
+
const toObject = {};
|
|
3020
|
+
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
3021
|
+
'functionCallingConfig',
|
|
3022
|
+
]);
|
|
3023
|
+
if (fromFunctionCallingConfig != null) {
|
|
3024
|
+
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$2(fromFunctionCallingConfig));
|
|
3025
|
+
}
|
|
3026
|
+
const fromRetrievalConfig = getValueByPath(fromObject, [
|
|
3027
|
+
'retrievalConfig',
|
|
3028
|
+
]);
|
|
3029
|
+
if (fromRetrievalConfig != null) {
|
|
3030
|
+
setValueByPath(toObject, ['retrievalConfig'], retrievalConfigToMldev$2(fromRetrievalConfig));
|
|
3031
|
+
}
|
|
3032
|
+
return toObject;
|
|
3033
|
+
}
|
|
3034
|
+
function prebuiltVoiceConfigToMldev$3(fromObject) {
|
|
3035
|
+
const toObject = {};
|
|
3036
|
+
const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
|
|
3037
|
+
if (fromVoiceName != null) {
|
|
3038
|
+
setValueByPath(toObject, ['voiceName'], fromVoiceName);
|
|
3039
|
+
}
|
|
3040
|
+
return toObject;
|
|
3041
|
+
}
|
|
3042
|
+
function voiceConfigToMldev$3(fromObject) {
|
|
3043
|
+
const toObject = {};
|
|
3044
|
+
const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
|
|
3045
|
+
'prebuiltVoiceConfig',
|
|
3046
|
+
]);
|
|
3047
|
+
if (fromPrebuiltVoiceConfig != null) {
|
|
3048
|
+
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev$3(fromPrebuiltVoiceConfig));
|
|
3049
|
+
}
|
|
3050
|
+
return toObject;
|
|
3051
|
+
}
|
|
3052
|
+
function speakerVoiceConfigToMldev$3(fromObject) {
|
|
3053
|
+
const toObject = {};
|
|
3054
|
+
const fromSpeaker = getValueByPath(fromObject, ['speaker']);
|
|
3055
|
+
if (fromSpeaker != null) {
|
|
3056
|
+
setValueByPath(toObject, ['speaker'], fromSpeaker);
|
|
3057
|
+
}
|
|
3058
|
+
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
3059
|
+
if (fromVoiceConfig != null) {
|
|
3060
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$3(fromVoiceConfig));
|
|
3061
|
+
}
|
|
3062
|
+
return toObject;
|
|
3063
|
+
}
|
|
3064
|
+
function multiSpeakerVoiceConfigToMldev$3(fromObject) {
|
|
3065
|
+
const toObject = {};
|
|
3066
|
+
const fromSpeakerVoiceConfigs = getValueByPath(fromObject, [
|
|
3067
|
+
'speakerVoiceConfigs',
|
|
3068
|
+
]);
|
|
3069
|
+
if (fromSpeakerVoiceConfigs != null) {
|
|
3070
|
+
let transformedList = fromSpeakerVoiceConfigs;
|
|
3071
|
+
if (Array.isArray(transformedList)) {
|
|
3072
|
+
transformedList = transformedList.map((item) => {
|
|
3073
|
+
return speakerVoiceConfigToMldev$3(item);
|
|
3074
|
+
});
|
|
3075
|
+
}
|
|
3076
|
+
setValueByPath(toObject, ['speakerVoiceConfigs'], transformedList);
|
|
3077
|
+
}
|
|
3078
|
+
return toObject;
|
|
3079
|
+
}
|
|
3080
|
+
function speechConfigToMldev$3(fromObject) {
|
|
3081
|
+
const toObject = {};
|
|
3082
|
+
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
3083
|
+
if (fromVoiceConfig != null) {
|
|
3084
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$3(fromVoiceConfig));
|
|
3085
|
+
}
|
|
3086
|
+
const fromMultiSpeakerVoiceConfig = getValueByPath(fromObject, [
|
|
3087
|
+
'multiSpeakerVoiceConfig',
|
|
3088
|
+
]);
|
|
3089
|
+
if (fromMultiSpeakerVoiceConfig != null) {
|
|
3090
|
+
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev$3(fromMultiSpeakerVoiceConfig));
|
|
3091
|
+
}
|
|
3092
|
+
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
3093
|
+
if (fromLanguageCode != null) {
|
|
3094
|
+
setValueByPath(toObject, ['languageCode'], fromLanguageCode);
|
|
3095
|
+
}
|
|
3096
|
+
return toObject;
|
|
3097
|
+
}
|
|
3098
|
+
function thinkingConfigToMldev$1(fromObject) {
|
|
3099
|
+
const toObject = {};
|
|
3100
|
+
const fromIncludeThoughts = getValueByPath(fromObject, [
|
|
3101
|
+
'includeThoughts',
|
|
3102
|
+
]);
|
|
3103
|
+
if (fromIncludeThoughts != null) {
|
|
3104
|
+
setValueByPath(toObject, ['includeThoughts'], fromIncludeThoughts);
|
|
3105
|
+
}
|
|
3106
|
+
const fromThinkingBudget = getValueByPath(fromObject, [
|
|
3107
|
+
'thinkingBudget',
|
|
3108
|
+
]);
|
|
3109
|
+
if (fromThinkingBudget != null) {
|
|
3110
|
+
setValueByPath(toObject, ['thinkingBudget'], fromThinkingBudget);
|
|
3111
|
+
}
|
|
3112
|
+
return toObject;
|
|
3113
|
+
}
|
|
3114
|
+
function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
|
|
3115
|
+
const toObject = {};
|
|
3116
|
+
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
3117
|
+
'systemInstruction',
|
|
3118
|
+
]);
|
|
3119
|
+
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
3120
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToMldev$4(tContent(fromSystemInstruction)));
|
|
3121
|
+
}
|
|
3122
|
+
const fromTemperature = getValueByPath(fromObject, ['temperature']);
|
|
3123
|
+
if (fromTemperature != null) {
|
|
3124
|
+
setValueByPath(toObject, ['temperature'], fromTemperature);
|
|
3125
|
+
}
|
|
3126
|
+
const fromTopP = getValueByPath(fromObject, ['topP']);
|
|
3127
|
+
if (fromTopP != null) {
|
|
3128
|
+
setValueByPath(toObject, ['topP'], fromTopP);
|
|
3129
|
+
}
|
|
3130
|
+
const fromTopK = getValueByPath(fromObject, ['topK']);
|
|
3131
|
+
if (fromTopK != null) {
|
|
3132
|
+
setValueByPath(toObject, ['topK'], fromTopK);
|
|
3133
|
+
}
|
|
3134
|
+
const fromCandidateCount = getValueByPath(fromObject, [
|
|
3135
|
+
'candidateCount',
|
|
3136
|
+
]);
|
|
3137
|
+
if (fromCandidateCount != null) {
|
|
3138
|
+
setValueByPath(toObject, ['candidateCount'], fromCandidateCount);
|
|
3139
|
+
}
|
|
3140
|
+
const fromMaxOutputTokens = getValueByPath(fromObject, [
|
|
3141
|
+
'maxOutputTokens',
|
|
3142
|
+
]);
|
|
3143
|
+
if (fromMaxOutputTokens != null) {
|
|
3144
|
+
setValueByPath(toObject, ['maxOutputTokens'], fromMaxOutputTokens);
|
|
3145
|
+
}
|
|
3146
|
+
const fromStopSequences = getValueByPath(fromObject, [
|
|
3147
|
+
'stopSequences',
|
|
3148
|
+
]);
|
|
3149
|
+
if (fromStopSequences != null) {
|
|
3150
|
+
setValueByPath(toObject, ['stopSequences'], fromStopSequences);
|
|
3151
|
+
}
|
|
3152
|
+
const fromResponseLogprobs = getValueByPath(fromObject, [
|
|
3153
|
+
'responseLogprobs',
|
|
3154
|
+
]);
|
|
3155
|
+
if (fromResponseLogprobs != null) {
|
|
3156
|
+
setValueByPath(toObject, ['responseLogprobs'], fromResponseLogprobs);
|
|
3157
|
+
}
|
|
3158
|
+
const fromLogprobs = getValueByPath(fromObject, ['logprobs']);
|
|
3159
|
+
if (fromLogprobs != null) {
|
|
3160
|
+
setValueByPath(toObject, ['logprobs'], fromLogprobs);
|
|
3161
|
+
}
|
|
3162
|
+
const fromPresencePenalty = getValueByPath(fromObject, [
|
|
3163
|
+
'presencePenalty',
|
|
3164
|
+
]);
|
|
3165
|
+
if (fromPresencePenalty != null) {
|
|
3166
|
+
setValueByPath(toObject, ['presencePenalty'], fromPresencePenalty);
|
|
3167
|
+
}
|
|
3168
|
+
const fromFrequencyPenalty = getValueByPath(fromObject, [
|
|
3169
|
+
'frequencyPenalty',
|
|
3170
|
+
]);
|
|
3171
|
+
if (fromFrequencyPenalty != null) {
|
|
3172
|
+
setValueByPath(toObject, ['frequencyPenalty'], fromFrequencyPenalty);
|
|
3173
|
+
}
|
|
3174
|
+
const fromSeed = getValueByPath(fromObject, ['seed']);
|
|
3175
|
+
if (fromSeed != null) {
|
|
3176
|
+
setValueByPath(toObject, ['seed'], fromSeed);
|
|
3177
|
+
}
|
|
3178
|
+
const fromResponseMimeType = getValueByPath(fromObject, [
|
|
3179
|
+
'responseMimeType',
|
|
3180
|
+
]);
|
|
3181
|
+
if (fromResponseMimeType != null) {
|
|
3182
|
+
setValueByPath(toObject, ['responseMimeType'], fromResponseMimeType);
|
|
3183
|
+
}
|
|
3184
|
+
const fromResponseSchema = getValueByPath(fromObject, [
|
|
3185
|
+
'responseSchema',
|
|
3186
|
+
]);
|
|
3187
|
+
if (fromResponseSchema != null) {
|
|
3188
|
+
setValueByPath(toObject, ['responseSchema'], schemaToMldev$1(tSchema(fromResponseSchema)));
|
|
3189
|
+
}
|
|
3190
|
+
const fromResponseJsonSchema = getValueByPath(fromObject, [
|
|
3191
|
+
'responseJsonSchema',
|
|
3192
|
+
]);
|
|
3193
|
+
if (fromResponseJsonSchema != null) {
|
|
3194
|
+
setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
|
|
3195
|
+
}
|
|
3196
|
+
if (getValueByPath(fromObject, ['routingConfig']) !== undefined) {
|
|
3197
|
+
throw new Error('routingConfig parameter is not supported in Gemini API.');
|
|
3198
|
+
}
|
|
3199
|
+
if (getValueByPath(fromObject, ['modelSelectionConfig']) !== undefined) {
|
|
3200
|
+
throw new Error('modelSelectionConfig parameter is not supported in Gemini API.');
|
|
3201
|
+
}
|
|
3202
|
+
const fromSafetySettings = getValueByPath(fromObject, [
|
|
3203
|
+
'safetySettings',
|
|
3204
|
+
]);
|
|
3205
|
+
if (parentObject !== undefined && fromSafetySettings != null) {
|
|
3206
|
+
let transformedList = fromSafetySettings;
|
|
3207
|
+
if (Array.isArray(transformedList)) {
|
|
3208
|
+
transformedList = transformedList.map((item) => {
|
|
3209
|
+
return safetySettingToMldev$1(item);
|
|
3210
|
+
});
|
|
3211
|
+
}
|
|
3212
|
+
setValueByPath(parentObject, ['safetySettings'], transformedList);
|
|
3213
|
+
}
|
|
3214
|
+
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
3215
|
+
if (parentObject !== undefined && fromTools != null) {
|
|
3216
|
+
let transformedList = tTools(fromTools);
|
|
3217
|
+
if (Array.isArray(transformedList)) {
|
|
3218
|
+
transformedList = transformedList.map((item) => {
|
|
3219
|
+
return toolToMldev$4(tTool(item));
|
|
3220
|
+
});
|
|
3221
|
+
}
|
|
3222
|
+
setValueByPath(parentObject, ['tools'], transformedList);
|
|
3223
|
+
}
|
|
3224
|
+
const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
|
|
3225
|
+
if (parentObject !== undefined && fromToolConfig != null) {
|
|
3226
|
+
setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev$2(fromToolConfig));
|
|
3227
|
+
}
|
|
3228
|
+
if (getValueByPath(fromObject, ['labels']) !== undefined) {
|
|
3229
|
+
throw new Error('labels parameter is not supported in Gemini API.');
|
|
3230
|
+
}
|
|
3231
|
+
const fromCachedContent = getValueByPath(fromObject, [
|
|
3232
|
+
'cachedContent',
|
|
3233
|
+
]);
|
|
3234
|
+
if (parentObject !== undefined && fromCachedContent != null) {
|
|
3235
|
+
setValueByPath(parentObject, ['cachedContent'], tCachedContentName(apiClient, fromCachedContent));
|
|
3236
|
+
}
|
|
3237
|
+
const fromResponseModalities = getValueByPath(fromObject, [
|
|
3238
|
+
'responseModalities',
|
|
3239
|
+
]);
|
|
3240
|
+
if (fromResponseModalities != null) {
|
|
3241
|
+
setValueByPath(toObject, ['responseModalities'], fromResponseModalities);
|
|
3242
|
+
}
|
|
3243
|
+
const fromMediaResolution = getValueByPath(fromObject, [
|
|
3244
|
+
'mediaResolution',
|
|
3245
|
+
]);
|
|
3246
|
+
if (fromMediaResolution != null) {
|
|
3247
|
+
setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
|
|
3248
|
+
}
|
|
3249
|
+
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
3250
|
+
if (fromSpeechConfig != null) {
|
|
3251
|
+
setValueByPath(toObject, ['speechConfig'], speechConfigToMldev$3(tSpeechConfig(fromSpeechConfig)));
|
|
3252
|
+
}
|
|
3253
|
+
if (getValueByPath(fromObject, ['audioTimestamp']) !== undefined) {
|
|
3254
|
+
throw new Error('audioTimestamp parameter is not supported in Gemini API.');
|
|
3255
|
+
}
|
|
3256
|
+
const fromThinkingConfig = getValueByPath(fromObject, [
|
|
3257
|
+
'thinkingConfig',
|
|
3258
|
+
]);
|
|
3259
|
+
if (fromThinkingConfig != null) {
|
|
3260
|
+
setValueByPath(toObject, ['thinkingConfig'], thinkingConfigToMldev$1(fromThinkingConfig));
|
|
3261
|
+
}
|
|
3262
|
+
return toObject;
|
|
3263
|
+
}
|
|
3264
|
+
function inlinedRequestToMldev(apiClient, fromObject) {
|
|
3265
|
+
const toObject = {};
|
|
3266
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
3267
|
+
if (fromModel != null) {
|
|
3268
|
+
setValueByPath(toObject, ['request', 'model'], tModel(apiClient, fromModel));
|
|
3269
|
+
}
|
|
3270
|
+
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
3271
|
+
if (fromContents != null) {
|
|
3272
|
+
let transformedList = tContents(fromContents);
|
|
3273
|
+
if (Array.isArray(transformedList)) {
|
|
3274
|
+
transformedList = transformedList.map((item) => {
|
|
3275
|
+
return contentToMldev$4(item);
|
|
3276
|
+
});
|
|
3277
|
+
}
|
|
3278
|
+
setValueByPath(toObject, ['request', 'contents'], transformedList);
|
|
3279
|
+
}
|
|
3280
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3281
|
+
if (fromConfig != null) {
|
|
3282
|
+
setValueByPath(toObject, ['request', 'generationConfig'], generateContentConfigToMldev$1(apiClient, fromConfig, toObject));
|
|
3283
|
+
}
|
|
3284
|
+
return toObject;
|
|
3285
|
+
}
|
|
3286
|
+
function batchJobSourceToMldev(apiClient, fromObject) {
|
|
3287
|
+
const toObject = {};
|
|
3288
|
+
if (getValueByPath(fromObject, ['format']) !== undefined) {
|
|
3289
|
+
throw new Error('format parameter is not supported in Gemini API.');
|
|
3290
|
+
}
|
|
3291
|
+
if (getValueByPath(fromObject, ['gcsUri']) !== undefined) {
|
|
3292
|
+
throw new Error('gcsUri parameter is not supported in Gemini API.');
|
|
3293
|
+
}
|
|
3294
|
+
if (getValueByPath(fromObject, ['bigqueryUri']) !== undefined) {
|
|
3295
|
+
throw new Error('bigqueryUri parameter is not supported in Gemini API.');
|
|
3296
|
+
}
|
|
3297
|
+
const fromFileName = getValueByPath(fromObject, ['fileName']);
|
|
3298
|
+
if (fromFileName != null) {
|
|
3299
|
+
setValueByPath(toObject, ['fileName'], fromFileName);
|
|
3300
|
+
}
|
|
3301
|
+
const fromInlinedRequests = getValueByPath(fromObject, [
|
|
3302
|
+
'inlinedRequests',
|
|
3303
|
+
]);
|
|
3304
|
+
if (fromInlinedRequests != null) {
|
|
3305
|
+
let transformedList = fromInlinedRequests;
|
|
3306
|
+
if (Array.isArray(transformedList)) {
|
|
3307
|
+
transformedList = transformedList.map((item) => {
|
|
3308
|
+
return inlinedRequestToMldev(apiClient, item);
|
|
3309
|
+
});
|
|
3310
|
+
}
|
|
3311
|
+
setValueByPath(toObject, ['requests', 'requests'], transformedList);
|
|
3312
|
+
}
|
|
3313
|
+
return toObject;
|
|
3314
|
+
}
|
|
3315
|
+
function createBatchJobConfigToMldev(fromObject, parentObject) {
|
|
3316
|
+
const toObject = {};
|
|
3317
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
3318
|
+
if (parentObject !== undefined && fromDisplayName != null) {
|
|
3319
|
+
setValueByPath(parentObject, ['batch', 'displayName'], fromDisplayName);
|
|
3320
|
+
}
|
|
3321
|
+
if (getValueByPath(fromObject, ['dest']) !== undefined) {
|
|
3322
|
+
throw new Error('dest parameter is not supported in Gemini API.');
|
|
3323
|
+
}
|
|
3324
|
+
return toObject;
|
|
3325
|
+
}
|
|
3326
|
+
function createBatchJobParametersToMldev(apiClient, fromObject) {
|
|
3327
|
+
const toObject = {};
|
|
3328
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
3329
|
+
if (fromModel != null) {
|
|
3330
|
+
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
3331
|
+
}
|
|
3332
|
+
const fromSrc = getValueByPath(fromObject, ['src']);
|
|
3333
|
+
if (fromSrc != null) {
|
|
3334
|
+
setValueByPath(toObject, ['batch', 'inputConfig'], batchJobSourceToMldev(apiClient, tBatchJobSource(apiClient, fromSrc)));
|
|
3335
|
+
}
|
|
3336
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3337
|
+
if (fromConfig != null) {
|
|
3338
|
+
setValueByPath(toObject, ['config'], createBatchJobConfigToMldev(fromConfig, toObject));
|
|
3339
|
+
}
|
|
3340
|
+
return toObject;
|
|
3341
|
+
}
|
|
3342
|
+
function getBatchJobParametersToMldev(apiClient, fromObject) {
|
|
3343
|
+
const toObject = {};
|
|
3344
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
3345
|
+
if (fromName != null) {
|
|
3346
|
+
setValueByPath(toObject, ['_url', 'name'], tBatchJobName(apiClient, fromName));
|
|
3347
|
+
}
|
|
3348
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3349
|
+
if (fromConfig != null) {
|
|
3350
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
3351
|
+
}
|
|
3352
|
+
return toObject;
|
|
3353
|
+
}
|
|
3354
|
+
function cancelBatchJobParametersToMldev(apiClient, fromObject) {
|
|
3355
|
+
const toObject = {};
|
|
3356
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
3357
|
+
if (fromName != null) {
|
|
3358
|
+
setValueByPath(toObject, ['_url', 'name'], tBatchJobName(apiClient, fromName));
|
|
3359
|
+
}
|
|
3360
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3361
|
+
if (fromConfig != null) {
|
|
3362
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
3363
|
+
}
|
|
3364
|
+
return toObject;
|
|
3365
|
+
}
|
|
3366
|
+
function listBatchJobsConfigToMldev(fromObject, parentObject) {
|
|
3367
|
+
const toObject = {};
|
|
3368
|
+
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
3369
|
+
if (parentObject !== undefined && fromPageSize != null) {
|
|
3370
|
+
setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
|
|
3371
|
+
}
|
|
3372
|
+
const fromPageToken = getValueByPath(fromObject, ['pageToken']);
|
|
3373
|
+
if (parentObject !== undefined && fromPageToken != null) {
|
|
3374
|
+
setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
|
|
3375
|
+
}
|
|
3376
|
+
if (getValueByPath(fromObject, ['filter']) !== undefined) {
|
|
3377
|
+
throw new Error('filter parameter is not supported in Gemini API.');
|
|
3378
|
+
}
|
|
3379
|
+
return toObject;
|
|
3380
|
+
}
|
|
3381
|
+
function listBatchJobsParametersToMldev(fromObject) {
|
|
3382
|
+
const toObject = {};
|
|
3383
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3384
|
+
if (fromConfig != null) {
|
|
3385
|
+
setValueByPath(toObject, ['config'], listBatchJobsConfigToMldev(fromConfig, toObject));
|
|
3386
|
+
}
|
|
3387
|
+
return toObject;
|
|
3388
|
+
}
|
|
3389
|
+
function deleteBatchJobParametersToMldev(apiClient, fromObject) {
|
|
3390
|
+
const toObject = {};
|
|
3391
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
3392
|
+
if (fromName != null) {
|
|
3393
|
+
setValueByPath(toObject, ['_url', 'name'], tBatchJobName(apiClient, fromName));
|
|
3394
|
+
}
|
|
3395
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3396
|
+
if (fromConfig != null) {
|
|
3397
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
3398
|
+
}
|
|
3399
|
+
return toObject;
|
|
3400
|
+
}
|
|
3401
|
+
function batchJobSourceToVertex(fromObject) {
|
|
3402
|
+
const toObject = {};
|
|
3403
|
+
const fromFormat = getValueByPath(fromObject, ['format']);
|
|
3404
|
+
if (fromFormat != null) {
|
|
3405
|
+
setValueByPath(toObject, ['instancesFormat'], fromFormat);
|
|
3406
|
+
}
|
|
3407
|
+
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
3408
|
+
if (fromGcsUri != null) {
|
|
3409
|
+
setValueByPath(toObject, ['gcsSource', 'uris'], fromGcsUri);
|
|
3410
|
+
}
|
|
3411
|
+
const fromBigqueryUri = getValueByPath(fromObject, ['bigqueryUri']);
|
|
3412
|
+
if (fromBigqueryUri != null) {
|
|
3413
|
+
setValueByPath(toObject, ['bigquerySource', 'inputUri'], fromBigqueryUri);
|
|
3414
|
+
}
|
|
3415
|
+
if (getValueByPath(fromObject, ['fileName']) !== undefined) {
|
|
3416
|
+
throw new Error('fileName parameter is not supported in Vertex AI.');
|
|
3417
|
+
}
|
|
3418
|
+
if (getValueByPath(fromObject, ['inlinedRequests']) !== undefined) {
|
|
3419
|
+
throw new Error('inlinedRequests parameter is not supported in Vertex AI.');
|
|
3420
|
+
}
|
|
3421
|
+
return toObject;
|
|
3422
|
+
}
|
|
3423
|
+
function batchJobDestinationToVertex(fromObject) {
|
|
3424
|
+
const toObject = {};
|
|
3425
|
+
const fromFormat = getValueByPath(fromObject, ['format']);
|
|
3426
|
+
if (fromFormat != null) {
|
|
3427
|
+
setValueByPath(toObject, ['predictionsFormat'], fromFormat);
|
|
3428
|
+
}
|
|
3429
|
+
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
3430
|
+
if (fromGcsUri != null) {
|
|
3431
|
+
setValueByPath(toObject, ['gcsDestination', 'outputUriPrefix'], fromGcsUri);
|
|
3432
|
+
}
|
|
3433
|
+
const fromBigqueryUri = getValueByPath(fromObject, ['bigqueryUri']);
|
|
3434
|
+
if (fromBigqueryUri != null) {
|
|
3435
|
+
setValueByPath(toObject, ['bigqueryDestination', 'outputUri'], fromBigqueryUri);
|
|
3436
|
+
}
|
|
3437
|
+
if (getValueByPath(fromObject, ['fileName']) !== undefined) {
|
|
3438
|
+
throw new Error('fileName parameter is not supported in Vertex AI.');
|
|
3439
|
+
}
|
|
3440
|
+
if (getValueByPath(fromObject, ['inlinedResponses']) !== undefined) {
|
|
3441
|
+
throw new Error('inlinedResponses parameter is not supported in Vertex AI.');
|
|
3442
|
+
}
|
|
3443
|
+
return toObject;
|
|
3444
|
+
}
|
|
3445
|
+
function createBatchJobConfigToVertex(fromObject, parentObject) {
|
|
3446
|
+
const toObject = {};
|
|
3447
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
3448
|
+
if (parentObject !== undefined && fromDisplayName != null) {
|
|
3449
|
+
setValueByPath(parentObject, ['displayName'], fromDisplayName);
|
|
3450
|
+
}
|
|
3451
|
+
const fromDest = getValueByPath(fromObject, ['dest']);
|
|
3452
|
+
if (parentObject !== undefined && fromDest != null) {
|
|
3453
|
+
setValueByPath(parentObject, ['outputConfig'], batchJobDestinationToVertex(tBatchJobDestination(fromDest)));
|
|
3454
|
+
}
|
|
3455
|
+
return toObject;
|
|
3456
|
+
}
|
|
3457
|
+
function createBatchJobParametersToVertex(apiClient, fromObject) {
|
|
3458
|
+
const toObject = {};
|
|
3459
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
3460
|
+
if (fromModel != null) {
|
|
3461
|
+
setValueByPath(toObject, ['model'], tModel(apiClient, fromModel));
|
|
3462
|
+
}
|
|
3463
|
+
const fromSrc = getValueByPath(fromObject, ['src']);
|
|
3464
|
+
if (fromSrc != null) {
|
|
3465
|
+
setValueByPath(toObject, ['inputConfig'], batchJobSourceToVertex(tBatchJobSource(apiClient, fromSrc)));
|
|
3466
|
+
}
|
|
3467
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3468
|
+
if (fromConfig != null) {
|
|
3469
|
+
setValueByPath(toObject, ['config'], createBatchJobConfigToVertex(fromConfig, toObject));
|
|
3470
|
+
}
|
|
3471
|
+
return toObject;
|
|
3472
|
+
}
|
|
3473
|
+
function getBatchJobParametersToVertex(apiClient, fromObject) {
|
|
3474
|
+
const toObject = {};
|
|
3475
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
3476
|
+
if (fromName != null) {
|
|
3477
|
+
setValueByPath(toObject, ['_url', 'name'], tBatchJobName(apiClient, fromName));
|
|
3478
|
+
}
|
|
3479
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3480
|
+
if (fromConfig != null) {
|
|
3481
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
3482
|
+
}
|
|
3483
|
+
return toObject;
|
|
3484
|
+
}
|
|
3485
|
+
function cancelBatchJobParametersToVertex(apiClient, fromObject) {
|
|
3486
|
+
const toObject = {};
|
|
3487
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
3488
|
+
if (fromName != null) {
|
|
3489
|
+
setValueByPath(toObject, ['_url', 'name'], tBatchJobName(apiClient, fromName));
|
|
3490
|
+
}
|
|
3491
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3492
|
+
if (fromConfig != null) {
|
|
3493
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
3494
|
+
}
|
|
3495
|
+
return toObject;
|
|
3496
|
+
}
|
|
3497
|
+
function listBatchJobsConfigToVertex(fromObject, parentObject) {
|
|
3498
|
+
const toObject = {};
|
|
3499
|
+
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
3500
|
+
if (parentObject !== undefined && fromPageSize != null) {
|
|
3501
|
+
setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
|
|
3502
|
+
}
|
|
3503
|
+
const fromPageToken = getValueByPath(fromObject, ['pageToken']);
|
|
3504
|
+
if (parentObject !== undefined && fromPageToken != null) {
|
|
3505
|
+
setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
|
|
3506
|
+
}
|
|
3507
|
+
const fromFilter = getValueByPath(fromObject, ['filter']);
|
|
3508
|
+
if (parentObject !== undefined && fromFilter != null) {
|
|
3509
|
+
setValueByPath(parentObject, ['_query', 'filter'], fromFilter);
|
|
3510
|
+
}
|
|
3511
|
+
return toObject;
|
|
3512
|
+
}
|
|
3513
|
+
function listBatchJobsParametersToVertex(fromObject) {
|
|
3514
|
+
const toObject = {};
|
|
3515
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3516
|
+
if (fromConfig != null) {
|
|
3517
|
+
setValueByPath(toObject, ['config'], listBatchJobsConfigToVertex(fromConfig, toObject));
|
|
3518
|
+
}
|
|
3519
|
+
return toObject;
|
|
3520
|
+
}
|
|
3521
|
+
function deleteBatchJobParametersToVertex(apiClient, fromObject) {
|
|
3522
|
+
const toObject = {};
|
|
3523
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
3524
|
+
if (fromName != null) {
|
|
3525
|
+
setValueByPath(toObject, ['_url', 'name'], tBatchJobName(apiClient, fromName));
|
|
3526
|
+
}
|
|
3527
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3528
|
+
if (fromConfig != null) {
|
|
3529
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
3530
|
+
}
|
|
3531
|
+
return toObject;
|
|
3532
|
+
}
|
|
3533
|
+
function jobErrorFromMldev() {
|
|
3534
|
+
const toObject = {};
|
|
3535
|
+
return toObject;
|
|
3536
|
+
}
|
|
3537
|
+
function videoMetadataFromMldev$2(fromObject) {
|
|
3538
|
+
const toObject = {};
|
|
3539
|
+
const fromFps = getValueByPath(fromObject, ['fps']);
|
|
3540
|
+
if (fromFps != null) {
|
|
3541
|
+
setValueByPath(toObject, ['fps'], fromFps);
|
|
3542
|
+
}
|
|
3543
|
+
const fromEndOffset = getValueByPath(fromObject, ['endOffset']);
|
|
3544
|
+
if (fromEndOffset != null) {
|
|
3545
|
+
setValueByPath(toObject, ['endOffset'], fromEndOffset);
|
|
3546
|
+
}
|
|
3547
|
+
const fromStartOffset = getValueByPath(fromObject, ['startOffset']);
|
|
3548
|
+
if (fromStartOffset != null) {
|
|
3549
|
+
setValueByPath(toObject, ['startOffset'], fromStartOffset);
|
|
3550
|
+
}
|
|
3551
|
+
return toObject;
|
|
3552
|
+
}
|
|
3553
|
+
function blobFromMldev$2(fromObject) {
|
|
3554
|
+
const toObject = {};
|
|
3555
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
3556
|
+
if (fromData != null) {
|
|
3557
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
3558
|
+
}
|
|
3559
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
3560
|
+
if (fromMimeType != null) {
|
|
3561
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
3562
|
+
}
|
|
3563
|
+
return toObject;
|
|
3564
|
+
}
|
|
3565
|
+
function fileDataFromMldev$2(fromObject) {
|
|
3566
|
+
const toObject = {};
|
|
3567
|
+
const fromFileUri = getValueByPath(fromObject, ['fileUri']);
|
|
3568
|
+
if (fromFileUri != null) {
|
|
3569
|
+
setValueByPath(toObject, ['fileUri'], fromFileUri);
|
|
3570
|
+
}
|
|
3571
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
3572
|
+
if (fromMimeType != null) {
|
|
3573
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
3574
|
+
}
|
|
3575
|
+
return toObject;
|
|
3576
|
+
}
|
|
3577
|
+
function partFromMldev$2(fromObject) {
|
|
3578
|
+
const toObject = {};
|
|
3579
|
+
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
3580
|
+
'videoMetadata',
|
|
3581
|
+
]);
|
|
3582
|
+
if (fromVideoMetadata != null) {
|
|
3583
|
+
setValueByPath(toObject, ['videoMetadata'], videoMetadataFromMldev$2(fromVideoMetadata));
|
|
3584
|
+
}
|
|
3585
|
+
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
3586
|
+
if (fromThought != null) {
|
|
3587
|
+
setValueByPath(toObject, ['thought'], fromThought);
|
|
3588
|
+
}
|
|
3589
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
3590
|
+
if (fromInlineData != null) {
|
|
3591
|
+
setValueByPath(toObject, ['inlineData'], blobFromMldev$2(fromInlineData));
|
|
3592
|
+
}
|
|
3593
|
+
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
3594
|
+
if (fromFileData != null) {
|
|
3595
|
+
setValueByPath(toObject, ['fileData'], fileDataFromMldev$2(fromFileData));
|
|
3596
|
+
}
|
|
3597
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
3598
|
+
'thoughtSignature',
|
|
3599
|
+
]);
|
|
3600
|
+
if (fromThoughtSignature != null) {
|
|
3601
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
3602
|
+
}
|
|
3603
|
+
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
3604
|
+
'codeExecutionResult',
|
|
3605
|
+
]);
|
|
3606
|
+
if (fromCodeExecutionResult != null) {
|
|
3607
|
+
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
3608
|
+
}
|
|
3609
|
+
const fromExecutableCode = getValueByPath(fromObject, [
|
|
3610
|
+
'executableCode',
|
|
3611
|
+
]);
|
|
3612
|
+
if (fromExecutableCode != null) {
|
|
3613
|
+
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
3614
|
+
}
|
|
3615
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
3616
|
+
if (fromFunctionCall != null) {
|
|
3617
|
+
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
3618
|
+
}
|
|
3619
|
+
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
3620
|
+
'functionResponse',
|
|
3621
|
+
]);
|
|
3622
|
+
if (fromFunctionResponse != null) {
|
|
3623
|
+
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
3624
|
+
}
|
|
3625
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
3626
|
+
if (fromText != null) {
|
|
3627
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
3628
|
+
}
|
|
3629
|
+
return toObject;
|
|
3630
|
+
}
|
|
3631
|
+
function contentFromMldev$2(fromObject) {
|
|
3632
|
+
const toObject = {};
|
|
3633
|
+
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
3634
|
+
if (fromParts != null) {
|
|
3635
|
+
let transformedList = fromParts;
|
|
3636
|
+
if (Array.isArray(transformedList)) {
|
|
3637
|
+
transformedList = transformedList.map((item) => {
|
|
3638
|
+
return partFromMldev$2(item);
|
|
3639
|
+
});
|
|
3640
|
+
}
|
|
3641
|
+
setValueByPath(toObject, ['parts'], transformedList);
|
|
3642
|
+
}
|
|
3643
|
+
const fromRole = getValueByPath(fromObject, ['role']);
|
|
3644
|
+
if (fromRole != null) {
|
|
3645
|
+
setValueByPath(toObject, ['role'], fromRole);
|
|
3646
|
+
}
|
|
3647
|
+
return toObject;
|
|
3648
|
+
}
|
|
3649
|
+
function citationMetadataFromMldev$1(fromObject) {
|
|
3650
|
+
const toObject = {};
|
|
3651
|
+
const fromCitations = getValueByPath(fromObject, ['citationSources']);
|
|
3652
|
+
if (fromCitations != null) {
|
|
3653
|
+
setValueByPath(toObject, ['citations'], fromCitations);
|
|
3654
|
+
}
|
|
3655
|
+
return toObject;
|
|
3656
|
+
}
|
|
3657
|
+
function urlMetadataFromMldev$2(fromObject) {
|
|
3658
|
+
const toObject = {};
|
|
3659
|
+
const fromRetrievedUrl = getValueByPath(fromObject, ['retrievedUrl']);
|
|
3660
|
+
if (fromRetrievedUrl != null) {
|
|
3661
|
+
setValueByPath(toObject, ['retrievedUrl'], fromRetrievedUrl);
|
|
3662
|
+
}
|
|
3663
|
+
const fromUrlRetrievalStatus = getValueByPath(fromObject, [
|
|
3664
|
+
'urlRetrievalStatus',
|
|
3665
|
+
]);
|
|
3666
|
+
if (fromUrlRetrievalStatus != null) {
|
|
3667
|
+
setValueByPath(toObject, ['urlRetrievalStatus'], fromUrlRetrievalStatus);
|
|
3668
|
+
}
|
|
3669
|
+
return toObject;
|
|
3670
|
+
}
|
|
3671
|
+
function urlContextMetadataFromMldev$2(fromObject) {
|
|
3672
|
+
const toObject = {};
|
|
3673
|
+
const fromUrlMetadata = getValueByPath(fromObject, ['urlMetadata']);
|
|
3674
|
+
if (fromUrlMetadata != null) {
|
|
3675
|
+
let transformedList = fromUrlMetadata;
|
|
3676
|
+
if (Array.isArray(transformedList)) {
|
|
3677
|
+
transformedList = transformedList.map((item) => {
|
|
3678
|
+
return urlMetadataFromMldev$2(item);
|
|
3679
|
+
});
|
|
3680
|
+
}
|
|
3681
|
+
setValueByPath(toObject, ['urlMetadata'], transformedList);
|
|
3682
|
+
}
|
|
3683
|
+
return toObject;
|
|
3684
|
+
}
|
|
3685
|
+
function candidateFromMldev$1(fromObject) {
|
|
3686
|
+
const toObject = {};
|
|
3687
|
+
const fromContent = getValueByPath(fromObject, ['content']);
|
|
3688
|
+
if (fromContent != null) {
|
|
3689
|
+
setValueByPath(toObject, ['content'], contentFromMldev$2(fromContent));
|
|
3690
|
+
}
|
|
3691
|
+
const fromCitationMetadata = getValueByPath(fromObject, [
|
|
3692
|
+
'citationMetadata',
|
|
3693
|
+
]);
|
|
3694
|
+
if (fromCitationMetadata != null) {
|
|
3695
|
+
setValueByPath(toObject, ['citationMetadata'], citationMetadataFromMldev$1(fromCitationMetadata));
|
|
3696
|
+
}
|
|
3697
|
+
const fromTokenCount = getValueByPath(fromObject, ['tokenCount']);
|
|
3698
|
+
if (fromTokenCount != null) {
|
|
3699
|
+
setValueByPath(toObject, ['tokenCount'], fromTokenCount);
|
|
3700
|
+
}
|
|
3701
|
+
const fromFinishReason = getValueByPath(fromObject, ['finishReason']);
|
|
3702
|
+
if (fromFinishReason != null) {
|
|
3703
|
+
setValueByPath(toObject, ['finishReason'], fromFinishReason);
|
|
3704
|
+
}
|
|
3705
|
+
const fromUrlContextMetadata = getValueByPath(fromObject, [
|
|
3706
|
+
'urlContextMetadata',
|
|
3707
|
+
]);
|
|
3708
|
+
if (fromUrlContextMetadata != null) {
|
|
3709
|
+
setValueByPath(toObject, ['urlContextMetadata'], urlContextMetadataFromMldev$2(fromUrlContextMetadata));
|
|
3710
|
+
}
|
|
3711
|
+
const fromAvgLogprobs = getValueByPath(fromObject, ['avgLogprobs']);
|
|
3712
|
+
if (fromAvgLogprobs != null) {
|
|
3713
|
+
setValueByPath(toObject, ['avgLogprobs'], fromAvgLogprobs);
|
|
3714
|
+
}
|
|
3715
|
+
const fromGroundingMetadata = getValueByPath(fromObject, [
|
|
3716
|
+
'groundingMetadata',
|
|
3717
|
+
]);
|
|
3718
|
+
if (fromGroundingMetadata != null) {
|
|
3719
|
+
setValueByPath(toObject, ['groundingMetadata'], fromGroundingMetadata);
|
|
3720
|
+
}
|
|
3721
|
+
const fromIndex = getValueByPath(fromObject, ['index']);
|
|
3722
|
+
if (fromIndex != null) {
|
|
3723
|
+
setValueByPath(toObject, ['index'], fromIndex);
|
|
3724
|
+
}
|
|
3725
|
+
const fromLogprobsResult = getValueByPath(fromObject, [
|
|
3726
|
+
'logprobsResult',
|
|
3727
|
+
]);
|
|
3728
|
+
if (fromLogprobsResult != null) {
|
|
3729
|
+
setValueByPath(toObject, ['logprobsResult'], fromLogprobsResult);
|
|
3730
|
+
}
|
|
3731
|
+
const fromSafetyRatings = getValueByPath(fromObject, [
|
|
3732
|
+
'safetyRatings',
|
|
3733
|
+
]);
|
|
3734
|
+
if (fromSafetyRatings != null) {
|
|
3735
|
+
setValueByPath(toObject, ['safetyRatings'], fromSafetyRatings);
|
|
3736
|
+
}
|
|
3737
|
+
return toObject;
|
|
3738
|
+
}
|
|
3739
|
+
function generateContentResponseFromMldev$1(fromObject) {
|
|
3740
|
+
const toObject = {};
|
|
3741
|
+
const fromCandidates = getValueByPath(fromObject, ['candidates']);
|
|
3742
|
+
if (fromCandidates != null) {
|
|
3743
|
+
let transformedList = fromCandidates;
|
|
3744
|
+
if (Array.isArray(transformedList)) {
|
|
3745
|
+
transformedList = transformedList.map((item) => {
|
|
3746
|
+
return candidateFromMldev$1(item);
|
|
3747
|
+
});
|
|
3748
|
+
}
|
|
3749
|
+
setValueByPath(toObject, ['candidates'], transformedList);
|
|
3750
|
+
}
|
|
3751
|
+
const fromModelVersion = getValueByPath(fromObject, ['modelVersion']);
|
|
3752
|
+
if (fromModelVersion != null) {
|
|
3753
|
+
setValueByPath(toObject, ['modelVersion'], fromModelVersion);
|
|
3754
|
+
}
|
|
3755
|
+
const fromPromptFeedback = getValueByPath(fromObject, [
|
|
3756
|
+
'promptFeedback',
|
|
3757
|
+
]);
|
|
3758
|
+
if (fromPromptFeedback != null) {
|
|
3759
|
+
setValueByPath(toObject, ['promptFeedback'], fromPromptFeedback);
|
|
3760
|
+
}
|
|
3761
|
+
const fromUsageMetadata = getValueByPath(fromObject, [
|
|
3762
|
+
'usageMetadata',
|
|
3763
|
+
]);
|
|
3764
|
+
if (fromUsageMetadata != null) {
|
|
3765
|
+
setValueByPath(toObject, ['usageMetadata'], fromUsageMetadata);
|
|
3766
|
+
}
|
|
3767
|
+
return toObject;
|
|
3768
|
+
}
|
|
3769
|
+
function inlinedResponseFromMldev(fromObject) {
|
|
3770
|
+
const toObject = {};
|
|
3771
|
+
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
3772
|
+
if (fromResponse != null) {
|
|
3773
|
+
setValueByPath(toObject, ['response'], generateContentResponseFromMldev$1(fromResponse));
|
|
3774
|
+
}
|
|
3775
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
3776
|
+
if (fromError != null) {
|
|
3777
|
+
setValueByPath(toObject, ['error'], jobErrorFromMldev());
|
|
3778
|
+
}
|
|
3779
|
+
return toObject;
|
|
3780
|
+
}
|
|
3781
|
+
function batchJobDestinationFromMldev(fromObject) {
|
|
3782
|
+
const toObject = {};
|
|
3783
|
+
const fromFileName = getValueByPath(fromObject, ['responsesFile']);
|
|
3784
|
+
if (fromFileName != null) {
|
|
3785
|
+
setValueByPath(toObject, ['fileName'], fromFileName);
|
|
3786
|
+
}
|
|
3787
|
+
const fromInlinedResponses = getValueByPath(fromObject, [
|
|
3788
|
+
'inlinedResponses',
|
|
3789
|
+
'inlinedResponses',
|
|
3790
|
+
]);
|
|
3791
|
+
if (fromInlinedResponses != null) {
|
|
3792
|
+
let transformedList = fromInlinedResponses;
|
|
3793
|
+
if (Array.isArray(transformedList)) {
|
|
3794
|
+
transformedList = transformedList.map((item) => {
|
|
3795
|
+
return inlinedResponseFromMldev(item);
|
|
3796
|
+
});
|
|
3797
|
+
}
|
|
3798
|
+
setValueByPath(toObject, ['inlinedResponses'], transformedList);
|
|
3799
|
+
}
|
|
3800
|
+
return toObject;
|
|
3801
|
+
}
|
|
3802
|
+
function batchJobFromMldev(fromObject) {
|
|
3803
|
+
const toObject = {};
|
|
3804
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
3805
|
+
if (fromName != null) {
|
|
3806
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
3807
|
+
}
|
|
3808
|
+
const fromDisplayName = getValueByPath(fromObject, [
|
|
3809
|
+
'metadata',
|
|
3810
|
+
'displayName',
|
|
3811
|
+
]);
|
|
3812
|
+
if (fromDisplayName != null) {
|
|
3813
|
+
setValueByPath(toObject, ['displayName'], fromDisplayName);
|
|
3814
|
+
}
|
|
3815
|
+
const fromState = getValueByPath(fromObject, ['metadata', 'state']);
|
|
3816
|
+
if (fromState != null) {
|
|
3817
|
+
setValueByPath(toObject, ['state'], tJobState(fromState));
|
|
3818
|
+
}
|
|
3819
|
+
const fromCreateTime = getValueByPath(fromObject, [
|
|
3820
|
+
'metadata',
|
|
3821
|
+
'createTime',
|
|
3822
|
+
]);
|
|
3823
|
+
if (fromCreateTime != null) {
|
|
3824
|
+
setValueByPath(toObject, ['createTime'], fromCreateTime);
|
|
3825
|
+
}
|
|
3826
|
+
const fromEndTime = getValueByPath(fromObject, [
|
|
3827
|
+
'metadata',
|
|
3828
|
+
'endTime',
|
|
3829
|
+
]);
|
|
3830
|
+
if (fromEndTime != null) {
|
|
3831
|
+
setValueByPath(toObject, ['endTime'], fromEndTime);
|
|
3832
|
+
}
|
|
3833
|
+
const fromUpdateTime = getValueByPath(fromObject, [
|
|
3834
|
+
'metadata',
|
|
3835
|
+
'updateTime',
|
|
3836
|
+
]);
|
|
3837
|
+
if (fromUpdateTime != null) {
|
|
3838
|
+
setValueByPath(toObject, ['updateTime'], fromUpdateTime);
|
|
3839
|
+
}
|
|
3840
|
+
const fromModel = getValueByPath(fromObject, ['metadata', 'model']);
|
|
3841
|
+
if (fromModel != null) {
|
|
3842
|
+
setValueByPath(toObject, ['model'], fromModel);
|
|
3843
|
+
}
|
|
3844
|
+
const fromDest = getValueByPath(fromObject, ['metadata', 'output']);
|
|
3845
|
+
if (fromDest != null) {
|
|
3846
|
+
setValueByPath(toObject, ['dest'], batchJobDestinationFromMldev(fromDest));
|
|
3847
|
+
}
|
|
3848
|
+
return toObject;
|
|
3849
|
+
}
|
|
3850
|
+
function listBatchJobsResponseFromMldev(fromObject) {
|
|
3851
|
+
const toObject = {};
|
|
3852
|
+
const fromNextPageToken = getValueByPath(fromObject, [
|
|
3853
|
+
'nextPageToken',
|
|
3854
|
+
]);
|
|
3855
|
+
if (fromNextPageToken != null) {
|
|
3856
|
+
setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
|
|
3857
|
+
}
|
|
3858
|
+
const fromBatchJobs = getValueByPath(fromObject, ['operations']);
|
|
3859
|
+
if (fromBatchJobs != null) {
|
|
3860
|
+
let transformedList = fromBatchJobs;
|
|
3861
|
+
if (Array.isArray(transformedList)) {
|
|
3862
|
+
transformedList = transformedList.map((item) => {
|
|
3863
|
+
return batchJobFromMldev(item);
|
|
3864
|
+
});
|
|
3865
|
+
}
|
|
3866
|
+
setValueByPath(toObject, ['batchJobs'], transformedList);
|
|
3867
|
+
}
|
|
3868
|
+
return toObject;
|
|
3869
|
+
}
|
|
3870
|
+
function deleteResourceJobFromMldev(fromObject) {
|
|
3871
|
+
const toObject = {};
|
|
3872
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
3873
|
+
if (fromName != null) {
|
|
3874
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
3875
|
+
}
|
|
3876
|
+
const fromDone = getValueByPath(fromObject, ['done']);
|
|
3877
|
+
if (fromDone != null) {
|
|
3878
|
+
setValueByPath(toObject, ['done'], fromDone);
|
|
3879
|
+
}
|
|
3880
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
3881
|
+
if (fromError != null) {
|
|
3882
|
+
setValueByPath(toObject, ['error'], jobErrorFromMldev());
|
|
3883
|
+
}
|
|
3884
|
+
return toObject;
|
|
3885
|
+
}
|
|
3886
|
+
function jobErrorFromVertex(fromObject) {
|
|
3887
|
+
const toObject = {};
|
|
3888
|
+
const fromDetails = getValueByPath(fromObject, ['details']);
|
|
3889
|
+
if (fromDetails != null) {
|
|
3890
|
+
setValueByPath(toObject, ['details'], fromDetails);
|
|
3891
|
+
}
|
|
3892
|
+
const fromCode = getValueByPath(fromObject, ['code']);
|
|
3893
|
+
if (fromCode != null) {
|
|
3894
|
+
setValueByPath(toObject, ['code'], fromCode);
|
|
3895
|
+
}
|
|
3896
|
+
const fromMessage = getValueByPath(fromObject, ['message']);
|
|
3897
|
+
if (fromMessage != null) {
|
|
3898
|
+
setValueByPath(toObject, ['message'], fromMessage);
|
|
3899
|
+
}
|
|
3900
|
+
return toObject;
|
|
3901
|
+
}
|
|
3902
|
+
function batchJobSourceFromVertex(fromObject) {
|
|
3903
|
+
const toObject = {};
|
|
3904
|
+
const fromFormat = getValueByPath(fromObject, ['instancesFormat']);
|
|
3905
|
+
if (fromFormat != null) {
|
|
3906
|
+
setValueByPath(toObject, ['format'], fromFormat);
|
|
3907
|
+
}
|
|
3908
|
+
const fromGcsUri = getValueByPath(fromObject, ['gcsSource', 'uris']);
|
|
3909
|
+
if (fromGcsUri != null) {
|
|
3910
|
+
setValueByPath(toObject, ['gcsUri'], fromGcsUri);
|
|
3911
|
+
}
|
|
3912
|
+
const fromBigqueryUri = getValueByPath(fromObject, [
|
|
3913
|
+
'bigquerySource',
|
|
3914
|
+
'inputUri',
|
|
3915
|
+
]);
|
|
3916
|
+
if (fromBigqueryUri != null) {
|
|
3917
|
+
setValueByPath(toObject, ['bigqueryUri'], fromBigqueryUri);
|
|
3918
|
+
}
|
|
3919
|
+
return toObject;
|
|
3920
|
+
}
|
|
3921
|
+
function batchJobDestinationFromVertex(fromObject) {
|
|
3922
|
+
const toObject = {};
|
|
3923
|
+
const fromFormat = getValueByPath(fromObject, ['predictionsFormat']);
|
|
3924
|
+
if (fromFormat != null) {
|
|
3925
|
+
setValueByPath(toObject, ['format'], fromFormat);
|
|
3926
|
+
}
|
|
3927
|
+
const fromGcsUri = getValueByPath(fromObject, [
|
|
3928
|
+
'gcsDestination',
|
|
3929
|
+
'outputUriPrefix',
|
|
3930
|
+
]);
|
|
3931
|
+
if (fromGcsUri != null) {
|
|
3932
|
+
setValueByPath(toObject, ['gcsUri'], fromGcsUri);
|
|
3933
|
+
}
|
|
3934
|
+
const fromBigqueryUri = getValueByPath(fromObject, [
|
|
3935
|
+
'bigqueryDestination',
|
|
3936
|
+
'outputUri',
|
|
3937
|
+
]);
|
|
3938
|
+
if (fromBigqueryUri != null) {
|
|
3939
|
+
setValueByPath(toObject, ['bigqueryUri'], fromBigqueryUri);
|
|
3940
|
+
}
|
|
3941
|
+
return toObject;
|
|
3942
|
+
}
|
|
3943
|
+
function batchJobFromVertex(fromObject) {
|
|
3944
|
+
const toObject = {};
|
|
3945
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
3946
|
+
if (fromName != null) {
|
|
3947
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
3948
|
+
}
|
|
3949
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
3950
|
+
if (fromDisplayName != null) {
|
|
3951
|
+
setValueByPath(toObject, ['displayName'], fromDisplayName);
|
|
3952
|
+
}
|
|
3953
|
+
const fromState = getValueByPath(fromObject, ['state']);
|
|
3954
|
+
if (fromState != null) {
|
|
3955
|
+
setValueByPath(toObject, ['state'], tJobState(fromState));
|
|
3956
|
+
}
|
|
3957
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
3958
|
+
if (fromError != null) {
|
|
3959
|
+
setValueByPath(toObject, ['error'], jobErrorFromVertex(fromError));
|
|
3960
|
+
}
|
|
3961
|
+
const fromCreateTime = getValueByPath(fromObject, ['createTime']);
|
|
3962
|
+
if (fromCreateTime != null) {
|
|
3963
|
+
setValueByPath(toObject, ['createTime'], fromCreateTime);
|
|
3964
|
+
}
|
|
3965
|
+
const fromStartTime = getValueByPath(fromObject, ['startTime']);
|
|
3966
|
+
if (fromStartTime != null) {
|
|
3967
|
+
setValueByPath(toObject, ['startTime'], fromStartTime);
|
|
3968
|
+
}
|
|
3969
|
+
const fromEndTime = getValueByPath(fromObject, ['endTime']);
|
|
3970
|
+
if (fromEndTime != null) {
|
|
3971
|
+
setValueByPath(toObject, ['endTime'], fromEndTime);
|
|
3972
|
+
}
|
|
3973
|
+
const fromUpdateTime = getValueByPath(fromObject, ['updateTime']);
|
|
3974
|
+
if (fromUpdateTime != null) {
|
|
3975
|
+
setValueByPath(toObject, ['updateTime'], fromUpdateTime);
|
|
3976
|
+
}
|
|
3977
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
3978
|
+
if (fromModel != null) {
|
|
3979
|
+
setValueByPath(toObject, ['model'], fromModel);
|
|
3980
|
+
}
|
|
3981
|
+
const fromSrc = getValueByPath(fromObject, ['inputConfig']);
|
|
3982
|
+
if (fromSrc != null) {
|
|
3983
|
+
setValueByPath(toObject, ['src'], batchJobSourceFromVertex(fromSrc));
|
|
3984
|
+
}
|
|
3985
|
+
const fromDest = getValueByPath(fromObject, ['outputConfig']);
|
|
3986
|
+
if (fromDest != null) {
|
|
3987
|
+
setValueByPath(toObject, ['dest'], batchJobDestinationFromVertex(fromDest));
|
|
3988
|
+
}
|
|
3989
|
+
return toObject;
|
|
3990
|
+
}
|
|
3991
|
+
function listBatchJobsResponseFromVertex(fromObject) {
|
|
3992
|
+
const toObject = {};
|
|
3993
|
+
const fromNextPageToken = getValueByPath(fromObject, [
|
|
3994
|
+
'nextPageToken',
|
|
3995
|
+
]);
|
|
3996
|
+
if (fromNextPageToken != null) {
|
|
3997
|
+
setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
|
|
3998
|
+
}
|
|
3999
|
+
const fromBatchJobs = getValueByPath(fromObject, [
|
|
4000
|
+
'batchPredictionJobs',
|
|
4001
|
+
]);
|
|
4002
|
+
if (fromBatchJobs != null) {
|
|
4003
|
+
let transformedList = fromBatchJobs;
|
|
4004
|
+
if (Array.isArray(transformedList)) {
|
|
4005
|
+
transformedList = transformedList.map((item) => {
|
|
4006
|
+
return batchJobFromVertex(item);
|
|
4007
|
+
});
|
|
4008
|
+
}
|
|
4009
|
+
setValueByPath(toObject, ['batchJobs'], transformedList);
|
|
4010
|
+
}
|
|
4011
|
+
return toObject;
|
|
4012
|
+
}
|
|
4013
|
+
function deleteResourceJobFromVertex(fromObject) {
|
|
4014
|
+
const toObject = {};
|
|
4015
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
4016
|
+
if (fromName != null) {
|
|
4017
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
4018
|
+
}
|
|
4019
|
+
const fromDone = getValueByPath(fromObject, ['done']);
|
|
4020
|
+
if (fromDone != null) {
|
|
4021
|
+
setValueByPath(toObject, ['done'], fromDone);
|
|
4022
|
+
}
|
|
4023
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
4024
|
+
if (fromError != null) {
|
|
4025
|
+
setValueByPath(toObject, ['error'], jobErrorFromVertex(fromError));
|
|
4026
|
+
}
|
|
4027
|
+
return toObject;
|
|
4028
|
+
}
|
|
4029
|
+
|
|
4030
|
+
/**
|
|
4031
|
+
* @license
|
|
4032
|
+
* Copyright 2025 Google LLC
|
|
4033
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4034
|
+
*/
|
|
4035
|
+
/**
|
|
4036
|
+
* Pagers for the GenAI List APIs.
|
|
4037
|
+
*/
|
|
4038
|
+
var PagedItem;
|
|
4039
|
+
(function (PagedItem) {
|
|
4040
|
+
PagedItem["PAGED_ITEM_BATCH_JOBS"] = "batchJobs";
|
|
4041
|
+
PagedItem["PAGED_ITEM_MODELS"] = "models";
|
|
4042
|
+
PagedItem["PAGED_ITEM_TUNING_JOBS"] = "tuningJobs";
|
|
4043
|
+
PagedItem["PAGED_ITEM_FILES"] = "files";
|
|
4044
|
+
PagedItem["PAGED_ITEM_CACHED_CONTENTS"] = "cachedContents";
|
|
4045
|
+
})(PagedItem || (PagedItem = {}));
|
|
4046
|
+
/**
|
|
4047
|
+
* Pager class for iterating through paginated results.
|
|
4048
|
+
*/
|
|
4049
|
+
class Pager {
|
|
4050
|
+
constructor(name, request, response, params) {
|
|
4051
|
+
this.pageInternal = [];
|
|
4052
|
+
this.paramsInternal = {};
|
|
4053
|
+
this.requestInternal = request;
|
|
4054
|
+
this.init(name, response, params);
|
|
4055
|
+
}
|
|
4056
|
+
init(name, response, params) {
|
|
4057
|
+
var _a, _b;
|
|
4058
|
+
this.nameInternal = name;
|
|
4059
|
+
this.pageInternal = response[this.nameInternal] || [];
|
|
4060
|
+
this.idxInternal = 0;
|
|
4061
|
+
let requestParams = { config: {} };
|
|
4062
|
+
if (!params) {
|
|
4063
|
+
requestParams = { config: {} };
|
|
4064
|
+
}
|
|
4065
|
+
else if (typeof params === 'object') {
|
|
4066
|
+
requestParams = Object.assign({}, params);
|
|
4067
|
+
}
|
|
4068
|
+
else {
|
|
4069
|
+
requestParams = params;
|
|
4070
|
+
}
|
|
4071
|
+
if (requestParams['config']) {
|
|
4072
|
+
requestParams['config']['pageToken'] = response['nextPageToken'];
|
|
4073
|
+
}
|
|
4074
|
+
this.paramsInternal = requestParams;
|
|
4075
|
+
this.pageInternalSize =
|
|
4076
|
+
(_b = (_a = requestParams['config']) === null || _a === void 0 ? void 0 : _a['pageSize']) !== null && _b !== void 0 ? _b : this.pageInternal.length;
|
|
4077
|
+
}
|
|
4078
|
+
initNextPage(response) {
|
|
4079
|
+
this.init(this.nameInternal, response, this.paramsInternal);
|
|
4080
|
+
}
|
|
4081
|
+
/**
|
|
4082
|
+
* Returns the current page, which is a list of items.
|
|
4083
|
+
*
|
|
4084
|
+
* @remarks
|
|
4085
|
+
* The first page is retrieved when the pager is created. The returned list of
|
|
4086
|
+
* items could be a subset of the entire list.
|
|
4087
|
+
*/
|
|
4088
|
+
get page() {
|
|
4089
|
+
return this.pageInternal;
|
|
4090
|
+
}
|
|
4091
|
+
/**
|
|
4092
|
+
* Returns the type of paged item (for example, ``batch_jobs``).
|
|
4093
|
+
*/
|
|
4094
|
+
get name() {
|
|
4095
|
+
return this.nameInternal;
|
|
4096
|
+
}
|
|
4097
|
+
/**
|
|
4098
|
+
* Returns the length of the page fetched each time by this pager.
|
|
4099
|
+
*
|
|
4100
|
+
* @remarks
|
|
4101
|
+
* The number of items in the page is less than or equal to the page length.
|
|
4102
|
+
*/
|
|
4103
|
+
get pageSize() {
|
|
4104
|
+
return this.pageInternalSize;
|
|
4105
|
+
}
|
|
4106
|
+
/**
|
|
4107
|
+
* Returns the parameters when making the API request for the next page.
|
|
4108
|
+
*
|
|
4109
|
+
* @remarks
|
|
4110
|
+
* Parameters contain a set of optional configs that can be
|
|
4111
|
+
* used to customize the API request. For example, the `pageToken` parameter
|
|
4112
|
+
* contains the token to request the next page.
|
|
4113
|
+
*/
|
|
4114
|
+
get params() {
|
|
4115
|
+
return this.paramsInternal;
|
|
4116
|
+
}
|
|
4117
|
+
/**
|
|
4118
|
+
* Returns the total number of items in the current page.
|
|
4119
|
+
*/
|
|
4120
|
+
get pageLength() {
|
|
4121
|
+
return this.pageInternal.length;
|
|
4122
|
+
}
|
|
4123
|
+
/**
|
|
4124
|
+
* Returns the item at the given index.
|
|
4125
|
+
*/
|
|
4126
|
+
getItem(index) {
|
|
4127
|
+
return this.pageInternal[index];
|
|
4128
|
+
}
|
|
4129
|
+
/**
|
|
4130
|
+
* Returns an async iterator that support iterating through all items
|
|
4131
|
+
* retrieved from the API.
|
|
4132
|
+
*
|
|
4133
|
+
* @remarks
|
|
4134
|
+
* The iterator will automatically fetch the next page if there are more items
|
|
4135
|
+
* to fetch from the API.
|
|
4136
|
+
*
|
|
4137
|
+
* @example
|
|
4138
|
+
*
|
|
4139
|
+
* ```ts
|
|
4140
|
+
* const pager = await ai.files.list({config: {pageSize: 10}});
|
|
4141
|
+
* for await (const file of pager) {
|
|
4142
|
+
* console.log(file.name);
|
|
4143
|
+
* }
|
|
4144
|
+
* ```
|
|
4145
|
+
*/
|
|
4146
|
+
[Symbol.asyncIterator]() {
|
|
4147
|
+
return {
|
|
4148
|
+
next: async () => {
|
|
4149
|
+
if (this.idxInternal >= this.pageLength) {
|
|
4150
|
+
if (this.hasNextPage()) {
|
|
4151
|
+
await this.nextPage();
|
|
4152
|
+
}
|
|
4153
|
+
else {
|
|
4154
|
+
return { value: undefined, done: true };
|
|
4155
|
+
}
|
|
4156
|
+
}
|
|
4157
|
+
const item = this.getItem(this.idxInternal);
|
|
4158
|
+
this.idxInternal += 1;
|
|
4159
|
+
return { value: item, done: false };
|
|
4160
|
+
},
|
|
4161
|
+
return: async () => {
|
|
4162
|
+
return { value: undefined, done: true };
|
|
4163
|
+
},
|
|
4164
|
+
};
|
|
4165
|
+
}
|
|
4166
|
+
/**
|
|
4167
|
+
* Fetches the next page of items. This makes a new API request.
|
|
4168
|
+
*
|
|
4169
|
+
* @throws {Error} If there are no more pages to fetch.
|
|
4170
|
+
*
|
|
4171
|
+
* @example
|
|
4172
|
+
*
|
|
4173
|
+
* ```ts
|
|
4174
|
+
* const pager = await ai.files.list({config: {pageSize: 10}});
|
|
4175
|
+
* let page = pager.page;
|
|
4176
|
+
* while (true) {
|
|
4177
|
+
* for (const file of page) {
|
|
4178
|
+
* console.log(file.name);
|
|
4179
|
+
* }
|
|
4180
|
+
* if (!pager.hasNextPage()) {
|
|
4181
|
+
* break;
|
|
4182
|
+
* }
|
|
4183
|
+
* page = await pager.nextPage();
|
|
4184
|
+
* }
|
|
4185
|
+
* ```
|
|
4186
|
+
*/
|
|
4187
|
+
async nextPage() {
|
|
4188
|
+
if (!this.hasNextPage()) {
|
|
4189
|
+
throw new Error('No more pages to fetch.');
|
|
4190
|
+
}
|
|
4191
|
+
const response = await this.requestInternal(this.params);
|
|
4192
|
+
this.initNextPage(response);
|
|
4193
|
+
return this.page;
|
|
4194
|
+
}
|
|
4195
|
+
/**
|
|
4196
|
+
* Returns true if there are more pages to fetch from the API.
|
|
4197
|
+
*/
|
|
4198
|
+
hasNextPage() {
|
|
4199
|
+
var _a;
|
|
4200
|
+
if (((_a = this.params['config']) === null || _a === void 0 ? void 0 : _a['pageToken']) !== undefined) {
|
|
4201
|
+
return true;
|
|
4202
|
+
}
|
|
4203
|
+
return false;
|
|
4204
|
+
}
|
|
4205
|
+
}
|
|
4206
|
+
|
|
4207
|
+
/**
|
|
4208
|
+
* @license
|
|
4209
|
+
* Copyright 2025 Google LLC
|
|
4210
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4211
|
+
*/
|
|
4212
|
+
class Batches extends BaseModule {
|
|
4213
|
+
constructor(apiClient) {
|
|
4214
|
+
super();
|
|
4215
|
+
this.apiClient = apiClient;
|
|
4216
|
+
/**
|
|
4217
|
+
* Create batch job.
|
|
4218
|
+
*
|
|
4219
|
+
* @param params - The parameters for create batch job request.
|
|
4220
|
+
* @return The created batch job.
|
|
4221
|
+
*
|
|
4222
|
+
* @example
|
|
4223
|
+
* ```ts
|
|
4224
|
+
* const response = await ai.batches.create({
|
|
4225
|
+
* model: 'gemini-2.0-flash',
|
|
4226
|
+
* src: {gcsUri: 'gs://bucket/path/to/file.jsonl', format: 'jsonl'},
|
|
4227
|
+
* config: {
|
|
4228
|
+
* dest: {gcsUri: 'gs://bucket/path/output/directory', format: 'jsonl'},
|
|
4229
|
+
* }
|
|
4230
|
+
* });
|
|
4231
|
+
* console.log(response);
|
|
4232
|
+
* ```
|
|
4233
|
+
*/
|
|
4234
|
+
this.create = async (params) => {
|
|
4235
|
+
if (this.apiClient.isVertexAI()) {
|
|
4236
|
+
const timestamp = Date.now();
|
|
4237
|
+
const timestampStr = timestamp.toString();
|
|
4238
|
+
if (Array.isArray(params.src)) {
|
|
4239
|
+
throw new Error('InlinedRequest[] is not supported in Vertex AI. Please use ' +
|
|
4240
|
+
'Google Cloud Storage URI or BigQuery URI instead.');
|
|
4241
|
+
}
|
|
4242
|
+
params.config = params.config || {};
|
|
4243
|
+
if (params.config.displayName === undefined) {
|
|
4244
|
+
params.config.displayName = 'genaiBatchJob_${timestampStr}';
|
|
4245
|
+
}
|
|
4246
|
+
if (params.config.dest === undefined && typeof params.src === 'string') {
|
|
4247
|
+
if (params.src.startsWith('gs://') && params.src.endsWith('.jsonl')) {
|
|
4248
|
+
params.config.dest = `${params.src.slice(0, -6)}/dest`;
|
|
4249
|
+
}
|
|
4250
|
+
else if (params.src.startsWith('bq://')) {
|
|
4251
|
+
params.config.dest =
|
|
4252
|
+
`${params.src}_dest_${timestampStr}`;
|
|
4253
|
+
}
|
|
4254
|
+
else {
|
|
4255
|
+
throw new Error('Unsupported source:' + params.src);
|
|
4256
|
+
}
|
|
4257
|
+
}
|
|
4258
|
+
}
|
|
4259
|
+
return await this.createInternal(params);
|
|
4260
|
+
};
|
|
4261
|
+
/**
|
|
4262
|
+
* Lists batch job configurations.
|
|
4263
|
+
*
|
|
4264
|
+
* @param params - The parameters for the list request.
|
|
4265
|
+
* @return The paginated results of the list of batch jobs.
|
|
4266
|
+
*
|
|
4267
|
+
* @example
|
|
4268
|
+
* ```ts
|
|
4269
|
+
* const batchJobs = await ai.batches.list({config: {'pageSize': 2}});
|
|
4270
|
+
* for await (const batchJob of batchJobs) {
|
|
4271
|
+
* console.log(batchJob);
|
|
4272
|
+
* }
|
|
4273
|
+
* ```
|
|
4274
|
+
*/
|
|
4275
|
+
this.list = async (params = {}) => {
|
|
4276
|
+
return new Pager(PagedItem.PAGED_ITEM_BATCH_JOBS, (x) => this.listInternal(x), await this.listInternal(params), params);
|
|
4277
|
+
};
|
|
4278
|
+
}
|
|
4279
|
+
/**
|
|
4280
|
+
* Internal method to create batch job.
|
|
4281
|
+
*
|
|
4282
|
+
* @param params - The parameters for create batch job request.
|
|
4283
|
+
* @return The created batch job.
|
|
4284
|
+
*
|
|
4285
|
+
*/
|
|
4286
|
+
async createInternal(params) {
|
|
4287
|
+
var _a, _b, _c, _d;
|
|
4288
|
+
let response;
|
|
4289
|
+
let path = '';
|
|
4290
|
+
let queryParams = {};
|
|
4291
|
+
if (this.apiClient.isVertexAI()) {
|
|
4292
|
+
const body = createBatchJobParametersToVertex(this.apiClient, params);
|
|
4293
|
+
path = formatMap('batchPredictionJobs', body['_url']);
|
|
4294
|
+
queryParams = body['_query'];
|
|
4295
|
+
delete body['config'];
|
|
4296
|
+
delete body['_url'];
|
|
4297
|
+
delete body['_query'];
|
|
4298
|
+
response = this.apiClient
|
|
4299
|
+
.request({
|
|
4300
|
+
path: path,
|
|
4301
|
+
queryParams: queryParams,
|
|
4302
|
+
body: JSON.stringify(body),
|
|
4303
|
+
httpMethod: 'POST',
|
|
4304
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
4305
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
4306
|
+
})
|
|
4307
|
+
.then((httpResponse) => {
|
|
4308
|
+
return httpResponse.json();
|
|
4309
|
+
});
|
|
4310
|
+
return response.then((apiResponse) => {
|
|
4311
|
+
const resp = batchJobFromVertex(apiResponse);
|
|
4312
|
+
return resp;
|
|
4313
|
+
});
|
|
4314
|
+
}
|
|
4315
|
+
else {
|
|
4316
|
+
const body = createBatchJobParametersToMldev(this.apiClient, params);
|
|
4317
|
+
path = formatMap('{model}:batchGenerateContent', body['_url']);
|
|
4318
|
+
queryParams = body['_query'];
|
|
4319
|
+
delete body['config'];
|
|
4320
|
+
delete body['_url'];
|
|
4321
|
+
delete body['_query'];
|
|
4322
|
+
response = this.apiClient
|
|
4323
|
+
.request({
|
|
4324
|
+
path: path,
|
|
4325
|
+
queryParams: queryParams,
|
|
4326
|
+
body: JSON.stringify(body),
|
|
4327
|
+
httpMethod: 'POST',
|
|
4328
|
+
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
4329
|
+
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
4330
|
+
})
|
|
4331
|
+
.then((httpResponse) => {
|
|
4332
|
+
return httpResponse.json();
|
|
4333
|
+
});
|
|
4334
|
+
return response.then((apiResponse) => {
|
|
4335
|
+
const resp = batchJobFromMldev(apiResponse);
|
|
4336
|
+
return resp;
|
|
4337
|
+
});
|
|
4338
|
+
}
|
|
4339
|
+
}
|
|
4340
|
+
/**
|
|
4341
|
+
* Gets batch job configurations.
|
|
4342
|
+
*
|
|
4343
|
+
* @param params - The parameters for the get request.
|
|
4344
|
+
* @return The batch job.
|
|
4345
|
+
*
|
|
4346
|
+
* @example
|
|
4347
|
+
* ```ts
|
|
4348
|
+
* await ai.batches.get({name: '...'}); // The server-generated resource name.
|
|
4349
|
+
* ```
|
|
4350
|
+
*/
|
|
4351
|
+
async get(params) {
|
|
4352
|
+
var _a, _b, _c, _d;
|
|
4353
|
+
let response;
|
|
4354
|
+
let path = '';
|
|
4355
|
+
let queryParams = {};
|
|
4356
|
+
if (this.apiClient.isVertexAI()) {
|
|
4357
|
+
const body = getBatchJobParametersToVertex(this.apiClient, params);
|
|
4358
|
+
path = formatMap('batchPredictionJobs/{name}', body['_url']);
|
|
4359
|
+
queryParams = body['_query'];
|
|
4360
|
+
delete body['config'];
|
|
4361
|
+
delete body['_url'];
|
|
4362
|
+
delete body['_query'];
|
|
4363
|
+
response = this.apiClient
|
|
4364
|
+
.request({
|
|
4365
|
+
path: path,
|
|
4366
|
+
queryParams: queryParams,
|
|
4367
|
+
body: JSON.stringify(body),
|
|
4368
|
+
httpMethod: 'GET',
|
|
4369
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
4370
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
4371
|
+
})
|
|
4372
|
+
.then((httpResponse) => {
|
|
4373
|
+
return httpResponse.json();
|
|
4374
|
+
});
|
|
4375
|
+
return response.then((apiResponse) => {
|
|
4376
|
+
const resp = batchJobFromVertex(apiResponse);
|
|
4377
|
+
return resp;
|
|
4378
|
+
});
|
|
4379
|
+
}
|
|
4380
|
+
else {
|
|
4381
|
+
const body = getBatchJobParametersToMldev(this.apiClient, params);
|
|
4382
|
+
path = formatMap('batches/{name}', body['_url']);
|
|
4383
|
+
queryParams = body['_query'];
|
|
4384
|
+
delete body['config'];
|
|
4385
|
+
delete body['_url'];
|
|
4386
|
+
delete body['_query'];
|
|
4387
|
+
response = this.apiClient
|
|
4388
|
+
.request({
|
|
4389
|
+
path: path,
|
|
4390
|
+
queryParams: queryParams,
|
|
4391
|
+
body: JSON.stringify(body),
|
|
4392
|
+
httpMethod: 'GET',
|
|
4393
|
+
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
4394
|
+
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
4395
|
+
})
|
|
4396
|
+
.then((httpResponse) => {
|
|
4397
|
+
return httpResponse.json();
|
|
4398
|
+
});
|
|
4399
|
+
return response.then((apiResponse) => {
|
|
4400
|
+
const resp = batchJobFromMldev(apiResponse);
|
|
4401
|
+
return resp;
|
|
4402
|
+
});
|
|
4403
|
+
}
|
|
4404
|
+
}
|
|
4405
|
+
/**
|
|
4406
|
+
* Cancels a batch job.
|
|
4407
|
+
*
|
|
4408
|
+
* @param params - The parameters for the cancel request.
|
|
4409
|
+
* @return The empty response returned by the API.
|
|
4410
|
+
*
|
|
4411
|
+
* @example
|
|
4412
|
+
* ```ts
|
|
4413
|
+
* await ai.batches.cancel({name: '...'}); // The server-generated resource name.
|
|
4414
|
+
* ```
|
|
4415
|
+
*/
|
|
4416
|
+
async cancel(params) {
|
|
4417
|
+
var _a, _b, _c, _d;
|
|
4418
|
+
let path = '';
|
|
4419
|
+
let queryParams = {};
|
|
4420
|
+
if (this.apiClient.isVertexAI()) {
|
|
4421
|
+
const body = cancelBatchJobParametersToVertex(this.apiClient, params);
|
|
4422
|
+
path = formatMap('batchPredictionJobs/{name}:cancel', body['_url']);
|
|
4423
|
+
queryParams = body['_query'];
|
|
4424
|
+
delete body['config'];
|
|
4425
|
+
delete body['_url'];
|
|
4426
|
+
delete body['_query'];
|
|
4427
|
+
await this.apiClient.request({
|
|
4428
|
+
path: path,
|
|
4429
|
+
queryParams: queryParams,
|
|
4430
|
+
body: JSON.stringify(body),
|
|
4431
|
+
httpMethod: 'POST',
|
|
4432
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
4433
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
4434
|
+
});
|
|
4435
|
+
}
|
|
4436
|
+
else {
|
|
4437
|
+
const body = cancelBatchJobParametersToMldev(this.apiClient, params);
|
|
4438
|
+
path = formatMap('batches/{name}:cancel', body['_url']);
|
|
4439
|
+
queryParams = body['_query'];
|
|
4440
|
+
delete body['config'];
|
|
4441
|
+
delete body['_url'];
|
|
4442
|
+
delete body['_query'];
|
|
4443
|
+
await this.apiClient.request({
|
|
4444
|
+
path: path,
|
|
4445
|
+
queryParams: queryParams,
|
|
4446
|
+
body: JSON.stringify(body),
|
|
4447
|
+
httpMethod: 'POST',
|
|
4448
|
+
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
4449
|
+
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
4450
|
+
});
|
|
4451
|
+
}
|
|
4452
|
+
}
|
|
4453
|
+
async listInternal(params) {
|
|
4454
|
+
var _a, _b, _c, _d;
|
|
4455
|
+
let response;
|
|
4456
|
+
let path = '';
|
|
4457
|
+
let queryParams = {};
|
|
4458
|
+
if (this.apiClient.isVertexAI()) {
|
|
4459
|
+
const body = listBatchJobsParametersToVertex(params);
|
|
4460
|
+
path = formatMap('batchPredictionJobs', body['_url']);
|
|
4461
|
+
queryParams = body['_query'];
|
|
4462
|
+
delete body['config'];
|
|
4463
|
+
delete body['_url'];
|
|
4464
|
+
delete body['_query'];
|
|
4465
|
+
response = this.apiClient
|
|
4466
|
+
.request({
|
|
4467
|
+
path: path,
|
|
4468
|
+
queryParams: queryParams,
|
|
4469
|
+
body: JSON.stringify(body),
|
|
4470
|
+
httpMethod: 'GET',
|
|
4471
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
4472
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
4473
|
+
})
|
|
4474
|
+
.then((httpResponse) => {
|
|
4475
|
+
return httpResponse.json();
|
|
4476
|
+
});
|
|
4477
|
+
return response.then((apiResponse) => {
|
|
4478
|
+
const resp = listBatchJobsResponseFromVertex(apiResponse);
|
|
4479
|
+
const typedResp = new ListBatchJobsResponse();
|
|
4480
|
+
Object.assign(typedResp, resp);
|
|
4481
|
+
return typedResp;
|
|
4482
|
+
});
|
|
4483
|
+
}
|
|
4484
|
+
else {
|
|
4485
|
+
const body = listBatchJobsParametersToMldev(params);
|
|
4486
|
+
path = formatMap('batches', body['_url']);
|
|
4487
|
+
queryParams = body['_query'];
|
|
4488
|
+
delete body['config'];
|
|
4489
|
+
delete body['_url'];
|
|
4490
|
+
delete body['_query'];
|
|
4491
|
+
response = this.apiClient
|
|
4492
|
+
.request({
|
|
4493
|
+
path: path,
|
|
4494
|
+
queryParams: queryParams,
|
|
4495
|
+
body: JSON.stringify(body),
|
|
4496
|
+
httpMethod: 'GET',
|
|
4497
|
+
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
4498
|
+
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
4499
|
+
})
|
|
4500
|
+
.then((httpResponse) => {
|
|
4501
|
+
return httpResponse.json();
|
|
4502
|
+
});
|
|
4503
|
+
return response.then((apiResponse) => {
|
|
4504
|
+
const resp = listBatchJobsResponseFromMldev(apiResponse);
|
|
4505
|
+
const typedResp = new ListBatchJobsResponse();
|
|
4506
|
+
Object.assign(typedResp, resp);
|
|
4507
|
+
return typedResp;
|
|
4508
|
+
});
|
|
4509
|
+
}
|
|
4510
|
+
}
|
|
4511
|
+
/**
|
|
4512
|
+
* Deletes a batch job.
|
|
4513
|
+
*
|
|
4514
|
+
* @param params - The parameters for the delete request.
|
|
4515
|
+
* @return The empty response returned by the API.
|
|
4516
|
+
*
|
|
4517
|
+
* @example
|
|
4518
|
+
* ```ts
|
|
4519
|
+
* await ai.batches.delete({name: '...'}); // The server-generated resource name.
|
|
4520
|
+
* ```
|
|
4521
|
+
*/
|
|
4522
|
+
async delete(params) {
|
|
4523
|
+
var _a, _b, _c, _d;
|
|
4524
|
+
let response;
|
|
4525
|
+
let path = '';
|
|
4526
|
+
let queryParams = {};
|
|
4527
|
+
if (this.apiClient.isVertexAI()) {
|
|
4528
|
+
const body = deleteBatchJobParametersToVertex(this.apiClient, params);
|
|
4529
|
+
path = formatMap('batchPredictionJobs/{name}', body['_url']);
|
|
4530
|
+
queryParams = body['_query'];
|
|
4531
|
+
delete body['config'];
|
|
4532
|
+
delete body['_url'];
|
|
4533
|
+
delete body['_query'];
|
|
4534
|
+
response = this.apiClient
|
|
4535
|
+
.request({
|
|
4536
|
+
path: path,
|
|
4537
|
+
queryParams: queryParams,
|
|
4538
|
+
body: JSON.stringify(body),
|
|
4539
|
+
httpMethod: 'DELETE',
|
|
4540
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
4541
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
4542
|
+
})
|
|
4543
|
+
.then((httpResponse) => {
|
|
4544
|
+
return httpResponse.json();
|
|
4545
|
+
});
|
|
4546
|
+
return response.then((apiResponse) => {
|
|
4547
|
+
const resp = deleteResourceJobFromVertex(apiResponse);
|
|
4548
|
+
return resp;
|
|
4549
|
+
});
|
|
4550
|
+
}
|
|
4551
|
+
else {
|
|
4552
|
+
const body = deleteBatchJobParametersToMldev(this.apiClient, params);
|
|
4553
|
+
path = formatMap('batches/{name}', body['_url']);
|
|
4554
|
+
queryParams = body['_query'];
|
|
4555
|
+
delete body['config'];
|
|
4556
|
+
delete body['_url'];
|
|
4557
|
+
delete body['_query'];
|
|
4558
|
+
response = this.apiClient
|
|
4559
|
+
.request({
|
|
4560
|
+
path: path,
|
|
4561
|
+
queryParams: queryParams,
|
|
4562
|
+
body: JSON.stringify(body),
|
|
4563
|
+
httpMethod: 'DELETE',
|
|
4564
|
+
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
4565
|
+
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
4566
|
+
})
|
|
4567
|
+
.then((httpResponse) => {
|
|
4568
|
+
return httpResponse.json();
|
|
4569
|
+
});
|
|
4570
|
+
return response.then((apiResponse) => {
|
|
4571
|
+
const resp = deleteResourceJobFromMldev(apiResponse);
|
|
4572
|
+
return resp;
|
|
4573
|
+
});
|
|
2419
4574
|
}
|
|
2420
4575
|
}
|
|
2421
|
-
return filteredSchema;
|
|
2422
4576
|
}
|
|
2423
4577
|
|
|
2424
4578
|
/**
|
|
@@ -2673,6 +4827,10 @@ function toolToMldev$3(fromObject) {
|
|
|
2673
4827
|
if (fromCodeExecution != null) {
|
|
2674
4828
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
2675
4829
|
}
|
|
4830
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
4831
|
+
if (fromComputerUse != null) {
|
|
4832
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
4833
|
+
}
|
|
2676
4834
|
return toObject;
|
|
2677
4835
|
}
|
|
2678
4836
|
function functionCallingConfigToMldev$1(fromObject) {
|
|
@@ -3163,6 +5321,10 @@ function toolToVertex$2(fromObject) {
|
|
|
3163
5321
|
if (fromCodeExecution != null) {
|
|
3164
5322
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
3165
5323
|
}
|
|
5324
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
5325
|
+
if (fromComputerUse != null) {
|
|
5326
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
5327
|
+
}
|
|
3166
5328
|
return toObject;
|
|
3167
5329
|
}
|
|
3168
5330
|
function functionCallingConfigToVertex$1(fromObject) {
|
|
@@ -3470,183 +5632,6 @@ function listCachedContentsResponseFromVertex(fromObject) {
|
|
|
3470
5632
|
return toObject;
|
|
3471
5633
|
}
|
|
3472
5634
|
|
|
3473
|
-
/**
|
|
3474
|
-
* @license
|
|
3475
|
-
* Copyright 2025 Google LLC
|
|
3476
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
3477
|
-
*/
|
|
3478
|
-
/**
|
|
3479
|
-
* Pagers for the GenAI List APIs.
|
|
3480
|
-
*/
|
|
3481
|
-
var PagedItem;
|
|
3482
|
-
(function (PagedItem) {
|
|
3483
|
-
PagedItem["PAGED_ITEM_BATCH_JOBS"] = "batchJobs";
|
|
3484
|
-
PagedItem["PAGED_ITEM_MODELS"] = "models";
|
|
3485
|
-
PagedItem["PAGED_ITEM_TUNING_JOBS"] = "tuningJobs";
|
|
3486
|
-
PagedItem["PAGED_ITEM_FILES"] = "files";
|
|
3487
|
-
PagedItem["PAGED_ITEM_CACHED_CONTENTS"] = "cachedContents";
|
|
3488
|
-
})(PagedItem || (PagedItem = {}));
|
|
3489
|
-
/**
|
|
3490
|
-
* Pager class for iterating through paginated results.
|
|
3491
|
-
*/
|
|
3492
|
-
class Pager {
|
|
3493
|
-
constructor(name, request, response, params) {
|
|
3494
|
-
this.pageInternal = [];
|
|
3495
|
-
this.paramsInternal = {};
|
|
3496
|
-
this.requestInternal = request;
|
|
3497
|
-
this.init(name, response, params);
|
|
3498
|
-
}
|
|
3499
|
-
init(name, response, params) {
|
|
3500
|
-
var _a, _b;
|
|
3501
|
-
this.nameInternal = name;
|
|
3502
|
-
this.pageInternal = response[this.nameInternal] || [];
|
|
3503
|
-
this.idxInternal = 0;
|
|
3504
|
-
let requestParams = { config: {} };
|
|
3505
|
-
if (!params) {
|
|
3506
|
-
requestParams = { config: {} };
|
|
3507
|
-
}
|
|
3508
|
-
else if (typeof params === 'object') {
|
|
3509
|
-
requestParams = Object.assign({}, params);
|
|
3510
|
-
}
|
|
3511
|
-
else {
|
|
3512
|
-
requestParams = params;
|
|
3513
|
-
}
|
|
3514
|
-
if (requestParams['config']) {
|
|
3515
|
-
requestParams['config']['pageToken'] = response['nextPageToken'];
|
|
3516
|
-
}
|
|
3517
|
-
this.paramsInternal = requestParams;
|
|
3518
|
-
this.pageInternalSize =
|
|
3519
|
-
(_b = (_a = requestParams['config']) === null || _a === void 0 ? void 0 : _a['pageSize']) !== null && _b !== void 0 ? _b : this.pageInternal.length;
|
|
3520
|
-
}
|
|
3521
|
-
initNextPage(response) {
|
|
3522
|
-
this.init(this.nameInternal, response, this.paramsInternal);
|
|
3523
|
-
}
|
|
3524
|
-
/**
|
|
3525
|
-
* Returns the current page, which is a list of items.
|
|
3526
|
-
*
|
|
3527
|
-
* @remarks
|
|
3528
|
-
* The first page is retrieved when the pager is created. The returned list of
|
|
3529
|
-
* items could be a subset of the entire list.
|
|
3530
|
-
*/
|
|
3531
|
-
get page() {
|
|
3532
|
-
return this.pageInternal;
|
|
3533
|
-
}
|
|
3534
|
-
/**
|
|
3535
|
-
* Returns the type of paged item (for example, ``batch_jobs``).
|
|
3536
|
-
*/
|
|
3537
|
-
get name() {
|
|
3538
|
-
return this.nameInternal;
|
|
3539
|
-
}
|
|
3540
|
-
/**
|
|
3541
|
-
* Returns the length of the page fetched each time by this pager.
|
|
3542
|
-
*
|
|
3543
|
-
* @remarks
|
|
3544
|
-
* The number of items in the page is less than or equal to the page length.
|
|
3545
|
-
*/
|
|
3546
|
-
get pageSize() {
|
|
3547
|
-
return this.pageInternalSize;
|
|
3548
|
-
}
|
|
3549
|
-
/**
|
|
3550
|
-
* Returns the parameters when making the API request for the next page.
|
|
3551
|
-
*
|
|
3552
|
-
* @remarks
|
|
3553
|
-
* Parameters contain a set of optional configs that can be
|
|
3554
|
-
* used to customize the API request. For example, the `pageToken` parameter
|
|
3555
|
-
* contains the token to request the next page.
|
|
3556
|
-
*/
|
|
3557
|
-
get params() {
|
|
3558
|
-
return this.paramsInternal;
|
|
3559
|
-
}
|
|
3560
|
-
/**
|
|
3561
|
-
* Returns the total number of items in the current page.
|
|
3562
|
-
*/
|
|
3563
|
-
get pageLength() {
|
|
3564
|
-
return this.pageInternal.length;
|
|
3565
|
-
}
|
|
3566
|
-
/**
|
|
3567
|
-
* Returns the item at the given index.
|
|
3568
|
-
*/
|
|
3569
|
-
getItem(index) {
|
|
3570
|
-
return this.pageInternal[index];
|
|
3571
|
-
}
|
|
3572
|
-
/**
|
|
3573
|
-
* Returns an async iterator that support iterating through all items
|
|
3574
|
-
* retrieved from the API.
|
|
3575
|
-
*
|
|
3576
|
-
* @remarks
|
|
3577
|
-
* The iterator will automatically fetch the next page if there are more items
|
|
3578
|
-
* to fetch from the API.
|
|
3579
|
-
*
|
|
3580
|
-
* @example
|
|
3581
|
-
*
|
|
3582
|
-
* ```ts
|
|
3583
|
-
* const pager = await ai.files.list({config: {pageSize: 10}});
|
|
3584
|
-
* for await (const file of pager) {
|
|
3585
|
-
* console.log(file.name);
|
|
3586
|
-
* }
|
|
3587
|
-
* ```
|
|
3588
|
-
*/
|
|
3589
|
-
[Symbol.asyncIterator]() {
|
|
3590
|
-
return {
|
|
3591
|
-
next: async () => {
|
|
3592
|
-
if (this.idxInternal >= this.pageLength) {
|
|
3593
|
-
if (this.hasNextPage()) {
|
|
3594
|
-
await this.nextPage();
|
|
3595
|
-
}
|
|
3596
|
-
else {
|
|
3597
|
-
return { value: undefined, done: true };
|
|
3598
|
-
}
|
|
3599
|
-
}
|
|
3600
|
-
const item = this.getItem(this.idxInternal);
|
|
3601
|
-
this.idxInternal += 1;
|
|
3602
|
-
return { value: item, done: false };
|
|
3603
|
-
},
|
|
3604
|
-
return: async () => {
|
|
3605
|
-
return { value: undefined, done: true };
|
|
3606
|
-
},
|
|
3607
|
-
};
|
|
3608
|
-
}
|
|
3609
|
-
/**
|
|
3610
|
-
* Fetches the next page of items. This makes a new API request.
|
|
3611
|
-
*
|
|
3612
|
-
* @throws {Error} If there are no more pages to fetch.
|
|
3613
|
-
*
|
|
3614
|
-
* @example
|
|
3615
|
-
*
|
|
3616
|
-
* ```ts
|
|
3617
|
-
* const pager = await ai.files.list({config: {pageSize: 10}});
|
|
3618
|
-
* let page = pager.page;
|
|
3619
|
-
* while (true) {
|
|
3620
|
-
* for (const file of page) {
|
|
3621
|
-
* console.log(file.name);
|
|
3622
|
-
* }
|
|
3623
|
-
* if (!pager.hasNextPage()) {
|
|
3624
|
-
* break;
|
|
3625
|
-
* }
|
|
3626
|
-
* page = await pager.nextPage();
|
|
3627
|
-
* }
|
|
3628
|
-
* ```
|
|
3629
|
-
*/
|
|
3630
|
-
async nextPage() {
|
|
3631
|
-
if (!this.hasNextPage()) {
|
|
3632
|
-
throw new Error('No more pages to fetch.');
|
|
3633
|
-
}
|
|
3634
|
-
const response = await this.requestInternal(this.params);
|
|
3635
|
-
this.initNextPage(response);
|
|
3636
|
-
return this.page;
|
|
3637
|
-
}
|
|
3638
|
-
/**
|
|
3639
|
-
* Returns true if there are more pages to fetch from the API.
|
|
3640
|
-
*/
|
|
3641
|
-
hasNextPage() {
|
|
3642
|
-
var _a;
|
|
3643
|
-
if (((_a = this.params['config']) === null || _a === void 0 ? void 0 : _a['pageToken']) !== undefined) {
|
|
3644
|
-
return true;
|
|
3645
|
-
}
|
|
3646
|
-
return false;
|
|
3647
|
-
}
|
|
3648
|
-
}
|
|
3649
|
-
|
|
3650
5635
|
/**
|
|
3651
5636
|
* @license
|
|
3652
5637
|
* Copyright 2025 Google LLC
|
|
@@ -5546,6 +7531,10 @@ function toolToMldev$2(fromObject) {
|
|
|
5546
7531
|
if (fromCodeExecution != null) {
|
|
5547
7532
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
5548
7533
|
}
|
|
7534
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
7535
|
+
if (fromComputerUse != null) {
|
|
7536
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
7537
|
+
}
|
|
5549
7538
|
return toObject;
|
|
5550
7539
|
}
|
|
5551
7540
|
function toolToVertex$1(fromObject) {
|
|
@@ -5596,6 +7585,10 @@ function toolToVertex$1(fromObject) {
|
|
|
5596
7585
|
if (fromCodeExecution != null) {
|
|
5597
7586
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
5598
7587
|
}
|
|
7588
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
7589
|
+
if (fromComputerUse != null) {
|
|
7590
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
7591
|
+
}
|
|
5599
7592
|
return toObject;
|
|
5600
7593
|
}
|
|
5601
7594
|
function sessionResumptionConfigToMldev$1(fromObject) {
|
|
@@ -6091,8 +8084,9 @@ function liveSendRealtimeInputParametersToVertex(fromObject) {
|
|
|
6091
8084
|
if (fromMedia != null) {
|
|
6092
8085
|
setValueByPath(toObject, ['mediaChunks'], tBlobs(fromMedia));
|
|
6093
8086
|
}
|
|
6094
|
-
|
|
6095
|
-
|
|
8087
|
+
const fromAudio = getValueByPath(fromObject, ['audio']);
|
|
8088
|
+
if (fromAudio != null) {
|
|
8089
|
+
setValueByPath(toObject, ['audio'], tAudioBlob(fromAudio));
|
|
6096
8090
|
}
|
|
6097
8091
|
const fromAudioStreamEnd = getValueByPath(fromObject, [
|
|
6098
8092
|
'audioStreamEnd',
|
|
@@ -6100,11 +8094,13 @@ function liveSendRealtimeInputParametersToVertex(fromObject) {
|
|
|
6100
8094
|
if (fromAudioStreamEnd != null) {
|
|
6101
8095
|
setValueByPath(toObject, ['audioStreamEnd'], fromAudioStreamEnd);
|
|
6102
8096
|
}
|
|
6103
|
-
|
|
6104
|
-
|
|
8097
|
+
const fromVideo = getValueByPath(fromObject, ['video']);
|
|
8098
|
+
if (fromVideo != null) {
|
|
8099
|
+
setValueByPath(toObject, ['video'], tImageBlob(fromVideo));
|
|
6105
8100
|
}
|
|
6106
|
-
|
|
6107
|
-
|
|
8101
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
8102
|
+
if (fromText != null) {
|
|
8103
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
6108
8104
|
}
|
|
6109
8105
|
const fromActivityStart = getValueByPath(fromObject, [
|
|
6110
8106
|
'activityStart',
|
|
@@ -6260,8 +8256,12 @@ function liveServerSetupCompleteFromMldev() {
|
|
|
6260
8256
|
const toObject = {};
|
|
6261
8257
|
return toObject;
|
|
6262
8258
|
}
|
|
6263
|
-
function liveServerSetupCompleteFromVertex() {
|
|
8259
|
+
function liveServerSetupCompleteFromVertex(fromObject) {
|
|
6264
8260
|
const toObject = {};
|
|
8261
|
+
const fromSessionId = getValueByPath(fromObject, ['sessionId']);
|
|
8262
|
+
if (fromSessionId != null) {
|
|
8263
|
+
setValueByPath(toObject, ['sessionId'], fromSessionId);
|
|
8264
|
+
}
|
|
6265
8265
|
return toObject;
|
|
6266
8266
|
}
|
|
6267
8267
|
function videoMetadataFromMldev$1(fromObject) {
|
|
@@ -7014,7 +9014,7 @@ function liveServerMessageFromVertex(fromObject) {
|
|
|
7014
9014
|
'setupComplete',
|
|
7015
9015
|
]);
|
|
7016
9016
|
if (fromSetupComplete != null) {
|
|
7017
|
-
setValueByPath(toObject, ['setupComplete'], liveServerSetupCompleteFromVertex());
|
|
9017
|
+
setValueByPath(toObject, ['setupComplete'], liveServerSetupCompleteFromVertex(fromSetupComplete));
|
|
7018
9018
|
}
|
|
7019
9019
|
const fromServerContent = getValueByPath(fromObject, [
|
|
7020
9020
|
'serverContent',
|
|
@@ -7582,6 +9582,10 @@ function toolToMldev$1(fromObject) {
|
|
|
7582
9582
|
if (fromCodeExecution != null) {
|
|
7583
9583
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
7584
9584
|
}
|
|
9585
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
9586
|
+
if (fromComputerUse != null) {
|
|
9587
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
9588
|
+
}
|
|
7585
9589
|
return toObject;
|
|
7586
9590
|
}
|
|
7587
9591
|
function functionCallingConfigToMldev(fromObject) {
|
|
@@ -7794,6 +9798,12 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
7794
9798
|
if (fromResponseSchema != null) {
|
|
7795
9799
|
setValueByPath(toObject, ['responseSchema'], schemaToMldev(tSchema(fromResponseSchema)));
|
|
7796
9800
|
}
|
|
9801
|
+
const fromResponseJsonSchema = getValueByPath(fromObject, [
|
|
9802
|
+
'responseJsonSchema',
|
|
9803
|
+
]);
|
|
9804
|
+
if (fromResponseJsonSchema != null) {
|
|
9805
|
+
setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
|
|
9806
|
+
}
|
|
7797
9807
|
if (getValueByPath(fromObject, ['routingConfig']) !== undefined) {
|
|
7798
9808
|
throw new Error('routingConfig parameter is not supported in Gemini API.');
|
|
7799
9809
|
}
|
|
@@ -8208,6 +10218,9 @@ function generateVideosConfigToMldev(fromObject, parentObject) {
|
|
|
8208
10218
|
if (getValueByPath(fromObject, ['lastFrame']) !== undefined) {
|
|
8209
10219
|
throw new Error('lastFrame parameter is not supported in Gemini API.');
|
|
8210
10220
|
}
|
|
10221
|
+
if (getValueByPath(fromObject, ['compressionQuality']) !== undefined) {
|
|
10222
|
+
throw new Error('compressionQuality parameter is not supported in Gemini API.');
|
|
10223
|
+
}
|
|
8211
10224
|
return toObject;
|
|
8212
10225
|
}
|
|
8213
10226
|
function generateVideosParametersToMldev(apiClient, fromObject) {
|
|
@@ -8662,6 +10675,10 @@ function toolToVertex(fromObject) {
|
|
|
8662
10675
|
if (fromCodeExecution != null) {
|
|
8663
10676
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
8664
10677
|
}
|
|
10678
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
10679
|
+
if (fromComputerUse != null) {
|
|
10680
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
10681
|
+
}
|
|
8665
10682
|
return toObject;
|
|
8666
10683
|
}
|
|
8667
10684
|
function functionCallingConfigToVertex(fromObject) {
|
|
@@ -8843,6 +10860,12 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
|
|
|
8843
10860
|
if (fromResponseSchema != null) {
|
|
8844
10861
|
setValueByPath(toObject, ['responseSchema'], schemaToVertex(tSchema(fromResponseSchema)));
|
|
8845
10862
|
}
|
|
10863
|
+
const fromResponseJsonSchema = getValueByPath(fromObject, [
|
|
10864
|
+
'responseJsonSchema',
|
|
10865
|
+
]);
|
|
10866
|
+
if (fromResponseJsonSchema != null) {
|
|
10867
|
+
setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
|
|
10868
|
+
}
|
|
8846
10869
|
const fromRoutingConfig = getValueByPath(fromObject, [
|
|
8847
10870
|
'routingConfig',
|
|
8848
10871
|
]);
|
|
@@ -9331,6 +11354,18 @@ function upscaleImageAPIConfigInternalToVertex(fromObject, parentObject) {
|
|
|
9331
11354
|
if (parentObject !== undefined && fromOutputCompressionQuality != null) {
|
|
9332
11355
|
setValueByPath(parentObject, ['parameters', 'outputOptions', 'compressionQuality'], fromOutputCompressionQuality);
|
|
9333
11356
|
}
|
|
11357
|
+
const fromEnhanceInputImage = getValueByPath(fromObject, [
|
|
11358
|
+
'enhanceInputImage',
|
|
11359
|
+
]);
|
|
11360
|
+
if (parentObject !== undefined && fromEnhanceInputImage != null) {
|
|
11361
|
+
setValueByPath(parentObject, ['parameters', 'upscaleConfig', 'enhanceInputImage'], fromEnhanceInputImage);
|
|
11362
|
+
}
|
|
11363
|
+
const fromImagePreservationFactor = getValueByPath(fromObject, [
|
|
11364
|
+
'imagePreservationFactor',
|
|
11365
|
+
]);
|
|
11366
|
+
if (parentObject !== undefined && fromImagePreservationFactor != null) {
|
|
11367
|
+
setValueByPath(parentObject, ['parameters', 'upscaleConfig', 'imagePreservationFactor'], fromImagePreservationFactor);
|
|
11368
|
+
}
|
|
9334
11369
|
const fromNumberOfImages = getValueByPath(fromObject, [
|
|
9335
11370
|
'numberOfImages',
|
|
9336
11371
|
]);
|
|
@@ -9599,6 +11634,12 @@ function generateVideosConfigToVertex(fromObject, parentObject) {
|
|
|
9599
11634
|
if (parentObject !== undefined && fromLastFrame != null) {
|
|
9600
11635
|
setValueByPath(parentObject, ['instances[0]', 'lastFrame'], imageToVertex(fromLastFrame));
|
|
9601
11636
|
}
|
|
11637
|
+
const fromCompressionQuality = getValueByPath(fromObject, [
|
|
11638
|
+
'compressionQuality',
|
|
11639
|
+
]);
|
|
11640
|
+
if (parentObject !== undefined && fromCompressionQuality != null) {
|
|
11641
|
+
setValueByPath(parentObject, ['parameters', 'compressionQuality'], fromCompressionQuality);
|
|
11642
|
+
}
|
|
9602
11643
|
return toObject;
|
|
9603
11644
|
}
|
|
9604
11645
|
function generateVideosParametersToVertex(apiClient, fromObject) {
|
|
@@ -10021,7 +12062,7 @@ function modelFromMldev(fromObject) {
|
|
|
10021
12062
|
}
|
|
10022
12063
|
return toObject;
|
|
10023
12064
|
}
|
|
10024
|
-
function listModelsResponseFromMldev(
|
|
12065
|
+
function listModelsResponseFromMldev(fromObject) {
|
|
10025
12066
|
const toObject = {};
|
|
10026
12067
|
const fromNextPageToken = getValueByPath(fromObject, [
|
|
10027
12068
|
'nextPageToken',
|
|
@@ -10665,7 +12706,7 @@ function modelFromVertex(fromObject) {
|
|
|
10665
12706
|
}
|
|
10666
12707
|
return toObject;
|
|
10667
12708
|
}
|
|
10668
|
-
function listModelsResponseFromVertex(
|
|
12709
|
+
function listModelsResponseFromVertex(fromObject) {
|
|
10669
12710
|
const toObject = {};
|
|
10670
12711
|
const fromNextPageToken = getValueByPath(fromObject, [
|
|
10671
12712
|
'nextPageToken',
|
|
@@ -10791,7 +12832,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
10791
12832
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
10792
12833
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
10793
12834
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
10794
|
-
const SDK_VERSION = '1.
|
|
12835
|
+
const SDK_VERSION = '1.8.0'; // x-release-please-version
|
|
10795
12836
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
10796
12837
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
10797
12838
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -11790,13 +13831,17 @@ const FUNCTION_RESPONSE_REQUIRES_ID = 'FunctionResponse request must have an `id
|
|
|
11790
13831
|
*/
|
|
11791
13832
|
async function handleWebSocketMessage(apiClient, onmessage, event) {
|
|
11792
13833
|
const serverMessage = new LiveServerMessage();
|
|
11793
|
-
let
|
|
13834
|
+
let jsonData;
|
|
11794
13835
|
if (event.data instanceof Blob) {
|
|
11795
|
-
|
|
13836
|
+
jsonData = await event.data.text();
|
|
13837
|
+
}
|
|
13838
|
+
else if (event.data instanceof ArrayBuffer) {
|
|
13839
|
+
jsonData = new TextDecoder().decode(event.data);
|
|
11796
13840
|
}
|
|
11797
13841
|
else {
|
|
11798
|
-
|
|
13842
|
+
jsonData = event.data;
|
|
11799
13843
|
}
|
|
13844
|
+
const data = JSON.parse(jsonData);
|
|
11800
13845
|
if (apiClient.isVertexAI()) {
|
|
11801
13846
|
const resp = liveServerMessageFromVertex(data);
|
|
11802
13847
|
Object.assign(serverMessage, resp);
|
|
@@ -13121,7 +15166,7 @@ class Models extends BaseModule {
|
|
|
13121
15166
|
return httpResponse.json();
|
|
13122
15167
|
});
|
|
13123
15168
|
return response.then((apiResponse) => {
|
|
13124
|
-
const resp = listModelsResponseFromVertex(
|
|
15169
|
+
const resp = listModelsResponseFromVertex(apiResponse);
|
|
13125
15170
|
const typedResp = new ListModelsResponse();
|
|
13126
15171
|
Object.assign(typedResp, resp);
|
|
13127
15172
|
return typedResp;
|
|
@@ -13147,7 +15192,7 @@ class Models extends BaseModule {
|
|
|
13147
15192
|
return httpResponse.json();
|
|
13148
15193
|
});
|
|
13149
15194
|
return response.then((apiResponse) => {
|
|
13150
|
-
const resp = listModelsResponseFromMldev(
|
|
15195
|
+
const resp = listModelsResponseFromMldev(apiResponse);
|
|
13151
15196
|
const typedResp = new ListModelsResponse();
|
|
13152
15197
|
Object.assign(typedResp, resp);
|
|
13153
15198
|
return typedResp;
|
|
@@ -14157,6 +16202,10 @@ function toolToMldev(fromObject) {
|
|
|
14157
16202
|
if (fromCodeExecution != null) {
|
|
14158
16203
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
14159
16204
|
}
|
|
16205
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
16206
|
+
if (fromComputerUse != null) {
|
|
16207
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
16208
|
+
}
|
|
14160
16209
|
return toObject;
|
|
14161
16210
|
}
|
|
14162
16211
|
function sessionResumptionConfigToMldev(fromObject) {
|
|
@@ -14921,6 +16970,9 @@ function tuningDatasetToMldev(fromObject) {
|
|
|
14921
16970
|
if (getValueByPath(fromObject, ['gcsUri']) !== undefined) {
|
|
14922
16971
|
throw new Error('gcsUri parameter is not supported in Gemini API.');
|
|
14923
16972
|
}
|
|
16973
|
+
if (getValueByPath(fromObject, ['vertexDatasetResource']) !== undefined) {
|
|
16974
|
+
throw new Error('vertexDatasetResource parameter is not supported in Gemini API.');
|
|
16975
|
+
}
|
|
14924
16976
|
const fromExamples = getValueByPath(fromObject, ['examples']);
|
|
14925
16977
|
if (fromExamples != null) {
|
|
14926
16978
|
let transformedList = fromExamples;
|
|
@@ -15034,17 +17086,29 @@ function tuningDatasetToVertex(fromObject, parentObject) {
|
|
|
15034
17086
|
if (parentObject !== undefined && fromGcsUri != null) {
|
|
15035
17087
|
setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromGcsUri);
|
|
15036
17088
|
}
|
|
17089
|
+
const fromVertexDatasetResource = getValueByPath(fromObject, [
|
|
17090
|
+
'vertexDatasetResource',
|
|
17091
|
+
]);
|
|
17092
|
+
if (parentObject !== undefined && fromVertexDatasetResource != null) {
|
|
17093
|
+
setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
|
|
17094
|
+
}
|
|
15037
17095
|
if (getValueByPath(fromObject, ['examples']) !== undefined) {
|
|
15038
17096
|
throw new Error('examples parameter is not supported in Vertex AI.');
|
|
15039
17097
|
}
|
|
15040
17098
|
return toObject;
|
|
15041
17099
|
}
|
|
15042
|
-
function tuningValidationDatasetToVertex(fromObject) {
|
|
17100
|
+
function tuningValidationDatasetToVertex(fromObject, parentObject) {
|
|
15043
17101
|
const toObject = {};
|
|
15044
17102
|
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
15045
17103
|
if (fromGcsUri != null) {
|
|
15046
17104
|
setValueByPath(toObject, ['validationDatasetUri'], fromGcsUri);
|
|
15047
17105
|
}
|
|
17106
|
+
const fromVertexDatasetResource = getValueByPath(fromObject, [
|
|
17107
|
+
'vertexDatasetResource',
|
|
17108
|
+
]);
|
|
17109
|
+
if (parentObject !== undefined && fromVertexDatasetResource != null) {
|
|
17110
|
+
setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
|
|
17111
|
+
}
|
|
15048
17112
|
return toObject;
|
|
15049
17113
|
}
|
|
15050
17114
|
function createTuningJobConfigToVertex(fromObject, parentObject) {
|
|
@@ -15053,7 +17117,7 @@ function createTuningJobConfigToVertex(fromObject, parentObject) {
|
|
|
15053
17117
|
'validationDataset',
|
|
15054
17118
|
]);
|
|
15055
17119
|
if (parentObject !== undefined && fromValidationDataset != null) {
|
|
15056
|
-
setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
|
|
17120
|
+
setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset, toObject));
|
|
15057
17121
|
}
|
|
15058
17122
|
const fromTunedModelDisplayName = getValueByPath(fromObject, [
|
|
15059
17123
|
'tunedModelDisplayName',
|
|
@@ -15185,6 +17249,14 @@ function tuningJobFromMldev(fromObject) {
|
|
|
15185
17249
|
if (fromPipelineJob != null) {
|
|
15186
17250
|
setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
|
|
15187
17251
|
}
|
|
17252
|
+
const fromSatisfiesPzi = getValueByPath(fromObject, ['satisfiesPzi']);
|
|
17253
|
+
if (fromSatisfiesPzi != null) {
|
|
17254
|
+
setValueByPath(toObject, ['satisfiesPzi'], fromSatisfiesPzi);
|
|
17255
|
+
}
|
|
17256
|
+
const fromSatisfiesPzs = getValueByPath(fromObject, ['satisfiesPzs']);
|
|
17257
|
+
if (fromSatisfiesPzs != null) {
|
|
17258
|
+
setValueByPath(toObject, ['satisfiesPzs'], fromSatisfiesPzs);
|
|
17259
|
+
}
|
|
15188
17260
|
const fromServiceAccount = getValueByPath(fromObject, [
|
|
15189
17261
|
'serviceAccount',
|
|
15190
17262
|
]);
|
|
@@ -15365,6 +17437,14 @@ function tuningJobFromVertex(fromObject) {
|
|
|
15365
17437
|
if (fromPipelineJob != null) {
|
|
15366
17438
|
setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
|
|
15367
17439
|
}
|
|
17440
|
+
const fromSatisfiesPzi = getValueByPath(fromObject, ['satisfiesPzi']);
|
|
17441
|
+
if (fromSatisfiesPzi != null) {
|
|
17442
|
+
setValueByPath(toObject, ['satisfiesPzi'], fromSatisfiesPzi);
|
|
17443
|
+
}
|
|
17444
|
+
const fromSatisfiesPzs = getValueByPath(fromObject, ['satisfiesPzs']);
|
|
17445
|
+
if (fromSatisfiesPzs != null) {
|
|
17446
|
+
setValueByPath(toObject, ['satisfiesPzs'], fromSatisfiesPzs);
|
|
17447
|
+
}
|
|
15368
17448
|
const fromServiceAccount = getValueByPath(fromObject, [
|
|
15369
17449
|
'serviceAccount',
|
|
15370
17450
|
]);
|
|
@@ -16020,6 +18100,7 @@ class GoogleGenAI {
|
|
|
16020
18100
|
});
|
|
16021
18101
|
this.models = new Models(this.apiClient);
|
|
16022
18102
|
this.live = new Live(this.apiClient, auth, new NodeWebSocketFactory());
|
|
18103
|
+
this.batches = new Batches(this.apiClient);
|
|
16023
18104
|
this.chats = new Chats(this.models, this.apiClient);
|
|
16024
18105
|
this.caches = new Caches(this.apiClient);
|
|
16025
18106
|
this.files = new Files(this.apiClient);
|
|
@@ -16050,5 +18131,5 @@ function getApiKeyFromEnv() {
|
|
|
16050
18131
|
return envGoogleApiKey || envGeminiApiKey;
|
|
16051
18132
|
}
|
|
16052
18133
|
|
|
16053
|
-
export { ActivityHandling, AdapterSize, ApiError, AuthType, Behavior, BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EndSensitivity, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, JobState, Language, ListCachedContentsResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Mode, Models, Operations, Outcome, PagedItem, Pager, PersonGeneration, RawReferenceImage, ReplayResponse, SafetyFilterLevel, Scale, Session, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, Tokens, TrafficType, TurnCoverage, Type, UpscaleImageResponse, UrlRetrievalStatus, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
|
|
18134
|
+
export { ActivityHandling, AdapterSize, ApiError, ApiSpec, AuthType, Batches, Behavior, BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EndSensitivity, Environment, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, InlinedResponse, JobState, Language, ListBatchJobsResponse, ListCachedContentsResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Mode, Models, Operations, Outcome, PagedItem, Pager, PersonGeneration, RawReferenceImage, ReplayResponse, SafetyFilterLevel, Scale, Session, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, Tokens, TrafficType, TurnCoverage, Type, UpscaleImageResponse, UrlRetrievalStatus, VideoCompressionQuality, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
|
|
16054
18135
|
//# sourceMappingURL=index.mjs.map
|