@google/genai 1.50.0 → 1.51.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 +12 -12
- package/dist/genai.d.ts +230 -358
- package/dist/index.cjs +164 -148
- package/dist/index.mjs +165 -149
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +192 -158
- package/dist/node/index.mjs +193 -159
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +230 -358
- package/dist/tokenizer/node.cjs +15 -1
- package/dist/tokenizer/node.d.ts +1 -1
- package/dist/tokenizer/node.mjs +15 -1
- package/dist/tokenizer/node.mjs.map +1 -1
- package/dist/vertex_internal/index.cjs +16 -2
- package/dist/vertex_internal/index.cjs.map +1 -1
- package/dist/vertex_internal/index.d.ts +75 -24
- package/dist/vertex_internal/index.js +16 -2
- package/dist/vertex_internal/index.js.map +1 -1
- package/dist/web/index.mjs +158 -147
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +230 -358
- package/package.json +6 -1
|
@@ -500,7 +500,7 @@ declare interface BatchJob {
|
|
|
500
500
|
createTime?: string;
|
|
501
501
|
/** Output only. Time when the Job for the first time entered the `JOB_STATE_RUNNING` state. */
|
|
502
502
|
startTime?: string;
|
|
503
|
-
/** The time when the BatchJob was completed. This field is for
|
|
503
|
+
/** The time when the BatchJob was completed. This field is for Gemini Enterprise Agent Platform only.
|
|
504
504
|
*/
|
|
505
505
|
endTime?: string;
|
|
506
506
|
/** The time when the BatchJob was last updated.
|
|
@@ -509,21 +509,24 @@ declare interface BatchJob {
|
|
|
509
509
|
/** The name of the model that produces the predictions via the BatchJob.
|
|
510
510
|
*/
|
|
511
511
|
model?: string;
|
|
512
|
-
/** Configuration for the input data. This field is for
|
|
512
|
+
/** Configuration for the input data. This field is for Gemini Enterprise Agent Platform only.
|
|
513
513
|
*/
|
|
514
514
|
src?: BatchJobSource;
|
|
515
515
|
/** Configuration for the output data.
|
|
516
516
|
*/
|
|
517
517
|
dest?: BatchJobDestination;
|
|
518
|
-
/** Statistics on completed and failed prediction instances. This field is for
|
|
518
|
+
/** Statistics on completed and failed prediction instances. This field is for Gemini Enterprise Agent Platform only.
|
|
519
519
|
*/
|
|
520
520
|
completionStats?: CompletionStats;
|
|
521
|
+
/** Information further describing the output of this job. Output only.
|
|
522
|
+
*/
|
|
523
|
+
outputInfo?: BatchJobOutputInfo;
|
|
521
524
|
}
|
|
522
525
|
|
|
523
526
|
/** Config for `des` parameter. */
|
|
524
527
|
declare interface BatchJobDestination {
|
|
525
528
|
/** Storage format of the output files. Must be one of:
|
|
526
|
-
'jsonl', 'bigquery'.
|
|
529
|
+
'jsonl', 'bigquery', 'vertex-dataset'.
|
|
527
530
|
*/
|
|
528
531
|
format?: string;
|
|
529
532
|
/** The Google Cloud Storage URI to the output file.
|
|
@@ -549,14 +552,27 @@ declare interface BatchJobDestination {
|
|
|
549
552
|
the input requests.
|
|
550
553
|
*/
|
|
551
554
|
inlinedEmbedContentResponses?: InlinedEmbedContentResponse[];
|
|
555
|
+
/** This field is experimental and may change in future versions. The Vertex AI dataset destination.
|
|
556
|
+
*/
|
|
557
|
+
vertexDataset?: VertexMultimodalDatasetDestination;
|
|
552
558
|
}
|
|
553
559
|
|
|
554
560
|
declare type BatchJobDestinationUnion = BatchJobDestination | string;
|
|
555
561
|
|
|
562
|
+
/** Represents the `output_info` field in batch jobs. */
|
|
563
|
+
declare interface BatchJobOutputInfo {
|
|
564
|
+
/** This field is experimental and may change in future versions. The Vertex AI dataset name containing the output data. */
|
|
565
|
+
vertexMultimodalDatasetName?: string;
|
|
566
|
+
/** The full path of the Cloud Storage directory created, into which the prediction output is written. */
|
|
567
|
+
gcsOutputDirectory?: string;
|
|
568
|
+
/** The name of the BigQuery table created, in `predictions_<timestamp>` format, into which the prediction output is written. */
|
|
569
|
+
bigqueryOutputTable?: string;
|
|
570
|
+
}
|
|
571
|
+
|
|
556
572
|
/** Config for `src` parameter. */
|
|
557
573
|
declare interface BatchJobSource {
|
|
558
574
|
/** Storage format of the input files. Must be one of:
|
|
559
|
-
'jsonl', 'bigquery'.
|
|
575
|
+
'jsonl', 'bigquery', 'vertex-dataset'.
|
|
560
576
|
*/
|
|
561
577
|
format?: string;
|
|
562
578
|
/** The Google Cloud Storage URIs to input files.
|
|
@@ -572,6 +588,9 @@ declare interface BatchJobSource {
|
|
|
572
588
|
/** The Gemini Developer API's inlined input data to run batch job.
|
|
573
589
|
*/
|
|
574
590
|
inlinedRequests?: InlinedRequest[];
|
|
591
|
+
/** This field is experimental and may change in future versions. The Vertex AI dataset resource name to use as input. Must be of type multimodal.
|
|
592
|
+
*/
|
|
593
|
+
vertexDatasetName?: string;
|
|
575
594
|
}
|
|
576
595
|
|
|
577
596
|
declare type BatchJobSourceUnion = BatchJobSource | InlinedRequest[] | string;
|
|
@@ -934,7 +953,7 @@ declare interface ContentEmbedding {
|
|
|
934
953
|
/** A list of floats representing an embedding.
|
|
935
954
|
*/
|
|
936
955
|
values?: number[];
|
|
937
|
-
/**
|
|
956
|
+
/** Gemini Enterprise Agent Platform only. Statistics of the input text associated with this
|
|
938
957
|
embedding.
|
|
939
958
|
*/
|
|
940
959
|
statistics?: ContentEmbeddingStatistics;
|
|
@@ -942,11 +961,11 @@ declare interface ContentEmbedding {
|
|
|
942
961
|
|
|
943
962
|
/** Statistics of the input text associated with the result of content embedding. */
|
|
944
963
|
declare interface ContentEmbeddingStatistics {
|
|
945
|
-
/**
|
|
964
|
+
/** Gemini Enterprise Agent Platform only. If the input text was truncated due to having
|
|
946
965
|
a length longer than the allowed maximum input.
|
|
947
966
|
*/
|
|
948
967
|
truncated?: boolean;
|
|
949
|
-
/**
|
|
968
|
+
/** Gemini Enterprise Agent Platform only. Number of tokens of the input text.
|
|
950
969
|
*/
|
|
951
970
|
tokenCount?: number;
|
|
952
971
|
}
|
|
@@ -1390,9 +1409,9 @@ declare interface CreateTuningJobConfig {
|
|
|
1390
1409
|
adapterSize?: AdapterSize;
|
|
1391
1410
|
/** Tuning mode for tuning. */
|
|
1392
1411
|
tuningMode?: TuningMode;
|
|
1393
|
-
/** Custom base model for tuning. This is only supported for OSS models in
|
|
1412
|
+
/** Custom base model for tuning. This is only supported for OSS models in Gemini Enterprise Agent Platform. */
|
|
1394
1413
|
customBaseModel?: string;
|
|
1395
|
-
/** The batch size hyperparameter for tuning. This is only supported for OSS models in
|
|
1414
|
+
/** The batch size hyperparameter for tuning. This is only supported for OSS models in Gemini Enterprise Agent Platform. */
|
|
1396
1415
|
batchSize?: number;
|
|
1397
1416
|
/** The learning rate for tuning. OSS models only. Mutually exclusive with learning_rate_multiplier. */
|
|
1398
1417
|
learningRate?: number;
|
|
@@ -1708,7 +1727,8 @@ declare interface DistillationHyperParameters {
|
|
|
1708
1727
|
/** Optional. Multiplier for adjusting the default learning rate. */
|
|
1709
1728
|
learningRateMultiplier?: number;
|
|
1710
1729
|
/** The batch size hyperparameter for tuning.
|
|
1711
|
-
This is only supported for OSS models in
|
|
1730
|
+
This is only supported for OSS models in Gemini Enterprise Agent Platform.
|
|
1731
|
+
*/
|
|
1712
1732
|
batchSize?: number;
|
|
1713
1733
|
/** The learning rate for tuning. OSS models only. */
|
|
1714
1734
|
learningRate?: number;
|
|
@@ -1963,27 +1983,27 @@ declare interface EmbedContentConfig {
|
|
|
1963
1983
|
using the earlier model (`models/embedding-001`).
|
|
1964
1984
|
*/
|
|
1965
1985
|
outputDimensionality?: number;
|
|
1966
|
-
/**
|
|
1986
|
+
/** Gemini Enterprise Agent Platform only. The MIME type of the input.
|
|
1967
1987
|
*/
|
|
1968
1988
|
mimeType?: string;
|
|
1969
|
-
/**
|
|
1989
|
+
/** Gemini Enterprise Agent Platform only. Whether to silently truncate inputs longer than
|
|
1970
1990
|
the max sequence length. If this option is set to false, oversized inputs
|
|
1971
1991
|
will lead to an INVALID_ARGUMENT error, similar to other text APIs.
|
|
1972
1992
|
*/
|
|
1973
1993
|
autoTruncate?: boolean;
|
|
1974
|
-
/**
|
|
1994
|
+
/** Gemini Enterprise Agent Platform only. Whether to enable OCR for document content.
|
|
1975
1995
|
Only applicable to Gemini Embedding 2 models.
|
|
1976
1996
|
*/
|
|
1977
1997
|
documentOcr?: boolean;
|
|
1978
|
-
/**
|
|
1998
|
+
/** Gemini Enterprise Agent Platform only. Whether to extract audio from video content.
|
|
1979
1999
|
Only applicable to Gemini Embedding 2 models.
|
|
1980
2000
|
*/
|
|
1981
2001
|
audioTrackExtraction?: boolean;
|
|
1982
2002
|
}
|
|
1983
2003
|
|
|
1984
|
-
/** Request-level metadata for the
|
|
2004
|
+
/** Request-level metadata for the Gemini Enterprise Agent Platform Embed Content API. */
|
|
1985
2005
|
declare interface EmbedContentMetadata {
|
|
1986
|
-
/**
|
|
2006
|
+
/** Gemini Enterprise Agent Platform only. The total number of billable characters included
|
|
1987
2007
|
in the request.
|
|
1988
2008
|
*/
|
|
1989
2009
|
billableCharacterCount?: number;
|
|
@@ -2013,7 +2033,7 @@ declare interface EmbedContentParametersPrivate {
|
|
|
2013
2033
|
/** The single content to embed. Only the `parts.text` fields will be counted.
|
|
2014
2034
|
*/
|
|
2015
2035
|
content?: ContentUnion;
|
|
2016
|
-
/** The
|
|
2036
|
+
/** The Gemini Enterprise Agent Platform embedding API to use.
|
|
2017
2037
|
*/
|
|
2018
2038
|
embeddingApiType?: EmbeddingApiType;
|
|
2019
2039
|
/** Configuration that contains optional parameters.
|
|
@@ -2029,12 +2049,12 @@ declare class EmbedContentResponse {
|
|
|
2029
2049
|
the batch request.
|
|
2030
2050
|
*/
|
|
2031
2051
|
embeddings?: ContentEmbedding[];
|
|
2032
|
-
/**
|
|
2052
|
+
/** Gemini Enterprise Agent Platform only. Metadata about the request.
|
|
2033
2053
|
*/
|
|
2034
2054
|
metadata?: EmbedContentMetadata;
|
|
2035
2055
|
}
|
|
2036
2056
|
|
|
2037
|
-
/** Enum representing the
|
|
2057
|
+
/** Enum representing the Gemini Enterprise Agent Platform embedding API to use. */
|
|
2038
2058
|
declare enum EmbeddingApiType {
|
|
2039
2059
|
/**
|
|
2040
2060
|
* predict API endpoint (default)
|
|
@@ -2757,7 +2777,7 @@ declare interface GenerateContentConfig {
|
|
|
2757
2777
|
*/
|
|
2758
2778
|
imageConfig?: ImageConfig;
|
|
2759
2779
|
/** Enables enhanced civic answers. It may not be available for all
|
|
2760
|
-
models. This field is not supported in
|
|
2780
|
+
models. This field is not supported in Gemini Enterprise Agent Platform.
|
|
2761
2781
|
*/
|
|
2762
2782
|
enableEnhancedCivicAnswers?: boolean;
|
|
2763
2783
|
/** Settings for prompt and response sanitization using the Model Armor
|
|
@@ -3138,6 +3158,8 @@ declare interface GenerateVideosConfig {
|
|
|
3138
3158
|
/** Webhook configuration for receiving notifications when the
|
|
3139
3159
|
video generation operation completes. */
|
|
3140
3160
|
webhookConfig?: WebhookConfig;
|
|
3161
|
+
/** Resize mode of the image input for video generation. */
|
|
3162
|
+
resizeMode?: ImageResizeMode;
|
|
3141
3163
|
}
|
|
3142
3164
|
|
|
3143
3165
|
/** A video generation operation. */
|
|
@@ -3636,6 +3658,8 @@ declare interface GroundingChunkRetrievedContext {
|
|
|
3636
3658
|
customMetadata?: GroundingChunkCustomMetadata[];
|
|
3637
3659
|
/** Optional. Name of the `FileSearchStore` containing the document. Example: `fileSearchStores/123`. This field is not supported in Vertex AI. */
|
|
3638
3660
|
fileSearchStore?: string;
|
|
3661
|
+
/** Optional. Page number of the retrieved context. This field is not supported in Vertex AI. */
|
|
3662
|
+
pageNumber?: number;
|
|
3639
3663
|
}
|
|
3640
3664
|
|
|
3641
3665
|
/** A list of string values. This data type is not supported in Vertex AI. */
|
|
@@ -3885,7 +3909,7 @@ declare interface HttpOptions {
|
|
|
3885
3909
|
timeout?: number;
|
|
3886
3910
|
/** Extra parameters to add to the request body.
|
|
3887
3911
|
The structure must match the backend API's request structure.
|
|
3888
|
-
-
|
|
3912
|
+
- Gemini Enterprise Agent Platform backend API docs: https://cloud.google.com/vertex-ai/docs/reference/rest
|
|
3889
3913
|
- GeminiAPI backend API docs: https://ai.google.dev/api/rest */
|
|
3890
3914
|
extraBody?: Record<string, unknown>;
|
|
3891
3915
|
/** HTTP retry options for the request. */
|
|
@@ -4041,6 +4065,20 @@ declare enum ImagePromptLanguage {
|
|
|
4041
4065
|
es = "es"
|
|
4042
4066
|
}
|
|
4043
4067
|
|
|
4068
|
+
/** Resize mode for the image input for video generation. */
|
|
4069
|
+
declare enum ImageResizeMode {
|
|
4070
|
+
/**
|
|
4071
|
+
* Crop the image to fit the correct aspect ratio (so we lose parts
|
|
4072
|
+
of the image in the process).
|
|
4073
|
+
*/
|
|
4074
|
+
CROP = "CROP",
|
|
4075
|
+
/**
|
|
4076
|
+
* Pad the image to fit the correct aspect ratio (so we don't lose
|
|
4077
|
+
any parts of the image in the process).
|
|
4078
|
+
*/
|
|
4079
|
+
PAD = "PAD"
|
|
4080
|
+
}
|
|
4081
|
+
|
|
4044
4082
|
/** Image search for grounding and related configurations. */
|
|
4045
4083
|
declare interface ImageSearch {
|
|
4046
4084
|
}
|
|
@@ -6901,7 +6939,7 @@ declare interface TunedModelInfo {
|
|
|
6901
6939
|
declare interface TuningDataset {
|
|
6902
6940
|
/** GCS URI of the file containing training dataset in JSONL format. */
|
|
6903
6941
|
gcsUri?: string;
|
|
6904
|
-
/** The resource name of the Vertex Multimodal Dataset that is used as training dataset. Example: 'projects/my-project-id-or-number/locations/my-location/datasets/my-dataset-id'. */
|
|
6942
|
+
/** The resource name of the Gemini Enterprise Agent Platform (previously known as Vertex AI) Multimodal Dataset that is used as training dataset. Example: 'projects/my-project-id-or-number/locations/my-location/datasets/my-dataset-id'. */
|
|
6905
6943
|
vertexDatasetResource?: string;
|
|
6906
6944
|
/** Inline examples with simple input/output text. */
|
|
6907
6945
|
examples?: TuningExample[];
|
|
@@ -7096,7 +7134,7 @@ declare enum TuningTask {
|
|
|
7096
7134
|
declare interface TuningValidationDataset {
|
|
7097
7135
|
/** GCS URI of the file containing validation dataset in JSONL format. */
|
|
7098
7136
|
gcsUri?: string;
|
|
7099
|
-
/** The resource name of the Vertex Multimodal Dataset that is used as validation dataset. Example: 'projects/my-project-id-or-number/locations/my-location/datasets/my-dataset-id'. */
|
|
7137
|
+
/** The resource name of the Gemini Enterprise Agent Platform (previously known as Vertex AI) Multimodal Dataset that is used as validation dataset. Example: 'projects/my-project-id-or-number/locations/my-location/datasets/my-dataset-id'. */
|
|
7100
7138
|
vertexDatasetResource?: string;
|
|
7101
7139
|
}
|
|
7102
7140
|
|
|
@@ -7336,6 +7374,7 @@ declare namespace types {
|
|
|
7336
7374
|
VideoGenerationReferenceType,
|
|
7337
7375
|
VideoGenerationMaskMode,
|
|
7338
7376
|
VideoCompressionQuality,
|
|
7377
|
+
ImageResizeMode,
|
|
7339
7378
|
TuningMethod,
|
|
7340
7379
|
FileState,
|
|
7341
7380
|
FileSource,
|
|
@@ -7653,6 +7692,7 @@ declare namespace types {
|
|
|
7653
7692
|
RegisterFilesResponse,
|
|
7654
7693
|
InlinedRequest,
|
|
7655
7694
|
BatchJobSource,
|
|
7695
|
+
VertexMultimodalDatasetDestination,
|
|
7656
7696
|
JobError,
|
|
7657
7697
|
InlinedResponse,
|
|
7658
7698
|
SingleEmbedContentResponse,
|
|
@@ -7660,6 +7700,7 @@ declare namespace types {
|
|
|
7660
7700
|
BatchJobDestination,
|
|
7661
7701
|
CreateBatchJobConfig,
|
|
7662
7702
|
CreateBatchJobParameters,
|
|
7703
|
+
BatchJobOutputInfo,
|
|
7663
7704
|
CompletionStats,
|
|
7664
7705
|
BatchJob,
|
|
7665
7706
|
EmbedContentBatch,
|
|
@@ -8153,6 +8194,16 @@ declare interface VertexAISearchDataStoreSpec {
|
|
|
8153
8194
|
filter?: string;
|
|
8154
8195
|
}
|
|
8155
8196
|
|
|
8197
|
+
/** This class is experimental and may change in future versions.
|
|
8198
|
+
|
|
8199
|
+
The specification for an output Vertex AI multimodal dataset. */
|
|
8200
|
+
declare interface VertexMultimodalDatasetDestination {
|
|
8201
|
+
/** The BigQuery destination for the multimodal dataset. */
|
|
8202
|
+
bigqueryDestination?: string;
|
|
8203
|
+
/** The display name of the multimodal dataset. */
|
|
8204
|
+
displayName?: string;
|
|
8205
|
+
}
|
|
8206
|
+
|
|
8156
8207
|
/** Retrieve from Vertex RAG Store for grounding. This data type is not supported in Gemini API. */
|
|
8157
8208
|
declare interface VertexRagStore {
|
|
8158
8209
|
/** Optional. Deprecated. Please use rag_resources instead. */
|
|
@@ -1398,7 +1398,7 @@ var FeatureSelectionPreference;
|
|
|
1398
1398
|
FeatureSelectionPreference["BALANCED"] = "BALANCED";
|
|
1399
1399
|
FeatureSelectionPreference["PRIORITIZE_COST"] = "PRIORITIZE_COST";
|
|
1400
1400
|
})(FeatureSelectionPreference || (FeatureSelectionPreference = {}));
|
|
1401
|
-
/** Enum representing the
|
|
1401
|
+
/** Enum representing the Gemini Enterprise Agent Platform embedding API to use. */
|
|
1402
1402
|
var EmbeddingApiType;
|
|
1403
1403
|
(function (EmbeddingApiType) {
|
|
1404
1404
|
/**
|
|
@@ -1556,6 +1556,20 @@ var VideoCompressionQuality;
|
|
|
1556
1556
|
*/
|
|
1557
1557
|
VideoCompressionQuality["LOSSLESS"] = "LOSSLESS";
|
|
1558
1558
|
})(VideoCompressionQuality || (VideoCompressionQuality = {}));
|
|
1559
|
+
/** Resize mode for the image input for video generation. */
|
|
1560
|
+
var ImageResizeMode;
|
|
1561
|
+
(function (ImageResizeMode) {
|
|
1562
|
+
/**
|
|
1563
|
+
* Crop the image to fit the correct aspect ratio (so we lose parts
|
|
1564
|
+
of the image in the process).
|
|
1565
|
+
*/
|
|
1566
|
+
ImageResizeMode["CROP"] = "CROP";
|
|
1567
|
+
/**
|
|
1568
|
+
* Pad the image to fit the correct aspect ratio (so we don't lose
|
|
1569
|
+
any parts of the image in the process).
|
|
1570
|
+
*/
|
|
1571
|
+
ImageResizeMode["PAD"] = "PAD";
|
|
1572
|
+
})(ImageResizeMode || (ImageResizeMode = {}));
|
|
1559
1573
|
/** Enum representing the tuning method. */
|
|
1560
1574
|
var TuningMethod;
|
|
1561
1575
|
(function (TuningMethod) {
|
|
@@ -1976,7 +1990,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
1976
1990
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
1977
1991
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
1978
1992
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
1979
|
-
const SDK_VERSION = '1.
|
|
1993
|
+
const SDK_VERSION = '1.51.0'; // x-release-please-version
|
|
1980
1994
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
1981
1995
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
1982
1996
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|