@google/genai 1.25.0 → 1.26.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/dist/genai.d.ts +61 -39
- package/dist/index.cjs +57 -77
- package/dist/index.mjs +57 -77
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +59 -79
- package/dist/node/index.mjs +59 -79
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +61 -39
- package/dist/web/index.mjs +57 -77
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +61 -39
- package/package.json +8 -3
package/dist/index.mjs
CHANGED
|
@@ -502,6 +502,26 @@ var Language;
|
|
|
502
502
|
*/
|
|
503
503
|
Language["PYTHON"] = "PYTHON";
|
|
504
504
|
})(Language || (Language = {}));
|
|
505
|
+
/** Specifies how the response should be scheduled in the conversation. */
|
|
506
|
+
var FunctionResponseScheduling;
|
|
507
|
+
(function (FunctionResponseScheduling) {
|
|
508
|
+
/**
|
|
509
|
+
* This value is unused.
|
|
510
|
+
*/
|
|
511
|
+
FunctionResponseScheduling["SCHEDULING_UNSPECIFIED"] = "SCHEDULING_UNSPECIFIED";
|
|
512
|
+
/**
|
|
513
|
+
* Only add the result to the conversation context, do not interrupt or trigger generation.
|
|
514
|
+
*/
|
|
515
|
+
FunctionResponseScheduling["SILENT"] = "SILENT";
|
|
516
|
+
/**
|
|
517
|
+
* Add the result to the conversation context, and prompt to generate output without interrupting ongoing generation.
|
|
518
|
+
*/
|
|
519
|
+
FunctionResponseScheduling["WHEN_IDLE"] = "WHEN_IDLE";
|
|
520
|
+
/**
|
|
521
|
+
* Add the result to the conversation context, interrupt ongoing generation and prompt to generate output.
|
|
522
|
+
*/
|
|
523
|
+
FunctionResponseScheduling["INTERRUPT"] = "INTERRUPT";
|
|
524
|
+
})(FunctionResponseScheduling || (FunctionResponseScheduling = {}));
|
|
505
525
|
/** Optional. The type of the data. */
|
|
506
526
|
var Type;
|
|
507
527
|
(function (Type) {
|
|
@@ -545,22 +565,22 @@ var HarmCategory;
|
|
|
545
565
|
* The harm category is unspecified.
|
|
546
566
|
*/
|
|
547
567
|
HarmCategory["HARM_CATEGORY_UNSPECIFIED"] = "HARM_CATEGORY_UNSPECIFIED";
|
|
548
|
-
/**
|
|
549
|
-
* The harm category is hate speech.
|
|
550
|
-
*/
|
|
551
|
-
HarmCategory["HARM_CATEGORY_HATE_SPEECH"] = "HARM_CATEGORY_HATE_SPEECH";
|
|
552
|
-
/**
|
|
553
|
-
* The harm category is dangerous content.
|
|
554
|
-
*/
|
|
555
|
-
HarmCategory["HARM_CATEGORY_DANGEROUS_CONTENT"] = "HARM_CATEGORY_DANGEROUS_CONTENT";
|
|
556
568
|
/**
|
|
557
569
|
* The harm category is harassment.
|
|
558
570
|
*/
|
|
559
571
|
HarmCategory["HARM_CATEGORY_HARASSMENT"] = "HARM_CATEGORY_HARASSMENT";
|
|
572
|
+
/**
|
|
573
|
+
* The harm category is hate speech.
|
|
574
|
+
*/
|
|
575
|
+
HarmCategory["HARM_CATEGORY_HATE_SPEECH"] = "HARM_CATEGORY_HATE_SPEECH";
|
|
560
576
|
/**
|
|
561
577
|
* The harm category is sexually explicit content.
|
|
562
578
|
*/
|
|
563
579
|
HarmCategory["HARM_CATEGORY_SEXUALLY_EXPLICIT"] = "HARM_CATEGORY_SEXUALLY_EXPLICIT";
|
|
580
|
+
/**
|
|
581
|
+
* The harm category is dangerous content.
|
|
582
|
+
*/
|
|
583
|
+
HarmCategory["HARM_CATEGORY_DANGEROUS_CONTENT"] = "HARM_CATEGORY_DANGEROUS_CONTENT";
|
|
564
584
|
/**
|
|
565
585
|
* Deprecated: Election filter is not longer supported. The harm category is civic integrity.
|
|
566
586
|
*/
|
|
@@ -581,6 +601,10 @@ var HarmCategory;
|
|
|
581
601
|
* The harm category is image sexually explicit content.
|
|
582
602
|
*/
|
|
583
603
|
HarmCategory["HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT"] = "HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT";
|
|
604
|
+
/**
|
|
605
|
+
* The harm category is for jailbreak prompts.
|
|
606
|
+
*/
|
|
607
|
+
HarmCategory["HARM_CATEGORY_JAILBREAK"] = "HARM_CATEGORY_JAILBREAK";
|
|
584
608
|
})(HarmCategory || (HarmCategory = {}));
|
|
585
609
|
/** Optional. Specify if the threshold is used for probability or severity score. If not specified, the threshold is used for probability score. */
|
|
586
610
|
var HarmBlockMethod;
|
|
@@ -821,33 +845,41 @@ var HarmSeverity;
|
|
|
821
845
|
*/
|
|
822
846
|
HarmSeverity["HARM_SEVERITY_HIGH"] = "HARM_SEVERITY_HIGH";
|
|
823
847
|
})(HarmSeverity || (HarmSeverity = {}));
|
|
824
|
-
/** Output only.
|
|
848
|
+
/** Output only. The reason why the prompt was blocked. */
|
|
825
849
|
var BlockedReason;
|
|
826
850
|
(function (BlockedReason) {
|
|
827
851
|
/**
|
|
828
|
-
*
|
|
852
|
+
* The blocked reason is unspecified.
|
|
829
853
|
*/
|
|
830
854
|
BlockedReason["BLOCKED_REASON_UNSPECIFIED"] = "BLOCKED_REASON_UNSPECIFIED";
|
|
831
855
|
/**
|
|
832
|
-
*
|
|
856
|
+
* The prompt was blocked for safety reasons.
|
|
833
857
|
*/
|
|
834
858
|
BlockedReason["SAFETY"] = "SAFETY";
|
|
835
859
|
/**
|
|
836
|
-
*
|
|
860
|
+
* The prompt was blocked for other reasons. For example, it may be due to the prompt's language, or because it contains other harmful content.
|
|
837
861
|
*/
|
|
838
862
|
BlockedReason["OTHER"] = "OTHER";
|
|
839
863
|
/**
|
|
840
|
-
*
|
|
864
|
+
* The prompt was blocked because it contains a term from the terminology blocklist.
|
|
841
865
|
*/
|
|
842
866
|
BlockedReason["BLOCKLIST"] = "BLOCKLIST";
|
|
843
867
|
/**
|
|
844
|
-
*
|
|
868
|
+
* The prompt was blocked because it contains prohibited content.
|
|
845
869
|
*/
|
|
846
870
|
BlockedReason["PROHIBITED_CONTENT"] = "PROHIBITED_CONTENT";
|
|
847
871
|
/**
|
|
848
|
-
*
|
|
872
|
+
* The prompt was blocked because it contains content that is unsafe for image generation.
|
|
849
873
|
*/
|
|
850
874
|
BlockedReason["IMAGE_SAFETY"] = "IMAGE_SAFETY";
|
|
875
|
+
/**
|
|
876
|
+
* The prompt was blocked by Model Armor.
|
|
877
|
+
*/
|
|
878
|
+
BlockedReason["MODEL_ARMOR"] = "MODEL_ARMOR";
|
|
879
|
+
/**
|
|
880
|
+
* The prompt was blocked as a jailbreak attempt.
|
|
881
|
+
*/
|
|
882
|
+
BlockedReason["JAILBREAK"] = "JAILBREAK";
|
|
851
883
|
})(BlockedReason || (BlockedReason = {}));
|
|
852
884
|
/** Output only. Traffic type. This shows whether a request consumes Pay-As-You-Go or Provisioned Throughput quota. */
|
|
853
885
|
var TrafficType;
|
|
@@ -1382,26 +1414,6 @@ var TurnCoverage;
|
|
|
1382
1414
|
*/
|
|
1383
1415
|
TurnCoverage["TURN_INCLUDES_ALL_INPUT"] = "TURN_INCLUDES_ALL_INPUT";
|
|
1384
1416
|
})(TurnCoverage || (TurnCoverage = {}));
|
|
1385
|
-
/** Specifies how the response should be scheduled in the conversation. */
|
|
1386
|
-
var FunctionResponseScheduling;
|
|
1387
|
-
(function (FunctionResponseScheduling) {
|
|
1388
|
-
/**
|
|
1389
|
-
* This value is unused.
|
|
1390
|
-
*/
|
|
1391
|
-
FunctionResponseScheduling["SCHEDULING_UNSPECIFIED"] = "SCHEDULING_UNSPECIFIED";
|
|
1392
|
-
/**
|
|
1393
|
-
* Only add the result to the conversation context, do not interrupt or trigger generation.
|
|
1394
|
-
*/
|
|
1395
|
-
FunctionResponseScheduling["SILENT"] = "SILENT";
|
|
1396
|
-
/**
|
|
1397
|
-
* Add the result to the conversation context, and prompt to generate output without interrupting ongoing generation.
|
|
1398
|
-
*/
|
|
1399
|
-
FunctionResponseScheduling["WHEN_IDLE"] = "WHEN_IDLE";
|
|
1400
|
-
/**
|
|
1401
|
-
* Add the result to the conversation context, interrupt ongoing generation and prompt to generate output.
|
|
1402
|
-
*/
|
|
1403
|
-
FunctionResponseScheduling["INTERRUPT"] = "INTERRUPT";
|
|
1404
|
-
})(FunctionResponseScheduling || (FunctionResponseScheduling = {}));
|
|
1405
1417
|
/** Scale of the generated music. */
|
|
1406
1418
|
var Scale;
|
|
1407
1419
|
(function (Scale) {
|
|
@@ -1699,7 +1711,7 @@ class HttpResponse {
|
|
|
1699
1711
|
return this.responseInternal.json();
|
|
1700
1712
|
}
|
|
1701
1713
|
}
|
|
1702
|
-
/** Content filter results for a prompt sent in the request. */
|
|
1714
|
+
/** Content filter results for a prompt sent in the request. Note: This is sent only in the first stream chunk and only if no candidates were generated due to content violations. */
|
|
1703
1715
|
class GenerateContentResponsePromptFeedback {
|
|
1704
1716
|
}
|
|
1705
1717
|
/** Usage metadata about response(s). */
|
|
@@ -6179,7 +6191,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
6179
6191
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
6180
6192
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
6181
6193
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
6182
|
-
const SDK_VERSION = '1.
|
|
6194
|
+
const SDK_VERSION = '1.26.0'; // x-release-please-version
|
|
6183
6195
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
6184
6196
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
6185
6197
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -7451,6 +7463,10 @@ function generationConfigToVertex$1(fromObject) {
|
|
|
7451
7463
|
if (fromTopP != null) {
|
|
7452
7464
|
setValueByPath(toObject, ['topP'], fromTopP);
|
|
7453
7465
|
}
|
|
7466
|
+
if (getValueByPath(fromObject, ['enableEnhancedCivicAnswers']) !==
|
|
7467
|
+
undefined) {
|
|
7468
|
+
throw new Error('enableEnhancedCivicAnswers parameter is not supported in Vertex AI.');
|
|
7469
|
+
}
|
|
7454
7470
|
return toObject;
|
|
7455
7471
|
}
|
|
7456
7472
|
function googleMapsToMldev$2(fromObject) {
|
|
@@ -10110,6 +10126,10 @@ function generationConfigToVertex(fromObject) {
|
|
|
10110
10126
|
if (fromTopP != null) {
|
|
10111
10127
|
setValueByPath(toObject, ['topP'], fromTopP);
|
|
10112
10128
|
}
|
|
10129
|
+
if (getValueByPath(fromObject, ['enableEnhancedCivicAnswers']) !==
|
|
10130
|
+
undefined) {
|
|
10131
|
+
throw new Error('enableEnhancedCivicAnswers parameter is not supported in Vertex AI.');
|
|
10132
|
+
}
|
|
10113
10133
|
return toObject;
|
|
10114
10134
|
}
|
|
10115
10135
|
function getModelParametersToMldev(apiClient, fromObject) {
|
|
@@ -14798,46 +14818,6 @@ function tuningJobFromMldev(fromObject) {
|
|
|
14798
14818
|
if (fromTunedModel != null) {
|
|
14799
14819
|
setValueByPath(toObject, ['tunedModel'], tunedModelFromMldev(fromTunedModel));
|
|
14800
14820
|
}
|
|
14801
|
-
const fromCustomBaseModel = getValueByPath(fromObject, [
|
|
14802
|
-
'customBaseModel',
|
|
14803
|
-
]);
|
|
14804
|
-
if (fromCustomBaseModel != null) {
|
|
14805
|
-
setValueByPath(toObject, ['customBaseModel'], fromCustomBaseModel);
|
|
14806
|
-
}
|
|
14807
|
-
const fromExperiment = getValueByPath(fromObject, ['experiment']);
|
|
14808
|
-
if (fromExperiment != null) {
|
|
14809
|
-
setValueByPath(toObject, ['experiment'], fromExperiment);
|
|
14810
|
-
}
|
|
14811
|
-
const fromLabels = getValueByPath(fromObject, ['labels']);
|
|
14812
|
-
if (fromLabels != null) {
|
|
14813
|
-
setValueByPath(toObject, ['labels'], fromLabels);
|
|
14814
|
-
}
|
|
14815
|
-
const fromOutputUri = getValueByPath(fromObject, ['outputUri']);
|
|
14816
|
-
if (fromOutputUri != null) {
|
|
14817
|
-
setValueByPath(toObject, ['outputUri'], fromOutputUri);
|
|
14818
|
-
}
|
|
14819
|
-
const fromPipelineJob = getValueByPath(fromObject, ['pipelineJob']);
|
|
14820
|
-
if (fromPipelineJob != null) {
|
|
14821
|
-
setValueByPath(toObject, ['pipelineJob'], fromPipelineJob);
|
|
14822
|
-
}
|
|
14823
|
-
const fromServiceAccount = getValueByPath(fromObject, [
|
|
14824
|
-
'serviceAccount',
|
|
14825
|
-
]);
|
|
14826
|
-
if (fromServiceAccount != null) {
|
|
14827
|
-
setValueByPath(toObject, ['serviceAccount'], fromServiceAccount);
|
|
14828
|
-
}
|
|
14829
|
-
const fromTunedModelDisplayName = getValueByPath(fromObject, [
|
|
14830
|
-
'tunedModelDisplayName',
|
|
14831
|
-
]);
|
|
14832
|
-
if (fromTunedModelDisplayName != null) {
|
|
14833
|
-
setValueByPath(toObject, ['tunedModelDisplayName'], fromTunedModelDisplayName);
|
|
14834
|
-
}
|
|
14835
|
-
const fromVeoTuningSpec = getValueByPath(fromObject, [
|
|
14836
|
-
'veoTuningSpec',
|
|
14837
|
-
]);
|
|
14838
|
-
if (fromVeoTuningSpec != null) {
|
|
14839
|
-
setValueByPath(toObject, ['veoTuningSpec'], fromVeoTuningSpec);
|
|
14840
|
-
}
|
|
14841
14821
|
return toObject;
|
|
14842
14822
|
}
|
|
14843
14823
|
function tuningJobFromVertex(fromObject) {
|