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