@google/genai 1.17.0 → 1.19.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 +131 -5
- package/dist/index.cjs +965 -293
- package/dist/index.mjs +964 -294
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +965 -293
- package/dist/node/index.mjs +964 -294
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +131 -5
- package/dist/web/index.mjs +964 -294
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +131 -5
- package/package.json +1 -1
package/dist/node/node.d.ts
CHANGED
|
@@ -437,6 +437,22 @@ export declare class Batches extends BaseModule {
|
|
|
437
437
|
* ```
|
|
438
438
|
*/
|
|
439
439
|
create: (params: types.CreateBatchJobParameters) => Promise<types.BatchJob>;
|
|
440
|
+
/**
|
|
441
|
+
* **Experimental** Creates an embedding batch job.
|
|
442
|
+
*
|
|
443
|
+
* @param params - The parameters for create embedding batch job request.
|
|
444
|
+
* @return The created batch job.
|
|
445
|
+
*
|
|
446
|
+
* @example
|
|
447
|
+
* ```ts
|
|
448
|
+
* const response = await ai.batches.createEmbeddings({
|
|
449
|
+
* model: 'text-embedding-004',
|
|
450
|
+
* src: {fileName: 'files/my_embedding_input'},
|
|
451
|
+
* });
|
|
452
|
+
* console.log(response);
|
|
453
|
+
* ```
|
|
454
|
+
*/
|
|
455
|
+
createEmbeddings: (params: types.CreateEmbeddingsBatchJobParameters) => Promise<types.BatchJob>;
|
|
440
456
|
/**
|
|
441
457
|
* Lists batch job configurations.
|
|
442
458
|
*
|
|
@@ -452,6 +468,11 @@ export declare class Batches extends BaseModule {
|
|
|
452
468
|
* ```
|
|
453
469
|
*/
|
|
454
470
|
list: (params?: types.ListBatchJobsParameters) => Promise<Pager<types.BatchJob>>;
|
|
471
|
+
private createInlinedGenerateContentRequest;
|
|
472
|
+
private createInlinedEmbedContentRequest;
|
|
473
|
+
private getGcsUri;
|
|
474
|
+
private getBigqueryUri;
|
|
475
|
+
private formatDestination;
|
|
455
476
|
/**
|
|
456
477
|
* Internal method to create batch job.
|
|
457
478
|
*
|
|
@@ -460,6 +481,14 @@ export declare class Batches extends BaseModule {
|
|
|
460
481
|
*
|
|
461
482
|
*/
|
|
462
483
|
private createInternal;
|
|
484
|
+
/**
|
|
485
|
+
* Internal method to create batch job.
|
|
486
|
+
*
|
|
487
|
+
* @param params - The parameters for create batch job request.
|
|
488
|
+
* @return The created batch job.
|
|
489
|
+
*
|
|
490
|
+
*/
|
|
491
|
+
private createEmbeddingsInternal;
|
|
463
492
|
/**
|
|
464
493
|
* Gets batch job configurations.
|
|
465
494
|
*
|
|
@@ -558,6 +587,11 @@ export declare interface BatchJobDestination {
|
|
|
558
587
|
the input requests.
|
|
559
588
|
*/
|
|
560
589
|
inlinedResponses?: InlinedResponse[];
|
|
590
|
+
/** The responses to the requests in the batch. Returned when the batch was
|
|
591
|
+
built using inlined requests. The responses will be in the same order as
|
|
592
|
+
the input requests.
|
|
593
|
+
*/
|
|
594
|
+
inlinedEmbedContentResponses?: InlinedEmbedContentResponse[];
|
|
561
595
|
}
|
|
562
596
|
|
|
563
597
|
export declare type BatchJobDestinationUnion = BatchJobDestination | string;
|
|
@@ -1351,6 +1385,35 @@ export declare interface CreateChatParameters {
|
|
|
1351
1385
|
history?: Content[];
|
|
1352
1386
|
}
|
|
1353
1387
|
|
|
1388
|
+
/** Config for optional parameters. */
|
|
1389
|
+
export declare interface CreateEmbeddingsBatchJobConfig {
|
|
1390
|
+
/** Used to override HTTP request options. */
|
|
1391
|
+
httpOptions?: HttpOptions;
|
|
1392
|
+
/** Abort signal which can be used to cancel the request.
|
|
1393
|
+
|
|
1394
|
+
NOTE: AbortSignal is a client-only operation. Using it to cancel an
|
|
1395
|
+
operation will not cancel the request in the service. You will still
|
|
1396
|
+
be charged usage for any applicable operations.
|
|
1397
|
+
*/
|
|
1398
|
+
abortSignal?: AbortSignal;
|
|
1399
|
+
/** The user-defined name of this BatchJob.
|
|
1400
|
+
*/
|
|
1401
|
+
displayName?: string;
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1404
|
+
/** Config for batches.create parameters. */
|
|
1405
|
+
export declare interface CreateEmbeddingsBatchJobParameters {
|
|
1406
|
+
/** The name of the model to produces the predictions via the BatchJob.
|
|
1407
|
+
*/
|
|
1408
|
+
model?: string;
|
|
1409
|
+
/** input data to run batch job".
|
|
1410
|
+
*/
|
|
1411
|
+
src: EmbeddingsBatchJobSource;
|
|
1412
|
+
/** Optional parameters for creating a BatchJob.
|
|
1413
|
+
*/
|
|
1414
|
+
config?: CreateEmbeddingsBatchJobConfig;
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1354
1417
|
/** Used to override the default configuration. */
|
|
1355
1418
|
export declare interface CreateFileConfig {
|
|
1356
1419
|
/** Used to override HTTP request options. */
|
|
@@ -1454,6 +1517,8 @@ export declare interface CreateTuningJobConfig {
|
|
|
1454
1517
|
batchSize?: number;
|
|
1455
1518
|
/** The learning rate hyperparameter for tuning. If not set, a default of 0.001 or 0.0002 will be calculated based on the number of training examples. */
|
|
1456
1519
|
learningRate?: number;
|
|
1520
|
+
/** Optional. The labels with user-defined metadata to organize TuningJob and generated resources such as Model and Endpoint. Label keys and values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. See https://goo.gl/xmQnxf for more information and examples of labels. */
|
|
1521
|
+
labels?: Record<string, string>;
|
|
1457
1522
|
}
|
|
1458
1523
|
|
|
1459
1524
|
/** Supervised fine-tuning job creation parameters - optional fields. */
|
|
@@ -1794,6 +1859,16 @@ export declare enum EditMode {
|
|
|
1794
1859
|
EDIT_MODE_PRODUCT_IMAGE = "EDIT_MODE_PRODUCT_IMAGE"
|
|
1795
1860
|
}
|
|
1796
1861
|
|
|
1862
|
+
/** Parameters for the embed_content method. */
|
|
1863
|
+
export declare interface EmbedContentBatch {
|
|
1864
|
+
/** The content to embed. Only the `parts.text` fields will be counted.
|
|
1865
|
+
*/
|
|
1866
|
+
contents?: ContentListUnion;
|
|
1867
|
+
/** Configuration that contains optional parameters.
|
|
1868
|
+
*/
|
|
1869
|
+
config?: EmbedContentConfig;
|
|
1870
|
+
}
|
|
1871
|
+
|
|
1797
1872
|
/** Optional parameters for the embed_content method. */
|
|
1798
1873
|
export declare interface EmbedContentConfig {
|
|
1799
1874
|
/** Used to override HTTP request options. */
|
|
@@ -1862,6 +1937,16 @@ export declare class EmbedContentResponse {
|
|
|
1862
1937
|
metadata?: EmbedContentMetadata;
|
|
1863
1938
|
}
|
|
1864
1939
|
|
|
1940
|
+
export declare interface EmbeddingsBatchJobSource {
|
|
1941
|
+
/** The Gemini Developer API's file resource name of the input data
|
|
1942
|
+
(e.g. "files/12345").
|
|
1943
|
+
*/
|
|
1944
|
+
fileName?: string;
|
|
1945
|
+
/** The Gemini Developer API's inlined input data to run batch job.
|
|
1946
|
+
*/
|
|
1947
|
+
inlinedRequests?: EmbedContentBatch;
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1865
1950
|
/** Represents a customer-managed encryption key spec that can be applied to a top-level resource. */
|
|
1866
1951
|
export declare interface EncryptionSpec {
|
|
1867
1952
|
/** Required. The Cloud KMS resource identifier of the customer managed encryption key used to protect a resource. Has the form: `projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key`. The key needs to be in the same region as where the compute resource is created. */
|
|
@@ -2866,6 +2951,8 @@ export declare interface GenerateVideosConfig {
|
|
|
2866
2951
|
be associated with a type. Veo 2 supports up to 3 asset images *or* 1
|
|
2867
2952
|
style image. */
|
|
2868
2953
|
referenceImages?: VideoGenerationReferenceImage[];
|
|
2954
|
+
/** The mask to use for generating videos. */
|
|
2955
|
+
mask?: VideoGenerationMask;
|
|
2869
2956
|
/** Compression quality of the generated videos. */
|
|
2870
2957
|
compressionQuality?: VideoCompressionQuality;
|
|
2871
2958
|
}
|
|
@@ -2882,13 +2969,13 @@ export declare class GenerateVideosOperation implements Operation<GenerateVideos
|
|
|
2882
2969
|
error?: Record<string, unknown>;
|
|
2883
2970
|
/** The generated videos. */
|
|
2884
2971
|
response?: GenerateVideosResponse;
|
|
2885
|
-
/** The full HTTP response. */
|
|
2886
|
-
sdkHttpResponse?: HttpResponse;
|
|
2887
2972
|
/**
|
|
2888
2973
|
* Instantiates an Operation of the same type as the one being called with the fields set from the API response.
|
|
2889
2974
|
* @internal
|
|
2890
2975
|
*/
|
|
2891
2976
|
_fromAPIResponse({ apiResponse, isVertexAI, }: OperationFromAPIResponseParameters): Operation<GenerateVideosResponse>;
|
|
2977
|
+
/** The full HTTP response. */
|
|
2978
|
+
sdkHttpResponse?: HttpResponse;
|
|
2892
2979
|
}
|
|
2893
2980
|
|
|
2894
2981
|
/** Class that represents the parameters for generating videos. */
|
|
@@ -3674,6 +3761,16 @@ export declare enum ImagePromptLanguage {
|
|
|
3674
3761
|
es = "es"
|
|
3675
3762
|
}
|
|
3676
3763
|
|
|
3764
|
+
/** Config for `inlined_embedding_responses` parameter. */
|
|
3765
|
+
export declare class InlinedEmbedContentResponse {
|
|
3766
|
+
/** The response to the request.
|
|
3767
|
+
*/
|
|
3768
|
+
response?: SingleEmbedContentResponse;
|
|
3769
|
+
/** The error encountered while processing the request.
|
|
3770
|
+
*/
|
|
3771
|
+
error?: JobError;
|
|
3772
|
+
}
|
|
3773
|
+
|
|
3677
3774
|
/** Config for inlined request. */
|
|
3678
3775
|
export declare interface InlinedRequest {
|
|
3679
3776
|
/** ID of the model to use. For a list of models, see `Google models
|
|
@@ -5528,12 +5625,14 @@ export declare interface Part {
|
|
|
5528
5625
|
/** An opaque signature for the thought so it can be reused in subsequent requests.
|
|
5529
5626
|
* @remarks Encoded as base64 string. */
|
|
5530
5627
|
thoughtSignature?: string;
|
|
5628
|
+
/** A predicted [FunctionCall] returned from the model that contains a string
|
|
5629
|
+
representing the [FunctionDeclaration.name] and a structured JSON object
|
|
5630
|
+
containing the parameters and their values. */
|
|
5631
|
+
functionCall?: FunctionCall;
|
|
5531
5632
|
/** Optional. Result of executing the [ExecutableCode]. */
|
|
5532
5633
|
codeExecutionResult?: CodeExecutionResult;
|
|
5533
5634
|
/** Optional. Code generated by the model that is meant to be executed. */
|
|
5534
5635
|
executableCode?: ExecutableCode;
|
|
5535
|
-
/** Optional. A predicted [FunctionCall] returned from the model that contains a string representing the [FunctionDeclaration.name] with the parameters and their values. */
|
|
5536
|
-
functionCall?: FunctionCall;
|
|
5537
5636
|
/** Optional. The result output of a [FunctionCall] that contains a string representing the [FunctionDeclaration.name] and a structured JSON object containing any output from the function call. It is used as context to the model. */
|
|
5538
5637
|
functionResponse?: FunctionResponse;
|
|
5539
5638
|
/** Optional. Text part (can be code). */
|
|
@@ -6291,6 +6390,16 @@ export declare interface SessionResumptionConfig {
|
|
|
6291
6390
|
*/
|
|
6292
6391
|
export declare function setDefaultBaseUrls(baseUrlParams: BaseUrlParameters): void;
|
|
6293
6392
|
|
|
6393
|
+
/** Config for `response` parameter. */
|
|
6394
|
+
export declare class SingleEmbedContentResponse {
|
|
6395
|
+
/** The response to the request.
|
|
6396
|
+
*/
|
|
6397
|
+
embedding?: ContentEmbedding;
|
|
6398
|
+
/** The error encountered while processing the request.
|
|
6399
|
+
*/
|
|
6400
|
+
tokenCount?: string;
|
|
6401
|
+
}
|
|
6402
|
+
|
|
6294
6403
|
/** Context window will be truncated by keeping only suffix of it.
|
|
6295
6404
|
|
|
6296
6405
|
Context window will always be cut at start of USER role turn. System
|
|
@@ -7025,9 +7134,9 @@ declare namespace types {
|
|
|
7025
7134
|
VideoMetadata,
|
|
7026
7135
|
Blob_2 as Blob,
|
|
7027
7136
|
FileData,
|
|
7137
|
+
FunctionCall,
|
|
7028
7138
|
CodeExecutionResult,
|
|
7029
7139
|
ExecutableCode,
|
|
7030
|
-
FunctionCall,
|
|
7031
7140
|
FunctionResponse,
|
|
7032
7141
|
Part,
|
|
7033
7142
|
Content,
|
|
@@ -7173,6 +7282,7 @@ declare namespace types {
|
|
|
7173
7282
|
Video,
|
|
7174
7283
|
GenerateVideosSource,
|
|
7175
7284
|
VideoGenerationReferenceImage,
|
|
7285
|
+
VideoGenerationMask,
|
|
7176
7286
|
GenerateVideosConfig,
|
|
7177
7287
|
GenerateVideosParameters,
|
|
7178
7288
|
GeneratedVideo,
|
|
@@ -7243,10 +7353,16 @@ declare namespace types {
|
|
|
7243
7353
|
BatchJobSource,
|
|
7244
7354
|
JobError,
|
|
7245
7355
|
InlinedResponse,
|
|
7356
|
+
SingleEmbedContentResponse,
|
|
7357
|
+
InlinedEmbedContentResponse,
|
|
7246
7358
|
BatchJobDestination,
|
|
7247
7359
|
CreateBatchJobConfig,
|
|
7248
7360
|
CreateBatchJobParameters,
|
|
7249
7361
|
BatchJob,
|
|
7362
|
+
EmbedContentBatch,
|
|
7363
|
+
EmbeddingsBatchJobSource,
|
|
7364
|
+
CreateEmbeddingsBatchJobConfig,
|
|
7365
|
+
CreateEmbeddingsBatchJobParameters,
|
|
7250
7366
|
GetBatchJobConfig,
|
|
7251
7367
|
GetBatchJobParameters,
|
|
7252
7368
|
CancelBatchJobConfig,
|
|
@@ -7641,6 +7757,16 @@ export declare enum VideoCompressionQuality {
|
|
|
7641
7757
|
LOSSLESS = "LOSSLESS"
|
|
7642
7758
|
}
|
|
7643
7759
|
|
|
7760
|
+
/** A mask for video generation. */
|
|
7761
|
+
export declare interface VideoGenerationMask {
|
|
7762
|
+
/** The image mask to use for generating videos. */
|
|
7763
|
+
image?: Image_2;
|
|
7764
|
+
/** Describes how the mask will be used. Inpainting masks must
|
|
7765
|
+
match the aspect ratio of the input video. Outpainting masks can be
|
|
7766
|
+
either 9:16 or 16:9. */
|
|
7767
|
+
maskMode?: string;
|
|
7768
|
+
}
|
|
7769
|
+
|
|
7644
7770
|
/** A reference image for video generation. */
|
|
7645
7771
|
export declare interface VideoGenerationReferenceImage {
|
|
7646
7772
|
/** The reference image. */
|