@google/genai 1.7.0 → 1.9.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 +240 -22
- package/dist/index.cjs +373 -224
- package/dist/index.mjs +374 -225
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +373 -223
- package/dist/node/index.mjs +374 -224
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +240 -22
- package/dist/web/index.mjs +374 -225
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +240 -22
- package/package.json +5 -5
package/dist/web/web.d.ts
CHANGED
|
@@ -66,6 +66,20 @@ export declare enum AdapterSize {
|
|
|
66
66
|
ADAPTER_SIZE_THIRTY_TWO = "ADAPTER_SIZE_THIRTY_TWO"
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
/** The generic reusable api auth config. Deprecated. Please use AuthConfig (google/cloud/aiplatform/master/auth.proto) instead. */
|
|
70
|
+
export declare interface ApiAuth {
|
|
71
|
+
/** The API secret. */
|
|
72
|
+
apiKeyConfig?: ApiAuthApiKeyConfig;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** The API secret. */
|
|
76
|
+
export declare interface ApiAuthApiKeyConfig {
|
|
77
|
+
/** Required. The SecretManager secret version resource name storing API key. e.g. projects/{project}/secrets/{secret}/versions/{version} */
|
|
78
|
+
apiKeySecretVersion?: string;
|
|
79
|
+
/** The API key string. Either this or `api_key_secret_version` must be set. */
|
|
80
|
+
apiKeyString?: string;
|
|
81
|
+
}
|
|
82
|
+
|
|
69
83
|
/**
|
|
70
84
|
* The ApiClient class is used to send requests to the Gemini API or Vertex AI
|
|
71
85
|
* endpoints.
|
|
@@ -222,9 +236,26 @@ export declare interface ApiKeyConfig {
|
|
|
222
236
|
apiKeyString?: string;
|
|
223
237
|
}
|
|
224
238
|
|
|
239
|
+
/** The API spec that the external API implements. */
|
|
240
|
+
export declare enum ApiSpec {
|
|
241
|
+
/**
|
|
242
|
+
* Unspecified API spec. This value should not be used.
|
|
243
|
+
*/
|
|
244
|
+
API_SPEC_UNSPECIFIED = "API_SPEC_UNSPECIFIED",
|
|
245
|
+
/**
|
|
246
|
+
* Simple search API spec.
|
|
247
|
+
*/
|
|
248
|
+
SIMPLE_SEARCH = "SIMPLE_SEARCH",
|
|
249
|
+
/**
|
|
250
|
+
* Elastic search API spec.
|
|
251
|
+
*/
|
|
252
|
+
ELASTIC_SEARCH = "ELASTIC_SEARCH"
|
|
253
|
+
}
|
|
254
|
+
|
|
225
255
|
/** Representation of an audio chunk. */
|
|
226
256
|
export declare interface AudioChunk {
|
|
227
|
-
/** Raw
|
|
257
|
+
/** Raw bytes of audio data.
|
|
258
|
+
* @remarks Encoded as base64 string. */
|
|
228
259
|
data?: string;
|
|
229
260
|
/** MIME type of the audio chunk. */
|
|
230
261
|
mimeType?: string;
|
|
@@ -454,6 +485,18 @@ export declare class Batches extends BaseModule {
|
|
|
454
485
|
*/
|
|
455
486
|
cancel(params: types.CancelBatchJobParameters): Promise<void>;
|
|
456
487
|
private listInternal;
|
|
488
|
+
/**
|
|
489
|
+
* Deletes a batch job.
|
|
490
|
+
*
|
|
491
|
+
* @param params - The parameters for the delete request.
|
|
492
|
+
* @return The empty response returned by the API.
|
|
493
|
+
*
|
|
494
|
+
* @example
|
|
495
|
+
* ```ts
|
|
496
|
+
* await ai.batches.delete({name: '...'}); // The server-generated resource name.
|
|
497
|
+
* ```
|
|
498
|
+
*/
|
|
499
|
+
delete(params: types.DeleteBatchJobParameters): Promise<types.DeleteResourceJob>;
|
|
457
500
|
}
|
|
458
501
|
|
|
459
502
|
/** Config for batches.create return value. */
|
|
@@ -560,7 +603,8 @@ export declare enum Behavior {
|
|
|
560
603
|
declare interface Blob_2 {
|
|
561
604
|
/** Optional. Display name of the blob. Used to provide a label or filename to distinguish blobs. This field is not currently used in the Gemini GenerateContent calls. */
|
|
562
605
|
displayName?: string;
|
|
563
|
-
/** Required. Raw bytes.
|
|
606
|
+
/** Required. Raw bytes.
|
|
607
|
+
* @remarks Encoded as base64 string. */
|
|
564
608
|
data?: string;
|
|
565
609
|
/** Required. The IANA standard MIME type of the source data. */
|
|
566
610
|
mimeType?: string;
|
|
@@ -590,7 +634,11 @@ export declare enum BlockedReason {
|
|
|
590
634
|
/**
|
|
591
635
|
* Candidates blocked due to prohibited content.
|
|
592
636
|
*/
|
|
593
|
-
PROHIBITED_CONTENT = "PROHIBITED_CONTENT"
|
|
637
|
+
PROHIBITED_CONTENT = "PROHIBITED_CONTENT",
|
|
638
|
+
/**
|
|
639
|
+
* Candidates blocked due to unsafe image generation content.
|
|
640
|
+
*/
|
|
641
|
+
IMAGE_SAFETY = "IMAGE_SAFETY"
|
|
594
642
|
}
|
|
595
643
|
|
|
596
644
|
/** A resource used in LLM queries for users to explicitly specify what to cache. */
|
|
@@ -956,7 +1004,7 @@ export declare interface CitationMetadata {
|
|
|
956
1004
|
citations?: Citation[];
|
|
957
1005
|
}
|
|
958
1006
|
|
|
959
|
-
/** Result of executing the [ExecutableCode].
|
|
1007
|
+
/** Result of executing the [ExecutableCode]. Only generated when using the [CodeExecution] tool, and always follows a `part` containing the [ExecutableCode]. */
|
|
960
1008
|
export declare interface CodeExecutionResult {
|
|
961
1009
|
/** Required. Outcome of the code execution. */
|
|
962
1010
|
outcome?: Outcome;
|
|
@@ -1444,6 +1492,30 @@ export declare interface DatasetStats {
|
|
|
1444
1492
|
userOutputTokenDistribution?: DatasetDistribution;
|
|
1445
1493
|
}
|
|
1446
1494
|
|
|
1495
|
+
/** Optional parameters for models.get method. */
|
|
1496
|
+
export declare interface DeleteBatchJobConfig {
|
|
1497
|
+
/** Used to override HTTP request options. */
|
|
1498
|
+
httpOptions?: HttpOptions;
|
|
1499
|
+
/** Abort signal which can be used to cancel the request.
|
|
1500
|
+
|
|
1501
|
+
NOTE: AbortSignal is a client-only operation. Using it to cancel an
|
|
1502
|
+
operation will not cancel the request in the service. You will still
|
|
1503
|
+
be charged usage for any applicable operations.
|
|
1504
|
+
*/
|
|
1505
|
+
abortSignal?: AbortSignal;
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
/** Config for batches.delete parameters. */
|
|
1509
|
+
export declare interface DeleteBatchJobParameters {
|
|
1510
|
+
/** A fully-qualified BatchJob resource name or ID.
|
|
1511
|
+
Example: "projects/.../locations/.../batchPredictionJobs/456"
|
|
1512
|
+
or "456" when project and location are initialized in the client.
|
|
1513
|
+
*/
|
|
1514
|
+
name: string;
|
|
1515
|
+
/** Optional parameters for the request. */
|
|
1516
|
+
config?: DeleteBatchJobConfig;
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1447
1519
|
/** Optional parameters for caches.delete method. */
|
|
1448
1520
|
export declare interface DeleteCachedContentConfig {
|
|
1449
1521
|
/** Used to override HTTP request options. */
|
|
@@ -1519,6 +1591,13 @@ export declare interface DeleteModelParameters {
|
|
|
1519
1591
|
export declare class DeleteModelResponse {
|
|
1520
1592
|
}
|
|
1521
1593
|
|
|
1594
|
+
/** The return value of delete operation. */
|
|
1595
|
+
export declare interface DeleteResourceJob {
|
|
1596
|
+
name?: string;
|
|
1597
|
+
done?: boolean;
|
|
1598
|
+
error?: JobError;
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1522
1601
|
/** Statistics computed for datasets used for distillation. */
|
|
1523
1602
|
export declare interface DistillationDataStats {
|
|
1524
1603
|
/** Output only. Statistics computed for the training dataset. */
|
|
@@ -1803,7 +1882,19 @@ export declare enum EndSensitivity {
|
|
|
1803
1882
|
export declare interface EnterpriseWebSearch {
|
|
1804
1883
|
}
|
|
1805
1884
|
|
|
1806
|
-
/**
|
|
1885
|
+
/** Required. The environment being operated. */
|
|
1886
|
+
export declare enum Environment {
|
|
1887
|
+
/**
|
|
1888
|
+
* Defaults to browser.
|
|
1889
|
+
*/
|
|
1890
|
+
ENVIRONMENT_UNSPECIFIED = "ENVIRONMENT_UNSPECIFIED",
|
|
1891
|
+
/**
|
|
1892
|
+
* Operates in a web browser.
|
|
1893
|
+
*/
|
|
1894
|
+
ENVIRONMENT_BROWSER = "ENVIRONMENT_BROWSER"
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1897
|
+
/** Code generated by the model that is meant to be executed, and the result returned to the model. Generated when using the [CodeExecution] tool, in which the code will be automatically executed, and a corresponding [CodeExecutionResult] will also be generated. */
|
|
1807
1898
|
export declare interface ExecutableCode {
|
|
1808
1899
|
/** Required. The code to be executed. */
|
|
1809
1900
|
code?: string;
|
|
@@ -1811,6 +1902,36 @@ export declare interface ExecutableCode {
|
|
|
1811
1902
|
language?: Language;
|
|
1812
1903
|
}
|
|
1813
1904
|
|
|
1905
|
+
/** Retrieve from data source powered by external API for grounding. The external API is not owned by Google, but need to follow the pre-defined API spec. */
|
|
1906
|
+
export declare interface ExternalApi {
|
|
1907
|
+
/** The authentication config to access the API. Deprecated. Please use auth_config instead. */
|
|
1908
|
+
apiAuth?: ApiAuth;
|
|
1909
|
+
/** The API spec that the external API implements. */
|
|
1910
|
+
apiSpec?: ApiSpec;
|
|
1911
|
+
/** The authentication config to access the API. */
|
|
1912
|
+
authConfig?: AuthConfig;
|
|
1913
|
+
/** Parameters for the elastic search API. */
|
|
1914
|
+
elasticSearchParams?: ExternalApiElasticSearchParams;
|
|
1915
|
+
/** The endpoint of the external API. The system will call the API at this endpoint to retrieve the data for grounding. Example: https://acme.com:443/search */
|
|
1916
|
+
endpoint?: string;
|
|
1917
|
+
/** Parameters for the simple search API. */
|
|
1918
|
+
simpleSearchParams?: ExternalApiSimpleSearchParams;
|
|
1919
|
+
}
|
|
1920
|
+
|
|
1921
|
+
/** The search parameters to use for the ELASTIC_SEARCH spec. */
|
|
1922
|
+
export declare interface ExternalApiElasticSearchParams {
|
|
1923
|
+
/** The ElasticSearch index to use. */
|
|
1924
|
+
index?: string;
|
|
1925
|
+
/** Optional. Number of hits (chunks) to request. When specified, it is passed to Elasticsearch as the `num_hits` param. */
|
|
1926
|
+
numHits?: number;
|
|
1927
|
+
/** The ElasticSearch search template to use. */
|
|
1928
|
+
searchTemplate?: string;
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
/** The search parameters to use for SIMPLE_SEARCH spec. */
|
|
1932
|
+
export declare interface ExternalApiSimpleSearchParams {
|
|
1933
|
+
}
|
|
1934
|
+
|
|
1814
1935
|
/** Options for feature selection preference. */
|
|
1815
1936
|
export declare enum FeatureSelectionPreference {
|
|
1816
1937
|
FEATURE_SELECTION_PREFERENCE_UNSPECIFIED = "FEATURE_SELECTION_PREFERENCE_UNSPECIFIED",
|
|
@@ -2746,6 +2867,8 @@ export declare interface GenerationConfig {
|
|
|
2746
2867
|
audioTimestamp?: boolean;
|
|
2747
2868
|
/** Optional. Number of candidates to generate. */
|
|
2748
2869
|
candidateCount?: number;
|
|
2870
|
+
/** Optional. If enabled, the model will detect emotions and adapt its responses accordingly. */
|
|
2871
|
+
enableAffectiveDialog?: boolean;
|
|
2749
2872
|
/** Optional. Frequency penalties. */
|
|
2750
2873
|
frequencyPenalty?: number;
|
|
2751
2874
|
/** Optional. Logit probabilities. */
|
|
@@ -2756,6 +2879,8 @@ export declare interface GenerationConfig {
|
|
|
2756
2879
|
mediaResolution?: MediaResolution;
|
|
2757
2880
|
/** Optional. Positive penalties. */
|
|
2758
2881
|
presencePenalty?: number;
|
|
2882
|
+
/** 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. */
|
|
2883
|
+
responseJsonSchema?: unknown;
|
|
2759
2884
|
/** Optional. If true, export the logprobs results in response. */
|
|
2760
2885
|
responseLogprobs?: boolean;
|
|
2761
2886
|
/** Optional. Output response mimetype of the generated candidate text. Supported mimetype: - `text/plain`: (default) Text output. - `application/json`: JSON response in the candidates. The model needs to be prompted to output the appropriate response type, otherwise the behavior is undefined. This is a preview feature. */
|
|
@@ -2764,8 +2889,6 @@ export declare interface GenerationConfig {
|
|
|
2764
2889
|
responseModalities?: Modality[];
|
|
2765
2890
|
/** 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. */
|
|
2766
2891
|
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;
|
|
2769
2892
|
/** Optional. Routing configuration. */
|
|
2770
2893
|
routingConfig?: GenerationConfigRoutingConfig;
|
|
2771
2894
|
/** Optional. Seed. */
|
|
@@ -3143,7 +3266,7 @@ export declare interface GroundingMetadata {
|
|
|
3143
3266
|
|
|
3144
3267
|
/** Grounding support. */
|
|
3145
3268
|
export declare interface GroundingSupport {
|
|
3146
|
-
/** Confidence score of the support references. Ranges from 0 to 1. 1 is the most confident.
|
|
3269
|
+
/** Confidence score of the support references. Ranges from 0 to 1. 1 is the most confident. For Gemini 2.0 and before, this list must have the same size as the grounding_chunk_indices. For Gemini 2.5 and after, this list will be empty and should be ignored. */
|
|
3147
3270
|
confidenceScores?: number[];
|
|
3148
3271
|
/** A list of indices (into 'grounding_chunk') specifying the citations associated with the claim. For instance [1,3,4] means that grounding_chunk[1], grounding_chunk[3], grounding_chunk[4] are the retrieved content attributed to the claim. */
|
|
3149
3272
|
groundingChunkIndices?: number[];
|
|
@@ -3220,7 +3343,23 @@ export declare enum HarmCategory {
|
|
|
3220
3343
|
/**
|
|
3221
3344
|
* Deprecated: Election filter is not longer supported. The harm category is civic integrity.
|
|
3222
3345
|
*/
|
|
3223
|
-
HARM_CATEGORY_CIVIC_INTEGRITY = "HARM_CATEGORY_CIVIC_INTEGRITY"
|
|
3346
|
+
HARM_CATEGORY_CIVIC_INTEGRITY = "HARM_CATEGORY_CIVIC_INTEGRITY",
|
|
3347
|
+
/**
|
|
3348
|
+
* The harm category is image hate.
|
|
3349
|
+
*/
|
|
3350
|
+
HARM_CATEGORY_IMAGE_HATE = "HARM_CATEGORY_IMAGE_HATE",
|
|
3351
|
+
/**
|
|
3352
|
+
* The harm category is image dangerous content.
|
|
3353
|
+
*/
|
|
3354
|
+
HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT = "HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT",
|
|
3355
|
+
/**
|
|
3356
|
+
* The harm category is image harassment.
|
|
3357
|
+
*/
|
|
3358
|
+
HARM_CATEGORY_IMAGE_HARASSMENT = "HARM_CATEGORY_IMAGE_HARASSMENT",
|
|
3359
|
+
/**
|
|
3360
|
+
* The harm category is image sexually explicit content.
|
|
3361
|
+
*/
|
|
3362
|
+
HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT = "HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT"
|
|
3224
3363
|
}
|
|
3225
3364
|
|
|
3226
3365
|
/** Output only. Harm probability levels in the content. */
|
|
@@ -3354,7 +3493,8 @@ declare interface Image_2 {
|
|
|
3354
3493
|
gcsUri?: string;
|
|
3355
3494
|
/** The image bytes data. ``Image`` can contain a value for this field
|
|
3356
3495
|
or the ``gcs_uri`` field but not both.
|
|
3357
|
-
|
|
3496
|
+
|
|
3497
|
+
* @remarks Encoded as base64 string. */
|
|
3358
3498
|
imageBytes?: string;
|
|
3359
3499
|
/** The MIME type of the image. */
|
|
3360
3500
|
mimeType?: string;
|
|
@@ -3363,11 +3503,38 @@ export { Image_2 as Image }
|
|
|
3363
3503
|
|
|
3364
3504
|
/** Enum that specifies the language of the text in the prompt. */
|
|
3365
3505
|
export declare enum ImagePromptLanguage {
|
|
3506
|
+
/**
|
|
3507
|
+
* Auto-detect the language.
|
|
3508
|
+
*/
|
|
3366
3509
|
auto = "auto",
|
|
3510
|
+
/**
|
|
3511
|
+
* English
|
|
3512
|
+
*/
|
|
3367
3513
|
en = "en",
|
|
3514
|
+
/**
|
|
3515
|
+
* Japanese
|
|
3516
|
+
*/
|
|
3368
3517
|
ja = "ja",
|
|
3518
|
+
/**
|
|
3519
|
+
* Korean
|
|
3520
|
+
*/
|
|
3369
3521
|
ko = "ko",
|
|
3370
|
-
|
|
3522
|
+
/**
|
|
3523
|
+
* Hindi
|
|
3524
|
+
*/
|
|
3525
|
+
hi = "hi",
|
|
3526
|
+
/**
|
|
3527
|
+
* Chinese
|
|
3528
|
+
*/
|
|
3529
|
+
zh = "zh",
|
|
3530
|
+
/**
|
|
3531
|
+
* Portuguese
|
|
3532
|
+
*/
|
|
3533
|
+
pt = "pt",
|
|
3534
|
+
/**
|
|
3535
|
+
* Spanish
|
|
3536
|
+
*/
|
|
3537
|
+
es = "es"
|
|
3371
3538
|
}
|
|
3372
3539
|
|
|
3373
3540
|
/** Config for inlined request. */
|
|
@@ -3665,7 +3832,7 @@ export declare class Live {
|
|
|
3665
3832
|
if (GOOGLE_GENAI_USE_VERTEXAI) {
|
|
3666
3833
|
model = 'gemini-2.0-flash-live-preview-04-09';
|
|
3667
3834
|
} else {
|
|
3668
|
-
model = 'gemini-2.
|
|
3835
|
+
model = 'gemini-live-2.5-flash-preview';
|
|
3669
3836
|
}
|
|
3670
3837
|
const session = await ai.live.connect({
|
|
3671
3838
|
model: model,
|
|
@@ -4366,6 +4533,8 @@ export declare interface LiveServerSessionResumptionUpdate {
|
|
|
4366
4533
|
}
|
|
4367
4534
|
|
|
4368
4535
|
export declare interface LiveServerSetupComplete {
|
|
4536
|
+
/** The session id of the live session. */
|
|
4537
|
+
sessionId?: string;
|
|
4369
4538
|
}
|
|
4370
4539
|
|
|
4371
4540
|
/** Request for the client to execute the `function_calls` and return the responses with the matching `id`s. */
|
|
@@ -4629,6 +4798,14 @@ export declare class Models extends BaseModule {
|
|
|
4629
4798
|
* ```
|
|
4630
4799
|
*/
|
|
4631
4800
|
generateContent: (params: types.GenerateContentParameters) => Promise<types.GenerateContentResponse>;
|
|
4801
|
+
/**
|
|
4802
|
+
* This logic is needed for GenerateContentConfig only.
|
|
4803
|
+
* Previously we made GenerateContentConfig.responseSchema field to accept
|
|
4804
|
+
* unknown. Since v1.9.0, we switch to use backend JSON schema support.
|
|
4805
|
+
* To maintain backward compatibility, we move the data that was treated as
|
|
4806
|
+
* JSON schema from the responseSchema field to the responseJsonSchema field.
|
|
4807
|
+
*/
|
|
4808
|
+
private maybeMoveToResponseJsonSchem;
|
|
4632
4809
|
/**
|
|
4633
4810
|
* Makes an API request to generate content with a given model and yields the
|
|
4634
4811
|
* response in chunks.
|
|
@@ -5099,7 +5276,8 @@ export declare interface Part {
|
|
|
5099
5276
|
inlineData?: Blob_2;
|
|
5100
5277
|
/** Optional. URI based data. */
|
|
5101
5278
|
fileData?: FileData;
|
|
5102
|
-
/** An opaque signature for the thought so it can be reused in subsequent requests.
|
|
5279
|
+
/** An opaque signature for the thought so it can be reused in subsequent requests.
|
|
5280
|
+
* @remarks Encoded as base64 string. */
|
|
5103
5281
|
thoughtSignature?: string;
|
|
5104
5282
|
/** Optional. Result of executing the [ExecutableCode]. */
|
|
5105
5283
|
codeExecutionResult?: CodeExecutionResult;
|
|
@@ -5304,6 +5482,8 @@ export declare class ReplayResponse {
|
|
|
5304
5482
|
export declare interface Retrieval {
|
|
5305
5483
|
/** Optional. Deprecated. This option is no longer supported. */
|
|
5306
5484
|
disableAttribution?: boolean;
|
|
5485
|
+
/** Use data source powered by external API for grounding. */
|
|
5486
|
+
externalApi?: ExternalApi;
|
|
5307
5487
|
/** Set to use data source powered by Vertex AI Search. */
|
|
5308
5488
|
vertexAiSearch?: VertexAISearch;
|
|
5309
5489
|
/** Set to use data source powered by Vertex RAG store. User data is uploaded via the VertexRagDataService. */
|
|
@@ -5352,6 +5532,8 @@ export declare interface SafetyRating {
|
|
|
5352
5532
|
blocked?: boolean;
|
|
5353
5533
|
/** Output only. Harm category. */
|
|
5354
5534
|
category?: HarmCategory;
|
|
5535
|
+
/** Output only. The overwritten threshold for the safety category of Gemini 2.0 image out. If minors are detected in the output image, the threshold of each safety category will be overwritten if user sets a lower threshold. */
|
|
5536
|
+
overwrittenThreshold?: HarmBlockThreshold;
|
|
5355
5537
|
/** Output only. Harm probability levels in the content. */
|
|
5356
5538
|
probability?: HarmProbability;
|
|
5357
5539
|
/** Output only. Harm probability score. */
|
|
@@ -5488,7 +5670,8 @@ export declare type SchemaUnion = Schema | unknown;
|
|
|
5488
5670
|
export declare interface SearchEntryPoint {
|
|
5489
5671
|
/** Optional. Web content snippet that can be embedded in a web page or an app webview. */
|
|
5490
5672
|
renderedContent?: string;
|
|
5491
|
-
/** Optional. Base64 encoded JSON representing array of tuple.
|
|
5673
|
+
/** Optional. Base64 encoded JSON representing array of tuple.
|
|
5674
|
+
* @remarks Encoded as base64 string. */
|
|
5492
5675
|
sdkBlob?: string;
|
|
5493
5676
|
}
|
|
5494
5677
|
|
|
@@ -5635,7 +5818,7 @@ export declare class Session {
|
|
|
5635
5818
|
if (GOOGLE_GENAI_USE_VERTEXAI) {
|
|
5636
5819
|
model = 'gemini-2.0-flash-live-preview-04-09';
|
|
5637
5820
|
} else {
|
|
5638
|
-
model = 'gemini-2.
|
|
5821
|
+
model = 'gemini-live-2.5-flash-preview';
|
|
5639
5822
|
}
|
|
5640
5823
|
const session = await ai.live.connect({
|
|
5641
5824
|
model: model,
|
|
@@ -5809,7 +5992,7 @@ export declare interface SupervisedHyperParameters {
|
|
|
5809
5992
|
adapterSize?: AdapterSize;
|
|
5810
5993
|
/** Optional. Number of complete passes the model makes over the entire training dataset during training. */
|
|
5811
5994
|
epochCount?: string;
|
|
5812
|
-
/** Optional. Multiplier for adjusting the default learning rate. */
|
|
5995
|
+
/** Optional. Multiplier for adjusting the default learning rate. Mutually exclusive with `learning_rate`. */
|
|
5813
5996
|
learningRateMultiplier?: number;
|
|
5814
5997
|
}
|
|
5815
5998
|
|
|
@@ -5879,9 +6062,9 @@ export declare interface SupervisedTuningSpec {
|
|
|
5879
6062
|
exportLastCheckpointOnly?: boolean;
|
|
5880
6063
|
/** Optional. Hyperparameters for SFT. */
|
|
5881
6064
|
hyperParameters?: SupervisedHyperParameters;
|
|
5882
|
-
/** Required.
|
|
6065
|
+
/** Required. Training dataset used for tuning. The dataset can be specified as either a Cloud Storage path to a JSONL file or as the resource name of a Vertex Multimodal Dataset. */
|
|
5883
6066
|
trainingDatasetUri?: string;
|
|
5884
|
-
/** Optional.
|
|
6067
|
+
/** Optional. Validation dataset used for tuning. The dataset can be specified as either a Cloud Storage path to a JSONL file or as the resource name of a Vertex Multimodal Dataset. */
|
|
5885
6068
|
validationDatasetUri?: string;
|
|
5886
6069
|
}
|
|
5887
6070
|
|
|
@@ -5930,14 +6113,20 @@ export declare class Tokens extends BaseModule {
|
|
|
5930
6113
|
* @experimental
|
|
5931
6114
|
*
|
|
5932
6115
|
* @remarks
|
|
5933
|
-
*
|
|
6116
|
+
* Ephemeral auth tokens is only supported in the Gemini Developer API.
|
|
5934
6117
|
* It can be used for the session connection to the Live constrained API.
|
|
6118
|
+
* Support in v1alpha only.
|
|
5935
6119
|
*
|
|
5936
6120
|
* @param params - The parameters for the create request.
|
|
5937
6121
|
* @return The created auth token.
|
|
5938
6122
|
*
|
|
5939
6123
|
* @example
|
|
5940
6124
|
* ```ts
|
|
6125
|
+
* const ai = new GoogleGenAI({
|
|
6126
|
+
* apiKey: token.name,
|
|
6127
|
+
* httpOptions: { apiVersion: 'v1alpha' } // Support in v1alpha only.
|
|
6128
|
+
* });
|
|
6129
|
+
*
|
|
5941
6130
|
* // Case 1: If LiveEphemeralParameters is unset, unlock LiveConnectConfig
|
|
5942
6131
|
* // when using the token in Live API sessions. Each session connection can
|
|
5943
6132
|
* // use a different configuration.
|
|
@@ -6010,7 +6199,8 @@ export declare interface TokensInfo {
|
|
|
6010
6199
|
role?: string;
|
|
6011
6200
|
/** A list of token ids from the input. */
|
|
6012
6201
|
tokenIds?: string[];
|
|
6013
|
-
/** A list of tokens from the input.
|
|
6202
|
+
/** A list of tokens from the input.
|
|
6203
|
+
* @remarks Encoded as base64 string. */
|
|
6014
6204
|
tokens?: string[];
|
|
6015
6205
|
}
|
|
6016
6206
|
|
|
@@ -6035,12 +6225,20 @@ export declare interface Tool {
|
|
|
6035
6225
|
urlContext?: UrlContext;
|
|
6036
6226
|
/** Optional. CodeExecution tool type. Enables the model to execute code as part of generation. */
|
|
6037
6227
|
codeExecution?: ToolCodeExecution;
|
|
6228
|
+
/** Optional. Tool to support the model interacting directly with the computer. If enabled, it automatically populates computer-use specific Function Declarations. */
|
|
6229
|
+
computerUse?: ToolComputerUse;
|
|
6038
6230
|
}
|
|
6039
6231
|
|
|
6040
6232
|
/** Tool that executes code generated by the model, and automatically returns the result to the model. See also [ExecutableCode]and [CodeExecutionResult] which are input and output to this tool. */
|
|
6041
6233
|
export declare interface ToolCodeExecution {
|
|
6042
6234
|
}
|
|
6043
6235
|
|
|
6236
|
+
/** Tool to support computer use. */
|
|
6237
|
+
export declare interface ToolComputerUse {
|
|
6238
|
+
/** Required. The environment being operated. */
|
|
6239
|
+
environment?: Environment;
|
|
6240
|
+
}
|
|
6241
|
+
|
|
6044
6242
|
/** Tool config.
|
|
6045
6243
|
|
|
6046
6244
|
This config is shared for all tools provided in the request.
|
|
@@ -6124,6 +6322,8 @@ export declare interface TunedModelInfo {
|
|
|
6124
6322
|
export declare interface TuningDataset {
|
|
6125
6323
|
/** GCS URI of the file containing training dataset in JSONL format. */
|
|
6126
6324
|
gcsUri?: string;
|
|
6325
|
+
/** 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'. */
|
|
6326
|
+
vertexDatasetResource?: string;
|
|
6127
6327
|
/** Inline examples with simple input/output text. */
|
|
6128
6328
|
examples?: TuningExample[];
|
|
6129
6329
|
}
|
|
@@ -6181,6 +6381,10 @@ export declare interface TuningJob {
|
|
|
6181
6381
|
labels?: Record<string, string>;
|
|
6182
6382
|
/** Output only. The resource name of the PipelineJob associated with the TuningJob. Format: `projects/{project}/locations/{location}/pipelineJobs/{pipeline_job}`. */
|
|
6183
6383
|
pipelineJob?: string;
|
|
6384
|
+
/** Output only. Reserved for future use. */
|
|
6385
|
+
satisfiesPzi?: boolean;
|
|
6386
|
+
/** Output only. Reserved for future use. */
|
|
6387
|
+
satisfiesPzs?: boolean;
|
|
6184
6388
|
/** The service account that the tuningJob workload runs as. If not specified, the Vertex AI Secure Fine-Tuned Service Agent in the project will be used. See https://cloud.google.com/iam/docs/service-agents#vertex-ai-secure-fine-tuning-service-agent Users starting the pipeline must have the `iam.serviceAccounts.actAs` permission on this service account. */
|
|
6185
6389
|
serviceAccount?: string;
|
|
6186
6390
|
/** Optional. The display name of the TunedModel. The name can be up to 128 characters long and can consist of any UTF-8 characters. */
|
|
@@ -6229,6 +6433,8 @@ declare class Tunings extends BaseModule {
|
|
|
6229
6433
|
export declare interface TuningValidationDataset {
|
|
6230
6434
|
/** GCS URI of the file containing validation dataset in JSONL format. */
|
|
6231
6435
|
gcsUri?: string;
|
|
6436
|
+
/** 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'. */
|
|
6437
|
+
vertexDatasetResource?: string;
|
|
6232
6438
|
}
|
|
6233
6439
|
|
|
6234
6440
|
/** Options about which input is included in the user's turn. */
|
|
@@ -6302,6 +6508,9 @@ declare namespace types {
|
|
|
6302
6508
|
HarmBlockThreshold,
|
|
6303
6509
|
Mode,
|
|
6304
6510
|
AuthType,
|
|
6511
|
+
ApiSpec,
|
|
6512
|
+
Environment,
|
|
6513
|
+
UrlRetrievalStatus,
|
|
6305
6514
|
FinishReason,
|
|
6306
6515
|
HarmProbability,
|
|
6307
6516
|
HarmSeverity,
|
|
@@ -6315,7 +6524,6 @@ declare namespace types {
|
|
|
6315
6524
|
Behavior,
|
|
6316
6525
|
DynamicRetrievalConfigMode,
|
|
6317
6526
|
FunctionCallingConfigMode,
|
|
6318
|
-
UrlRetrievalStatus,
|
|
6319
6527
|
SafetyFilterLevel,
|
|
6320
6528
|
PersonGeneration,
|
|
6321
6529
|
ImagePromptLanguage,
|
|
@@ -6361,6 +6569,11 @@ declare namespace types {
|
|
|
6361
6569
|
AuthConfig,
|
|
6362
6570
|
GoogleMaps,
|
|
6363
6571
|
UrlContext,
|
|
6572
|
+
ApiAuthApiKeyConfig,
|
|
6573
|
+
ApiAuth,
|
|
6574
|
+
ExternalApiElasticSearchParams,
|
|
6575
|
+
ExternalApiSimpleSearchParams,
|
|
6576
|
+
ExternalApi,
|
|
6364
6577
|
VertexAISearchDataStoreSpec,
|
|
6365
6578
|
VertexAISearch,
|
|
6366
6579
|
VertexRagStoreRagResource,
|
|
@@ -6373,6 +6586,7 @@ declare namespace types {
|
|
|
6373
6586
|
VertexRagStore,
|
|
6374
6587
|
Retrieval,
|
|
6375
6588
|
ToolCodeExecution,
|
|
6589
|
+
ToolComputerUse,
|
|
6376
6590
|
Tool,
|
|
6377
6591
|
FunctionCallingConfig,
|
|
6378
6592
|
LatLng,
|
|
@@ -6537,6 +6751,9 @@ declare namespace types {
|
|
|
6537
6751
|
ListBatchJobsConfig,
|
|
6538
6752
|
ListBatchJobsParameters,
|
|
6539
6753
|
ListBatchJobsResponse,
|
|
6754
|
+
DeleteBatchJobConfig,
|
|
6755
|
+
DeleteBatchJobParameters,
|
|
6756
|
+
DeleteResourceJob,
|
|
6540
6757
|
GetOperationConfig,
|
|
6541
6758
|
GetOperationParameters,
|
|
6542
6759
|
FetchPredictOperationConfig,
|
|
@@ -6885,7 +7102,8 @@ export declare interface VertexRagStoreRagResource {
|
|
|
6885
7102
|
export declare interface Video {
|
|
6886
7103
|
/** Path to another storage. */
|
|
6887
7104
|
uri?: string;
|
|
6888
|
-
/** Video bytes.
|
|
7105
|
+
/** Video bytes.
|
|
7106
|
+
* @remarks Encoded as base64 string. */
|
|
6889
7107
|
videoBytes?: string;
|
|
6890
7108
|
/** Video encoding, for example "video/mp4". */
|
|
6891
7109
|
mimeType?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@google/genai",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/node/index.mjs",
|
|
@@ -91,13 +91,13 @@
|
|
|
91
91
|
"tsx": "^4.19.4",
|
|
92
92
|
"typedoc": "^0.27.0",
|
|
93
93
|
"typescript": "~5.2.0",
|
|
94
|
-
"typescript-eslint": "8.24.1"
|
|
94
|
+
"typescript-eslint": "8.24.1",
|
|
95
|
+
"zod": "^3.22.4",
|
|
96
|
+
"zod-to-json-schema": "^3.22.4"
|
|
95
97
|
},
|
|
96
98
|
"dependencies": {
|
|
97
99
|
"google-auth-library": "^9.14.2",
|
|
98
|
-
"ws": "^8.18.0"
|
|
99
|
-
"zod": "^3.22.4",
|
|
100
|
-
"zod-to-json-schema": "^3.22.4"
|
|
100
|
+
"ws": "^8.18.0"
|
|
101
101
|
},
|
|
102
102
|
"peerDependencies": {
|
|
103
103
|
"@modelcontextprotocol/sdk": "^1.11.0"
|