@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/index.cjs
CHANGED
|
@@ -259,6 +259,22 @@ exports.HarmCategory = void 0;
|
|
|
259
259
|
* Deprecated: Election filter is not longer supported. The harm category is civic integrity.
|
|
260
260
|
*/
|
|
261
261
|
HarmCategory["HARM_CATEGORY_CIVIC_INTEGRITY"] = "HARM_CATEGORY_CIVIC_INTEGRITY";
|
|
262
|
+
/**
|
|
263
|
+
* The harm category is image hate.
|
|
264
|
+
*/
|
|
265
|
+
HarmCategory["HARM_CATEGORY_IMAGE_HATE"] = "HARM_CATEGORY_IMAGE_HATE";
|
|
266
|
+
/**
|
|
267
|
+
* The harm category is image dangerous content.
|
|
268
|
+
*/
|
|
269
|
+
HarmCategory["HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT"] = "HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT";
|
|
270
|
+
/**
|
|
271
|
+
* The harm category is image harassment.
|
|
272
|
+
*/
|
|
273
|
+
HarmCategory["HARM_CATEGORY_IMAGE_HARASSMENT"] = "HARM_CATEGORY_IMAGE_HARASSMENT";
|
|
274
|
+
/**
|
|
275
|
+
* The harm category is image sexually explicit content.
|
|
276
|
+
*/
|
|
277
|
+
HarmCategory["HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT"] = "HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT";
|
|
262
278
|
})(exports.HarmCategory || (exports.HarmCategory = {}));
|
|
263
279
|
/** Optional. Specify if the threshold is used for probability or severity score. If not specified, the threshold is used for probability score. */
|
|
264
280
|
exports.HarmBlockMethod = void 0;
|
|
@@ -345,6 +361,50 @@ exports.AuthType = void 0;
|
|
|
345
361
|
*/
|
|
346
362
|
AuthType["OIDC_AUTH"] = "OIDC_AUTH";
|
|
347
363
|
})(exports.AuthType || (exports.AuthType = {}));
|
|
364
|
+
/** The API spec that the external API implements. */
|
|
365
|
+
exports.ApiSpec = void 0;
|
|
366
|
+
(function (ApiSpec) {
|
|
367
|
+
/**
|
|
368
|
+
* Unspecified API spec. This value should not be used.
|
|
369
|
+
*/
|
|
370
|
+
ApiSpec["API_SPEC_UNSPECIFIED"] = "API_SPEC_UNSPECIFIED";
|
|
371
|
+
/**
|
|
372
|
+
* Simple search API spec.
|
|
373
|
+
*/
|
|
374
|
+
ApiSpec["SIMPLE_SEARCH"] = "SIMPLE_SEARCH";
|
|
375
|
+
/**
|
|
376
|
+
* Elastic search API spec.
|
|
377
|
+
*/
|
|
378
|
+
ApiSpec["ELASTIC_SEARCH"] = "ELASTIC_SEARCH";
|
|
379
|
+
})(exports.ApiSpec || (exports.ApiSpec = {}));
|
|
380
|
+
/** Required. The environment being operated. */
|
|
381
|
+
exports.Environment = void 0;
|
|
382
|
+
(function (Environment) {
|
|
383
|
+
/**
|
|
384
|
+
* Defaults to browser.
|
|
385
|
+
*/
|
|
386
|
+
Environment["ENVIRONMENT_UNSPECIFIED"] = "ENVIRONMENT_UNSPECIFIED";
|
|
387
|
+
/**
|
|
388
|
+
* Operates in a web browser.
|
|
389
|
+
*/
|
|
390
|
+
Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
|
|
391
|
+
})(exports.Environment || (exports.Environment = {}));
|
|
392
|
+
/** Status of the url retrieval. */
|
|
393
|
+
exports.UrlRetrievalStatus = void 0;
|
|
394
|
+
(function (UrlRetrievalStatus) {
|
|
395
|
+
/**
|
|
396
|
+
* Default value. This value is unused
|
|
397
|
+
*/
|
|
398
|
+
UrlRetrievalStatus["URL_RETRIEVAL_STATUS_UNSPECIFIED"] = "URL_RETRIEVAL_STATUS_UNSPECIFIED";
|
|
399
|
+
/**
|
|
400
|
+
* Url retrieval is successful.
|
|
401
|
+
*/
|
|
402
|
+
UrlRetrievalStatus["URL_RETRIEVAL_STATUS_SUCCESS"] = "URL_RETRIEVAL_STATUS_SUCCESS";
|
|
403
|
+
/**
|
|
404
|
+
* Url retrieval is failed due to error.
|
|
405
|
+
*/
|
|
406
|
+
UrlRetrievalStatus["URL_RETRIEVAL_STATUS_ERROR"] = "URL_RETRIEVAL_STATUS_ERROR";
|
|
407
|
+
})(exports.UrlRetrievalStatus || (exports.UrlRetrievalStatus = {}));
|
|
348
408
|
/** Output only. The reason why the model stopped generating tokens.
|
|
349
409
|
|
|
350
410
|
If empty, the model has not stopped generating the tokens.
|
|
@@ -475,6 +535,10 @@ exports.BlockedReason = void 0;
|
|
|
475
535
|
* Candidates blocked due to prohibited content.
|
|
476
536
|
*/
|
|
477
537
|
BlockedReason["PROHIBITED_CONTENT"] = "PROHIBITED_CONTENT";
|
|
538
|
+
/**
|
|
539
|
+
* Candidates blocked due to unsafe image generation content.
|
|
540
|
+
*/
|
|
541
|
+
BlockedReason["IMAGE_SAFETY"] = "IMAGE_SAFETY";
|
|
478
542
|
})(exports.BlockedReason || (exports.BlockedReason = {}));
|
|
479
543
|
/** Output only. Traffic type. This shows whether a request consumes Pay-As-You-Go or Provisioned Throughput quota. */
|
|
480
544
|
exports.TrafficType = void 0;
|
|
@@ -532,7 +596,7 @@ exports.MediaResolution = void 0;
|
|
|
532
596
|
*/
|
|
533
597
|
MediaResolution["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
|
|
534
598
|
})(exports.MediaResolution || (exports.MediaResolution = {}));
|
|
535
|
-
/**
|
|
599
|
+
/** Job state. */
|
|
536
600
|
exports.JobState = void 0;
|
|
537
601
|
(function (JobState) {
|
|
538
602
|
/**
|
|
@@ -576,7 +640,7 @@ exports.JobState = void 0;
|
|
|
576
640
|
*/
|
|
577
641
|
JobState["JOB_STATE_EXPIRED"] = "JOB_STATE_EXPIRED";
|
|
578
642
|
/**
|
|
579
|
-
* The job is being updated. Only jobs in the `
|
|
643
|
+
* 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.
|
|
580
644
|
*/
|
|
581
645
|
JobState["JOB_STATE_UPDATING"] = "JOB_STATE_UPDATING";
|
|
582
646
|
/**
|
|
@@ -672,22 +736,6 @@ exports.FunctionCallingConfigMode = void 0;
|
|
|
672
736
|
*/
|
|
673
737
|
FunctionCallingConfigMode["NONE"] = "NONE";
|
|
674
738
|
})(exports.FunctionCallingConfigMode || (exports.FunctionCallingConfigMode = {}));
|
|
675
|
-
/** Status of the url retrieval. */
|
|
676
|
-
exports.UrlRetrievalStatus = void 0;
|
|
677
|
-
(function (UrlRetrievalStatus) {
|
|
678
|
-
/**
|
|
679
|
-
* Default value. This value is unused
|
|
680
|
-
*/
|
|
681
|
-
UrlRetrievalStatus["URL_RETRIEVAL_STATUS_UNSPECIFIED"] = "URL_RETRIEVAL_STATUS_UNSPECIFIED";
|
|
682
|
-
/**
|
|
683
|
-
* Url retrieval is successful.
|
|
684
|
-
*/
|
|
685
|
-
UrlRetrievalStatus["URL_RETRIEVAL_STATUS_SUCCESS"] = "URL_RETRIEVAL_STATUS_SUCCESS";
|
|
686
|
-
/**
|
|
687
|
-
* Url retrieval is failed due to error.
|
|
688
|
-
*/
|
|
689
|
-
UrlRetrievalStatus["URL_RETRIEVAL_STATUS_ERROR"] = "URL_RETRIEVAL_STATUS_ERROR";
|
|
690
|
-
})(exports.UrlRetrievalStatus || (exports.UrlRetrievalStatus = {}));
|
|
691
739
|
/** Enum that controls the safety filter level for objectionable content. */
|
|
692
740
|
exports.SafetyFilterLevel = void 0;
|
|
693
741
|
(function (SafetyFilterLevel) {
|
|
@@ -699,8 +747,17 @@ exports.SafetyFilterLevel = void 0;
|
|
|
699
747
|
/** Enum that controls the generation of people. */
|
|
700
748
|
exports.PersonGeneration = void 0;
|
|
701
749
|
(function (PersonGeneration) {
|
|
750
|
+
/**
|
|
751
|
+
* Block generation of images of people.
|
|
752
|
+
*/
|
|
702
753
|
PersonGeneration["DONT_ALLOW"] = "DONT_ALLOW";
|
|
754
|
+
/**
|
|
755
|
+
* Generate images of adults, but not children.
|
|
756
|
+
*/
|
|
703
757
|
PersonGeneration["ALLOW_ADULT"] = "ALLOW_ADULT";
|
|
758
|
+
/**
|
|
759
|
+
* Generate images that include adults and children.
|
|
760
|
+
*/
|
|
704
761
|
PersonGeneration["ALLOW_ALL"] = "ALLOW_ALL";
|
|
705
762
|
})(exports.PersonGeneration || (exports.PersonGeneration = {}));
|
|
706
763
|
/** Enum that specifies the language of the text in the prompt. */
|
|
@@ -749,6 +806,20 @@ exports.EditMode = void 0;
|
|
|
749
806
|
EditMode["EDIT_MODE_BGSWAP"] = "EDIT_MODE_BGSWAP";
|
|
750
807
|
EditMode["EDIT_MODE_PRODUCT_IMAGE"] = "EDIT_MODE_PRODUCT_IMAGE";
|
|
751
808
|
})(exports.EditMode || (exports.EditMode = {}));
|
|
809
|
+
/** Enum that controls the compression quality of the generated videos. */
|
|
810
|
+
exports.VideoCompressionQuality = void 0;
|
|
811
|
+
(function (VideoCompressionQuality) {
|
|
812
|
+
/**
|
|
813
|
+
* Optimized video compression quality. This will produce videos
|
|
814
|
+
with a compressed, smaller file size.
|
|
815
|
+
*/
|
|
816
|
+
VideoCompressionQuality["OPTIMIZED"] = "OPTIMIZED";
|
|
817
|
+
/**
|
|
818
|
+
* Lossless video compression quality. This will produce videos
|
|
819
|
+
with a larger file size.
|
|
820
|
+
*/
|
|
821
|
+
VideoCompressionQuality["LOSSLESS"] = "LOSSLESS";
|
|
822
|
+
})(exports.VideoCompressionQuality || (exports.VideoCompressionQuality = {}));
|
|
752
823
|
/** State for the lifecycle of a File. */
|
|
753
824
|
exports.FileState = void 0;
|
|
754
825
|
(function (FileState) {
|
|
@@ -1385,6 +1456,12 @@ class CreateFileResponse {
|
|
|
1385
1456
|
/** Response for the delete file method. */
|
|
1386
1457
|
class DeleteFileResponse {
|
|
1387
1458
|
}
|
|
1459
|
+
/** Config for `inlined_responses` parameter. */
|
|
1460
|
+
class InlinedResponse {
|
|
1461
|
+
}
|
|
1462
|
+
/** Config for batches.list return value. */
|
|
1463
|
+
class ListBatchJobsResponse {
|
|
1464
|
+
}
|
|
1388
1465
|
/** Represents a single response in a replay. */
|
|
1389
1466
|
class ReplayResponse {
|
|
1390
1467
|
}
|
|
@@ -2381,11 +2458,2088 @@ function filterToJsonSchema(schema) {
|
|
|
2381
2458
|
? typeValue
|
|
2382
2459
|
: exports.Type.TYPE_UNSPECIFIED;
|
|
2383
2460
|
}
|
|
2384
|
-
else if (supportedJsonSchemaFields.has(fieldName)) {
|
|
2385
|
-
filteredSchema[fieldName] = fieldValue;
|
|
2461
|
+
else if (supportedJsonSchemaFields.has(fieldName)) {
|
|
2462
|
+
filteredSchema[fieldName] = fieldValue;
|
|
2463
|
+
}
|
|
2464
|
+
}
|
|
2465
|
+
return filteredSchema;
|
|
2466
|
+
}
|
|
2467
|
+
// Transforms a source input into a BatchJobSource object with validation.
|
|
2468
|
+
function tBatchJobSource(apiClient, src) {
|
|
2469
|
+
if (typeof src !== 'string' && !Array.isArray(src)) {
|
|
2470
|
+
if (apiClient && apiClient.isVertexAI()) {
|
|
2471
|
+
if (src.gcsUri && src.bigqueryUri) {
|
|
2472
|
+
throw new Error('Only one of `gcsUri` or `bigqueryUri` can be set.');
|
|
2473
|
+
}
|
|
2474
|
+
else if (!src.gcsUri && !src.bigqueryUri) {
|
|
2475
|
+
throw new Error('One of `gcsUri` or `bigqueryUri` must be set.');
|
|
2476
|
+
}
|
|
2477
|
+
}
|
|
2478
|
+
else {
|
|
2479
|
+
// Logic for non-Vertex AI client (inlined_requests, file_name)
|
|
2480
|
+
if (src.inlinedRequests && src.fileName) {
|
|
2481
|
+
throw new Error('Only one of `inlinedRequests` or `fileName` can be set.');
|
|
2482
|
+
}
|
|
2483
|
+
else if (!src.inlinedRequests && !src.fileName) {
|
|
2484
|
+
throw new Error('One of `inlinedRequests` or `fileName` must be set.');
|
|
2485
|
+
}
|
|
2486
|
+
}
|
|
2487
|
+
return src;
|
|
2488
|
+
}
|
|
2489
|
+
// If src is an array (list in Python)
|
|
2490
|
+
else if (Array.isArray(src)) {
|
|
2491
|
+
return { inlinedRequests: src };
|
|
2492
|
+
}
|
|
2493
|
+
else if (typeof src === 'string') {
|
|
2494
|
+
if (src.startsWith('gs://')) {
|
|
2495
|
+
return {
|
|
2496
|
+
format: 'jsonl',
|
|
2497
|
+
gcsUri: [src], // GCS URI is expected as an array
|
|
2498
|
+
};
|
|
2499
|
+
}
|
|
2500
|
+
else if (src.startsWith('bq://')) {
|
|
2501
|
+
return {
|
|
2502
|
+
format: 'bigquery',
|
|
2503
|
+
bigqueryUri: src,
|
|
2504
|
+
};
|
|
2505
|
+
}
|
|
2506
|
+
else if (src.startsWith('files/')) {
|
|
2507
|
+
return {
|
|
2508
|
+
fileName: src,
|
|
2509
|
+
};
|
|
2510
|
+
}
|
|
2511
|
+
}
|
|
2512
|
+
throw new Error(`Unsupported source: ${src}`);
|
|
2513
|
+
}
|
|
2514
|
+
function tBatchJobDestination(dest) {
|
|
2515
|
+
const destString = dest;
|
|
2516
|
+
if (destString.startsWith('gs://')) {
|
|
2517
|
+
return {
|
|
2518
|
+
format: 'jsonl',
|
|
2519
|
+
gcsUri: destString,
|
|
2520
|
+
};
|
|
2521
|
+
}
|
|
2522
|
+
else if (destString.startsWith('bq://')) {
|
|
2523
|
+
return {
|
|
2524
|
+
format: 'bigquery',
|
|
2525
|
+
bigqueryUri: destString,
|
|
2526
|
+
};
|
|
2527
|
+
}
|
|
2528
|
+
else {
|
|
2529
|
+
throw new Error(`Unsupported destination: ${destString}`);
|
|
2530
|
+
}
|
|
2531
|
+
}
|
|
2532
|
+
function tBatchJobName(apiClient, name) {
|
|
2533
|
+
const nameString = name;
|
|
2534
|
+
if (!apiClient.isVertexAI()) {
|
|
2535
|
+
const mldevPattern = /batches\/[^/]+$/;
|
|
2536
|
+
if (mldevPattern.test(nameString)) {
|
|
2537
|
+
return nameString.split('/').pop();
|
|
2538
|
+
}
|
|
2539
|
+
else {
|
|
2540
|
+
throw new Error(`Invalid batch job name: ${nameString}.`);
|
|
2541
|
+
}
|
|
2542
|
+
}
|
|
2543
|
+
const vertexPattern = /^projects\/[^/]+\/locations\/[^/]+\/batchPredictionJobs\/[^/]+$/;
|
|
2544
|
+
if (vertexPattern.test(nameString)) {
|
|
2545
|
+
return nameString.split('/').pop();
|
|
2546
|
+
}
|
|
2547
|
+
else if (/^\d+$/.test(nameString)) {
|
|
2548
|
+
return nameString;
|
|
2549
|
+
}
|
|
2550
|
+
else {
|
|
2551
|
+
throw new Error(`Invalid batch job name: ${nameString}.`);
|
|
2552
|
+
}
|
|
2553
|
+
}
|
|
2554
|
+
function tJobState(state) {
|
|
2555
|
+
const stateString = state;
|
|
2556
|
+
if (stateString === 'BATCH_STATE_UNSPECIFIED') {
|
|
2557
|
+
return 'JOB_STATE_UNSPECIFIED';
|
|
2558
|
+
}
|
|
2559
|
+
else if (stateString === 'BATCH_STATE_PENDING') {
|
|
2560
|
+
return 'JOB_STATE_PENDING';
|
|
2561
|
+
}
|
|
2562
|
+
else if (stateString === 'BATCH_STATE_SUCCEEDED') {
|
|
2563
|
+
return 'JOB_STATE_SUCCEEDED';
|
|
2564
|
+
}
|
|
2565
|
+
else if (stateString === 'BATCH_STATE_FAILED') {
|
|
2566
|
+
return 'JOB_STATE_FAILED';
|
|
2567
|
+
}
|
|
2568
|
+
else if (stateString === 'BATCH_STATE_CANCELLED') {
|
|
2569
|
+
return 'JOB_STATE_CANCELLED';
|
|
2570
|
+
}
|
|
2571
|
+
else {
|
|
2572
|
+
return stateString;
|
|
2573
|
+
}
|
|
2574
|
+
}
|
|
2575
|
+
|
|
2576
|
+
/**
|
|
2577
|
+
* @license
|
|
2578
|
+
* Copyright 2025 Google LLC
|
|
2579
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
2580
|
+
*/
|
|
2581
|
+
function videoMetadataToMldev$4(fromObject) {
|
|
2582
|
+
const toObject = {};
|
|
2583
|
+
const fromFps = getValueByPath(fromObject, ['fps']);
|
|
2584
|
+
if (fromFps != null) {
|
|
2585
|
+
setValueByPath(toObject, ['fps'], fromFps);
|
|
2586
|
+
}
|
|
2587
|
+
const fromEndOffset = getValueByPath(fromObject, ['endOffset']);
|
|
2588
|
+
if (fromEndOffset != null) {
|
|
2589
|
+
setValueByPath(toObject, ['endOffset'], fromEndOffset);
|
|
2590
|
+
}
|
|
2591
|
+
const fromStartOffset = getValueByPath(fromObject, ['startOffset']);
|
|
2592
|
+
if (fromStartOffset != null) {
|
|
2593
|
+
setValueByPath(toObject, ['startOffset'], fromStartOffset);
|
|
2594
|
+
}
|
|
2595
|
+
return toObject;
|
|
2596
|
+
}
|
|
2597
|
+
function blobToMldev$4(fromObject) {
|
|
2598
|
+
const toObject = {};
|
|
2599
|
+
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
2600
|
+
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
2601
|
+
}
|
|
2602
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
2603
|
+
if (fromData != null) {
|
|
2604
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
2605
|
+
}
|
|
2606
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
2607
|
+
if (fromMimeType != null) {
|
|
2608
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
2609
|
+
}
|
|
2610
|
+
return toObject;
|
|
2611
|
+
}
|
|
2612
|
+
function fileDataToMldev$4(fromObject) {
|
|
2613
|
+
const toObject = {};
|
|
2614
|
+
if (getValueByPath(fromObject, ['displayName']) !== undefined) {
|
|
2615
|
+
throw new Error('displayName parameter is not supported in Gemini API.');
|
|
2616
|
+
}
|
|
2617
|
+
const fromFileUri = getValueByPath(fromObject, ['fileUri']);
|
|
2618
|
+
if (fromFileUri != null) {
|
|
2619
|
+
setValueByPath(toObject, ['fileUri'], fromFileUri);
|
|
2620
|
+
}
|
|
2621
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
2622
|
+
if (fromMimeType != null) {
|
|
2623
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
2624
|
+
}
|
|
2625
|
+
return toObject;
|
|
2626
|
+
}
|
|
2627
|
+
function partToMldev$4(fromObject) {
|
|
2628
|
+
const toObject = {};
|
|
2629
|
+
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
2630
|
+
'videoMetadata',
|
|
2631
|
+
]);
|
|
2632
|
+
if (fromVideoMetadata != null) {
|
|
2633
|
+
setValueByPath(toObject, ['videoMetadata'], videoMetadataToMldev$4(fromVideoMetadata));
|
|
2634
|
+
}
|
|
2635
|
+
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
2636
|
+
if (fromThought != null) {
|
|
2637
|
+
setValueByPath(toObject, ['thought'], fromThought);
|
|
2638
|
+
}
|
|
2639
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
2640
|
+
if (fromInlineData != null) {
|
|
2641
|
+
setValueByPath(toObject, ['inlineData'], blobToMldev$4(fromInlineData));
|
|
2642
|
+
}
|
|
2643
|
+
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
2644
|
+
if (fromFileData != null) {
|
|
2645
|
+
setValueByPath(toObject, ['fileData'], fileDataToMldev$4(fromFileData));
|
|
2646
|
+
}
|
|
2647
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
2648
|
+
'thoughtSignature',
|
|
2649
|
+
]);
|
|
2650
|
+
if (fromThoughtSignature != null) {
|
|
2651
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
2652
|
+
}
|
|
2653
|
+
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
2654
|
+
'codeExecutionResult',
|
|
2655
|
+
]);
|
|
2656
|
+
if (fromCodeExecutionResult != null) {
|
|
2657
|
+
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
2658
|
+
}
|
|
2659
|
+
const fromExecutableCode = getValueByPath(fromObject, [
|
|
2660
|
+
'executableCode',
|
|
2661
|
+
]);
|
|
2662
|
+
if (fromExecutableCode != null) {
|
|
2663
|
+
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
2664
|
+
}
|
|
2665
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
2666
|
+
if (fromFunctionCall != null) {
|
|
2667
|
+
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
2668
|
+
}
|
|
2669
|
+
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
2670
|
+
'functionResponse',
|
|
2671
|
+
]);
|
|
2672
|
+
if (fromFunctionResponse != null) {
|
|
2673
|
+
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
2674
|
+
}
|
|
2675
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
2676
|
+
if (fromText != null) {
|
|
2677
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
2678
|
+
}
|
|
2679
|
+
return toObject;
|
|
2680
|
+
}
|
|
2681
|
+
function contentToMldev$4(fromObject) {
|
|
2682
|
+
const toObject = {};
|
|
2683
|
+
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
2684
|
+
if (fromParts != null) {
|
|
2685
|
+
let transformedList = fromParts;
|
|
2686
|
+
if (Array.isArray(transformedList)) {
|
|
2687
|
+
transformedList = transformedList.map((item) => {
|
|
2688
|
+
return partToMldev$4(item);
|
|
2689
|
+
});
|
|
2690
|
+
}
|
|
2691
|
+
setValueByPath(toObject, ['parts'], transformedList);
|
|
2692
|
+
}
|
|
2693
|
+
const fromRole = getValueByPath(fromObject, ['role']);
|
|
2694
|
+
if (fromRole != null) {
|
|
2695
|
+
setValueByPath(toObject, ['role'], fromRole);
|
|
2696
|
+
}
|
|
2697
|
+
return toObject;
|
|
2698
|
+
}
|
|
2699
|
+
function schemaToMldev$1(fromObject) {
|
|
2700
|
+
const toObject = {};
|
|
2701
|
+
const fromAnyOf = getValueByPath(fromObject, ['anyOf']);
|
|
2702
|
+
if (fromAnyOf != null) {
|
|
2703
|
+
setValueByPath(toObject, ['anyOf'], fromAnyOf);
|
|
2704
|
+
}
|
|
2705
|
+
const fromDefault = getValueByPath(fromObject, ['default']);
|
|
2706
|
+
if (fromDefault != null) {
|
|
2707
|
+
setValueByPath(toObject, ['default'], fromDefault);
|
|
2708
|
+
}
|
|
2709
|
+
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
2710
|
+
if (fromDescription != null) {
|
|
2711
|
+
setValueByPath(toObject, ['description'], fromDescription);
|
|
2712
|
+
}
|
|
2713
|
+
const fromEnum = getValueByPath(fromObject, ['enum']);
|
|
2714
|
+
if (fromEnum != null) {
|
|
2715
|
+
setValueByPath(toObject, ['enum'], fromEnum);
|
|
2716
|
+
}
|
|
2717
|
+
const fromExample = getValueByPath(fromObject, ['example']);
|
|
2718
|
+
if (fromExample != null) {
|
|
2719
|
+
setValueByPath(toObject, ['example'], fromExample);
|
|
2720
|
+
}
|
|
2721
|
+
const fromFormat = getValueByPath(fromObject, ['format']);
|
|
2722
|
+
if (fromFormat != null) {
|
|
2723
|
+
setValueByPath(toObject, ['format'], fromFormat);
|
|
2724
|
+
}
|
|
2725
|
+
const fromItems = getValueByPath(fromObject, ['items']);
|
|
2726
|
+
if (fromItems != null) {
|
|
2727
|
+
setValueByPath(toObject, ['items'], fromItems);
|
|
2728
|
+
}
|
|
2729
|
+
const fromMaxItems = getValueByPath(fromObject, ['maxItems']);
|
|
2730
|
+
if (fromMaxItems != null) {
|
|
2731
|
+
setValueByPath(toObject, ['maxItems'], fromMaxItems);
|
|
2732
|
+
}
|
|
2733
|
+
const fromMaxLength = getValueByPath(fromObject, ['maxLength']);
|
|
2734
|
+
if (fromMaxLength != null) {
|
|
2735
|
+
setValueByPath(toObject, ['maxLength'], fromMaxLength);
|
|
2736
|
+
}
|
|
2737
|
+
const fromMaxProperties = getValueByPath(fromObject, [
|
|
2738
|
+
'maxProperties',
|
|
2739
|
+
]);
|
|
2740
|
+
if (fromMaxProperties != null) {
|
|
2741
|
+
setValueByPath(toObject, ['maxProperties'], fromMaxProperties);
|
|
2742
|
+
}
|
|
2743
|
+
const fromMaximum = getValueByPath(fromObject, ['maximum']);
|
|
2744
|
+
if (fromMaximum != null) {
|
|
2745
|
+
setValueByPath(toObject, ['maximum'], fromMaximum);
|
|
2746
|
+
}
|
|
2747
|
+
const fromMinItems = getValueByPath(fromObject, ['minItems']);
|
|
2748
|
+
if (fromMinItems != null) {
|
|
2749
|
+
setValueByPath(toObject, ['minItems'], fromMinItems);
|
|
2750
|
+
}
|
|
2751
|
+
const fromMinLength = getValueByPath(fromObject, ['minLength']);
|
|
2752
|
+
if (fromMinLength != null) {
|
|
2753
|
+
setValueByPath(toObject, ['minLength'], fromMinLength);
|
|
2754
|
+
}
|
|
2755
|
+
const fromMinProperties = getValueByPath(fromObject, [
|
|
2756
|
+
'minProperties',
|
|
2757
|
+
]);
|
|
2758
|
+
if (fromMinProperties != null) {
|
|
2759
|
+
setValueByPath(toObject, ['minProperties'], fromMinProperties);
|
|
2760
|
+
}
|
|
2761
|
+
const fromMinimum = getValueByPath(fromObject, ['minimum']);
|
|
2762
|
+
if (fromMinimum != null) {
|
|
2763
|
+
setValueByPath(toObject, ['minimum'], fromMinimum);
|
|
2764
|
+
}
|
|
2765
|
+
const fromNullable = getValueByPath(fromObject, ['nullable']);
|
|
2766
|
+
if (fromNullable != null) {
|
|
2767
|
+
setValueByPath(toObject, ['nullable'], fromNullable);
|
|
2768
|
+
}
|
|
2769
|
+
const fromPattern = getValueByPath(fromObject, ['pattern']);
|
|
2770
|
+
if (fromPattern != null) {
|
|
2771
|
+
setValueByPath(toObject, ['pattern'], fromPattern);
|
|
2772
|
+
}
|
|
2773
|
+
const fromProperties = getValueByPath(fromObject, ['properties']);
|
|
2774
|
+
if (fromProperties != null) {
|
|
2775
|
+
setValueByPath(toObject, ['properties'], fromProperties);
|
|
2776
|
+
}
|
|
2777
|
+
const fromPropertyOrdering = getValueByPath(fromObject, [
|
|
2778
|
+
'propertyOrdering',
|
|
2779
|
+
]);
|
|
2780
|
+
if (fromPropertyOrdering != null) {
|
|
2781
|
+
setValueByPath(toObject, ['propertyOrdering'], fromPropertyOrdering);
|
|
2782
|
+
}
|
|
2783
|
+
const fromRequired = getValueByPath(fromObject, ['required']);
|
|
2784
|
+
if (fromRequired != null) {
|
|
2785
|
+
setValueByPath(toObject, ['required'], fromRequired);
|
|
2786
|
+
}
|
|
2787
|
+
const fromTitle = getValueByPath(fromObject, ['title']);
|
|
2788
|
+
if (fromTitle != null) {
|
|
2789
|
+
setValueByPath(toObject, ['title'], fromTitle);
|
|
2790
|
+
}
|
|
2791
|
+
const fromType = getValueByPath(fromObject, ['type']);
|
|
2792
|
+
if (fromType != null) {
|
|
2793
|
+
setValueByPath(toObject, ['type'], fromType);
|
|
2794
|
+
}
|
|
2795
|
+
return toObject;
|
|
2796
|
+
}
|
|
2797
|
+
function safetySettingToMldev$1(fromObject) {
|
|
2798
|
+
const toObject = {};
|
|
2799
|
+
if (getValueByPath(fromObject, ['method']) !== undefined) {
|
|
2800
|
+
throw new Error('method parameter is not supported in Gemini API.');
|
|
2801
|
+
}
|
|
2802
|
+
const fromCategory = getValueByPath(fromObject, ['category']);
|
|
2803
|
+
if (fromCategory != null) {
|
|
2804
|
+
setValueByPath(toObject, ['category'], fromCategory);
|
|
2805
|
+
}
|
|
2806
|
+
const fromThreshold = getValueByPath(fromObject, ['threshold']);
|
|
2807
|
+
if (fromThreshold != null) {
|
|
2808
|
+
setValueByPath(toObject, ['threshold'], fromThreshold);
|
|
2809
|
+
}
|
|
2810
|
+
return toObject;
|
|
2811
|
+
}
|
|
2812
|
+
function functionDeclarationToMldev$4(fromObject) {
|
|
2813
|
+
const toObject = {};
|
|
2814
|
+
const fromBehavior = getValueByPath(fromObject, ['behavior']);
|
|
2815
|
+
if (fromBehavior != null) {
|
|
2816
|
+
setValueByPath(toObject, ['behavior'], fromBehavior);
|
|
2817
|
+
}
|
|
2818
|
+
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
2819
|
+
if (fromDescription != null) {
|
|
2820
|
+
setValueByPath(toObject, ['description'], fromDescription);
|
|
2821
|
+
}
|
|
2822
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
2823
|
+
if (fromName != null) {
|
|
2824
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
2825
|
+
}
|
|
2826
|
+
const fromParameters = getValueByPath(fromObject, ['parameters']);
|
|
2827
|
+
if (fromParameters != null) {
|
|
2828
|
+
setValueByPath(toObject, ['parameters'], fromParameters);
|
|
2829
|
+
}
|
|
2830
|
+
const fromParametersJsonSchema = getValueByPath(fromObject, [
|
|
2831
|
+
'parametersJsonSchema',
|
|
2832
|
+
]);
|
|
2833
|
+
if (fromParametersJsonSchema != null) {
|
|
2834
|
+
setValueByPath(toObject, ['parametersJsonSchema'], fromParametersJsonSchema);
|
|
2835
|
+
}
|
|
2836
|
+
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
2837
|
+
if (fromResponse != null) {
|
|
2838
|
+
setValueByPath(toObject, ['response'], fromResponse);
|
|
2839
|
+
}
|
|
2840
|
+
const fromResponseJsonSchema = getValueByPath(fromObject, [
|
|
2841
|
+
'responseJsonSchema',
|
|
2842
|
+
]);
|
|
2843
|
+
if (fromResponseJsonSchema != null) {
|
|
2844
|
+
setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
|
|
2845
|
+
}
|
|
2846
|
+
return toObject;
|
|
2847
|
+
}
|
|
2848
|
+
function intervalToMldev$4(fromObject) {
|
|
2849
|
+
const toObject = {};
|
|
2850
|
+
const fromStartTime = getValueByPath(fromObject, ['startTime']);
|
|
2851
|
+
if (fromStartTime != null) {
|
|
2852
|
+
setValueByPath(toObject, ['startTime'], fromStartTime);
|
|
2853
|
+
}
|
|
2854
|
+
const fromEndTime = getValueByPath(fromObject, ['endTime']);
|
|
2855
|
+
if (fromEndTime != null) {
|
|
2856
|
+
setValueByPath(toObject, ['endTime'], fromEndTime);
|
|
2857
|
+
}
|
|
2858
|
+
return toObject;
|
|
2859
|
+
}
|
|
2860
|
+
function googleSearchToMldev$4(fromObject) {
|
|
2861
|
+
const toObject = {};
|
|
2862
|
+
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
2863
|
+
'timeRangeFilter',
|
|
2864
|
+
]);
|
|
2865
|
+
if (fromTimeRangeFilter != null) {
|
|
2866
|
+
setValueByPath(toObject, ['timeRangeFilter'], intervalToMldev$4(fromTimeRangeFilter));
|
|
2867
|
+
}
|
|
2868
|
+
return toObject;
|
|
2869
|
+
}
|
|
2870
|
+
function dynamicRetrievalConfigToMldev$4(fromObject) {
|
|
2871
|
+
const toObject = {};
|
|
2872
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
2873
|
+
if (fromMode != null) {
|
|
2874
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
2875
|
+
}
|
|
2876
|
+
const fromDynamicThreshold = getValueByPath(fromObject, [
|
|
2877
|
+
'dynamicThreshold',
|
|
2878
|
+
]);
|
|
2879
|
+
if (fromDynamicThreshold != null) {
|
|
2880
|
+
setValueByPath(toObject, ['dynamicThreshold'], fromDynamicThreshold);
|
|
2881
|
+
}
|
|
2882
|
+
return toObject;
|
|
2883
|
+
}
|
|
2884
|
+
function googleSearchRetrievalToMldev$4(fromObject) {
|
|
2885
|
+
const toObject = {};
|
|
2886
|
+
const fromDynamicRetrievalConfig = getValueByPath(fromObject, [
|
|
2887
|
+
'dynamicRetrievalConfig',
|
|
2888
|
+
]);
|
|
2889
|
+
if (fromDynamicRetrievalConfig != null) {
|
|
2890
|
+
setValueByPath(toObject, ['dynamicRetrievalConfig'], dynamicRetrievalConfigToMldev$4(fromDynamicRetrievalConfig));
|
|
2891
|
+
}
|
|
2892
|
+
return toObject;
|
|
2893
|
+
}
|
|
2894
|
+
function urlContextToMldev$4() {
|
|
2895
|
+
const toObject = {};
|
|
2896
|
+
return toObject;
|
|
2897
|
+
}
|
|
2898
|
+
function toolToMldev$4(fromObject) {
|
|
2899
|
+
const toObject = {};
|
|
2900
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
2901
|
+
'functionDeclarations',
|
|
2902
|
+
]);
|
|
2903
|
+
if (fromFunctionDeclarations != null) {
|
|
2904
|
+
let transformedList = fromFunctionDeclarations;
|
|
2905
|
+
if (Array.isArray(transformedList)) {
|
|
2906
|
+
transformedList = transformedList.map((item) => {
|
|
2907
|
+
return functionDeclarationToMldev$4(item);
|
|
2908
|
+
});
|
|
2909
|
+
}
|
|
2910
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
2911
|
+
}
|
|
2912
|
+
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
2913
|
+
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
2914
|
+
}
|
|
2915
|
+
const fromGoogleSearch = getValueByPath(fromObject, ['googleSearch']);
|
|
2916
|
+
if (fromGoogleSearch != null) {
|
|
2917
|
+
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$4(fromGoogleSearch));
|
|
2918
|
+
}
|
|
2919
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
2920
|
+
'googleSearchRetrieval',
|
|
2921
|
+
]);
|
|
2922
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
2923
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], googleSearchRetrievalToMldev$4(fromGoogleSearchRetrieval));
|
|
2924
|
+
}
|
|
2925
|
+
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
2926
|
+
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
2927
|
+
}
|
|
2928
|
+
if (getValueByPath(fromObject, ['googleMaps']) !== undefined) {
|
|
2929
|
+
throw new Error('googleMaps parameter is not supported in Gemini API.');
|
|
2930
|
+
}
|
|
2931
|
+
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
2932
|
+
if (fromUrlContext != null) {
|
|
2933
|
+
setValueByPath(toObject, ['urlContext'], urlContextToMldev$4());
|
|
2934
|
+
}
|
|
2935
|
+
const fromCodeExecution = getValueByPath(fromObject, [
|
|
2936
|
+
'codeExecution',
|
|
2937
|
+
]);
|
|
2938
|
+
if (fromCodeExecution != null) {
|
|
2939
|
+
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
2940
|
+
}
|
|
2941
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
2942
|
+
if (fromComputerUse != null) {
|
|
2943
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
2944
|
+
}
|
|
2945
|
+
return toObject;
|
|
2946
|
+
}
|
|
2947
|
+
function functionCallingConfigToMldev$2(fromObject) {
|
|
2948
|
+
const toObject = {};
|
|
2949
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
2950
|
+
if (fromMode != null) {
|
|
2951
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
2952
|
+
}
|
|
2953
|
+
const fromAllowedFunctionNames = getValueByPath(fromObject, [
|
|
2954
|
+
'allowedFunctionNames',
|
|
2955
|
+
]);
|
|
2956
|
+
if (fromAllowedFunctionNames != null) {
|
|
2957
|
+
setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
|
|
2958
|
+
}
|
|
2959
|
+
return toObject;
|
|
2960
|
+
}
|
|
2961
|
+
function latLngToMldev$2(fromObject) {
|
|
2962
|
+
const toObject = {};
|
|
2963
|
+
const fromLatitude = getValueByPath(fromObject, ['latitude']);
|
|
2964
|
+
if (fromLatitude != null) {
|
|
2965
|
+
setValueByPath(toObject, ['latitude'], fromLatitude);
|
|
2966
|
+
}
|
|
2967
|
+
const fromLongitude = getValueByPath(fromObject, ['longitude']);
|
|
2968
|
+
if (fromLongitude != null) {
|
|
2969
|
+
setValueByPath(toObject, ['longitude'], fromLongitude);
|
|
2970
|
+
}
|
|
2971
|
+
return toObject;
|
|
2972
|
+
}
|
|
2973
|
+
function retrievalConfigToMldev$2(fromObject) {
|
|
2974
|
+
const toObject = {};
|
|
2975
|
+
const fromLatLng = getValueByPath(fromObject, ['latLng']);
|
|
2976
|
+
if (fromLatLng != null) {
|
|
2977
|
+
setValueByPath(toObject, ['latLng'], latLngToMldev$2(fromLatLng));
|
|
2978
|
+
}
|
|
2979
|
+
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
2980
|
+
if (fromLanguageCode != null) {
|
|
2981
|
+
setValueByPath(toObject, ['languageCode'], fromLanguageCode);
|
|
2982
|
+
}
|
|
2983
|
+
return toObject;
|
|
2984
|
+
}
|
|
2985
|
+
function toolConfigToMldev$2(fromObject) {
|
|
2986
|
+
const toObject = {};
|
|
2987
|
+
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
2988
|
+
'functionCallingConfig',
|
|
2989
|
+
]);
|
|
2990
|
+
if (fromFunctionCallingConfig != null) {
|
|
2991
|
+
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$2(fromFunctionCallingConfig));
|
|
2992
|
+
}
|
|
2993
|
+
const fromRetrievalConfig = getValueByPath(fromObject, [
|
|
2994
|
+
'retrievalConfig',
|
|
2995
|
+
]);
|
|
2996
|
+
if (fromRetrievalConfig != null) {
|
|
2997
|
+
setValueByPath(toObject, ['retrievalConfig'], retrievalConfigToMldev$2(fromRetrievalConfig));
|
|
2998
|
+
}
|
|
2999
|
+
return toObject;
|
|
3000
|
+
}
|
|
3001
|
+
function prebuiltVoiceConfigToMldev$3(fromObject) {
|
|
3002
|
+
const toObject = {};
|
|
3003
|
+
const fromVoiceName = getValueByPath(fromObject, ['voiceName']);
|
|
3004
|
+
if (fromVoiceName != null) {
|
|
3005
|
+
setValueByPath(toObject, ['voiceName'], fromVoiceName);
|
|
3006
|
+
}
|
|
3007
|
+
return toObject;
|
|
3008
|
+
}
|
|
3009
|
+
function voiceConfigToMldev$3(fromObject) {
|
|
3010
|
+
const toObject = {};
|
|
3011
|
+
const fromPrebuiltVoiceConfig = getValueByPath(fromObject, [
|
|
3012
|
+
'prebuiltVoiceConfig',
|
|
3013
|
+
]);
|
|
3014
|
+
if (fromPrebuiltVoiceConfig != null) {
|
|
3015
|
+
setValueByPath(toObject, ['prebuiltVoiceConfig'], prebuiltVoiceConfigToMldev$3(fromPrebuiltVoiceConfig));
|
|
3016
|
+
}
|
|
3017
|
+
return toObject;
|
|
3018
|
+
}
|
|
3019
|
+
function speakerVoiceConfigToMldev$3(fromObject) {
|
|
3020
|
+
const toObject = {};
|
|
3021
|
+
const fromSpeaker = getValueByPath(fromObject, ['speaker']);
|
|
3022
|
+
if (fromSpeaker != null) {
|
|
3023
|
+
setValueByPath(toObject, ['speaker'], fromSpeaker);
|
|
3024
|
+
}
|
|
3025
|
+
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
3026
|
+
if (fromVoiceConfig != null) {
|
|
3027
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$3(fromVoiceConfig));
|
|
3028
|
+
}
|
|
3029
|
+
return toObject;
|
|
3030
|
+
}
|
|
3031
|
+
function multiSpeakerVoiceConfigToMldev$3(fromObject) {
|
|
3032
|
+
const toObject = {};
|
|
3033
|
+
const fromSpeakerVoiceConfigs = getValueByPath(fromObject, [
|
|
3034
|
+
'speakerVoiceConfigs',
|
|
3035
|
+
]);
|
|
3036
|
+
if (fromSpeakerVoiceConfigs != null) {
|
|
3037
|
+
let transformedList = fromSpeakerVoiceConfigs;
|
|
3038
|
+
if (Array.isArray(transformedList)) {
|
|
3039
|
+
transformedList = transformedList.map((item) => {
|
|
3040
|
+
return speakerVoiceConfigToMldev$3(item);
|
|
3041
|
+
});
|
|
3042
|
+
}
|
|
3043
|
+
setValueByPath(toObject, ['speakerVoiceConfigs'], transformedList);
|
|
3044
|
+
}
|
|
3045
|
+
return toObject;
|
|
3046
|
+
}
|
|
3047
|
+
function speechConfigToMldev$3(fromObject) {
|
|
3048
|
+
const toObject = {};
|
|
3049
|
+
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
3050
|
+
if (fromVoiceConfig != null) {
|
|
3051
|
+
setValueByPath(toObject, ['voiceConfig'], voiceConfigToMldev$3(fromVoiceConfig));
|
|
3052
|
+
}
|
|
3053
|
+
const fromMultiSpeakerVoiceConfig = getValueByPath(fromObject, [
|
|
3054
|
+
'multiSpeakerVoiceConfig',
|
|
3055
|
+
]);
|
|
3056
|
+
if (fromMultiSpeakerVoiceConfig != null) {
|
|
3057
|
+
setValueByPath(toObject, ['multiSpeakerVoiceConfig'], multiSpeakerVoiceConfigToMldev$3(fromMultiSpeakerVoiceConfig));
|
|
3058
|
+
}
|
|
3059
|
+
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
3060
|
+
if (fromLanguageCode != null) {
|
|
3061
|
+
setValueByPath(toObject, ['languageCode'], fromLanguageCode);
|
|
3062
|
+
}
|
|
3063
|
+
return toObject;
|
|
3064
|
+
}
|
|
3065
|
+
function thinkingConfigToMldev$1(fromObject) {
|
|
3066
|
+
const toObject = {};
|
|
3067
|
+
const fromIncludeThoughts = getValueByPath(fromObject, [
|
|
3068
|
+
'includeThoughts',
|
|
3069
|
+
]);
|
|
3070
|
+
if (fromIncludeThoughts != null) {
|
|
3071
|
+
setValueByPath(toObject, ['includeThoughts'], fromIncludeThoughts);
|
|
3072
|
+
}
|
|
3073
|
+
const fromThinkingBudget = getValueByPath(fromObject, [
|
|
3074
|
+
'thinkingBudget',
|
|
3075
|
+
]);
|
|
3076
|
+
if (fromThinkingBudget != null) {
|
|
3077
|
+
setValueByPath(toObject, ['thinkingBudget'], fromThinkingBudget);
|
|
3078
|
+
}
|
|
3079
|
+
return toObject;
|
|
3080
|
+
}
|
|
3081
|
+
function generateContentConfigToMldev$1(apiClient, fromObject, parentObject) {
|
|
3082
|
+
const toObject = {};
|
|
3083
|
+
const fromSystemInstruction = getValueByPath(fromObject, [
|
|
3084
|
+
'systemInstruction',
|
|
3085
|
+
]);
|
|
3086
|
+
if (parentObject !== undefined && fromSystemInstruction != null) {
|
|
3087
|
+
setValueByPath(parentObject, ['systemInstruction'], contentToMldev$4(tContent(fromSystemInstruction)));
|
|
3088
|
+
}
|
|
3089
|
+
const fromTemperature = getValueByPath(fromObject, ['temperature']);
|
|
3090
|
+
if (fromTemperature != null) {
|
|
3091
|
+
setValueByPath(toObject, ['temperature'], fromTemperature);
|
|
3092
|
+
}
|
|
3093
|
+
const fromTopP = getValueByPath(fromObject, ['topP']);
|
|
3094
|
+
if (fromTopP != null) {
|
|
3095
|
+
setValueByPath(toObject, ['topP'], fromTopP);
|
|
3096
|
+
}
|
|
3097
|
+
const fromTopK = getValueByPath(fromObject, ['topK']);
|
|
3098
|
+
if (fromTopK != null) {
|
|
3099
|
+
setValueByPath(toObject, ['topK'], fromTopK);
|
|
3100
|
+
}
|
|
3101
|
+
const fromCandidateCount = getValueByPath(fromObject, [
|
|
3102
|
+
'candidateCount',
|
|
3103
|
+
]);
|
|
3104
|
+
if (fromCandidateCount != null) {
|
|
3105
|
+
setValueByPath(toObject, ['candidateCount'], fromCandidateCount);
|
|
3106
|
+
}
|
|
3107
|
+
const fromMaxOutputTokens = getValueByPath(fromObject, [
|
|
3108
|
+
'maxOutputTokens',
|
|
3109
|
+
]);
|
|
3110
|
+
if (fromMaxOutputTokens != null) {
|
|
3111
|
+
setValueByPath(toObject, ['maxOutputTokens'], fromMaxOutputTokens);
|
|
3112
|
+
}
|
|
3113
|
+
const fromStopSequences = getValueByPath(fromObject, [
|
|
3114
|
+
'stopSequences',
|
|
3115
|
+
]);
|
|
3116
|
+
if (fromStopSequences != null) {
|
|
3117
|
+
setValueByPath(toObject, ['stopSequences'], fromStopSequences);
|
|
3118
|
+
}
|
|
3119
|
+
const fromResponseLogprobs = getValueByPath(fromObject, [
|
|
3120
|
+
'responseLogprobs',
|
|
3121
|
+
]);
|
|
3122
|
+
if (fromResponseLogprobs != null) {
|
|
3123
|
+
setValueByPath(toObject, ['responseLogprobs'], fromResponseLogprobs);
|
|
3124
|
+
}
|
|
3125
|
+
const fromLogprobs = getValueByPath(fromObject, ['logprobs']);
|
|
3126
|
+
if (fromLogprobs != null) {
|
|
3127
|
+
setValueByPath(toObject, ['logprobs'], fromLogprobs);
|
|
3128
|
+
}
|
|
3129
|
+
const fromPresencePenalty = getValueByPath(fromObject, [
|
|
3130
|
+
'presencePenalty',
|
|
3131
|
+
]);
|
|
3132
|
+
if (fromPresencePenalty != null) {
|
|
3133
|
+
setValueByPath(toObject, ['presencePenalty'], fromPresencePenalty);
|
|
3134
|
+
}
|
|
3135
|
+
const fromFrequencyPenalty = getValueByPath(fromObject, [
|
|
3136
|
+
'frequencyPenalty',
|
|
3137
|
+
]);
|
|
3138
|
+
if (fromFrequencyPenalty != null) {
|
|
3139
|
+
setValueByPath(toObject, ['frequencyPenalty'], fromFrequencyPenalty);
|
|
3140
|
+
}
|
|
3141
|
+
const fromSeed = getValueByPath(fromObject, ['seed']);
|
|
3142
|
+
if (fromSeed != null) {
|
|
3143
|
+
setValueByPath(toObject, ['seed'], fromSeed);
|
|
3144
|
+
}
|
|
3145
|
+
const fromResponseMimeType = getValueByPath(fromObject, [
|
|
3146
|
+
'responseMimeType',
|
|
3147
|
+
]);
|
|
3148
|
+
if (fromResponseMimeType != null) {
|
|
3149
|
+
setValueByPath(toObject, ['responseMimeType'], fromResponseMimeType);
|
|
3150
|
+
}
|
|
3151
|
+
const fromResponseSchema = getValueByPath(fromObject, [
|
|
3152
|
+
'responseSchema',
|
|
3153
|
+
]);
|
|
3154
|
+
if (fromResponseSchema != null) {
|
|
3155
|
+
setValueByPath(toObject, ['responseSchema'], schemaToMldev$1(tSchema(fromResponseSchema)));
|
|
3156
|
+
}
|
|
3157
|
+
const fromResponseJsonSchema = getValueByPath(fromObject, [
|
|
3158
|
+
'responseJsonSchema',
|
|
3159
|
+
]);
|
|
3160
|
+
if (fromResponseJsonSchema != null) {
|
|
3161
|
+
setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
|
|
3162
|
+
}
|
|
3163
|
+
if (getValueByPath(fromObject, ['routingConfig']) !== undefined) {
|
|
3164
|
+
throw new Error('routingConfig parameter is not supported in Gemini API.');
|
|
3165
|
+
}
|
|
3166
|
+
if (getValueByPath(fromObject, ['modelSelectionConfig']) !== undefined) {
|
|
3167
|
+
throw new Error('modelSelectionConfig parameter is not supported in Gemini API.');
|
|
3168
|
+
}
|
|
3169
|
+
const fromSafetySettings = getValueByPath(fromObject, [
|
|
3170
|
+
'safetySettings',
|
|
3171
|
+
]);
|
|
3172
|
+
if (parentObject !== undefined && fromSafetySettings != null) {
|
|
3173
|
+
let transformedList = fromSafetySettings;
|
|
3174
|
+
if (Array.isArray(transformedList)) {
|
|
3175
|
+
transformedList = transformedList.map((item) => {
|
|
3176
|
+
return safetySettingToMldev$1(item);
|
|
3177
|
+
});
|
|
3178
|
+
}
|
|
3179
|
+
setValueByPath(parentObject, ['safetySettings'], transformedList);
|
|
3180
|
+
}
|
|
3181
|
+
const fromTools = getValueByPath(fromObject, ['tools']);
|
|
3182
|
+
if (parentObject !== undefined && fromTools != null) {
|
|
3183
|
+
let transformedList = tTools(fromTools);
|
|
3184
|
+
if (Array.isArray(transformedList)) {
|
|
3185
|
+
transformedList = transformedList.map((item) => {
|
|
3186
|
+
return toolToMldev$4(tTool(item));
|
|
3187
|
+
});
|
|
3188
|
+
}
|
|
3189
|
+
setValueByPath(parentObject, ['tools'], transformedList);
|
|
3190
|
+
}
|
|
3191
|
+
const fromToolConfig = getValueByPath(fromObject, ['toolConfig']);
|
|
3192
|
+
if (parentObject !== undefined && fromToolConfig != null) {
|
|
3193
|
+
setValueByPath(parentObject, ['toolConfig'], toolConfigToMldev$2(fromToolConfig));
|
|
3194
|
+
}
|
|
3195
|
+
if (getValueByPath(fromObject, ['labels']) !== undefined) {
|
|
3196
|
+
throw new Error('labels parameter is not supported in Gemini API.');
|
|
3197
|
+
}
|
|
3198
|
+
const fromCachedContent = getValueByPath(fromObject, [
|
|
3199
|
+
'cachedContent',
|
|
3200
|
+
]);
|
|
3201
|
+
if (parentObject !== undefined && fromCachedContent != null) {
|
|
3202
|
+
setValueByPath(parentObject, ['cachedContent'], tCachedContentName(apiClient, fromCachedContent));
|
|
3203
|
+
}
|
|
3204
|
+
const fromResponseModalities = getValueByPath(fromObject, [
|
|
3205
|
+
'responseModalities',
|
|
3206
|
+
]);
|
|
3207
|
+
if (fromResponseModalities != null) {
|
|
3208
|
+
setValueByPath(toObject, ['responseModalities'], fromResponseModalities);
|
|
3209
|
+
}
|
|
3210
|
+
const fromMediaResolution = getValueByPath(fromObject, [
|
|
3211
|
+
'mediaResolution',
|
|
3212
|
+
]);
|
|
3213
|
+
if (fromMediaResolution != null) {
|
|
3214
|
+
setValueByPath(toObject, ['mediaResolution'], fromMediaResolution);
|
|
3215
|
+
}
|
|
3216
|
+
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
3217
|
+
if (fromSpeechConfig != null) {
|
|
3218
|
+
setValueByPath(toObject, ['speechConfig'], speechConfigToMldev$3(tSpeechConfig(fromSpeechConfig)));
|
|
3219
|
+
}
|
|
3220
|
+
if (getValueByPath(fromObject, ['audioTimestamp']) !== undefined) {
|
|
3221
|
+
throw new Error('audioTimestamp parameter is not supported in Gemini API.');
|
|
3222
|
+
}
|
|
3223
|
+
const fromThinkingConfig = getValueByPath(fromObject, [
|
|
3224
|
+
'thinkingConfig',
|
|
3225
|
+
]);
|
|
3226
|
+
if (fromThinkingConfig != null) {
|
|
3227
|
+
setValueByPath(toObject, ['thinkingConfig'], thinkingConfigToMldev$1(fromThinkingConfig));
|
|
3228
|
+
}
|
|
3229
|
+
return toObject;
|
|
3230
|
+
}
|
|
3231
|
+
function inlinedRequestToMldev(apiClient, fromObject) {
|
|
3232
|
+
const toObject = {};
|
|
3233
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
3234
|
+
if (fromModel != null) {
|
|
3235
|
+
setValueByPath(toObject, ['request', 'model'], tModel(apiClient, fromModel));
|
|
3236
|
+
}
|
|
3237
|
+
const fromContents = getValueByPath(fromObject, ['contents']);
|
|
3238
|
+
if (fromContents != null) {
|
|
3239
|
+
let transformedList = tContents(fromContents);
|
|
3240
|
+
if (Array.isArray(transformedList)) {
|
|
3241
|
+
transformedList = transformedList.map((item) => {
|
|
3242
|
+
return contentToMldev$4(item);
|
|
3243
|
+
});
|
|
3244
|
+
}
|
|
3245
|
+
setValueByPath(toObject, ['request', 'contents'], transformedList);
|
|
3246
|
+
}
|
|
3247
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3248
|
+
if (fromConfig != null) {
|
|
3249
|
+
setValueByPath(toObject, ['request', 'generationConfig'], generateContentConfigToMldev$1(apiClient, fromConfig, toObject));
|
|
3250
|
+
}
|
|
3251
|
+
return toObject;
|
|
3252
|
+
}
|
|
3253
|
+
function batchJobSourceToMldev(apiClient, fromObject) {
|
|
3254
|
+
const toObject = {};
|
|
3255
|
+
if (getValueByPath(fromObject, ['format']) !== undefined) {
|
|
3256
|
+
throw new Error('format parameter is not supported in Gemini API.');
|
|
3257
|
+
}
|
|
3258
|
+
if (getValueByPath(fromObject, ['gcsUri']) !== undefined) {
|
|
3259
|
+
throw new Error('gcsUri parameter is not supported in Gemini API.');
|
|
3260
|
+
}
|
|
3261
|
+
if (getValueByPath(fromObject, ['bigqueryUri']) !== undefined) {
|
|
3262
|
+
throw new Error('bigqueryUri parameter is not supported in Gemini API.');
|
|
3263
|
+
}
|
|
3264
|
+
const fromFileName = getValueByPath(fromObject, ['fileName']);
|
|
3265
|
+
if (fromFileName != null) {
|
|
3266
|
+
setValueByPath(toObject, ['fileName'], fromFileName);
|
|
3267
|
+
}
|
|
3268
|
+
const fromInlinedRequests = getValueByPath(fromObject, [
|
|
3269
|
+
'inlinedRequests',
|
|
3270
|
+
]);
|
|
3271
|
+
if (fromInlinedRequests != null) {
|
|
3272
|
+
let transformedList = fromInlinedRequests;
|
|
3273
|
+
if (Array.isArray(transformedList)) {
|
|
3274
|
+
transformedList = transformedList.map((item) => {
|
|
3275
|
+
return inlinedRequestToMldev(apiClient, item);
|
|
3276
|
+
});
|
|
3277
|
+
}
|
|
3278
|
+
setValueByPath(toObject, ['requests', 'requests'], transformedList);
|
|
3279
|
+
}
|
|
3280
|
+
return toObject;
|
|
3281
|
+
}
|
|
3282
|
+
function createBatchJobConfigToMldev(fromObject, parentObject) {
|
|
3283
|
+
const toObject = {};
|
|
3284
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
3285
|
+
if (parentObject !== undefined && fromDisplayName != null) {
|
|
3286
|
+
setValueByPath(parentObject, ['batch', 'displayName'], fromDisplayName);
|
|
3287
|
+
}
|
|
3288
|
+
if (getValueByPath(fromObject, ['dest']) !== undefined) {
|
|
3289
|
+
throw new Error('dest parameter is not supported in Gemini API.');
|
|
3290
|
+
}
|
|
3291
|
+
return toObject;
|
|
3292
|
+
}
|
|
3293
|
+
function createBatchJobParametersToMldev(apiClient, fromObject) {
|
|
3294
|
+
const toObject = {};
|
|
3295
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
3296
|
+
if (fromModel != null) {
|
|
3297
|
+
setValueByPath(toObject, ['_url', 'model'], tModel(apiClient, fromModel));
|
|
3298
|
+
}
|
|
3299
|
+
const fromSrc = getValueByPath(fromObject, ['src']);
|
|
3300
|
+
if (fromSrc != null) {
|
|
3301
|
+
setValueByPath(toObject, ['batch', 'inputConfig'], batchJobSourceToMldev(apiClient, tBatchJobSource(apiClient, fromSrc)));
|
|
3302
|
+
}
|
|
3303
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3304
|
+
if (fromConfig != null) {
|
|
3305
|
+
setValueByPath(toObject, ['config'], createBatchJobConfigToMldev(fromConfig, toObject));
|
|
3306
|
+
}
|
|
3307
|
+
return toObject;
|
|
3308
|
+
}
|
|
3309
|
+
function getBatchJobParametersToMldev(apiClient, fromObject) {
|
|
3310
|
+
const toObject = {};
|
|
3311
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
3312
|
+
if (fromName != null) {
|
|
3313
|
+
setValueByPath(toObject, ['_url', 'name'], tBatchJobName(apiClient, fromName));
|
|
3314
|
+
}
|
|
3315
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3316
|
+
if (fromConfig != null) {
|
|
3317
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
3318
|
+
}
|
|
3319
|
+
return toObject;
|
|
3320
|
+
}
|
|
3321
|
+
function cancelBatchJobParametersToMldev(apiClient, fromObject) {
|
|
3322
|
+
const toObject = {};
|
|
3323
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
3324
|
+
if (fromName != null) {
|
|
3325
|
+
setValueByPath(toObject, ['_url', 'name'], tBatchJobName(apiClient, fromName));
|
|
3326
|
+
}
|
|
3327
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3328
|
+
if (fromConfig != null) {
|
|
3329
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
3330
|
+
}
|
|
3331
|
+
return toObject;
|
|
3332
|
+
}
|
|
3333
|
+
function listBatchJobsConfigToMldev(fromObject, parentObject) {
|
|
3334
|
+
const toObject = {};
|
|
3335
|
+
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
3336
|
+
if (parentObject !== undefined && fromPageSize != null) {
|
|
3337
|
+
setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
|
|
3338
|
+
}
|
|
3339
|
+
const fromPageToken = getValueByPath(fromObject, ['pageToken']);
|
|
3340
|
+
if (parentObject !== undefined && fromPageToken != null) {
|
|
3341
|
+
setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
|
|
3342
|
+
}
|
|
3343
|
+
if (getValueByPath(fromObject, ['filter']) !== undefined) {
|
|
3344
|
+
throw new Error('filter parameter is not supported in Gemini API.');
|
|
3345
|
+
}
|
|
3346
|
+
return toObject;
|
|
3347
|
+
}
|
|
3348
|
+
function listBatchJobsParametersToMldev(fromObject) {
|
|
3349
|
+
const toObject = {};
|
|
3350
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3351
|
+
if (fromConfig != null) {
|
|
3352
|
+
setValueByPath(toObject, ['config'], listBatchJobsConfigToMldev(fromConfig, toObject));
|
|
3353
|
+
}
|
|
3354
|
+
return toObject;
|
|
3355
|
+
}
|
|
3356
|
+
function deleteBatchJobParametersToMldev(apiClient, fromObject) {
|
|
3357
|
+
const toObject = {};
|
|
3358
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
3359
|
+
if (fromName != null) {
|
|
3360
|
+
setValueByPath(toObject, ['_url', 'name'], tBatchJobName(apiClient, fromName));
|
|
3361
|
+
}
|
|
3362
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3363
|
+
if (fromConfig != null) {
|
|
3364
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
3365
|
+
}
|
|
3366
|
+
return toObject;
|
|
3367
|
+
}
|
|
3368
|
+
function batchJobSourceToVertex(fromObject) {
|
|
3369
|
+
const toObject = {};
|
|
3370
|
+
const fromFormat = getValueByPath(fromObject, ['format']);
|
|
3371
|
+
if (fromFormat != null) {
|
|
3372
|
+
setValueByPath(toObject, ['instancesFormat'], fromFormat);
|
|
3373
|
+
}
|
|
3374
|
+
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
3375
|
+
if (fromGcsUri != null) {
|
|
3376
|
+
setValueByPath(toObject, ['gcsSource', 'uris'], fromGcsUri);
|
|
3377
|
+
}
|
|
3378
|
+
const fromBigqueryUri = getValueByPath(fromObject, ['bigqueryUri']);
|
|
3379
|
+
if (fromBigqueryUri != null) {
|
|
3380
|
+
setValueByPath(toObject, ['bigquerySource', 'inputUri'], fromBigqueryUri);
|
|
3381
|
+
}
|
|
3382
|
+
if (getValueByPath(fromObject, ['fileName']) !== undefined) {
|
|
3383
|
+
throw new Error('fileName parameter is not supported in Vertex AI.');
|
|
3384
|
+
}
|
|
3385
|
+
if (getValueByPath(fromObject, ['inlinedRequests']) !== undefined) {
|
|
3386
|
+
throw new Error('inlinedRequests parameter is not supported in Vertex AI.');
|
|
3387
|
+
}
|
|
3388
|
+
return toObject;
|
|
3389
|
+
}
|
|
3390
|
+
function batchJobDestinationToVertex(fromObject) {
|
|
3391
|
+
const toObject = {};
|
|
3392
|
+
const fromFormat = getValueByPath(fromObject, ['format']);
|
|
3393
|
+
if (fromFormat != null) {
|
|
3394
|
+
setValueByPath(toObject, ['predictionsFormat'], fromFormat);
|
|
3395
|
+
}
|
|
3396
|
+
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
3397
|
+
if (fromGcsUri != null) {
|
|
3398
|
+
setValueByPath(toObject, ['gcsDestination', 'outputUriPrefix'], fromGcsUri);
|
|
3399
|
+
}
|
|
3400
|
+
const fromBigqueryUri = getValueByPath(fromObject, ['bigqueryUri']);
|
|
3401
|
+
if (fromBigqueryUri != null) {
|
|
3402
|
+
setValueByPath(toObject, ['bigqueryDestination', 'outputUri'], fromBigqueryUri);
|
|
3403
|
+
}
|
|
3404
|
+
if (getValueByPath(fromObject, ['fileName']) !== undefined) {
|
|
3405
|
+
throw new Error('fileName parameter is not supported in Vertex AI.');
|
|
3406
|
+
}
|
|
3407
|
+
if (getValueByPath(fromObject, ['inlinedResponses']) !== undefined) {
|
|
3408
|
+
throw new Error('inlinedResponses parameter is not supported in Vertex AI.');
|
|
3409
|
+
}
|
|
3410
|
+
return toObject;
|
|
3411
|
+
}
|
|
3412
|
+
function createBatchJobConfigToVertex(fromObject, parentObject) {
|
|
3413
|
+
const toObject = {};
|
|
3414
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
3415
|
+
if (parentObject !== undefined && fromDisplayName != null) {
|
|
3416
|
+
setValueByPath(parentObject, ['displayName'], fromDisplayName);
|
|
3417
|
+
}
|
|
3418
|
+
const fromDest = getValueByPath(fromObject, ['dest']);
|
|
3419
|
+
if (parentObject !== undefined && fromDest != null) {
|
|
3420
|
+
setValueByPath(parentObject, ['outputConfig'], batchJobDestinationToVertex(tBatchJobDestination(fromDest)));
|
|
3421
|
+
}
|
|
3422
|
+
return toObject;
|
|
3423
|
+
}
|
|
3424
|
+
function createBatchJobParametersToVertex(apiClient, fromObject) {
|
|
3425
|
+
const toObject = {};
|
|
3426
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
3427
|
+
if (fromModel != null) {
|
|
3428
|
+
setValueByPath(toObject, ['model'], tModel(apiClient, fromModel));
|
|
3429
|
+
}
|
|
3430
|
+
const fromSrc = getValueByPath(fromObject, ['src']);
|
|
3431
|
+
if (fromSrc != null) {
|
|
3432
|
+
setValueByPath(toObject, ['inputConfig'], batchJobSourceToVertex(tBatchJobSource(apiClient, fromSrc)));
|
|
3433
|
+
}
|
|
3434
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3435
|
+
if (fromConfig != null) {
|
|
3436
|
+
setValueByPath(toObject, ['config'], createBatchJobConfigToVertex(fromConfig, toObject));
|
|
3437
|
+
}
|
|
3438
|
+
return toObject;
|
|
3439
|
+
}
|
|
3440
|
+
function getBatchJobParametersToVertex(apiClient, fromObject) {
|
|
3441
|
+
const toObject = {};
|
|
3442
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
3443
|
+
if (fromName != null) {
|
|
3444
|
+
setValueByPath(toObject, ['_url', 'name'], tBatchJobName(apiClient, fromName));
|
|
3445
|
+
}
|
|
3446
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3447
|
+
if (fromConfig != null) {
|
|
3448
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
3449
|
+
}
|
|
3450
|
+
return toObject;
|
|
3451
|
+
}
|
|
3452
|
+
function cancelBatchJobParametersToVertex(apiClient, fromObject) {
|
|
3453
|
+
const toObject = {};
|
|
3454
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
3455
|
+
if (fromName != null) {
|
|
3456
|
+
setValueByPath(toObject, ['_url', 'name'], tBatchJobName(apiClient, fromName));
|
|
3457
|
+
}
|
|
3458
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3459
|
+
if (fromConfig != null) {
|
|
3460
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
3461
|
+
}
|
|
3462
|
+
return toObject;
|
|
3463
|
+
}
|
|
3464
|
+
function listBatchJobsConfigToVertex(fromObject, parentObject) {
|
|
3465
|
+
const toObject = {};
|
|
3466
|
+
const fromPageSize = getValueByPath(fromObject, ['pageSize']);
|
|
3467
|
+
if (parentObject !== undefined && fromPageSize != null) {
|
|
3468
|
+
setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
|
|
3469
|
+
}
|
|
3470
|
+
const fromPageToken = getValueByPath(fromObject, ['pageToken']);
|
|
3471
|
+
if (parentObject !== undefined && fromPageToken != null) {
|
|
3472
|
+
setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
|
|
3473
|
+
}
|
|
3474
|
+
const fromFilter = getValueByPath(fromObject, ['filter']);
|
|
3475
|
+
if (parentObject !== undefined && fromFilter != null) {
|
|
3476
|
+
setValueByPath(parentObject, ['_query', 'filter'], fromFilter);
|
|
3477
|
+
}
|
|
3478
|
+
return toObject;
|
|
3479
|
+
}
|
|
3480
|
+
function listBatchJobsParametersToVertex(fromObject) {
|
|
3481
|
+
const toObject = {};
|
|
3482
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3483
|
+
if (fromConfig != null) {
|
|
3484
|
+
setValueByPath(toObject, ['config'], listBatchJobsConfigToVertex(fromConfig, toObject));
|
|
3485
|
+
}
|
|
3486
|
+
return toObject;
|
|
3487
|
+
}
|
|
3488
|
+
function deleteBatchJobParametersToVertex(apiClient, fromObject) {
|
|
3489
|
+
const toObject = {};
|
|
3490
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
3491
|
+
if (fromName != null) {
|
|
3492
|
+
setValueByPath(toObject, ['_url', 'name'], tBatchJobName(apiClient, fromName));
|
|
3493
|
+
}
|
|
3494
|
+
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3495
|
+
if (fromConfig != null) {
|
|
3496
|
+
setValueByPath(toObject, ['config'], fromConfig);
|
|
3497
|
+
}
|
|
3498
|
+
return toObject;
|
|
3499
|
+
}
|
|
3500
|
+
function jobErrorFromMldev() {
|
|
3501
|
+
const toObject = {};
|
|
3502
|
+
return toObject;
|
|
3503
|
+
}
|
|
3504
|
+
function videoMetadataFromMldev$2(fromObject) {
|
|
3505
|
+
const toObject = {};
|
|
3506
|
+
const fromFps = getValueByPath(fromObject, ['fps']);
|
|
3507
|
+
if (fromFps != null) {
|
|
3508
|
+
setValueByPath(toObject, ['fps'], fromFps);
|
|
3509
|
+
}
|
|
3510
|
+
const fromEndOffset = getValueByPath(fromObject, ['endOffset']);
|
|
3511
|
+
if (fromEndOffset != null) {
|
|
3512
|
+
setValueByPath(toObject, ['endOffset'], fromEndOffset);
|
|
3513
|
+
}
|
|
3514
|
+
const fromStartOffset = getValueByPath(fromObject, ['startOffset']);
|
|
3515
|
+
if (fromStartOffset != null) {
|
|
3516
|
+
setValueByPath(toObject, ['startOffset'], fromStartOffset);
|
|
3517
|
+
}
|
|
3518
|
+
return toObject;
|
|
3519
|
+
}
|
|
3520
|
+
function blobFromMldev$2(fromObject) {
|
|
3521
|
+
const toObject = {};
|
|
3522
|
+
const fromData = getValueByPath(fromObject, ['data']);
|
|
3523
|
+
if (fromData != null) {
|
|
3524
|
+
setValueByPath(toObject, ['data'], fromData);
|
|
3525
|
+
}
|
|
3526
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
3527
|
+
if (fromMimeType != null) {
|
|
3528
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
3529
|
+
}
|
|
3530
|
+
return toObject;
|
|
3531
|
+
}
|
|
3532
|
+
function fileDataFromMldev$2(fromObject) {
|
|
3533
|
+
const toObject = {};
|
|
3534
|
+
const fromFileUri = getValueByPath(fromObject, ['fileUri']);
|
|
3535
|
+
if (fromFileUri != null) {
|
|
3536
|
+
setValueByPath(toObject, ['fileUri'], fromFileUri);
|
|
3537
|
+
}
|
|
3538
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
3539
|
+
if (fromMimeType != null) {
|
|
3540
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
3541
|
+
}
|
|
3542
|
+
return toObject;
|
|
3543
|
+
}
|
|
3544
|
+
function partFromMldev$2(fromObject) {
|
|
3545
|
+
const toObject = {};
|
|
3546
|
+
const fromVideoMetadata = getValueByPath(fromObject, [
|
|
3547
|
+
'videoMetadata',
|
|
3548
|
+
]);
|
|
3549
|
+
if (fromVideoMetadata != null) {
|
|
3550
|
+
setValueByPath(toObject, ['videoMetadata'], videoMetadataFromMldev$2(fromVideoMetadata));
|
|
3551
|
+
}
|
|
3552
|
+
const fromThought = getValueByPath(fromObject, ['thought']);
|
|
3553
|
+
if (fromThought != null) {
|
|
3554
|
+
setValueByPath(toObject, ['thought'], fromThought);
|
|
3555
|
+
}
|
|
3556
|
+
const fromInlineData = getValueByPath(fromObject, ['inlineData']);
|
|
3557
|
+
if (fromInlineData != null) {
|
|
3558
|
+
setValueByPath(toObject, ['inlineData'], blobFromMldev$2(fromInlineData));
|
|
3559
|
+
}
|
|
3560
|
+
const fromFileData = getValueByPath(fromObject, ['fileData']);
|
|
3561
|
+
if (fromFileData != null) {
|
|
3562
|
+
setValueByPath(toObject, ['fileData'], fileDataFromMldev$2(fromFileData));
|
|
3563
|
+
}
|
|
3564
|
+
const fromThoughtSignature = getValueByPath(fromObject, [
|
|
3565
|
+
'thoughtSignature',
|
|
3566
|
+
]);
|
|
3567
|
+
if (fromThoughtSignature != null) {
|
|
3568
|
+
setValueByPath(toObject, ['thoughtSignature'], fromThoughtSignature);
|
|
3569
|
+
}
|
|
3570
|
+
const fromCodeExecutionResult = getValueByPath(fromObject, [
|
|
3571
|
+
'codeExecutionResult',
|
|
3572
|
+
]);
|
|
3573
|
+
if (fromCodeExecutionResult != null) {
|
|
3574
|
+
setValueByPath(toObject, ['codeExecutionResult'], fromCodeExecutionResult);
|
|
3575
|
+
}
|
|
3576
|
+
const fromExecutableCode = getValueByPath(fromObject, [
|
|
3577
|
+
'executableCode',
|
|
3578
|
+
]);
|
|
3579
|
+
if (fromExecutableCode != null) {
|
|
3580
|
+
setValueByPath(toObject, ['executableCode'], fromExecutableCode);
|
|
3581
|
+
}
|
|
3582
|
+
const fromFunctionCall = getValueByPath(fromObject, ['functionCall']);
|
|
3583
|
+
if (fromFunctionCall != null) {
|
|
3584
|
+
setValueByPath(toObject, ['functionCall'], fromFunctionCall);
|
|
3585
|
+
}
|
|
3586
|
+
const fromFunctionResponse = getValueByPath(fromObject, [
|
|
3587
|
+
'functionResponse',
|
|
3588
|
+
]);
|
|
3589
|
+
if (fromFunctionResponse != null) {
|
|
3590
|
+
setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
|
|
3591
|
+
}
|
|
3592
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
3593
|
+
if (fromText != null) {
|
|
3594
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
3595
|
+
}
|
|
3596
|
+
return toObject;
|
|
3597
|
+
}
|
|
3598
|
+
function contentFromMldev$2(fromObject) {
|
|
3599
|
+
const toObject = {};
|
|
3600
|
+
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
3601
|
+
if (fromParts != null) {
|
|
3602
|
+
let transformedList = fromParts;
|
|
3603
|
+
if (Array.isArray(transformedList)) {
|
|
3604
|
+
transformedList = transformedList.map((item) => {
|
|
3605
|
+
return partFromMldev$2(item);
|
|
3606
|
+
});
|
|
3607
|
+
}
|
|
3608
|
+
setValueByPath(toObject, ['parts'], transformedList);
|
|
3609
|
+
}
|
|
3610
|
+
const fromRole = getValueByPath(fromObject, ['role']);
|
|
3611
|
+
if (fromRole != null) {
|
|
3612
|
+
setValueByPath(toObject, ['role'], fromRole);
|
|
3613
|
+
}
|
|
3614
|
+
return toObject;
|
|
3615
|
+
}
|
|
3616
|
+
function citationMetadataFromMldev$1(fromObject) {
|
|
3617
|
+
const toObject = {};
|
|
3618
|
+
const fromCitations = getValueByPath(fromObject, ['citationSources']);
|
|
3619
|
+
if (fromCitations != null) {
|
|
3620
|
+
setValueByPath(toObject, ['citations'], fromCitations);
|
|
3621
|
+
}
|
|
3622
|
+
return toObject;
|
|
3623
|
+
}
|
|
3624
|
+
function urlMetadataFromMldev$2(fromObject) {
|
|
3625
|
+
const toObject = {};
|
|
3626
|
+
const fromRetrievedUrl = getValueByPath(fromObject, ['retrievedUrl']);
|
|
3627
|
+
if (fromRetrievedUrl != null) {
|
|
3628
|
+
setValueByPath(toObject, ['retrievedUrl'], fromRetrievedUrl);
|
|
3629
|
+
}
|
|
3630
|
+
const fromUrlRetrievalStatus = getValueByPath(fromObject, [
|
|
3631
|
+
'urlRetrievalStatus',
|
|
3632
|
+
]);
|
|
3633
|
+
if (fromUrlRetrievalStatus != null) {
|
|
3634
|
+
setValueByPath(toObject, ['urlRetrievalStatus'], fromUrlRetrievalStatus);
|
|
3635
|
+
}
|
|
3636
|
+
return toObject;
|
|
3637
|
+
}
|
|
3638
|
+
function urlContextMetadataFromMldev$2(fromObject) {
|
|
3639
|
+
const toObject = {};
|
|
3640
|
+
const fromUrlMetadata = getValueByPath(fromObject, ['urlMetadata']);
|
|
3641
|
+
if (fromUrlMetadata != null) {
|
|
3642
|
+
let transformedList = fromUrlMetadata;
|
|
3643
|
+
if (Array.isArray(transformedList)) {
|
|
3644
|
+
transformedList = transformedList.map((item) => {
|
|
3645
|
+
return urlMetadataFromMldev$2(item);
|
|
3646
|
+
});
|
|
3647
|
+
}
|
|
3648
|
+
setValueByPath(toObject, ['urlMetadata'], transformedList);
|
|
3649
|
+
}
|
|
3650
|
+
return toObject;
|
|
3651
|
+
}
|
|
3652
|
+
function candidateFromMldev$1(fromObject) {
|
|
3653
|
+
const toObject = {};
|
|
3654
|
+
const fromContent = getValueByPath(fromObject, ['content']);
|
|
3655
|
+
if (fromContent != null) {
|
|
3656
|
+
setValueByPath(toObject, ['content'], contentFromMldev$2(fromContent));
|
|
3657
|
+
}
|
|
3658
|
+
const fromCitationMetadata = getValueByPath(fromObject, [
|
|
3659
|
+
'citationMetadata',
|
|
3660
|
+
]);
|
|
3661
|
+
if (fromCitationMetadata != null) {
|
|
3662
|
+
setValueByPath(toObject, ['citationMetadata'], citationMetadataFromMldev$1(fromCitationMetadata));
|
|
3663
|
+
}
|
|
3664
|
+
const fromTokenCount = getValueByPath(fromObject, ['tokenCount']);
|
|
3665
|
+
if (fromTokenCount != null) {
|
|
3666
|
+
setValueByPath(toObject, ['tokenCount'], fromTokenCount);
|
|
3667
|
+
}
|
|
3668
|
+
const fromFinishReason = getValueByPath(fromObject, ['finishReason']);
|
|
3669
|
+
if (fromFinishReason != null) {
|
|
3670
|
+
setValueByPath(toObject, ['finishReason'], fromFinishReason);
|
|
3671
|
+
}
|
|
3672
|
+
const fromUrlContextMetadata = getValueByPath(fromObject, [
|
|
3673
|
+
'urlContextMetadata',
|
|
3674
|
+
]);
|
|
3675
|
+
if (fromUrlContextMetadata != null) {
|
|
3676
|
+
setValueByPath(toObject, ['urlContextMetadata'], urlContextMetadataFromMldev$2(fromUrlContextMetadata));
|
|
3677
|
+
}
|
|
3678
|
+
const fromAvgLogprobs = getValueByPath(fromObject, ['avgLogprobs']);
|
|
3679
|
+
if (fromAvgLogprobs != null) {
|
|
3680
|
+
setValueByPath(toObject, ['avgLogprobs'], fromAvgLogprobs);
|
|
3681
|
+
}
|
|
3682
|
+
const fromGroundingMetadata = getValueByPath(fromObject, [
|
|
3683
|
+
'groundingMetadata',
|
|
3684
|
+
]);
|
|
3685
|
+
if (fromGroundingMetadata != null) {
|
|
3686
|
+
setValueByPath(toObject, ['groundingMetadata'], fromGroundingMetadata);
|
|
3687
|
+
}
|
|
3688
|
+
const fromIndex = getValueByPath(fromObject, ['index']);
|
|
3689
|
+
if (fromIndex != null) {
|
|
3690
|
+
setValueByPath(toObject, ['index'], fromIndex);
|
|
3691
|
+
}
|
|
3692
|
+
const fromLogprobsResult = getValueByPath(fromObject, [
|
|
3693
|
+
'logprobsResult',
|
|
3694
|
+
]);
|
|
3695
|
+
if (fromLogprobsResult != null) {
|
|
3696
|
+
setValueByPath(toObject, ['logprobsResult'], fromLogprobsResult);
|
|
3697
|
+
}
|
|
3698
|
+
const fromSafetyRatings = getValueByPath(fromObject, [
|
|
3699
|
+
'safetyRatings',
|
|
3700
|
+
]);
|
|
3701
|
+
if (fromSafetyRatings != null) {
|
|
3702
|
+
setValueByPath(toObject, ['safetyRatings'], fromSafetyRatings);
|
|
3703
|
+
}
|
|
3704
|
+
return toObject;
|
|
3705
|
+
}
|
|
3706
|
+
function generateContentResponseFromMldev$1(fromObject) {
|
|
3707
|
+
const toObject = {};
|
|
3708
|
+
const fromCandidates = getValueByPath(fromObject, ['candidates']);
|
|
3709
|
+
if (fromCandidates != null) {
|
|
3710
|
+
let transformedList = fromCandidates;
|
|
3711
|
+
if (Array.isArray(transformedList)) {
|
|
3712
|
+
transformedList = transformedList.map((item) => {
|
|
3713
|
+
return candidateFromMldev$1(item);
|
|
3714
|
+
});
|
|
3715
|
+
}
|
|
3716
|
+
setValueByPath(toObject, ['candidates'], transformedList);
|
|
3717
|
+
}
|
|
3718
|
+
const fromModelVersion = getValueByPath(fromObject, ['modelVersion']);
|
|
3719
|
+
if (fromModelVersion != null) {
|
|
3720
|
+
setValueByPath(toObject, ['modelVersion'], fromModelVersion);
|
|
3721
|
+
}
|
|
3722
|
+
const fromPromptFeedback = getValueByPath(fromObject, [
|
|
3723
|
+
'promptFeedback',
|
|
3724
|
+
]);
|
|
3725
|
+
if (fromPromptFeedback != null) {
|
|
3726
|
+
setValueByPath(toObject, ['promptFeedback'], fromPromptFeedback);
|
|
3727
|
+
}
|
|
3728
|
+
const fromUsageMetadata = getValueByPath(fromObject, [
|
|
3729
|
+
'usageMetadata',
|
|
3730
|
+
]);
|
|
3731
|
+
if (fromUsageMetadata != null) {
|
|
3732
|
+
setValueByPath(toObject, ['usageMetadata'], fromUsageMetadata);
|
|
3733
|
+
}
|
|
3734
|
+
return toObject;
|
|
3735
|
+
}
|
|
3736
|
+
function inlinedResponseFromMldev(fromObject) {
|
|
3737
|
+
const toObject = {};
|
|
3738
|
+
const fromResponse = getValueByPath(fromObject, ['response']);
|
|
3739
|
+
if (fromResponse != null) {
|
|
3740
|
+
setValueByPath(toObject, ['response'], generateContentResponseFromMldev$1(fromResponse));
|
|
3741
|
+
}
|
|
3742
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
3743
|
+
if (fromError != null) {
|
|
3744
|
+
setValueByPath(toObject, ['error'], jobErrorFromMldev());
|
|
3745
|
+
}
|
|
3746
|
+
return toObject;
|
|
3747
|
+
}
|
|
3748
|
+
function batchJobDestinationFromMldev(fromObject) {
|
|
3749
|
+
const toObject = {};
|
|
3750
|
+
const fromFileName = getValueByPath(fromObject, ['responsesFile']);
|
|
3751
|
+
if (fromFileName != null) {
|
|
3752
|
+
setValueByPath(toObject, ['fileName'], fromFileName);
|
|
3753
|
+
}
|
|
3754
|
+
const fromInlinedResponses = getValueByPath(fromObject, [
|
|
3755
|
+
'inlinedResponses',
|
|
3756
|
+
'inlinedResponses',
|
|
3757
|
+
]);
|
|
3758
|
+
if (fromInlinedResponses != null) {
|
|
3759
|
+
let transformedList = fromInlinedResponses;
|
|
3760
|
+
if (Array.isArray(transformedList)) {
|
|
3761
|
+
transformedList = transformedList.map((item) => {
|
|
3762
|
+
return inlinedResponseFromMldev(item);
|
|
3763
|
+
});
|
|
3764
|
+
}
|
|
3765
|
+
setValueByPath(toObject, ['inlinedResponses'], transformedList);
|
|
3766
|
+
}
|
|
3767
|
+
return toObject;
|
|
3768
|
+
}
|
|
3769
|
+
function batchJobFromMldev(fromObject) {
|
|
3770
|
+
const toObject = {};
|
|
3771
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
3772
|
+
if (fromName != null) {
|
|
3773
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
3774
|
+
}
|
|
3775
|
+
const fromDisplayName = getValueByPath(fromObject, [
|
|
3776
|
+
'metadata',
|
|
3777
|
+
'displayName',
|
|
3778
|
+
]);
|
|
3779
|
+
if (fromDisplayName != null) {
|
|
3780
|
+
setValueByPath(toObject, ['displayName'], fromDisplayName);
|
|
3781
|
+
}
|
|
3782
|
+
const fromState = getValueByPath(fromObject, ['metadata', 'state']);
|
|
3783
|
+
if (fromState != null) {
|
|
3784
|
+
setValueByPath(toObject, ['state'], tJobState(fromState));
|
|
3785
|
+
}
|
|
3786
|
+
const fromCreateTime = getValueByPath(fromObject, [
|
|
3787
|
+
'metadata',
|
|
3788
|
+
'createTime',
|
|
3789
|
+
]);
|
|
3790
|
+
if (fromCreateTime != null) {
|
|
3791
|
+
setValueByPath(toObject, ['createTime'], fromCreateTime);
|
|
3792
|
+
}
|
|
3793
|
+
const fromEndTime = getValueByPath(fromObject, [
|
|
3794
|
+
'metadata',
|
|
3795
|
+
'endTime',
|
|
3796
|
+
]);
|
|
3797
|
+
if (fromEndTime != null) {
|
|
3798
|
+
setValueByPath(toObject, ['endTime'], fromEndTime);
|
|
3799
|
+
}
|
|
3800
|
+
const fromUpdateTime = getValueByPath(fromObject, [
|
|
3801
|
+
'metadata',
|
|
3802
|
+
'updateTime',
|
|
3803
|
+
]);
|
|
3804
|
+
if (fromUpdateTime != null) {
|
|
3805
|
+
setValueByPath(toObject, ['updateTime'], fromUpdateTime);
|
|
3806
|
+
}
|
|
3807
|
+
const fromModel = getValueByPath(fromObject, ['metadata', 'model']);
|
|
3808
|
+
if (fromModel != null) {
|
|
3809
|
+
setValueByPath(toObject, ['model'], fromModel);
|
|
3810
|
+
}
|
|
3811
|
+
const fromDest = getValueByPath(fromObject, ['metadata', 'output']);
|
|
3812
|
+
if (fromDest != null) {
|
|
3813
|
+
setValueByPath(toObject, ['dest'], batchJobDestinationFromMldev(fromDest));
|
|
3814
|
+
}
|
|
3815
|
+
return toObject;
|
|
3816
|
+
}
|
|
3817
|
+
function listBatchJobsResponseFromMldev(fromObject) {
|
|
3818
|
+
const toObject = {};
|
|
3819
|
+
const fromNextPageToken = getValueByPath(fromObject, [
|
|
3820
|
+
'nextPageToken',
|
|
3821
|
+
]);
|
|
3822
|
+
if (fromNextPageToken != null) {
|
|
3823
|
+
setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
|
|
3824
|
+
}
|
|
3825
|
+
const fromBatchJobs = getValueByPath(fromObject, ['operations']);
|
|
3826
|
+
if (fromBatchJobs != null) {
|
|
3827
|
+
let transformedList = fromBatchJobs;
|
|
3828
|
+
if (Array.isArray(transformedList)) {
|
|
3829
|
+
transformedList = transformedList.map((item) => {
|
|
3830
|
+
return batchJobFromMldev(item);
|
|
3831
|
+
});
|
|
3832
|
+
}
|
|
3833
|
+
setValueByPath(toObject, ['batchJobs'], transformedList);
|
|
3834
|
+
}
|
|
3835
|
+
return toObject;
|
|
3836
|
+
}
|
|
3837
|
+
function deleteResourceJobFromMldev(fromObject) {
|
|
3838
|
+
const toObject = {};
|
|
3839
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
3840
|
+
if (fromName != null) {
|
|
3841
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
3842
|
+
}
|
|
3843
|
+
const fromDone = getValueByPath(fromObject, ['done']);
|
|
3844
|
+
if (fromDone != null) {
|
|
3845
|
+
setValueByPath(toObject, ['done'], fromDone);
|
|
3846
|
+
}
|
|
3847
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
3848
|
+
if (fromError != null) {
|
|
3849
|
+
setValueByPath(toObject, ['error'], jobErrorFromMldev());
|
|
3850
|
+
}
|
|
3851
|
+
return toObject;
|
|
3852
|
+
}
|
|
3853
|
+
function jobErrorFromVertex(fromObject) {
|
|
3854
|
+
const toObject = {};
|
|
3855
|
+
const fromDetails = getValueByPath(fromObject, ['details']);
|
|
3856
|
+
if (fromDetails != null) {
|
|
3857
|
+
setValueByPath(toObject, ['details'], fromDetails);
|
|
3858
|
+
}
|
|
3859
|
+
const fromCode = getValueByPath(fromObject, ['code']);
|
|
3860
|
+
if (fromCode != null) {
|
|
3861
|
+
setValueByPath(toObject, ['code'], fromCode);
|
|
3862
|
+
}
|
|
3863
|
+
const fromMessage = getValueByPath(fromObject, ['message']);
|
|
3864
|
+
if (fromMessage != null) {
|
|
3865
|
+
setValueByPath(toObject, ['message'], fromMessage);
|
|
3866
|
+
}
|
|
3867
|
+
return toObject;
|
|
3868
|
+
}
|
|
3869
|
+
function batchJobSourceFromVertex(fromObject) {
|
|
3870
|
+
const toObject = {};
|
|
3871
|
+
const fromFormat = getValueByPath(fromObject, ['instancesFormat']);
|
|
3872
|
+
if (fromFormat != null) {
|
|
3873
|
+
setValueByPath(toObject, ['format'], fromFormat);
|
|
3874
|
+
}
|
|
3875
|
+
const fromGcsUri = getValueByPath(fromObject, ['gcsSource', 'uris']);
|
|
3876
|
+
if (fromGcsUri != null) {
|
|
3877
|
+
setValueByPath(toObject, ['gcsUri'], fromGcsUri);
|
|
3878
|
+
}
|
|
3879
|
+
const fromBigqueryUri = getValueByPath(fromObject, [
|
|
3880
|
+
'bigquerySource',
|
|
3881
|
+
'inputUri',
|
|
3882
|
+
]);
|
|
3883
|
+
if (fromBigqueryUri != null) {
|
|
3884
|
+
setValueByPath(toObject, ['bigqueryUri'], fromBigqueryUri);
|
|
3885
|
+
}
|
|
3886
|
+
return toObject;
|
|
3887
|
+
}
|
|
3888
|
+
function batchJobDestinationFromVertex(fromObject) {
|
|
3889
|
+
const toObject = {};
|
|
3890
|
+
const fromFormat = getValueByPath(fromObject, ['predictionsFormat']);
|
|
3891
|
+
if (fromFormat != null) {
|
|
3892
|
+
setValueByPath(toObject, ['format'], fromFormat);
|
|
3893
|
+
}
|
|
3894
|
+
const fromGcsUri = getValueByPath(fromObject, [
|
|
3895
|
+
'gcsDestination',
|
|
3896
|
+
'outputUriPrefix',
|
|
3897
|
+
]);
|
|
3898
|
+
if (fromGcsUri != null) {
|
|
3899
|
+
setValueByPath(toObject, ['gcsUri'], fromGcsUri);
|
|
3900
|
+
}
|
|
3901
|
+
const fromBigqueryUri = getValueByPath(fromObject, [
|
|
3902
|
+
'bigqueryDestination',
|
|
3903
|
+
'outputUri',
|
|
3904
|
+
]);
|
|
3905
|
+
if (fromBigqueryUri != null) {
|
|
3906
|
+
setValueByPath(toObject, ['bigqueryUri'], fromBigqueryUri);
|
|
3907
|
+
}
|
|
3908
|
+
return toObject;
|
|
3909
|
+
}
|
|
3910
|
+
function batchJobFromVertex(fromObject) {
|
|
3911
|
+
const toObject = {};
|
|
3912
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
3913
|
+
if (fromName != null) {
|
|
3914
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
3915
|
+
}
|
|
3916
|
+
const fromDisplayName = getValueByPath(fromObject, ['displayName']);
|
|
3917
|
+
if (fromDisplayName != null) {
|
|
3918
|
+
setValueByPath(toObject, ['displayName'], fromDisplayName);
|
|
3919
|
+
}
|
|
3920
|
+
const fromState = getValueByPath(fromObject, ['state']);
|
|
3921
|
+
if (fromState != null) {
|
|
3922
|
+
setValueByPath(toObject, ['state'], tJobState(fromState));
|
|
3923
|
+
}
|
|
3924
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
3925
|
+
if (fromError != null) {
|
|
3926
|
+
setValueByPath(toObject, ['error'], jobErrorFromVertex(fromError));
|
|
3927
|
+
}
|
|
3928
|
+
const fromCreateTime = getValueByPath(fromObject, ['createTime']);
|
|
3929
|
+
if (fromCreateTime != null) {
|
|
3930
|
+
setValueByPath(toObject, ['createTime'], fromCreateTime);
|
|
3931
|
+
}
|
|
3932
|
+
const fromStartTime = getValueByPath(fromObject, ['startTime']);
|
|
3933
|
+
if (fromStartTime != null) {
|
|
3934
|
+
setValueByPath(toObject, ['startTime'], fromStartTime);
|
|
3935
|
+
}
|
|
3936
|
+
const fromEndTime = getValueByPath(fromObject, ['endTime']);
|
|
3937
|
+
if (fromEndTime != null) {
|
|
3938
|
+
setValueByPath(toObject, ['endTime'], fromEndTime);
|
|
3939
|
+
}
|
|
3940
|
+
const fromUpdateTime = getValueByPath(fromObject, ['updateTime']);
|
|
3941
|
+
if (fromUpdateTime != null) {
|
|
3942
|
+
setValueByPath(toObject, ['updateTime'], fromUpdateTime);
|
|
3943
|
+
}
|
|
3944
|
+
const fromModel = getValueByPath(fromObject, ['model']);
|
|
3945
|
+
if (fromModel != null) {
|
|
3946
|
+
setValueByPath(toObject, ['model'], fromModel);
|
|
3947
|
+
}
|
|
3948
|
+
const fromSrc = getValueByPath(fromObject, ['inputConfig']);
|
|
3949
|
+
if (fromSrc != null) {
|
|
3950
|
+
setValueByPath(toObject, ['src'], batchJobSourceFromVertex(fromSrc));
|
|
3951
|
+
}
|
|
3952
|
+
const fromDest = getValueByPath(fromObject, ['outputConfig']);
|
|
3953
|
+
if (fromDest != null) {
|
|
3954
|
+
setValueByPath(toObject, ['dest'], batchJobDestinationFromVertex(fromDest));
|
|
3955
|
+
}
|
|
3956
|
+
return toObject;
|
|
3957
|
+
}
|
|
3958
|
+
function listBatchJobsResponseFromVertex(fromObject) {
|
|
3959
|
+
const toObject = {};
|
|
3960
|
+
const fromNextPageToken = getValueByPath(fromObject, [
|
|
3961
|
+
'nextPageToken',
|
|
3962
|
+
]);
|
|
3963
|
+
if (fromNextPageToken != null) {
|
|
3964
|
+
setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
|
|
3965
|
+
}
|
|
3966
|
+
const fromBatchJobs = getValueByPath(fromObject, [
|
|
3967
|
+
'batchPredictionJobs',
|
|
3968
|
+
]);
|
|
3969
|
+
if (fromBatchJobs != null) {
|
|
3970
|
+
let transformedList = fromBatchJobs;
|
|
3971
|
+
if (Array.isArray(transformedList)) {
|
|
3972
|
+
transformedList = transformedList.map((item) => {
|
|
3973
|
+
return batchJobFromVertex(item);
|
|
3974
|
+
});
|
|
3975
|
+
}
|
|
3976
|
+
setValueByPath(toObject, ['batchJobs'], transformedList);
|
|
3977
|
+
}
|
|
3978
|
+
return toObject;
|
|
3979
|
+
}
|
|
3980
|
+
function deleteResourceJobFromVertex(fromObject) {
|
|
3981
|
+
const toObject = {};
|
|
3982
|
+
const fromName = getValueByPath(fromObject, ['name']);
|
|
3983
|
+
if (fromName != null) {
|
|
3984
|
+
setValueByPath(toObject, ['name'], fromName);
|
|
3985
|
+
}
|
|
3986
|
+
const fromDone = getValueByPath(fromObject, ['done']);
|
|
3987
|
+
if (fromDone != null) {
|
|
3988
|
+
setValueByPath(toObject, ['done'], fromDone);
|
|
3989
|
+
}
|
|
3990
|
+
const fromError = getValueByPath(fromObject, ['error']);
|
|
3991
|
+
if (fromError != null) {
|
|
3992
|
+
setValueByPath(toObject, ['error'], jobErrorFromVertex(fromError));
|
|
3993
|
+
}
|
|
3994
|
+
return toObject;
|
|
3995
|
+
}
|
|
3996
|
+
|
|
3997
|
+
/**
|
|
3998
|
+
* @license
|
|
3999
|
+
* Copyright 2025 Google LLC
|
|
4000
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4001
|
+
*/
|
|
4002
|
+
/**
|
|
4003
|
+
* Pagers for the GenAI List APIs.
|
|
4004
|
+
*/
|
|
4005
|
+
exports.PagedItem = void 0;
|
|
4006
|
+
(function (PagedItem) {
|
|
4007
|
+
PagedItem["PAGED_ITEM_BATCH_JOBS"] = "batchJobs";
|
|
4008
|
+
PagedItem["PAGED_ITEM_MODELS"] = "models";
|
|
4009
|
+
PagedItem["PAGED_ITEM_TUNING_JOBS"] = "tuningJobs";
|
|
4010
|
+
PagedItem["PAGED_ITEM_FILES"] = "files";
|
|
4011
|
+
PagedItem["PAGED_ITEM_CACHED_CONTENTS"] = "cachedContents";
|
|
4012
|
+
})(exports.PagedItem || (exports.PagedItem = {}));
|
|
4013
|
+
/**
|
|
4014
|
+
* Pager class for iterating through paginated results.
|
|
4015
|
+
*/
|
|
4016
|
+
class Pager {
|
|
4017
|
+
constructor(name, request, response, params) {
|
|
4018
|
+
this.pageInternal = [];
|
|
4019
|
+
this.paramsInternal = {};
|
|
4020
|
+
this.requestInternal = request;
|
|
4021
|
+
this.init(name, response, params);
|
|
4022
|
+
}
|
|
4023
|
+
init(name, response, params) {
|
|
4024
|
+
var _a, _b;
|
|
4025
|
+
this.nameInternal = name;
|
|
4026
|
+
this.pageInternal = response[this.nameInternal] || [];
|
|
4027
|
+
this.idxInternal = 0;
|
|
4028
|
+
let requestParams = { config: {} };
|
|
4029
|
+
if (!params) {
|
|
4030
|
+
requestParams = { config: {} };
|
|
4031
|
+
}
|
|
4032
|
+
else if (typeof params === 'object') {
|
|
4033
|
+
requestParams = Object.assign({}, params);
|
|
4034
|
+
}
|
|
4035
|
+
else {
|
|
4036
|
+
requestParams = params;
|
|
4037
|
+
}
|
|
4038
|
+
if (requestParams['config']) {
|
|
4039
|
+
requestParams['config']['pageToken'] = response['nextPageToken'];
|
|
4040
|
+
}
|
|
4041
|
+
this.paramsInternal = requestParams;
|
|
4042
|
+
this.pageInternalSize =
|
|
4043
|
+
(_b = (_a = requestParams['config']) === null || _a === void 0 ? void 0 : _a['pageSize']) !== null && _b !== void 0 ? _b : this.pageInternal.length;
|
|
4044
|
+
}
|
|
4045
|
+
initNextPage(response) {
|
|
4046
|
+
this.init(this.nameInternal, response, this.paramsInternal);
|
|
4047
|
+
}
|
|
4048
|
+
/**
|
|
4049
|
+
* Returns the current page, which is a list of items.
|
|
4050
|
+
*
|
|
4051
|
+
* @remarks
|
|
4052
|
+
* The first page is retrieved when the pager is created. The returned list of
|
|
4053
|
+
* items could be a subset of the entire list.
|
|
4054
|
+
*/
|
|
4055
|
+
get page() {
|
|
4056
|
+
return this.pageInternal;
|
|
4057
|
+
}
|
|
4058
|
+
/**
|
|
4059
|
+
* Returns the type of paged item (for example, ``batch_jobs``).
|
|
4060
|
+
*/
|
|
4061
|
+
get name() {
|
|
4062
|
+
return this.nameInternal;
|
|
4063
|
+
}
|
|
4064
|
+
/**
|
|
4065
|
+
* Returns the length of the page fetched each time by this pager.
|
|
4066
|
+
*
|
|
4067
|
+
* @remarks
|
|
4068
|
+
* The number of items in the page is less than or equal to the page length.
|
|
4069
|
+
*/
|
|
4070
|
+
get pageSize() {
|
|
4071
|
+
return this.pageInternalSize;
|
|
4072
|
+
}
|
|
4073
|
+
/**
|
|
4074
|
+
* Returns the parameters when making the API request for the next page.
|
|
4075
|
+
*
|
|
4076
|
+
* @remarks
|
|
4077
|
+
* Parameters contain a set of optional configs that can be
|
|
4078
|
+
* used to customize the API request. For example, the `pageToken` parameter
|
|
4079
|
+
* contains the token to request the next page.
|
|
4080
|
+
*/
|
|
4081
|
+
get params() {
|
|
4082
|
+
return this.paramsInternal;
|
|
4083
|
+
}
|
|
4084
|
+
/**
|
|
4085
|
+
* Returns the total number of items in the current page.
|
|
4086
|
+
*/
|
|
4087
|
+
get pageLength() {
|
|
4088
|
+
return this.pageInternal.length;
|
|
4089
|
+
}
|
|
4090
|
+
/**
|
|
4091
|
+
* Returns the item at the given index.
|
|
4092
|
+
*/
|
|
4093
|
+
getItem(index) {
|
|
4094
|
+
return this.pageInternal[index];
|
|
4095
|
+
}
|
|
4096
|
+
/**
|
|
4097
|
+
* Returns an async iterator that support iterating through all items
|
|
4098
|
+
* retrieved from the API.
|
|
4099
|
+
*
|
|
4100
|
+
* @remarks
|
|
4101
|
+
* The iterator will automatically fetch the next page if there are more items
|
|
4102
|
+
* to fetch from the API.
|
|
4103
|
+
*
|
|
4104
|
+
* @example
|
|
4105
|
+
*
|
|
4106
|
+
* ```ts
|
|
4107
|
+
* const pager = await ai.files.list({config: {pageSize: 10}});
|
|
4108
|
+
* for await (const file of pager) {
|
|
4109
|
+
* console.log(file.name);
|
|
4110
|
+
* }
|
|
4111
|
+
* ```
|
|
4112
|
+
*/
|
|
4113
|
+
[Symbol.asyncIterator]() {
|
|
4114
|
+
return {
|
|
4115
|
+
next: async () => {
|
|
4116
|
+
if (this.idxInternal >= this.pageLength) {
|
|
4117
|
+
if (this.hasNextPage()) {
|
|
4118
|
+
await this.nextPage();
|
|
4119
|
+
}
|
|
4120
|
+
else {
|
|
4121
|
+
return { value: undefined, done: true };
|
|
4122
|
+
}
|
|
4123
|
+
}
|
|
4124
|
+
const item = this.getItem(this.idxInternal);
|
|
4125
|
+
this.idxInternal += 1;
|
|
4126
|
+
return { value: item, done: false };
|
|
4127
|
+
},
|
|
4128
|
+
return: async () => {
|
|
4129
|
+
return { value: undefined, done: true };
|
|
4130
|
+
},
|
|
4131
|
+
};
|
|
4132
|
+
}
|
|
4133
|
+
/**
|
|
4134
|
+
* Fetches the next page of items. This makes a new API request.
|
|
4135
|
+
*
|
|
4136
|
+
* @throws {Error} If there are no more pages to fetch.
|
|
4137
|
+
*
|
|
4138
|
+
* @example
|
|
4139
|
+
*
|
|
4140
|
+
* ```ts
|
|
4141
|
+
* const pager = await ai.files.list({config: {pageSize: 10}});
|
|
4142
|
+
* let page = pager.page;
|
|
4143
|
+
* while (true) {
|
|
4144
|
+
* for (const file of page) {
|
|
4145
|
+
* console.log(file.name);
|
|
4146
|
+
* }
|
|
4147
|
+
* if (!pager.hasNextPage()) {
|
|
4148
|
+
* break;
|
|
4149
|
+
* }
|
|
4150
|
+
* page = await pager.nextPage();
|
|
4151
|
+
* }
|
|
4152
|
+
* ```
|
|
4153
|
+
*/
|
|
4154
|
+
async nextPage() {
|
|
4155
|
+
if (!this.hasNextPage()) {
|
|
4156
|
+
throw new Error('No more pages to fetch.');
|
|
4157
|
+
}
|
|
4158
|
+
const response = await this.requestInternal(this.params);
|
|
4159
|
+
this.initNextPage(response);
|
|
4160
|
+
return this.page;
|
|
4161
|
+
}
|
|
4162
|
+
/**
|
|
4163
|
+
* Returns true if there are more pages to fetch from the API.
|
|
4164
|
+
*/
|
|
4165
|
+
hasNextPage() {
|
|
4166
|
+
var _a;
|
|
4167
|
+
if (((_a = this.params['config']) === null || _a === void 0 ? void 0 : _a['pageToken']) !== undefined) {
|
|
4168
|
+
return true;
|
|
4169
|
+
}
|
|
4170
|
+
return false;
|
|
4171
|
+
}
|
|
4172
|
+
}
|
|
4173
|
+
|
|
4174
|
+
/**
|
|
4175
|
+
* @license
|
|
4176
|
+
* Copyright 2025 Google LLC
|
|
4177
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4178
|
+
*/
|
|
4179
|
+
class Batches extends BaseModule {
|
|
4180
|
+
constructor(apiClient) {
|
|
4181
|
+
super();
|
|
4182
|
+
this.apiClient = apiClient;
|
|
4183
|
+
/**
|
|
4184
|
+
* Create batch job.
|
|
4185
|
+
*
|
|
4186
|
+
* @param params - The parameters for create batch job request.
|
|
4187
|
+
* @return The created batch job.
|
|
4188
|
+
*
|
|
4189
|
+
* @example
|
|
4190
|
+
* ```ts
|
|
4191
|
+
* const response = await ai.batches.create({
|
|
4192
|
+
* model: 'gemini-2.0-flash',
|
|
4193
|
+
* src: {gcsUri: 'gs://bucket/path/to/file.jsonl', format: 'jsonl'},
|
|
4194
|
+
* config: {
|
|
4195
|
+
* dest: {gcsUri: 'gs://bucket/path/output/directory', format: 'jsonl'},
|
|
4196
|
+
* }
|
|
4197
|
+
* });
|
|
4198
|
+
* console.log(response);
|
|
4199
|
+
* ```
|
|
4200
|
+
*/
|
|
4201
|
+
this.create = async (params) => {
|
|
4202
|
+
if (this.apiClient.isVertexAI()) {
|
|
4203
|
+
const timestamp = Date.now();
|
|
4204
|
+
const timestampStr = timestamp.toString();
|
|
4205
|
+
if (Array.isArray(params.src)) {
|
|
4206
|
+
throw new Error('InlinedRequest[] is not supported in Vertex AI. Please use ' +
|
|
4207
|
+
'Google Cloud Storage URI or BigQuery URI instead.');
|
|
4208
|
+
}
|
|
4209
|
+
params.config = params.config || {};
|
|
4210
|
+
if (params.config.displayName === undefined) {
|
|
4211
|
+
params.config.displayName = 'genaiBatchJob_${timestampStr}';
|
|
4212
|
+
}
|
|
4213
|
+
if (params.config.dest === undefined && typeof params.src === 'string') {
|
|
4214
|
+
if (params.src.startsWith('gs://') && params.src.endsWith('.jsonl')) {
|
|
4215
|
+
params.config.dest = `${params.src.slice(0, -6)}/dest`;
|
|
4216
|
+
}
|
|
4217
|
+
else if (params.src.startsWith('bq://')) {
|
|
4218
|
+
params.config.dest =
|
|
4219
|
+
`${params.src}_dest_${timestampStr}`;
|
|
4220
|
+
}
|
|
4221
|
+
else {
|
|
4222
|
+
throw new Error('Unsupported source:' + params.src);
|
|
4223
|
+
}
|
|
4224
|
+
}
|
|
4225
|
+
}
|
|
4226
|
+
return await this.createInternal(params);
|
|
4227
|
+
};
|
|
4228
|
+
/**
|
|
4229
|
+
* Lists batch job configurations.
|
|
4230
|
+
*
|
|
4231
|
+
* @param params - The parameters for the list request.
|
|
4232
|
+
* @return The paginated results of the list of batch jobs.
|
|
4233
|
+
*
|
|
4234
|
+
* @example
|
|
4235
|
+
* ```ts
|
|
4236
|
+
* const batchJobs = await ai.batches.list({config: {'pageSize': 2}});
|
|
4237
|
+
* for await (const batchJob of batchJobs) {
|
|
4238
|
+
* console.log(batchJob);
|
|
4239
|
+
* }
|
|
4240
|
+
* ```
|
|
4241
|
+
*/
|
|
4242
|
+
this.list = async (params = {}) => {
|
|
4243
|
+
return new Pager(exports.PagedItem.PAGED_ITEM_BATCH_JOBS, (x) => this.listInternal(x), await this.listInternal(params), params);
|
|
4244
|
+
};
|
|
4245
|
+
}
|
|
4246
|
+
/**
|
|
4247
|
+
* Internal method to create batch job.
|
|
4248
|
+
*
|
|
4249
|
+
* @param params - The parameters for create batch job request.
|
|
4250
|
+
* @return The created batch job.
|
|
4251
|
+
*
|
|
4252
|
+
*/
|
|
4253
|
+
async createInternal(params) {
|
|
4254
|
+
var _a, _b, _c, _d;
|
|
4255
|
+
let response;
|
|
4256
|
+
let path = '';
|
|
4257
|
+
let queryParams = {};
|
|
4258
|
+
if (this.apiClient.isVertexAI()) {
|
|
4259
|
+
const body = createBatchJobParametersToVertex(this.apiClient, params);
|
|
4260
|
+
path = formatMap('batchPredictionJobs', body['_url']);
|
|
4261
|
+
queryParams = body['_query'];
|
|
4262
|
+
delete body['config'];
|
|
4263
|
+
delete body['_url'];
|
|
4264
|
+
delete body['_query'];
|
|
4265
|
+
response = this.apiClient
|
|
4266
|
+
.request({
|
|
4267
|
+
path: path,
|
|
4268
|
+
queryParams: queryParams,
|
|
4269
|
+
body: JSON.stringify(body),
|
|
4270
|
+
httpMethod: 'POST',
|
|
4271
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
4272
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
4273
|
+
})
|
|
4274
|
+
.then((httpResponse) => {
|
|
4275
|
+
return httpResponse.json();
|
|
4276
|
+
});
|
|
4277
|
+
return response.then((apiResponse) => {
|
|
4278
|
+
const resp = batchJobFromVertex(apiResponse);
|
|
4279
|
+
return resp;
|
|
4280
|
+
});
|
|
4281
|
+
}
|
|
4282
|
+
else {
|
|
4283
|
+
const body = createBatchJobParametersToMldev(this.apiClient, params);
|
|
4284
|
+
path = formatMap('{model}:batchGenerateContent', body['_url']);
|
|
4285
|
+
queryParams = body['_query'];
|
|
4286
|
+
delete body['config'];
|
|
4287
|
+
delete body['_url'];
|
|
4288
|
+
delete body['_query'];
|
|
4289
|
+
response = this.apiClient
|
|
4290
|
+
.request({
|
|
4291
|
+
path: path,
|
|
4292
|
+
queryParams: queryParams,
|
|
4293
|
+
body: JSON.stringify(body),
|
|
4294
|
+
httpMethod: 'POST',
|
|
4295
|
+
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
4296
|
+
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
4297
|
+
})
|
|
4298
|
+
.then((httpResponse) => {
|
|
4299
|
+
return httpResponse.json();
|
|
4300
|
+
});
|
|
4301
|
+
return response.then((apiResponse) => {
|
|
4302
|
+
const resp = batchJobFromMldev(apiResponse);
|
|
4303
|
+
return resp;
|
|
4304
|
+
});
|
|
4305
|
+
}
|
|
4306
|
+
}
|
|
4307
|
+
/**
|
|
4308
|
+
* Gets batch job configurations.
|
|
4309
|
+
*
|
|
4310
|
+
* @param params - The parameters for the get request.
|
|
4311
|
+
* @return The batch job.
|
|
4312
|
+
*
|
|
4313
|
+
* @example
|
|
4314
|
+
* ```ts
|
|
4315
|
+
* await ai.batches.get({name: '...'}); // The server-generated resource name.
|
|
4316
|
+
* ```
|
|
4317
|
+
*/
|
|
4318
|
+
async get(params) {
|
|
4319
|
+
var _a, _b, _c, _d;
|
|
4320
|
+
let response;
|
|
4321
|
+
let path = '';
|
|
4322
|
+
let queryParams = {};
|
|
4323
|
+
if (this.apiClient.isVertexAI()) {
|
|
4324
|
+
const body = getBatchJobParametersToVertex(this.apiClient, params);
|
|
4325
|
+
path = formatMap('batchPredictionJobs/{name}', body['_url']);
|
|
4326
|
+
queryParams = body['_query'];
|
|
4327
|
+
delete body['config'];
|
|
4328
|
+
delete body['_url'];
|
|
4329
|
+
delete body['_query'];
|
|
4330
|
+
response = this.apiClient
|
|
4331
|
+
.request({
|
|
4332
|
+
path: path,
|
|
4333
|
+
queryParams: queryParams,
|
|
4334
|
+
body: JSON.stringify(body),
|
|
4335
|
+
httpMethod: 'GET',
|
|
4336
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
4337
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
4338
|
+
})
|
|
4339
|
+
.then((httpResponse) => {
|
|
4340
|
+
return httpResponse.json();
|
|
4341
|
+
});
|
|
4342
|
+
return response.then((apiResponse) => {
|
|
4343
|
+
const resp = batchJobFromVertex(apiResponse);
|
|
4344
|
+
return resp;
|
|
4345
|
+
});
|
|
4346
|
+
}
|
|
4347
|
+
else {
|
|
4348
|
+
const body = getBatchJobParametersToMldev(this.apiClient, params);
|
|
4349
|
+
path = formatMap('batches/{name}', body['_url']);
|
|
4350
|
+
queryParams = body['_query'];
|
|
4351
|
+
delete body['config'];
|
|
4352
|
+
delete body['_url'];
|
|
4353
|
+
delete body['_query'];
|
|
4354
|
+
response = this.apiClient
|
|
4355
|
+
.request({
|
|
4356
|
+
path: path,
|
|
4357
|
+
queryParams: queryParams,
|
|
4358
|
+
body: JSON.stringify(body),
|
|
4359
|
+
httpMethod: 'GET',
|
|
4360
|
+
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
4361
|
+
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
4362
|
+
})
|
|
4363
|
+
.then((httpResponse) => {
|
|
4364
|
+
return httpResponse.json();
|
|
4365
|
+
});
|
|
4366
|
+
return response.then((apiResponse) => {
|
|
4367
|
+
const resp = batchJobFromMldev(apiResponse);
|
|
4368
|
+
return resp;
|
|
4369
|
+
});
|
|
4370
|
+
}
|
|
4371
|
+
}
|
|
4372
|
+
/**
|
|
4373
|
+
* Cancels a batch job.
|
|
4374
|
+
*
|
|
4375
|
+
* @param params - The parameters for the cancel request.
|
|
4376
|
+
* @return The empty response returned by the API.
|
|
4377
|
+
*
|
|
4378
|
+
* @example
|
|
4379
|
+
* ```ts
|
|
4380
|
+
* await ai.batches.cancel({name: '...'}); // The server-generated resource name.
|
|
4381
|
+
* ```
|
|
4382
|
+
*/
|
|
4383
|
+
async cancel(params) {
|
|
4384
|
+
var _a, _b, _c, _d;
|
|
4385
|
+
let path = '';
|
|
4386
|
+
let queryParams = {};
|
|
4387
|
+
if (this.apiClient.isVertexAI()) {
|
|
4388
|
+
const body = cancelBatchJobParametersToVertex(this.apiClient, params);
|
|
4389
|
+
path = formatMap('batchPredictionJobs/{name}:cancel', body['_url']);
|
|
4390
|
+
queryParams = body['_query'];
|
|
4391
|
+
delete body['config'];
|
|
4392
|
+
delete body['_url'];
|
|
4393
|
+
delete body['_query'];
|
|
4394
|
+
await this.apiClient.request({
|
|
4395
|
+
path: path,
|
|
4396
|
+
queryParams: queryParams,
|
|
4397
|
+
body: JSON.stringify(body),
|
|
4398
|
+
httpMethod: 'POST',
|
|
4399
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
4400
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
4401
|
+
});
|
|
4402
|
+
}
|
|
4403
|
+
else {
|
|
4404
|
+
const body = cancelBatchJobParametersToMldev(this.apiClient, params);
|
|
4405
|
+
path = formatMap('batches/{name}:cancel', body['_url']);
|
|
4406
|
+
queryParams = body['_query'];
|
|
4407
|
+
delete body['config'];
|
|
4408
|
+
delete body['_url'];
|
|
4409
|
+
delete body['_query'];
|
|
4410
|
+
await this.apiClient.request({
|
|
4411
|
+
path: path,
|
|
4412
|
+
queryParams: queryParams,
|
|
4413
|
+
body: JSON.stringify(body),
|
|
4414
|
+
httpMethod: 'POST',
|
|
4415
|
+
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
4416
|
+
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
4417
|
+
});
|
|
4418
|
+
}
|
|
4419
|
+
}
|
|
4420
|
+
async listInternal(params) {
|
|
4421
|
+
var _a, _b, _c, _d;
|
|
4422
|
+
let response;
|
|
4423
|
+
let path = '';
|
|
4424
|
+
let queryParams = {};
|
|
4425
|
+
if (this.apiClient.isVertexAI()) {
|
|
4426
|
+
const body = listBatchJobsParametersToVertex(params);
|
|
4427
|
+
path = formatMap('batchPredictionJobs', body['_url']);
|
|
4428
|
+
queryParams = body['_query'];
|
|
4429
|
+
delete body['config'];
|
|
4430
|
+
delete body['_url'];
|
|
4431
|
+
delete body['_query'];
|
|
4432
|
+
response = this.apiClient
|
|
4433
|
+
.request({
|
|
4434
|
+
path: path,
|
|
4435
|
+
queryParams: queryParams,
|
|
4436
|
+
body: JSON.stringify(body),
|
|
4437
|
+
httpMethod: 'GET',
|
|
4438
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
4439
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
4440
|
+
})
|
|
4441
|
+
.then((httpResponse) => {
|
|
4442
|
+
return httpResponse.json();
|
|
4443
|
+
});
|
|
4444
|
+
return response.then((apiResponse) => {
|
|
4445
|
+
const resp = listBatchJobsResponseFromVertex(apiResponse);
|
|
4446
|
+
const typedResp = new ListBatchJobsResponse();
|
|
4447
|
+
Object.assign(typedResp, resp);
|
|
4448
|
+
return typedResp;
|
|
4449
|
+
});
|
|
4450
|
+
}
|
|
4451
|
+
else {
|
|
4452
|
+
const body = listBatchJobsParametersToMldev(params);
|
|
4453
|
+
path = formatMap('batches', body['_url']);
|
|
4454
|
+
queryParams = body['_query'];
|
|
4455
|
+
delete body['config'];
|
|
4456
|
+
delete body['_url'];
|
|
4457
|
+
delete body['_query'];
|
|
4458
|
+
response = this.apiClient
|
|
4459
|
+
.request({
|
|
4460
|
+
path: path,
|
|
4461
|
+
queryParams: queryParams,
|
|
4462
|
+
body: JSON.stringify(body),
|
|
4463
|
+
httpMethod: 'GET',
|
|
4464
|
+
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
4465
|
+
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
4466
|
+
})
|
|
4467
|
+
.then((httpResponse) => {
|
|
4468
|
+
return httpResponse.json();
|
|
4469
|
+
});
|
|
4470
|
+
return response.then((apiResponse) => {
|
|
4471
|
+
const resp = listBatchJobsResponseFromMldev(apiResponse);
|
|
4472
|
+
const typedResp = new ListBatchJobsResponse();
|
|
4473
|
+
Object.assign(typedResp, resp);
|
|
4474
|
+
return typedResp;
|
|
4475
|
+
});
|
|
4476
|
+
}
|
|
4477
|
+
}
|
|
4478
|
+
/**
|
|
4479
|
+
* Deletes a batch job.
|
|
4480
|
+
*
|
|
4481
|
+
* @param params - The parameters for the delete request.
|
|
4482
|
+
* @return The empty response returned by the API.
|
|
4483
|
+
*
|
|
4484
|
+
* @example
|
|
4485
|
+
* ```ts
|
|
4486
|
+
* await ai.batches.delete({name: '...'}); // The server-generated resource name.
|
|
4487
|
+
* ```
|
|
4488
|
+
*/
|
|
4489
|
+
async delete(params) {
|
|
4490
|
+
var _a, _b, _c, _d;
|
|
4491
|
+
let response;
|
|
4492
|
+
let path = '';
|
|
4493
|
+
let queryParams = {};
|
|
4494
|
+
if (this.apiClient.isVertexAI()) {
|
|
4495
|
+
const body = deleteBatchJobParametersToVertex(this.apiClient, params);
|
|
4496
|
+
path = formatMap('batchPredictionJobs/{name}', body['_url']);
|
|
4497
|
+
queryParams = body['_query'];
|
|
4498
|
+
delete body['config'];
|
|
4499
|
+
delete body['_url'];
|
|
4500
|
+
delete body['_query'];
|
|
4501
|
+
response = this.apiClient
|
|
4502
|
+
.request({
|
|
4503
|
+
path: path,
|
|
4504
|
+
queryParams: queryParams,
|
|
4505
|
+
body: JSON.stringify(body),
|
|
4506
|
+
httpMethod: 'DELETE',
|
|
4507
|
+
httpOptions: (_a = params.config) === null || _a === void 0 ? void 0 : _a.httpOptions,
|
|
4508
|
+
abortSignal: (_b = params.config) === null || _b === void 0 ? void 0 : _b.abortSignal,
|
|
4509
|
+
})
|
|
4510
|
+
.then((httpResponse) => {
|
|
4511
|
+
return httpResponse.json();
|
|
4512
|
+
});
|
|
4513
|
+
return response.then((apiResponse) => {
|
|
4514
|
+
const resp = deleteResourceJobFromVertex(apiResponse);
|
|
4515
|
+
return resp;
|
|
4516
|
+
});
|
|
4517
|
+
}
|
|
4518
|
+
else {
|
|
4519
|
+
const body = deleteBatchJobParametersToMldev(this.apiClient, params);
|
|
4520
|
+
path = formatMap('batches/{name}', body['_url']);
|
|
4521
|
+
queryParams = body['_query'];
|
|
4522
|
+
delete body['config'];
|
|
4523
|
+
delete body['_url'];
|
|
4524
|
+
delete body['_query'];
|
|
4525
|
+
response = this.apiClient
|
|
4526
|
+
.request({
|
|
4527
|
+
path: path,
|
|
4528
|
+
queryParams: queryParams,
|
|
4529
|
+
body: JSON.stringify(body),
|
|
4530
|
+
httpMethod: 'DELETE',
|
|
4531
|
+
httpOptions: (_c = params.config) === null || _c === void 0 ? void 0 : _c.httpOptions,
|
|
4532
|
+
abortSignal: (_d = params.config) === null || _d === void 0 ? void 0 : _d.abortSignal,
|
|
4533
|
+
})
|
|
4534
|
+
.then((httpResponse) => {
|
|
4535
|
+
return httpResponse.json();
|
|
4536
|
+
});
|
|
4537
|
+
return response.then((apiResponse) => {
|
|
4538
|
+
const resp = deleteResourceJobFromMldev(apiResponse);
|
|
4539
|
+
return resp;
|
|
4540
|
+
});
|
|
2386
4541
|
}
|
|
2387
4542
|
}
|
|
2388
|
-
return filteredSchema;
|
|
2389
4543
|
}
|
|
2390
4544
|
|
|
2391
4545
|
/**
|
|
@@ -2640,6 +4794,10 @@ function toolToMldev$3(fromObject) {
|
|
|
2640
4794
|
if (fromCodeExecution != null) {
|
|
2641
4795
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
2642
4796
|
}
|
|
4797
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
4798
|
+
if (fromComputerUse != null) {
|
|
4799
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
4800
|
+
}
|
|
2643
4801
|
return toObject;
|
|
2644
4802
|
}
|
|
2645
4803
|
function functionCallingConfigToMldev$1(fromObject) {
|
|
@@ -3130,6 +5288,10 @@ function toolToVertex$2(fromObject) {
|
|
|
3130
5288
|
if (fromCodeExecution != null) {
|
|
3131
5289
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
3132
5290
|
}
|
|
5291
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
5292
|
+
if (fromComputerUse != null) {
|
|
5293
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
5294
|
+
}
|
|
3133
5295
|
return toObject;
|
|
3134
5296
|
}
|
|
3135
5297
|
function functionCallingConfigToVertex$1(fromObject) {
|
|
@@ -3437,183 +5599,6 @@ function listCachedContentsResponseFromVertex(fromObject) {
|
|
|
3437
5599
|
return toObject;
|
|
3438
5600
|
}
|
|
3439
5601
|
|
|
3440
|
-
/**
|
|
3441
|
-
* @license
|
|
3442
|
-
* Copyright 2025 Google LLC
|
|
3443
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
3444
|
-
*/
|
|
3445
|
-
/**
|
|
3446
|
-
* Pagers for the GenAI List APIs.
|
|
3447
|
-
*/
|
|
3448
|
-
exports.PagedItem = void 0;
|
|
3449
|
-
(function (PagedItem) {
|
|
3450
|
-
PagedItem["PAGED_ITEM_BATCH_JOBS"] = "batchJobs";
|
|
3451
|
-
PagedItem["PAGED_ITEM_MODELS"] = "models";
|
|
3452
|
-
PagedItem["PAGED_ITEM_TUNING_JOBS"] = "tuningJobs";
|
|
3453
|
-
PagedItem["PAGED_ITEM_FILES"] = "files";
|
|
3454
|
-
PagedItem["PAGED_ITEM_CACHED_CONTENTS"] = "cachedContents";
|
|
3455
|
-
})(exports.PagedItem || (exports.PagedItem = {}));
|
|
3456
|
-
/**
|
|
3457
|
-
* Pager class for iterating through paginated results.
|
|
3458
|
-
*/
|
|
3459
|
-
class Pager {
|
|
3460
|
-
constructor(name, request, response, params) {
|
|
3461
|
-
this.pageInternal = [];
|
|
3462
|
-
this.paramsInternal = {};
|
|
3463
|
-
this.requestInternal = request;
|
|
3464
|
-
this.init(name, response, params);
|
|
3465
|
-
}
|
|
3466
|
-
init(name, response, params) {
|
|
3467
|
-
var _a, _b;
|
|
3468
|
-
this.nameInternal = name;
|
|
3469
|
-
this.pageInternal = response[this.nameInternal] || [];
|
|
3470
|
-
this.idxInternal = 0;
|
|
3471
|
-
let requestParams = { config: {} };
|
|
3472
|
-
if (!params) {
|
|
3473
|
-
requestParams = { config: {} };
|
|
3474
|
-
}
|
|
3475
|
-
else if (typeof params === 'object') {
|
|
3476
|
-
requestParams = Object.assign({}, params);
|
|
3477
|
-
}
|
|
3478
|
-
else {
|
|
3479
|
-
requestParams = params;
|
|
3480
|
-
}
|
|
3481
|
-
if (requestParams['config']) {
|
|
3482
|
-
requestParams['config']['pageToken'] = response['nextPageToken'];
|
|
3483
|
-
}
|
|
3484
|
-
this.paramsInternal = requestParams;
|
|
3485
|
-
this.pageInternalSize =
|
|
3486
|
-
(_b = (_a = requestParams['config']) === null || _a === void 0 ? void 0 : _a['pageSize']) !== null && _b !== void 0 ? _b : this.pageInternal.length;
|
|
3487
|
-
}
|
|
3488
|
-
initNextPage(response) {
|
|
3489
|
-
this.init(this.nameInternal, response, this.paramsInternal);
|
|
3490
|
-
}
|
|
3491
|
-
/**
|
|
3492
|
-
* Returns the current page, which is a list of items.
|
|
3493
|
-
*
|
|
3494
|
-
* @remarks
|
|
3495
|
-
* The first page is retrieved when the pager is created. The returned list of
|
|
3496
|
-
* items could be a subset of the entire list.
|
|
3497
|
-
*/
|
|
3498
|
-
get page() {
|
|
3499
|
-
return this.pageInternal;
|
|
3500
|
-
}
|
|
3501
|
-
/**
|
|
3502
|
-
* Returns the type of paged item (for example, ``batch_jobs``).
|
|
3503
|
-
*/
|
|
3504
|
-
get name() {
|
|
3505
|
-
return this.nameInternal;
|
|
3506
|
-
}
|
|
3507
|
-
/**
|
|
3508
|
-
* Returns the length of the page fetched each time by this pager.
|
|
3509
|
-
*
|
|
3510
|
-
* @remarks
|
|
3511
|
-
* The number of items in the page is less than or equal to the page length.
|
|
3512
|
-
*/
|
|
3513
|
-
get pageSize() {
|
|
3514
|
-
return this.pageInternalSize;
|
|
3515
|
-
}
|
|
3516
|
-
/**
|
|
3517
|
-
* Returns the parameters when making the API request for the next page.
|
|
3518
|
-
*
|
|
3519
|
-
* @remarks
|
|
3520
|
-
* Parameters contain a set of optional configs that can be
|
|
3521
|
-
* used to customize the API request. For example, the `pageToken` parameter
|
|
3522
|
-
* contains the token to request the next page.
|
|
3523
|
-
*/
|
|
3524
|
-
get params() {
|
|
3525
|
-
return this.paramsInternal;
|
|
3526
|
-
}
|
|
3527
|
-
/**
|
|
3528
|
-
* Returns the total number of items in the current page.
|
|
3529
|
-
*/
|
|
3530
|
-
get pageLength() {
|
|
3531
|
-
return this.pageInternal.length;
|
|
3532
|
-
}
|
|
3533
|
-
/**
|
|
3534
|
-
* Returns the item at the given index.
|
|
3535
|
-
*/
|
|
3536
|
-
getItem(index) {
|
|
3537
|
-
return this.pageInternal[index];
|
|
3538
|
-
}
|
|
3539
|
-
/**
|
|
3540
|
-
* Returns an async iterator that support iterating through all items
|
|
3541
|
-
* retrieved from the API.
|
|
3542
|
-
*
|
|
3543
|
-
* @remarks
|
|
3544
|
-
* The iterator will automatically fetch the next page if there are more items
|
|
3545
|
-
* to fetch from the API.
|
|
3546
|
-
*
|
|
3547
|
-
* @example
|
|
3548
|
-
*
|
|
3549
|
-
* ```ts
|
|
3550
|
-
* const pager = await ai.files.list({config: {pageSize: 10}});
|
|
3551
|
-
* for await (const file of pager) {
|
|
3552
|
-
* console.log(file.name);
|
|
3553
|
-
* }
|
|
3554
|
-
* ```
|
|
3555
|
-
*/
|
|
3556
|
-
[Symbol.asyncIterator]() {
|
|
3557
|
-
return {
|
|
3558
|
-
next: async () => {
|
|
3559
|
-
if (this.idxInternal >= this.pageLength) {
|
|
3560
|
-
if (this.hasNextPage()) {
|
|
3561
|
-
await this.nextPage();
|
|
3562
|
-
}
|
|
3563
|
-
else {
|
|
3564
|
-
return { value: undefined, done: true };
|
|
3565
|
-
}
|
|
3566
|
-
}
|
|
3567
|
-
const item = this.getItem(this.idxInternal);
|
|
3568
|
-
this.idxInternal += 1;
|
|
3569
|
-
return { value: item, done: false };
|
|
3570
|
-
},
|
|
3571
|
-
return: async () => {
|
|
3572
|
-
return { value: undefined, done: true };
|
|
3573
|
-
},
|
|
3574
|
-
};
|
|
3575
|
-
}
|
|
3576
|
-
/**
|
|
3577
|
-
* Fetches the next page of items. This makes a new API request.
|
|
3578
|
-
*
|
|
3579
|
-
* @throws {Error} If there are no more pages to fetch.
|
|
3580
|
-
*
|
|
3581
|
-
* @example
|
|
3582
|
-
*
|
|
3583
|
-
* ```ts
|
|
3584
|
-
* const pager = await ai.files.list({config: {pageSize: 10}});
|
|
3585
|
-
* let page = pager.page;
|
|
3586
|
-
* while (true) {
|
|
3587
|
-
* for (const file of page) {
|
|
3588
|
-
* console.log(file.name);
|
|
3589
|
-
* }
|
|
3590
|
-
* if (!pager.hasNextPage()) {
|
|
3591
|
-
* break;
|
|
3592
|
-
* }
|
|
3593
|
-
* page = await pager.nextPage();
|
|
3594
|
-
* }
|
|
3595
|
-
* ```
|
|
3596
|
-
*/
|
|
3597
|
-
async nextPage() {
|
|
3598
|
-
if (!this.hasNextPage()) {
|
|
3599
|
-
throw new Error('No more pages to fetch.');
|
|
3600
|
-
}
|
|
3601
|
-
const response = await this.requestInternal(this.params);
|
|
3602
|
-
this.initNextPage(response);
|
|
3603
|
-
return this.page;
|
|
3604
|
-
}
|
|
3605
|
-
/**
|
|
3606
|
-
* Returns true if there are more pages to fetch from the API.
|
|
3607
|
-
*/
|
|
3608
|
-
hasNextPage() {
|
|
3609
|
-
var _a;
|
|
3610
|
-
if (((_a = this.params['config']) === null || _a === void 0 ? void 0 : _a['pageToken']) !== undefined) {
|
|
3611
|
-
return true;
|
|
3612
|
-
}
|
|
3613
|
-
return false;
|
|
3614
|
-
}
|
|
3615
|
-
}
|
|
3616
|
-
|
|
3617
5602
|
/**
|
|
3618
5603
|
* @license
|
|
3619
5604
|
* Copyright 2025 Google LLC
|
|
@@ -4394,7 +6379,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
4394
6379
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
4395
6380
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
4396
6381
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
4397
|
-
const SDK_VERSION = '1.
|
|
6382
|
+
const SDK_VERSION = '1.8.0'; // x-release-please-version
|
|
4398
6383
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
4399
6384
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
4400
6385
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -6203,6 +8188,10 @@ function toolToMldev$2(fromObject) {
|
|
|
6203
8188
|
if (fromCodeExecution != null) {
|
|
6204
8189
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
6205
8190
|
}
|
|
8191
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
8192
|
+
if (fromComputerUse != null) {
|
|
8193
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
8194
|
+
}
|
|
6206
8195
|
return toObject;
|
|
6207
8196
|
}
|
|
6208
8197
|
function toolToVertex$1(fromObject) {
|
|
@@ -6253,6 +8242,10 @@ function toolToVertex$1(fromObject) {
|
|
|
6253
8242
|
if (fromCodeExecution != null) {
|
|
6254
8243
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
6255
8244
|
}
|
|
8245
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
8246
|
+
if (fromComputerUse != null) {
|
|
8247
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
8248
|
+
}
|
|
6256
8249
|
return toObject;
|
|
6257
8250
|
}
|
|
6258
8251
|
function sessionResumptionConfigToMldev$1(fromObject) {
|
|
@@ -6748,8 +8741,9 @@ function liveSendRealtimeInputParametersToVertex(fromObject) {
|
|
|
6748
8741
|
if (fromMedia != null) {
|
|
6749
8742
|
setValueByPath(toObject, ['mediaChunks'], tBlobs(fromMedia));
|
|
6750
8743
|
}
|
|
6751
|
-
|
|
6752
|
-
|
|
8744
|
+
const fromAudio = getValueByPath(fromObject, ['audio']);
|
|
8745
|
+
if (fromAudio != null) {
|
|
8746
|
+
setValueByPath(toObject, ['audio'], tAudioBlob(fromAudio));
|
|
6753
8747
|
}
|
|
6754
8748
|
const fromAudioStreamEnd = getValueByPath(fromObject, [
|
|
6755
8749
|
'audioStreamEnd',
|
|
@@ -6757,11 +8751,13 @@ function liveSendRealtimeInputParametersToVertex(fromObject) {
|
|
|
6757
8751
|
if (fromAudioStreamEnd != null) {
|
|
6758
8752
|
setValueByPath(toObject, ['audioStreamEnd'], fromAudioStreamEnd);
|
|
6759
8753
|
}
|
|
6760
|
-
|
|
6761
|
-
|
|
8754
|
+
const fromVideo = getValueByPath(fromObject, ['video']);
|
|
8755
|
+
if (fromVideo != null) {
|
|
8756
|
+
setValueByPath(toObject, ['video'], tImageBlob(fromVideo));
|
|
6762
8757
|
}
|
|
6763
|
-
|
|
6764
|
-
|
|
8758
|
+
const fromText = getValueByPath(fromObject, ['text']);
|
|
8759
|
+
if (fromText != null) {
|
|
8760
|
+
setValueByPath(toObject, ['text'], fromText);
|
|
6765
8761
|
}
|
|
6766
8762
|
const fromActivityStart = getValueByPath(fromObject, [
|
|
6767
8763
|
'activityStart',
|
|
@@ -6917,8 +8913,12 @@ function liveServerSetupCompleteFromMldev() {
|
|
|
6917
8913
|
const toObject = {};
|
|
6918
8914
|
return toObject;
|
|
6919
8915
|
}
|
|
6920
|
-
function liveServerSetupCompleteFromVertex() {
|
|
8916
|
+
function liveServerSetupCompleteFromVertex(fromObject) {
|
|
6921
8917
|
const toObject = {};
|
|
8918
|
+
const fromSessionId = getValueByPath(fromObject, ['sessionId']);
|
|
8919
|
+
if (fromSessionId != null) {
|
|
8920
|
+
setValueByPath(toObject, ['sessionId'], fromSessionId);
|
|
8921
|
+
}
|
|
6922
8922
|
return toObject;
|
|
6923
8923
|
}
|
|
6924
8924
|
function videoMetadataFromMldev$1(fromObject) {
|
|
@@ -7671,7 +9671,7 @@ function liveServerMessageFromVertex(fromObject) {
|
|
|
7671
9671
|
'setupComplete',
|
|
7672
9672
|
]);
|
|
7673
9673
|
if (fromSetupComplete != null) {
|
|
7674
|
-
setValueByPath(toObject, ['setupComplete'], liveServerSetupCompleteFromVertex());
|
|
9674
|
+
setValueByPath(toObject, ['setupComplete'], liveServerSetupCompleteFromVertex(fromSetupComplete));
|
|
7675
9675
|
}
|
|
7676
9676
|
const fromServerContent = getValueByPath(fromObject, [
|
|
7677
9677
|
'serverContent',
|
|
@@ -8239,6 +10239,10 @@ function toolToMldev$1(fromObject) {
|
|
|
8239
10239
|
if (fromCodeExecution != null) {
|
|
8240
10240
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
8241
10241
|
}
|
|
10242
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
10243
|
+
if (fromComputerUse != null) {
|
|
10244
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
10245
|
+
}
|
|
8242
10246
|
return toObject;
|
|
8243
10247
|
}
|
|
8244
10248
|
function functionCallingConfigToMldev(fromObject) {
|
|
@@ -8451,6 +10455,12 @@ function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
8451
10455
|
if (fromResponseSchema != null) {
|
|
8452
10456
|
setValueByPath(toObject, ['responseSchema'], schemaToMldev(tSchema(fromResponseSchema)));
|
|
8453
10457
|
}
|
|
10458
|
+
const fromResponseJsonSchema = getValueByPath(fromObject, [
|
|
10459
|
+
'responseJsonSchema',
|
|
10460
|
+
]);
|
|
10461
|
+
if (fromResponseJsonSchema != null) {
|
|
10462
|
+
setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
|
|
10463
|
+
}
|
|
8454
10464
|
if (getValueByPath(fromObject, ['routingConfig']) !== undefined) {
|
|
8455
10465
|
throw new Error('routingConfig parameter is not supported in Gemini API.');
|
|
8456
10466
|
}
|
|
@@ -8865,6 +10875,9 @@ function generateVideosConfigToMldev(fromObject, parentObject) {
|
|
|
8865
10875
|
if (getValueByPath(fromObject, ['lastFrame']) !== undefined) {
|
|
8866
10876
|
throw new Error('lastFrame parameter is not supported in Gemini API.');
|
|
8867
10877
|
}
|
|
10878
|
+
if (getValueByPath(fromObject, ['compressionQuality']) !== undefined) {
|
|
10879
|
+
throw new Error('compressionQuality parameter is not supported in Gemini API.');
|
|
10880
|
+
}
|
|
8868
10881
|
return toObject;
|
|
8869
10882
|
}
|
|
8870
10883
|
function generateVideosParametersToMldev(apiClient, fromObject) {
|
|
@@ -9319,6 +11332,10 @@ function toolToVertex(fromObject) {
|
|
|
9319
11332
|
if (fromCodeExecution != null) {
|
|
9320
11333
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
9321
11334
|
}
|
|
11335
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
11336
|
+
if (fromComputerUse != null) {
|
|
11337
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
11338
|
+
}
|
|
9322
11339
|
return toObject;
|
|
9323
11340
|
}
|
|
9324
11341
|
function functionCallingConfigToVertex(fromObject) {
|
|
@@ -9500,6 +11517,12 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
|
|
|
9500
11517
|
if (fromResponseSchema != null) {
|
|
9501
11518
|
setValueByPath(toObject, ['responseSchema'], schemaToVertex(tSchema(fromResponseSchema)));
|
|
9502
11519
|
}
|
|
11520
|
+
const fromResponseJsonSchema = getValueByPath(fromObject, [
|
|
11521
|
+
'responseJsonSchema',
|
|
11522
|
+
]);
|
|
11523
|
+
if (fromResponseJsonSchema != null) {
|
|
11524
|
+
setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
|
|
11525
|
+
}
|
|
9503
11526
|
const fromRoutingConfig = getValueByPath(fromObject, [
|
|
9504
11527
|
'routingConfig',
|
|
9505
11528
|
]);
|
|
@@ -9988,6 +12011,18 @@ function upscaleImageAPIConfigInternalToVertex(fromObject, parentObject) {
|
|
|
9988
12011
|
if (parentObject !== undefined && fromOutputCompressionQuality != null) {
|
|
9989
12012
|
setValueByPath(parentObject, ['parameters', 'outputOptions', 'compressionQuality'], fromOutputCompressionQuality);
|
|
9990
12013
|
}
|
|
12014
|
+
const fromEnhanceInputImage = getValueByPath(fromObject, [
|
|
12015
|
+
'enhanceInputImage',
|
|
12016
|
+
]);
|
|
12017
|
+
if (parentObject !== undefined && fromEnhanceInputImage != null) {
|
|
12018
|
+
setValueByPath(parentObject, ['parameters', 'upscaleConfig', 'enhanceInputImage'], fromEnhanceInputImage);
|
|
12019
|
+
}
|
|
12020
|
+
const fromImagePreservationFactor = getValueByPath(fromObject, [
|
|
12021
|
+
'imagePreservationFactor',
|
|
12022
|
+
]);
|
|
12023
|
+
if (parentObject !== undefined && fromImagePreservationFactor != null) {
|
|
12024
|
+
setValueByPath(parentObject, ['parameters', 'upscaleConfig', 'imagePreservationFactor'], fromImagePreservationFactor);
|
|
12025
|
+
}
|
|
9991
12026
|
const fromNumberOfImages = getValueByPath(fromObject, [
|
|
9992
12027
|
'numberOfImages',
|
|
9993
12028
|
]);
|
|
@@ -10256,6 +12291,12 @@ function generateVideosConfigToVertex(fromObject, parentObject) {
|
|
|
10256
12291
|
if (parentObject !== undefined && fromLastFrame != null) {
|
|
10257
12292
|
setValueByPath(parentObject, ['instances[0]', 'lastFrame'], imageToVertex(fromLastFrame));
|
|
10258
12293
|
}
|
|
12294
|
+
const fromCompressionQuality = getValueByPath(fromObject, [
|
|
12295
|
+
'compressionQuality',
|
|
12296
|
+
]);
|
|
12297
|
+
if (parentObject !== undefined && fromCompressionQuality != null) {
|
|
12298
|
+
setValueByPath(parentObject, ['parameters', 'compressionQuality'], fromCompressionQuality);
|
|
12299
|
+
}
|
|
10259
12300
|
return toObject;
|
|
10260
12301
|
}
|
|
10261
12302
|
function generateVideosParametersToVertex(apiClient, fromObject) {
|
|
@@ -10678,7 +12719,7 @@ function modelFromMldev(fromObject) {
|
|
|
10678
12719
|
}
|
|
10679
12720
|
return toObject;
|
|
10680
12721
|
}
|
|
10681
|
-
function listModelsResponseFromMldev(
|
|
12722
|
+
function listModelsResponseFromMldev(fromObject) {
|
|
10682
12723
|
const toObject = {};
|
|
10683
12724
|
const fromNextPageToken = getValueByPath(fromObject, [
|
|
10684
12725
|
'nextPageToken',
|
|
@@ -11322,7 +13363,7 @@ function modelFromVertex(fromObject) {
|
|
|
11322
13363
|
}
|
|
11323
13364
|
return toObject;
|
|
11324
13365
|
}
|
|
11325
|
-
function listModelsResponseFromVertex(
|
|
13366
|
+
function listModelsResponseFromVertex(fromObject) {
|
|
11326
13367
|
const toObject = {};
|
|
11327
13368
|
const fromNextPageToken = getValueByPath(fromObject, [
|
|
11328
13369
|
'nextPageToken',
|
|
@@ -11880,13 +13921,17 @@ const FUNCTION_RESPONSE_REQUIRES_ID = 'FunctionResponse request must have an `id
|
|
|
11880
13921
|
*/
|
|
11881
13922
|
async function handleWebSocketMessage(apiClient, onmessage, event) {
|
|
11882
13923
|
const serverMessage = new LiveServerMessage();
|
|
11883
|
-
let
|
|
13924
|
+
let jsonData;
|
|
11884
13925
|
if (event.data instanceof Blob) {
|
|
11885
|
-
|
|
13926
|
+
jsonData = await event.data.text();
|
|
13927
|
+
}
|
|
13928
|
+
else if (event.data instanceof ArrayBuffer) {
|
|
13929
|
+
jsonData = new TextDecoder().decode(event.data);
|
|
11886
13930
|
}
|
|
11887
13931
|
else {
|
|
11888
|
-
|
|
13932
|
+
jsonData = event.data;
|
|
11889
13933
|
}
|
|
13934
|
+
const data = JSON.parse(jsonData);
|
|
11890
13935
|
if (apiClient.isVertexAI()) {
|
|
11891
13936
|
const resp = liveServerMessageFromVertex(data);
|
|
11892
13937
|
Object.assign(serverMessage, resp);
|
|
@@ -13211,7 +15256,7 @@ class Models extends BaseModule {
|
|
|
13211
15256
|
return httpResponse.json();
|
|
13212
15257
|
});
|
|
13213
15258
|
return response.then((apiResponse) => {
|
|
13214
|
-
const resp = listModelsResponseFromVertex(
|
|
15259
|
+
const resp = listModelsResponseFromVertex(apiResponse);
|
|
13215
15260
|
const typedResp = new ListModelsResponse();
|
|
13216
15261
|
Object.assign(typedResp, resp);
|
|
13217
15262
|
return typedResp;
|
|
@@ -13237,7 +15282,7 @@ class Models extends BaseModule {
|
|
|
13237
15282
|
return httpResponse.json();
|
|
13238
15283
|
});
|
|
13239
15284
|
return response.then((apiResponse) => {
|
|
13240
|
-
const resp = listModelsResponseFromMldev(
|
|
15285
|
+
const resp = listModelsResponseFromMldev(apiResponse);
|
|
13241
15286
|
const typedResp = new ListModelsResponse();
|
|
13242
15287
|
Object.assign(typedResp, resp);
|
|
13243
15288
|
return typedResp;
|
|
@@ -14247,6 +16292,10 @@ function toolToMldev(fromObject) {
|
|
|
14247
16292
|
if (fromCodeExecution != null) {
|
|
14248
16293
|
setValueByPath(toObject, ['codeExecution'], fromCodeExecution);
|
|
14249
16294
|
}
|
|
16295
|
+
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
16296
|
+
if (fromComputerUse != null) {
|
|
16297
|
+
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
16298
|
+
}
|
|
14250
16299
|
return toObject;
|
|
14251
16300
|
}
|
|
14252
16301
|
function sessionResumptionConfigToMldev(fromObject) {
|
|
@@ -14837,6 +16886,9 @@ function tuningDatasetToMldev(fromObject) {
|
|
|
14837
16886
|
if (getValueByPath(fromObject, ['gcsUri']) !== undefined) {
|
|
14838
16887
|
throw new Error('gcsUri parameter is not supported in Gemini API.');
|
|
14839
16888
|
}
|
|
16889
|
+
if (getValueByPath(fromObject, ['vertexDatasetResource']) !== undefined) {
|
|
16890
|
+
throw new Error('vertexDatasetResource parameter is not supported in Gemini API.');
|
|
16891
|
+
}
|
|
14840
16892
|
const fromExamples = getValueByPath(fromObject, ['examples']);
|
|
14841
16893
|
if (fromExamples != null) {
|
|
14842
16894
|
let transformedList = fromExamples;
|
|
@@ -14950,17 +17002,29 @@ function tuningDatasetToVertex(fromObject, parentObject) {
|
|
|
14950
17002
|
if (parentObject !== undefined && fromGcsUri != null) {
|
|
14951
17003
|
setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromGcsUri);
|
|
14952
17004
|
}
|
|
17005
|
+
const fromVertexDatasetResource = getValueByPath(fromObject, [
|
|
17006
|
+
'vertexDatasetResource',
|
|
17007
|
+
]);
|
|
17008
|
+
if (parentObject !== undefined && fromVertexDatasetResource != null) {
|
|
17009
|
+
setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
|
|
17010
|
+
}
|
|
14953
17011
|
if (getValueByPath(fromObject, ['examples']) !== undefined) {
|
|
14954
17012
|
throw new Error('examples parameter is not supported in Vertex AI.');
|
|
14955
17013
|
}
|
|
14956
17014
|
return toObject;
|
|
14957
17015
|
}
|
|
14958
|
-
function tuningValidationDatasetToVertex(fromObject) {
|
|
17016
|
+
function tuningValidationDatasetToVertex(fromObject, parentObject) {
|
|
14959
17017
|
const toObject = {};
|
|
14960
17018
|
const fromGcsUri = getValueByPath(fromObject, ['gcsUri']);
|
|
14961
17019
|
if (fromGcsUri != null) {
|
|
14962
17020
|
setValueByPath(toObject, ['validationDatasetUri'], fromGcsUri);
|
|
14963
17021
|
}
|
|
17022
|
+
const fromVertexDatasetResource = getValueByPath(fromObject, [
|
|
17023
|
+
'vertexDatasetResource',
|
|
17024
|
+
]);
|
|
17025
|
+
if (parentObject !== undefined && fromVertexDatasetResource != null) {
|
|
17026
|
+
setValueByPath(parentObject, ['supervisedTuningSpec', 'trainingDatasetUri'], fromVertexDatasetResource);
|
|
17027
|
+
}
|
|
14964
17028
|
return toObject;
|
|
14965
17029
|
}
|
|
14966
17030
|
function createTuningJobConfigToVertex(fromObject, parentObject) {
|
|
@@ -14969,7 +17033,7 @@ function createTuningJobConfigToVertex(fromObject, parentObject) {
|
|
|
14969
17033
|
'validationDataset',
|
|
14970
17034
|
]);
|
|
14971
17035
|
if (parentObject !== undefined && fromValidationDataset != null) {
|
|
14972
|
-
setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset));
|
|
17036
|
+
setValueByPath(parentObject, ['supervisedTuningSpec'], tuningValidationDatasetToVertex(fromValidationDataset, toObject));
|
|
14973
17037
|
}
|
|
14974
17038
|
const fromTunedModelDisplayName = getValueByPath(fromObject, [
|
|
14975
17039
|
'tunedModelDisplayName',
|
|
@@ -15101,6 +17165,14 @@ function tuningJobFromMldev(fromObject) {
|
|
|
15101
17165
|
if (fromPipelineJob != null) {
|
|
15102
17166
|
setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
|
|
15103
17167
|
}
|
|
17168
|
+
const fromSatisfiesPzi = getValueByPath(fromObject, ['satisfiesPzi']);
|
|
17169
|
+
if (fromSatisfiesPzi != null) {
|
|
17170
|
+
setValueByPath(toObject, ['satisfiesPzi'], fromSatisfiesPzi);
|
|
17171
|
+
}
|
|
17172
|
+
const fromSatisfiesPzs = getValueByPath(fromObject, ['satisfiesPzs']);
|
|
17173
|
+
if (fromSatisfiesPzs != null) {
|
|
17174
|
+
setValueByPath(toObject, ['satisfiesPzs'], fromSatisfiesPzs);
|
|
17175
|
+
}
|
|
15104
17176
|
const fromServiceAccount = getValueByPath(fromObject, [
|
|
15105
17177
|
'serviceAccount',
|
|
15106
17178
|
]);
|
|
@@ -15281,6 +17353,14 @@ function tuningJobFromVertex(fromObject) {
|
|
|
15281
17353
|
if (fromPipelineJob != null) {
|
|
15282
17354
|
setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
|
|
15283
17355
|
}
|
|
17356
|
+
const fromSatisfiesPzi = getValueByPath(fromObject, ['satisfiesPzi']);
|
|
17357
|
+
if (fromSatisfiesPzi != null) {
|
|
17358
|
+
setValueByPath(toObject, ['satisfiesPzi'], fromSatisfiesPzi);
|
|
17359
|
+
}
|
|
17360
|
+
const fromSatisfiesPzs = getValueByPath(fromObject, ['satisfiesPzs']);
|
|
17361
|
+
if (fromSatisfiesPzs != null) {
|
|
17362
|
+
setValueByPath(toObject, ['satisfiesPzs'], fromSatisfiesPzs);
|
|
17363
|
+
}
|
|
15284
17364
|
const fromServiceAccount = getValueByPath(fromObject, [
|
|
15285
17365
|
'serviceAccount',
|
|
15286
17366
|
]);
|
|
@@ -15647,6 +17727,7 @@ class GoogleGenAI {
|
|
|
15647
17727
|
this.models = new Models(this.apiClient);
|
|
15648
17728
|
this.live = new Live(this.apiClient, auth, new CrossWebSocketFactory());
|
|
15649
17729
|
this.chats = new Chats(this.models, this.apiClient);
|
|
17730
|
+
this.batches = new Batches(this.apiClient);
|
|
15650
17731
|
this.caches = new Caches(this.apiClient);
|
|
15651
17732
|
this.files = new Files(this.apiClient);
|
|
15652
17733
|
this.operations = new Operations(this.apiClient);
|
|
@@ -15656,6 +17737,7 @@ class GoogleGenAI {
|
|
|
15656
17737
|
}
|
|
15657
17738
|
|
|
15658
17739
|
exports.ApiError = ApiError;
|
|
17740
|
+
exports.Batches = Batches;
|
|
15659
17741
|
exports.Caches = Caches;
|
|
15660
17742
|
exports.Chat = Chat;
|
|
15661
17743
|
exports.Chats = Chats;
|
|
@@ -15677,6 +17759,8 @@ exports.GenerateImagesResponse = GenerateImagesResponse;
|
|
|
15677
17759
|
exports.GenerateVideosResponse = GenerateVideosResponse;
|
|
15678
17760
|
exports.GoogleGenAI = GoogleGenAI;
|
|
15679
17761
|
exports.HttpResponse = HttpResponse;
|
|
17762
|
+
exports.InlinedResponse = InlinedResponse;
|
|
17763
|
+
exports.ListBatchJobsResponse = ListBatchJobsResponse;
|
|
15680
17764
|
exports.ListCachedContentsResponse = ListCachedContentsResponse;
|
|
15681
17765
|
exports.ListFilesResponse = ListFilesResponse;
|
|
15682
17766
|
exports.ListModelsResponse = ListModelsResponse;
|