@google/genai 1.5.1 → 1.7.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 +409 -8
- package/dist/index.cjs +3099 -1107
- package/dist/index.mjs +3096 -1108
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +3099 -1107
- package/dist/node/index.mjs +3096 -1108
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +409 -8
- package/dist/web/index.mjs +3096 -1108
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +409 -8
- package/package.json +4 -4
package/dist/web/web.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// @ts-ignore
|
|
1
2
|
import type { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
2
3
|
import { GoogleAuthOptions } from 'google-auth-library';
|
|
3
4
|
|
|
@@ -191,6 +192,30 @@ declare interface ApiClientInitOptions {
|
|
|
191
192
|
userAgentExtra?: string;
|
|
192
193
|
}
|
|
193
194
|
|
|
195
|
+
/**
|
|
196
|
+
* API errors raised by the GenAI API.
|
|
197
|
+
*/
|
|
198
|
+
export declare class ApiError extends Error {
|
|
199
|
+
/** HTTP status code */
|
|
200
|
+
status: number;
|
|
201
|
+
constructor(options: ApiErrorInfo);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* @license
|
|
206
|
+
* Copyright 2025 Google LLC
|
|
207
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
208
|
+
*/
|
|
209
|
+
/**
|
|
210
|
+
* Details for errors from calling the API.
|
|
211
|
+
*/
|
|
212
|
+
export declare interface ApiErrorInfo {
|
|
213
|
+
/** The error message. */
|
|
214
|
+
message: string;
|
|
215
|
+
/** The HTTP status code. */
|
|
216
|
+
status: number;
|
|
217
|
+
}
|
|
218
|
+
|
|
194
219
|
/** Config for authentication with API key. */
|
|
195
220
|
export declare interface ApiKeyConfig {
|
|
196
221
|
/** The API key to be used in the request directly. */
|
|
@@ -359,6 +384,162 @@ export declare interface BaseUrlParameters {
|
|
|
359
384
|
vertexUrl?: string;
|
|
360
385
|
}
|
|
361
386
|
|
|
387
|
+
export declare class Batches extends BaseModule {
|
|
388
|
+
private readonly apiClient;
|
|
389
|
+
constructor(apiClient: ApiClient);
|
|
390
|
+
/**
|
|
391
|
+
* Create batch job.
|
|
392
|
+
*
|
|
393
|
+
* @param params - The parameters for create batch job request.
|
|
394
|
+
* @return The created batch job.
|
|
395
|
+
*
|
|
396
|
+
* @example
|
|
397
|
+
* ```ts
|
|
398
|
+
* const response = await ai.batches.create({
|
|
399
|
+
* model: 'gemini-2.0-flash',
|
|
400
|
+
* src: {gcsUri: 'gs://bucket/path/to/file.jsonl', format: 'jsonl'},
|
|
401
|
+
* config: {
|
|
402
|
+
* dest: {gcsUri: 'gs://bucket/path/output/directory', format: 'jsonl'},
|
|
403
|
+
* }
|
|
404
|
+
* });
|
|
405
|
+
* console.log(response);
|
|
406
|
+
* ```
|
|
407
|
+
*/
|
|
408
|
+
create: (params: types.CreateBatchJobParameters) => Promise<types.BatchJob>;
|
|
409
|
+
/**
|
|
410
|
+
* Lists batch job configurations.
|
|
411
|
+
*
|
|
412
|
+
* @param params - The parameters for the list request.
|
|
413
|
+
* @return The paginated results of the list of batch jobs.
|
|
414
|
+
*
|
|
415
|
+
* @example
|
|
416
|
+
* ```ts
|
|
417
|
+
* const batchJobs = await ai.batches.list({config: {'pageSize': 2}});
|
|
418
|
+
* for await (const batchJob of batchJobs) {
|
|
419
|
+
* console.log(batchJob);
|
|
420
|
+
* }
|
|
421
|
+
* ```
|
|
422
|
+
*/
|
|
423
|
+
list: (params?: types.ListBatchJobsParameters) => Promise<Pager<types.BatchJob>>;
|
|
424
|
+
/**
|
|
425
|
+
* Internal method to create batch job.
|
|
426
|
+
*
|
|
427
|
+
* @param params - The parameters for create batch job request.
|
|
428
|
+
* @return The created batch job.
|
|
429
|
+
*
|
|
430
|
+
*/
|
|
431
|
+
private createInternal;
|
|
432
|
+
/**
|
|
433
|
+
* Gets batch job configurations.
|
|
434
|
+
*
|
|
435
|
+
* @param params - The parameters for the get request.
|
|
436
|
+
* @return The batch job.
|
|
437
|
+
*
|
|
438
|
+
* @example
|
|
439
|
+
* ```ts
|
|
440
|
+
* await ai.batches.get({name: '...'}); // The server-generated resource name.
|
|
441
|
+
* ```
|
|
442
|
+
*/
|
|
443
|
+
get(params: types.GetBatchJobParameters): Promise<types.BatchJob>;
|
|
444
|
+
/**
|
|
445
|
+
* Cancels a batch job.
|
|
446
|
+
*
|
|
447
|
+
* @param params - The parameters for the cancel request.
|
|
448
|
+
* @return The empty response returned by the API.
|
|
449
|
+
*
|
|
450
|
+
* @example
|
|
451
|
+
* ```ts
|
|
452
|
+
* await ai.batches.cancel({name: '...'}); // The server-generated resource name.
|
|
453
|
+
* ```
|
|
454
|
+
*/
|
|
455
|
+
cancel(params: types.CancelBatchJobParameters): Promise<void>;
|
|
456
|
+
private listInternal;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
/** Config for batches.create return value. */
|
|
460
|
+
export declare interface BatchJob {
|
|
461
|
+
/** The resource name of the BatchJob. Output only.".
|
|
462
|
+
*/
|
|
463
|
+
name?: string;
|
|
464
|
+
/** The display name of the BatchJob.
|
|
465
|
+
*/
|
|
466
|
+
displayName?: string;
|
|
467
|
+
/** The state of the BatchJob.
|
|
468
|
+
*/
|
|
469
|
+
state?: JobState;
|
|
470
|
+
/** Output only. Only populated when the job's state is JOB_STATE_FAILED or JOB_STATE_CANCELLED. */
|
|
471
|
+
error?: JobError;
|
|
472
|
+
/** The time when the BatchJob was created.
|
|
473
|
+
*/
|
|
474
|
+
createTime?: string;
|
|
475
|
+
/** Output only. Time when the Job for the first time entered the `JOB_STATE_RUNNING` state. */
|
|
476
|
+
startTime?: string;
|
|
477
|
+
/** The time when the BatchJob was completed.
|
|
478
|
+
*/
|
|
479
|
+
endTime?: string;
|
|
480
|
+
/** The time when the BatchJob was last updated.
|
|
481
|
+
*/
|
|
482
|
+
updateTime?: string;
|
|
483
|
+
/** The name of the model that produces the predictions via the BatchJob.
|
|
484
|
+
*/
|
|
485
|
+
model?: string;
|
|
486
|
+
/** Configuration for the input data.
|
|
487
|
+
*/
|
|
488
|
+
src?: BatchJobSource;
|
|
489
|
+
/** Configuration for the output data.
|
|
490
|
+
*/
|
|
491
|
+
dest?: BatchJobDestination;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
/** Config for `des` parameter. */
|
|
495
|
+
export declare interface BatchJobDestination {
|
|
496
|
+
/** Storage format of the output files. Must be one of:
|
|
497
|
+
'jsonl', 'bigquery'.
|
|
498
|
+
*/
|
|
499
|
+
format?: string;
|
|
500
|
+
/** The Google Cloud Storage URI to the output file.
|
|
501
|
+
*/
|
|
502
|
+
gcsUri?: string;
|
|
503
|
+
/** The BigQuery URI to the output table.
|
|
504
|
+
*/
|
|
505
|
+
bigqueryUri?: string;
|
|
506
|
+
/** The Gemini Developer API's file resource name of the output data
|
|
507
|
+
(e.g. "files/12345"). The file will be a JSONL file with a single response
|
|
508
|
+
per line. The responses will be GenerateContentResponse messages formatted
|
|
509
|
+
as JSON. The responses will be written in the same order as the input
|
|
510
|
+
requests.
|
|
511
|
+
*/
|
|
512
|
+
fileName?: string;
|
|
513
|
+
/** The responses to the requests in the batch. Returned when the batch was
|
|
514
|
+
built using inlined requests. The responses will be in the same order as
|
|
515
|
+
the input requests.
|
|
516
|
+
*/
|
|
517
|
+
inlinedResponses?: InlinedResponse[];
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
/** Config for `src` parameter. */
|
|
521
|
+
export declare interface BatchJobSource {
|
|
522
|
+
/** Storage format of the input files. Must be one of:
|
|
523
|
+
'jsonl', 'bigquery'.
|
|
524
|
+
*/
|
|
525
|
+
format?: string;
|
|
526
|
+
/** The Google Cloud Storage URIs to input files.
|
|
527
|
+
*/
|
|
528
|
+
gcsUri?: string[];
|
|
529
|
+
/** The BigQuery URI to input table.
|
|
530
|
+
*/
|
|
531
|
+
bigqueryUri?: string;
|
|
532
|
+
/** The Gemini Developer API's file resource name of the input data
|
|
533
|
+
(e.g. "files/12345").
|
|
534
|
+
*/
|
|
535
|
+
fileName?: string;
|
|
536
|
+
/** The Gemini Developer API's inlined input data to run batch job.
|
|
537
|
+
*/
|
|
538
|
+
inlinedRequests?: InlinedRequest[];
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
export declare type BatchJobSourceUnion = BatchJobSource | InlinedRequest[] | string;
|
|
542
|
+
|
|
362
543
|
/** Defines the function behavior. Defaults to `BLOCKING`. */
|
|
363
544
|
export declare enum Behavior {
|
|
364
545
|
/**
|
|
@@ -562,6 +743,30 @@ export declare interface CallableToolConfig {
|
|
|
562
743
|
timeout?: number;
|
|
563
744
|
}
|
|
564
745
|
|
|
746
|
+
/** Optional parameters. */
|
|
747
|
+
export declare interface CancelBatchJobConfig {
|
|
748
|
+
/** Used to override HTTP request options. */
|
|
749
|
+
httpOptions?: HttpOptions;
|
|
750
|
+
/** Abort signal which can be used to cancel the request.
|
|
751
|
+
|
|
752
|
+
NOTE: AbortSignal is a client-only operation. Using it to cancel an
|
|
753
|
+
operation will not cancel the request in the service. You will still
|
|
754
|
+
be charged usage for any applicable operations.
|
|
755
|
+
*/
|
|
756
|
+
abortSignal?: AbortSignal;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
/** Config for batches.cancel parameters. */
|
|
760
|
+
export declare interface CancelBatchJobParameters {
|
|
761
|
+
/** A fully-qualified BatchJob resource name or ID.
|
|
762
|
+
Example: "projects/.../locations/.../batchPredictionJobs/456"
|
|
763
|
+
or "456" when project and location are initialized in the client.
|
|
764
|
+
*/
|
|
765
|
+
name: string;
|
|
766
|
+
/** Optional parameters for the request. */
|
|
767
|
+
config?: CancelBatchJobConfig;
|
|
768
|
+
}
|
|
769
|
+
|
|
565
770
|
/** A response candidate generated from the model. */
|
|
566
771
|
export declare interface Candidate {
|
|
567
772
|
/** Contains the multi-part content of the response.
|
|
@@ -959,6 +1164,40 @@ export declare interface CreateAuthTokenParameters {
|
|
|
959
1164
|
config?: CreateAuthTokenConfig;
|
|
960
1165
|
}
|
|
961
1166
|
|
|
1167
|
+
/** Config for optional parameters. */
|
|
1168
|
+
export declare interface CreateBatchJobConfig {
|
|
1169
|
+
/** Used to override HTTP request options. */
|
|
1170
|
+
httpOptions?: HttpOptions;
|
|
1171
|
+
/** Abort signal which can be used to cancel the request.
|
|
1172
|
+
|
|
1173
|
+
NOTE: AbortSignal is a client-only operation. Using it to cancel an
|
|
1174
|
+
operation will not cancel the request in the service. You will still
|
|
1175
|
+
be charged usage for any applicable operations.
|
|
1176
|
+
*/
|
|
1177
|
+
abortSignal?: AbortSignal;
|
|
1178
|
+
/** The user-defined name of this BatchJob.
|
|
1179
|
+
*/
|
|
1180
|
+
displayName?: string;
|
|
1181
|
+
/** GCS or BigQuery URI prefix for the output predictions. Example:
|
|
1182
|
+
"gs://path/to/output/data" or "bq://projectId.bqDatasetId.bqTableId".
|
|
1183
|
+
*/
|
|
1184
|
+
dest?: string;
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
/** Config for batches.create parameters. */
|
|
1188
|
+
export declare interface CreateBatchJobParameters {
|
|
1189
|
+
/** The name of the model to produces the predictions via the BatchJob.
|
|
1190
|
+
*/
|
|
1191
|
+
model?: string;
|
|
1192
|
+
/** GCS URI(-s) or BigQuery URI to your input data to run batch job.
|
|
1193
|
+
Example: "gs://path/to/input/data" or "bq://projectId.bqDatasetId.bqTableId".
|
|
1194
|
+
*/
|
|
1195
|
+
src: BatchJobSourceUnion;
|
|
1196
|
+
/** Optional parameters for creating a BatchJob.
|
|
1197
|
+
*/
|
|
1198
|
+
config?: CreateBatchJobConfig;
|
|
1199
|
+
}
|
|
1200
|
+
|
|
962
1201
|
/** Optional configuration for cached content creation. */
|
|
963
1202
|
export declare interface CreateCachedContentConfig {
|
|
964
1203
|
/** Used to override HTTP request options. */
|
|
@@ -1390,7 +1629,8 @@ export declare interface EditImageConfig {
|
|
|
1390
1629
|
/** Number of images to generate.
|
|
1391
1630
|
*/
|
|
1392
1631
|
numberOfImages?: number;
|
|
1393
|
-
/** Aspect ratio of the generated images.
|
|
1632
|
+
/** Aspect ratio of the generated images. Supported values are
|
|
1633
|
+
"1:1", "3:4", "4:3", "9:16", and "16:9".
|
|
1394
1634
|
*/
|
|
1395
1635
|
aspectRatio?: string;
|
|
1396
1636
|
/** Controls how much the model adheres to the text prompt. Large
|
|
@@ -1913,8 +2153,12 @@ export declare interface FunctionDeclaration {
|
|
|
1913
2153
|
name?: string;
|
|
1914
2154
|
/** Optional. Describes the parameters to this function in JSON Schema Object format. Reflects the Open API 3.03 Parameter Object. string Key: the name of the parameter. Parameter names are case sensitive. Schema Value: the Schema defining the type used for the parameter. For function with no parameters, this can be left unset. Parameter names must start with a letter or an underscore and must only contain chars a-z, A-Z, 0-9, or underscores with a maximum length of 64. Example with 1 required and 1 optional parameter: type: OBJECT properties: param1: type: STRING param2: type: INTEGER required: - param1 */
|
|
1915
2155
|
parameters?: Schema;
|
|
2156
|
+
/** Optional. Describes the parameters to the function in JSON Schema format. The schema must describe an object where the properties are the parameters to the function. For example: ``` { "type": "object", "properties": { "name": { "type": "string" }, "age": { "type": "integer" } }, "additionalProperties": false, "required": ["name", "age"], "propertyOrdering": ["name", "age"] } ``` This field is mutually exclusive with `parameters`. */
|
|
2157
|
+
parametersJsonSchema?: unknown;
|
|
1916
2158
|
/** Optional. Describes the output from this function in JSON Schema format. Reflects the Open API 3.03 Response Object. The Schema defines the type used for the response value of the function. */
|
|
1917
2159
|
response?: Schema;
|
|
2160
|
+
/** Optional. Describes the output from this function in JSON Schema format. The value specified by the schema is the response value of the function. This field is mutually exclusive with `response`. */
|
|
2161
|
+
responseJsonSchema?: unknown;
|
|
1918
2162
|
}
|
|
1919
2163
|
|
|
1920
2164
|
/** A function response. */
|
|
@@ -2039,6 +2283,22 @@ export declare interface GenerateContentConfig {
|
|
|
2039
2283
|
Compatible mimetypes: `application/json`: Schema for JSON response.
|
|
2040
2284
|
*/
|
|
2041
2285
|
responseSchema?: SchemaUnion;
|
|
2286
|
+
/** Optional. Output schema of the generated response.
|
|
2287
|
+
This is an alternative to `response_schema` that accepts [JSON
|
|
2288
|
+
Schema](https://json-schema.org/). If set, `response_schema` must be
|
|
2289
|
+
omitted, but `response_mime_type` is required. While the full JSON Schema
|
|
2290
|
+
may be sent, not all features are supported. Specifically, only the
|
|
2291
|
+
following properties are supported: - `$id` - `$defs` - `$ref` - `$anchor`
|
|
2292
|
+
- `type` - `format` - `title` - `description` - `enum` (for strings and
|
|
2293
|
+
numbers) - `items` - `prefixItems` - `minItems` - `maxItems` - `minimum` -
|
|
2294
|
+
`maximum` - `anyOf` - `oneOf` (interpreted the same as `anyOf`) -
|
|
2295
|
+
`properties` - `additionalProperties` - `required` The non-standard
|
|
2296
|
+
`propertyOrdering` property may also be set. Cyclic references are
|
|
2297
|
+
unrolled to a limited degree and, as such, may only be used within
|
|
2298
|
+
non-required properties. (Nullable properties are not sufficient.) If
|
|
2299
|
+
`$ref` is set on a sub-schema, no other properties, except for than those
|
|
2300
|
+
starting as a `$`, may be set. */
|
|
2301
|
+
responseJsonSchema?: unknown;
|
|
2042
2302
|
/** Configuration for model router requests.
|
|
2043
2303
|
*/
|
|
2044
2304
|
routingConfig?: GenerationConfigRoutingConfig;
|
|
@@ -2327,7 +2587,8 @@ export declare interface GenerateImagesConfig {
|
|
|
2327
2587
|
/** Number of images to generate.
|
|
2328
2588
|
*/
|
|
2329
2589
|
numberOfImages?: number;
|
|
2330
|
-
/** Aspect ratio of the generated images.
|
|
2590
|
+
/** Aspect ratio of the generated images. Supported values are
|
|
2591
|
+
"1:1", "3:4", "4:3", "9:16", and "16:9".
|
|
2331
2592
|
*/
|
|
2332
2593
|
aspectRatio?: string;
|
|
2333
2594
|
/** Controls how much the model adheres to the text prompt. Large
|
|
@@ -2432,6 +2693,8 @@ export declare interface GenerateVideosConfig {
|
|
|
2432
2693
|
generateAudio?: boolean;
|
|
2433
2694
|
/** Image to use as the last frame of generated videos. Only supported for image to video use cases. */
|
|
2434
2695
|
lastFrame?: Image_2;
|
|
2696
|
+
/** Compression quality of the generated videos. */
|
|
2697
|
+
compressionQuality?: VideoCompressionQuality;
|
|
2435
2698
|
}
|
|
2436
2699
|
|
|
2437
2700
|
/** A video generation operation. */
|
|
@@ -2501,6 +2764,8 @@ export declare interface GenerationConfig {
|
|
|
2501
2764
|
responseModalities?: Modality[];
|
|
2502
2765
|
/** Optional. The `Schema` object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. Represents a select subset of an [OpenAPI 3.0 schema object](https://spec.openapis.org/oas/v3.0.3#schema). If set, a compatible response_mime_type must also be set. Compatible mimetypes: `application/json`: Schema for JSON response. */
|
|
2503
2766
|
responseSchema?: Schema;
|
|
2767
|
+
/** Optional. Output schema of the generated response. This is an alternative to `response_schema` that accepts [JSON Schema](https://json-schema.org/). If set, `response_schema` must be omitted, but `response_mime_type` is required. While the full JSON Schema may be sent, not all features are supported. Specifically, only the following properties are supported: - `$id` - `$defs` - `$ref` - `$anchor` - `type` - `format` - `title` - `description` - `enum` (for strings and numbers) - `items` - `prefixItems` - `minItems` - `maxItems` - `minimum` - `maximum` - `anyOf` - `oneOf` (interpreted the same as `anyOf`) - `properties` - `additionalProperties` - `required` The non-standard `propertyOrdering` property may also be set. Cyclic references are unrolled to a limited degree and, as such, may only be used within non-required properties. (Nullable properties are not sufficient.) If `$ref` is set on a sub-schema, no other properties, except for than those starting as a `$`, may be set. */
|
|
2768
|
+
responseJsonSchema?: unknown;
|
|
2504
2769
|
/** Optional. Routing configuration. */
|
|
2505
2770
|
routingConfig?: GenerationConfigRoutingConfig;
|
|
2506
2771
|
/** Optional. Seed. */
|
|
@@ -2547,6 +2812,30 @@ export declare interface GenerationConfigThinkingConfig {
|
|
|
2547
2812
|
thinkingBudget?: number;
|
|
2548
2813
|
}
|
|
2549
2814
|
|
|
2815
|
+
/** Optional parameters. */
|
|
2816
|
+
export declare interface GetBatchJobConfig {
|
|
2817
|
+
/** Used to override HTTP request options. */
|
|
2818
|
+
httpOptions?: HttpOptions;
|
|
2819
|
+
/** Abort signal which can be used to cancel the request.
|
|
2820
|
+
|
|
2821
|
+
NOTE: AbortSignal is a client-only operation. Using it to cancel an
|
|
2822
|
+
operation will not cancel the request in the service. You will still
|
|
2823
|
+
be charged usage for any applicable operations.
|
|
2824
|
+
*/
|
|
2825
|
+
abortSignal?: AbortSignal;
|
|
2826
|
+
}
|
|
2827
|
+
|
|
2828
|
+
/** Config for batches.get parameters. */
|
|
2829
|
+
export declare interface GetBatchJobParameters {
|
|
2830
|
+
/** A fully-qualified BatchJob resource name or ID.
|
|
2831
|
+
Example: "projects/.../locations/.../batchPredictionJobs/456"
|
|
2832
|
+
or "456" when project and location are initialized in the client.
|
|
2833
|
+
*/
|
|
2834
|
+
name: string;
|
|
2835
|
+
/** Optional parameters for the request. */
|
|
2836
|
+
config?: GetBatchJobConfig;
|
|
2837
|
+
}
|
|
2838
|
+
|
|
2550
2839
|
/** Optional parameters for caches.get method. */
|
|
2551
2840
|
export declare interface GetCachedContentConfig {
|
|
2552
2841
|
/** Used to override HTTP request options. */
|
|
@@ -2693,6 +2982,7 @@ export declare class GoogleGenAI {
|
|
|
2693
2982
|
private readonly apiVersion?;
|
|
2694
2983
|
readonly models: Models;
|
|
2695
2984
|
readonly live: Live;
|
|
2985
|
+
readonly batches: Batches;
|
|
2696
2986
|
readonly chats: Chats;
|
|
2697
2987
|
readonly caches: Caches;
|
|
2698
2988
|
readonly files: Files;
|
|
@@ -2991,6 +3281,8 @@ export declare interface HttpOptions {
|
|
|
2991
3281
|
headers?: Record<string, string>;
|
|
2992
3282
|
/** Timeout for the request in milliseconds. */
|
|
2993
3283
|
timeout?: number;
|
|
3284
|
+
/** Extra parameters to add to the request body. */
|
|
3285
|
+
extraBody?: Record<string, unknown>;
|
|
2994
3286
|
}
|
|
2995
3287
|
|
|
2996
3288
|
/**
|
|
@@ -3078,6 +3370,29 @@ export declare enum ImagePromptLanguage {
|
|
|
3078
3370
|
hi = "hi"
|
|
3079
3371
|
}
|
|
3080
3372
|
|
|
3373
|
+
/** Config for inlined request. */
|
|
3374
|
+
export declare interface InlinedRequest {
|
|
3375
|
+
/** ID of the model to use. For a list of models, see `Google models
|
|
3376
|
+
<https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models>`_. */
|
|
3377
|
+
model?: string;
|
|
3378
|
+
/** Content of the request.
|
|
3379
|
+
*/
|
|
3380
|
+
contents?: ContentListUnion;
|
|
3381
|
+
/** Configuration that contains optional model parameters.
|
|
3382
|
+
*/
|
|
3383
|
+
config?: GenerateContentConfig;
|
|
3384
|
+
}
|
|
3385
|
+
|
|
3386
|
+
/** Config for `inlined_responses` parameter. */
|
|
3387
|
+
export declare class InlinedResponse {
|
|
3388
|
+
/** The response to the request.
|
|
3389
|
+
*/
|
|
3390
|
+
response?: GenerateContentResponse;
|
|
3391
|
+
/** The error encountered while processing the request.
|
|
3392
|
+
*/
|
|
3393
|
+
error?: JobError;
|
|
3394
|
+
}
|
|
3395
|
+
|
|
3081
3396
|
/** Represents a time interval, encoded as a start time (inclusive) and an end time (exclusive).
|
|
3082
3397
|
|
|
3083
3398
|
The start time must be less than or equal to the end time.
|
|
@@ -3092,7 +3407,17 @@ export declare interface Interval {
|
|
|
3092
3407
|
endTime?: string;
|
|
3093
3408
|
}
|
|
3094
3409
|
|
|
3095
|
-
/**
|
|
3410
|
+
/** Job error. */
|
|
3411
|
+
export declare interface JobError {
|
|
3412
|
+
/** A list of messages that carry the error details. There is a common set of message types for APIs to use. */
|
|
3413
|
+
details?: string[];
|
|
3414
|
+
/** The status code. */
|
|
3415
|
+
code?: number;
|
|
3416
|
+
/** A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the `details` field. */
|
|
3417
|
+
message?: string;
|
|
3418
|
+
}
|
|
3419
|
+
|
|
3420
|
+
/** Job state. */
|
|
3096
3421
|
export declare enum JobState {
|
|
3097
3422
|
/**
|
|
3098
3423
|
* The job state is unspecified.
|
|
@@ -3135,7 +3460,7 @@ export declare enum JobState {
|
|
|
3135
3460
|
*/
|
|
3136
3461
|
JOB_STATE_EXPIRED = "JOB_STATE_EXPIRED",
|
|
3137
3462
|
/**
|
|
3138
|
-
* The job is being updated. Only jobs in the `
|
|
3463
|
+
* 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.
|
|
3139
3464
|
*/
|
|
3140
3465
|
JOB_STATE_UPDATING = "JOB_STATE_UPDATING",
|
|
3141
3466
|
/**
|
|
@@ -3170,6 +3495,33 @@ export declare interface LatLng {
|
|
|
3170
3495
|
longitude?: number;
|
|
3171
3496
|
}
|
|
3172
3497
|
|
|
3498
|
+
/** Config for optional parameters. */
|
|
3499
|
+
export declare interface ListBatchJobsConfig {
|
|
3500
|
+
/** Used to override HTTP request options. */
|
|
3501
|
+
httpOptions?: HttpOptions;
|
|
3502
|
+
/** Abort signal which can be used to cancel the request.
|
|
3503
|
+
|
|
3504
|
+
NOTE: AbortSignal is a client-only operation. Using it to cancel an
|
|
3505
|
+
operation will not cancel the request in the service. You will still
|
|
3506
|
+
be charged usage for any applicable operations.
|
|
3507
|
+
*/
|
|
3508
|
+
abortSignal?: AbortSignal;
|
|
3509
|
+
pageSize?: number;
|
|
3510
|
+
pageToken?: string;
|
|
3511
|
+
filter?: string;
|
|
3512
|
+
}
|
|
3513
|
+
|
|
3514
|
+
/** Config for batches.list parameters. */
|
|
3515
|
+
export declare interface ListBatchJobsParameters {
|
|
3516
|
+
config?: ListBatchJobsConfig;
|
|
3517
|
+
}
|
|
3518
|
+
|
|
3519
|
+
/** Config for batches.list return value. */
|
|
3520
|
+
export declare class ListBatchJobsResponse {
|
|
3521
|
+
nextPageToken?: string;
|
|
3522
|
+
batchJobs?: BatchJob[];
|
|
3523
|
+
}
|
|
3524
|
+
|
|
3173
3525
|
/** Config for caches.list method. */
|
|
3174
3526
|
export declare interface ListCachedContentsConfig {
|
|
3175
3527
|
/** Used to override HTTP request options. */
|
|
@@ -4777,8 +5129,17 @@ export declare type PartUnion = Part | string;
|
|
|
4777
5129
|
|
|
4778
5130
|
/** Enum that controls the generation of people. */
|
|
4779
5131
|
export declare enum PersonGeneration {
|
|
5132
|
+
/**
|
|
5133
|
+
* Block generation of images of people.
|
|
5134
|
+
*/
|
|
4780
5135
|
DONT_ALLOW = "DONT_ALLOW",
|
|
5136
|
+
/**
|
|
5137
|
+
* Generate images of adults, but not children.
|
|
5138
|
+
*/
|
|
4781
5139
|
ALLOW_ADULT = "ALLOW_ADULT",
|
|
5140
|
+
/**
|
|
5141
|
+
* Generate images that include adults and children.
|
|
5142
|
+
*/
|
|
4782
5143
|
ALLOW_ALL = "ALLOW_ALL"
|
|
4783
5144
|
}
|
|
4784
5145
|
|
|
@@ -5555,7 +5916,7 @@ export declare interface ThinkingConfig {
|
|
|
5555
5916
|
/** Indicates whether to include thoughts in the response. If true, thoughts are returned only if the model supports thought and thoughts are available.
|
|
5556
5917
|
*/
|
|
5557
5918
|
includeThoughts?: boolean;
|
|
5558
|
-
/** Indicates the thinking budget in tokens.
|
|
5919
|
+
/** Indicates the thinking budget in tokens. 0 is DISABLED. -1 is AUTOMATIC. The default values and allowed ranges are model dependent.
|
|
5559
5920
|
*/
|
|
5560
5921
|
thinkingBudget?: number;
|
|
5561
5922
|
}
|
|
@@ -5962,6 +6323,7 @@ declare namespace types {
|
|
|
5962
6323
|
ControlReferenceType,
|
|
5963
6324
|
SubjectReferenceType,
|
|
5964
6325
|
EditMode,
|
|
6326
|
+
VideoCompressionQuality,
|
|
5965
6327
|
FileState,
|
|
5966
6328
|
FileSource,
|
|
5967
6329
|
MediaModality,
|
|
@@ -6028,6 +6390,8 @@ declare namespace types {
|
|
|
6028
6390
|
GenerationConfigRoutingConfig,
|
|
6029
6391
|
GenerateContentConfig,
|
|
6030
6392
|
GenerateContentParameters,
|
|
6393
|
+
HttpResponse,
|
|
6394
|
+
LiveCallbacks,
|
|
6031
6395
|
GoogleTypeDate,
|
|
6032
6396
|
Citation,
|
|
6033
6397
|
CitationMetadata,
|
|
@@ -6152,14 +6516,27 @@ declare namespace types {
|
|
|
6152
6516
|
ListFilesResponse,
|
|
6153
6517
|
CreateFileConfig,
|
|
6154
6518
|
CreateFileParameters,
|
|
6155
|
-
HttpResponse,
|
|
6156
|
-
LiveCallbacks,
|
|
6157
6519
|
CreateFileResponse,
|
|
6158
6520
|
GetFileConfig,
|
|
6159
6521
|
GetFileParameters,
|
|
6160
6522
|
DeleteFileConfig,
|
|
6161
6523
|
DeleteFileParameters,
|
|
6162
6524
|
DeleteFileResponse,
|
|
6525
|
+
InlinedRequest,
|
|
6526
|
+
BatchJobSource,
|
|
6527
|
+
JobError,
|
|
6528
|
+
InlinedResponse,
|
|
6529
|
+
BatchJobDestination,
|
|
6530
|
+
CreateBatchJobConfig,
|
|
6531
|
+
CreateBatchJobParameters,
|
|
6532
|
+
BatchJob,
|
|
6533
|
+
GetBatchJobConfig,
|
|
6534
|
+
GetBatchJobParameters,
|
|
6535
|
+
CancelBatchJobConfig,
|
|
6536
|
+
CancelBatchJobParameters,
|
|
6537
|
+
ListBatchJobsConfig,
|
|
6538
|
+
ListBatchJobsParameters,
|
|
6539
|
+
ListBatchJobsResponse,
|
|
6163
6540
|
GetOperationConfig,
|
|
6164
6541
|
GetOperationParameters,
|
|
6165
6542
|
FetchPredictOperationConfig,
|
|
@@ -6242,7 +6619,8 @@ declare namespace types {
|
|
|
6242
6619
|
SpeechConfigUnion,
|
|
6243
6620
|
ToolUnion,
|
|
6244
6621
|
ToolListUnion,
|
|
6245
|
-
DownloadableFileUnion
|
|
6622
|
+
DownloadableFileUnion,
|
|
6623
|
+
BatchJobSourceUnion
|
|
6246
6624
|
}
|
|
6247
6625
|
}
|
|
6248
6626
|
|
|
@@ -6368,6 +6746,15 @@ export declare interface UpscaleImageConfig {
|
|
|
6368
6746
|
/** The level of compression if the ``output_mime_type`` is
|
|
6369
6747
|
``image/jpeg``. */
|
|
6370
6748
|
outputCompressionQuality?: number;
|
|
6749
|
+
/** Whether to add an image enhancing step before upscaling.
|
|
6750
|
+
It is expected to suppress the noise and JPEG compression artifacts
|
|
6751
|
+
from the input image. */
|
|
6752
|
+
enhanceInputImage?: boolean;
|
|
6753
|
+
/** With a higher image preservation factor, the original image
|
|
6754
|
+
pixels are more respected. With a lower image preservation factor, the
|
|
6755
|
+
output image will have be more different from the input image, but
|
|
6756
|
+
with finer details and less noise. */
|
|
6757
|
+
imagePreservationFactor?: number;
|
|
6371
6758
|
}
|
|
6372
6759
|
|
|
6373
6760
|
/** User-facing config UpscaleImageParameters. */
|
|
@@ -6504,6 +6891,20 @@ export declare interface Video {
|
|
|
6504
6891
|
mimeType?: string;
|
|
6505
6892
|
}
|
|
6506
6893
|
|
|
6894
|
+
/** Enum that controls the compression quality of the generated videos. */
|
|
6895
|
+
export declare enum VideoCompressionQuality {
|
|
6896
|
+
/**
|
|
6897
|
+
* Optimized video compression quality. This will produce videos
|
|
6898
|
+
with a compressed, smaller file size.
|
|
6899
|
+
*/
|
|
6900
|
+
OPTIMIZED = "OPTIMIZED",
|
|
6901
|
+
/**
|
|
6902
|
+
* Lossless video compression quality. This will produce videos
|
|
6903
|
+
with a larger file size.
|
|
6904
|
+
*/
|
|
6905
|
+
LOSSLESS = "LOSSLESS"
|
|
6906
|
+
}
|
|
6907
|
+
|
|
6507
6908
|
/** Describes how the video in the Part should be used by the model. */
|
|
6508
6909
|
export declare interface VideoMetadata {
|
|
6509
6910
|
/** The frame rate of the video sent to the model. If not specified, the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@google/genai",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/node/index.mjs",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"prepare": "npm run build-prod",
|
|
41
|
-
"build": "rollup -c && api-extractor run --local --verbose && api-extractor run -c api-extractor.node.json --local --verbose&& api-extractor run -c api-extractor.web.json --local --verbose",
|
|
42
|
-
"build-prod": "rollup -c && api-extractor run --verbose && api-extractor run -c api-extractor.node.json --verbose && api-extractor run -c api-extractor.web.json --verbose",
|
|
41
|
+
"build": "rollup -c && api-extractor run --local --verbose && api-extractor run -c api-extractor.node.json --local --verbose&& api-extractor run -c api-extractor.web.json --local --verbose && node scripts/ignore_missing_mcp_dep.js",
|
|
42
|
+
"build-prod": "rollup -c && api-extractor run --verbose && api-extractor run -c api-extractor.node.json --verbose && api-extractor run -c api-extractor.web.json --verbose && node scripts/ignore_missing_mcp_dep.js",
|
|
43
43
|
"unit-test": "tsc && jasmine dist/test/unit/**/*_test.js dist/test/unit/*_test.js",
|
|
44
44
|
"system-test": "tsc && jasmine dist/test/system/**/*_test.js",
|
|
45
45
|
"test-server-tests": "tsc && GOOGLE_CLOUD_PROJECT=googcloudproj GOOGLE_CLOUD_LOCATION=googcloudloc jasmine dist/test/system/node/*_test.js !dist/test/system/node/live_test.js -- --test-server",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"prettier": "3.3.3",
|
|
86
86
|
"prettier-plugin-organize-imports": "^4.1.0",
|
|
87
87
|
"rollup-plugin-typescript2": "^0.36.0",
|
|
88
|
-
"test-server-sdk": "^0.2.
|
|
88
|
+
"test-server-sdk": "^0.2.3",
|
|
89
89
|
"ts-node": "^10.9.2",
|
|
90
90
|
"tslib": "^2.8.1",
|
|
91
91
|
"tsx": "^4.19.4",
|