@google/genai 1.47.0 → 1.49.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 +127 -90
- package/dist/index.cjs +15 -30
- package/dist/index.mjs +15 -30
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +15 -27
- package/dist/node/index.mjs +15 -27
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +127 -90
- package/dist/tokenizer/node.cjs +4 -4
- package/dist/tokenizer/node.mjs +4 -4
- package/dist/tokenizer/node.mjs.map +1 -1
- package/dist/vertex_internal/index.cjs +5 -5
- package/dist/vertex_internal/index.cjs.map +1 -1
- package/dist/vertex_internal/index.d.ts +5 -5
- package/dist/vertex_internal/index.js +5 -5
- package/dist/vertex_internal/index.js.map +1 -1
- package/dist/web/index.mjs +15 -27
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +127 -90
- package/package.json +1 -1
package/dist/genai.d.ts
CHANGED
|
@@ -465,6 +465,10 @@ export declare interface AudioChunk {
|
|
|
465
465
|
*/
|
|
466
466
|
declare interface AudioContent {
|
|
467
467
|
type: 'audio';
|
|
468
|
+
/**
|
|
469
|
+
* The number of audio channels.
|
|
470
|
+
*/
|
|
471
|
+
channels?: number;
|
|
468
472
|
/**
|
|
469
473
|
* The audio content.
|
|
470
474
|
*/
|
|
@@ -472,7 +476,11 @@ declare interface AudioContent {
|
|
|
472
476
|
/**
|
|
473
477
|
* The mime type of the audio.
|
|
474
478
|
*/
|
|
475
|
-
mime_type?: 'audio/wav' | 'audio/mp3' | 'audio/aiff' | 'audio/aac' | 'audio/ogg' | 'audio/flac' | 'audio/mpeg' | 'audio/m4a';
|
|
479
|
+
mime_type?: 'audio/wav' | 'audio/mp3' | 'audio/aiff' | 'audio/aac' | 'audio/ogg' | 'audio/flac' | 'audio/mpeg' | 'audio/m4a' | 'audio/l16';
|
|
480
|
+
/**
|
|
481
|
+
* The sample rate of the audio.
|
|
482
|
+
*/
|
|
483
|
+
rate?: number;
|
|
476
484
|
/**
|
|
477
485
|
* The URI of the audio.
|
|
478
486
|
*/
|
|
@@ -653,24 +661,26 @@ declare interface BaseCreateAgentInteractionParams {
|
|
|
653
661
|
*/
|
|
654
662
|
previous_interaction_id?: string;
|
|
655
663
|
/**
|
|
656
|
-
* Body param: Enforces that the generated response is a JSON object that complies
|
|
657
|
-
* the JSON schema specified in this field.
|
|
664
|
+
* Body param: Enforces that the generated response is a JSON object that complies
|
|
665
|
+
* with the JSON schema specified in this field.
|
|
658
666
|
*/
|
|
659
667
|
response_format?: unknown;
|
|
660
668
|
/**
|
|
661
|
-
* Body param: The mime type of the response. This is required if response_format
|
|
669
|
+
* Body param: The mime type of the response. This is required if response_format
|
|
670
|
+
* is set.
|
|
662
671
|
*/
|
|
663
672
|
response_mime_type?: string;
|
|
664
673
|
/**
|
|
665
674
|
* Body param: The requested modalities of the response (TEXT, IMAGE, AUDIO).
|
|
666
675
|
*/
|
|
667
|
-
response_modalities?: Array<'text' | 'image' | 'audio'>;
|
|
676
|
+
response_modalities?: Array<'text' | 'image' | 'audio' | 'video' | 'document'>;
|
|
668
677
|
/**
|
|
669
678
|
* Body param: The service tier for the interaction.
|
|
670
679
|
*/
|
|
671
680
|
service_tier?: 'flex' | 'standard' | 'priority';
|
|
672
681
|
/**
|
|
673
|
-
* Body param: Input only. Whether to store the response and request for later
|
|
682
|
+
* Body param: Input only. Whether to store the response and request for later
|
|
683
|
+
* retrieval.
|
|
674
684
|
*/
|
|
675
685
|
store?: boolean;
|
|
676
686
|
/**
|
|
@@ -713,24 +723,26 @@ declare interface BaseCreateModelInteractionParams {
|
|
|
713
723
|
*/
|
|
714
724
|
previous_interaction_id?: string;
|
|
715
725
|
/**
|
|
716
|
-
* Body param: Enforces that the generated response is a JSON object that complies
|
|
717
|
-
* the JSON schema specified in this field.
|
|
726
|
+
* Body param: Enforces that the generated response is a JSON object that complies
|
|
727
|
+
* with the JSON schema specified in this field.
|
|
718
728
|
*/
|
|
719
729
|
response_format?: unknown;
|
|
720
730
|
/**
|
|
721
|
-
* Body param: The mime type of the response. This is required if response_format
|
|
731
|
+
* Body param: The mime type of the response. This is required if response_format
|
|
732
|
+
* is set.
|
|
722
733
|
*/
|
|
723
734
|
response_mime_type?: string;
|
|
724
735
|
/**
|
|
725
736
|
* Body param: The requested modalities of the response (TEXT, IMAGE, AUDIO).
|
|
726
737
|
*/
|
|
727
|
-
response_modalities?: Array<'text' | 'image' | 'audio'>;
|
|
738
|
+
response_modalities?: Array<'text' | 'image' | 'audio' | 'video' | 'document'>;
|
|
728
739
|
/**
|
|
729
740
|
* Body param: The service tier for the interaction.
|
|
730
741
|
*/
|
|
731
742
|
service_tier?: 'flex' | 'standard' | 'priority';
|
|
732
743
|
/**
|
|
733
|
-
* Body param: Input only. Whether to store the response and request for later
|
|
744
|
+
* Body param: Input only. Whether to store the response and request for later
|
|
745
|
+
* retrieval.
|
|
734
746
|
*/
|
|
735
747
|
store?: boolean;
|
|
736
748
|
/**
|
|
@@ -868,7 +880,8 @@ declare class BaseInteractions extends APIResource {
|
|
|
868
880
|
*/
|
|
869
881
|
delete(id: string, params?: InteractionDeleteParams | null | undefined, options?: RequestOptions): APIPromise<unknown>;
|
|
870
882
|
/**
|
|
871
|
-
* Cancels an interaction by id. This only applies to background interactions that
|
|
883
|
+
* Cancels an interaction by id. This only applies to background interactions that
|
|
884
|
+
* are still running.
|
|
872
885
|
*
|
|
873
886
|
* @example
|
|
874
887
|
* ```ts
|
|
@@ -879,7 +892,8 @@ declare class BaseInteractions extends APIResource {
|
|
|
879
892
|
*/
|
|
880
893
|
cancel(id: string, params?: InteractionCancelParams | null | undefined, options?: RequestOptions): APIPromise<Interaction>;
|
|
881
894
|
/**
|
|
882
|
-
* Retrieves the full details of a single interaction based on its
|
|
895
|
+
* Retrieves the full details of a single interaction based on its
|
|
896
|
+
* `Interaction.id`.
|
|
883
897
|
*
|
|
884
898
|
* @example
|
|
885
899
|
* ```ts
|
|
@@ -1665,7 +1679,7 @@ declare interface ClientOptions {
|
|
|
1665
1679
|
/**
|
|
1666
1680
|
* The adapter to the parent API client instance (for accessing auth, project, location)
|
|
1667
1681
|
*/
|
|
1668
|
-
clientAdapter
|
|
1682
|
+
clientAdapter?: GeminiNextGenAPIClientAdapter | undefined;
|
|
1669
1683
|
}
|
|
1670
1684
|
|
|
1671
1685
|
/**
|
|
@@ -1824,12 +1838,11 @@ declare interface ContentDelta {
|
|
|
1824
1838
|
/**
|
|
1825
1839
|
* The delta content data for a content block.
|
|
1826
1840
|
*/
|
|
1827
|
-
delta: ContentDelta.Text | ContentDelta.Image | ContentDelta.Audio | ContentDelta.Document | ContentDelta.Video | ContentDelta.ThoughtSummary | ContentDelta.ThoughtSignature | ContentDelta.FunctionCall | ContentDelta.CodeExecutionCall | ContentDelta.URLContextCall | ContentDelta.GoogleSearchCall | ContentDelta.MCPServerToolCall | ContentDelta.FileSearchCall | ContentDelta.GoogleMapsCall | ContentDelta.FunctionResult | ContentDelta.CodeExecutionResult | ContentDelta.URLContextResult | ContentDelta.GoogleSearchResult | ContentDelta.MCPServerToolResult | ContentDelta.FileSearchResult | ContentDelta.GoogleMapsResult;
|
|
1841
|
+
delta: ContentDelta.Text | ContentDelta.Image | ContentDelta.Audio | ContentDelta.Document | ContentDelta.Video | ContentDelta.ThoughtSummary | ContentDelta.ThoughtSignature | ContentDelta.FunctionCall | ContentDelta.CodeExecutionCall | ContentDelta.URLContextCall | ContentDelta.GoogleSearchCall | ContentDelta.MCPServerToolCall | ContentDelta.FileSearchCall | ContentDelta.GoogleMapsCall | ContentDelta.FunctionResult | ContentDelta.CodeExecutionResult | ContentDelta.URLContextResult | ContentDelta.GoogleSearchResult | ContentDelta.MCPServerToolResult | ContentDelta.FileSearchResult | ContentDelta.GoogleMapsResult | ContentDelta.TextAnnotation;
|
|
1828
1842
|
event_type: 'content.delta';
|
|
1829
1843
|
index: number;
|
|
1830
1844
|
/**
|
|
1831
|
-
* The event_id token to be used to resume the interaction stream, from
|
|
1832
|
-
* this event.
|
|
1845
|
+
* The event_id token to be used to resume the interaction stream, from this event.
|
|
1833
1846
|
*/
|
|
1834
1847
|
event_id?: string;
|
|
1835
1848
|
}
|
|
@@ -1838,10 +1851,6 @@ declare namespace ContentDelta {
|
|
|
1838
1851
|
interface Text {
|
|
1839
1852
|
text: string;
|
|
1840
1853
|
type: 'text';
|
|
1841
|
-
/**
|
|
1842
|
-
* Citation information for model-generated content.
|
|
1843
|
-
*/
|
|
1844
|
-
annotations?: Array<InteractionsAPI.Annotation>;
|
|
1845
1854
|
}
|
|
1846
1855
|
interface Image {
|
|
1847
1856
|
type: 'image';
|
|
@@ -1855,8 +1864,16 @@ declare namespace ContentDelta {
|
|
|
1855
1864
|
}
|
|
1856
1865
|
interface Audio {
|
|
1857
1866
|
type: 'audio';
|
|
1867
|
+
/**
|
|
1868
|
+
* The number of audio channels.
|
|
1869
|
+
*/
|
|
1870
|
+
channels?: number;
|
|
1858
1871
|
data?: string;
|
|
1859
|
-
mime_type?: 'audio/wav' | 'audio/mp3' | 'audio/aiff' | 'audio/aac' | 'audio/ogg' | 'audio/flac' | 'audio/mpeg' | 'audio/m4a';
|
|
1872
|
+
mime_type?: 'audio/wav' | 'audio/mp3' | 'audio/aiff' | 'audio/aac' | 'audio/ogg' | 'audio/flac' | 'audio/mpeg' | 'audio/m4a' | 'audio/l16';
|
|
1873
|
+
/**
|
|
1874
|
+
* The sample rate of the audio.
|
|
1875
|
+
*/
|
|
1876
|
+
rate?: number;
|
|
1860
1877
|
uri?: string;
|
|
1861
1878
|
}
|
|
1862
1879
|
interface Document {
|
|
@@ -2096,6 +2113,13 @@ declare namespace ContentDelta {
|
|
|
2096
2113
|
*/
|
|
2097
2114
|
signature?: string;
|
|
2098
2115
|
}
|
|
2116
|
+
interface TextAnnotation {
|
|
2117
|
+
type: 'text_annotation';
|
|
2118
|
+
/**
|
|
2119
|
+
* Citation information for model-generated content.
|
|
2120
|
+
*/
|
|
2121
|
+
annotations?: Array<InteractionsAPI.Annotation>;
|
|
2122
|
+
}
|
|
2099
2123
|
}
|
|
2100
2124
|
|
|
2101
2125
|
/** The embedding generated from an input content. */
|
|
@@ -2146,8 +2170,7 @@ declare interface ContentStart {
|
|
|
2146
2170
|
event_type: 'content.start';
|
|
2147
2171
|
index: number;
|
|
2148
2172
|
/**
|
|
2149
|
-
* The event_id token to be used to resume the interaction stream, from
|
|
2150
|
-
* this event.
|
|
2173
|
+
* The event_id token to be used to resume the interaction stream, from this event.
|
|
2151
2174
|
*/
|
|
2152
2175
|
event_id?: string;
|
|
2153
2176
|
}
|
|
@@ -2156,8 +2179,7 @@ declare interface ContentStop {
|
|
|
2156
2179
|
event_type: 'content.stop';
|
|
2157
2180
|
index: number;
|
|
2158
2181
|
/**
|
|
2159
|
-
* The event_id token to be used to resume the interaction stream, from
|
|
2160
|
-
* this event.
|
|
2182
|
+
* The event_id token to be used to resume the interaction stream, from this event.
|
|
2161
2183
|
*/
|
|
2162
2184
|
event_id?: string;
|
|
2163
2185
|
}
|
|
@@ -3396,8 +3418,7 @@ declare interface ErrorEvent_2 {
|
|
|
3396
3418
|
*/
|
|
3397
3419
|
error?: ErrorEvent_2.Error;
|
|
3398
3420
|
/**
|
|
3399
|
-
* The event_id token to be used to resume the interaction stream, from
|
|
3400
|
-
* this event.
|
|
3421
|
+
* The event_id token to be used to resume the interaction stream, from this event.
|
|
3401
3422
|
*/
|
|
3402
3423
|
event_id?: string;
|
|
3403
3424
|
}
|
|
@@ -4467,7 +4488,7 @@ export declare interface GenerateContentConfig {
|
|
|
4467
4488
|
service. If supplied, safety_settings must not be supplied.
|
|
4468
4489
|
*/
|
|
4469
4490
|
modelArmorConfig?: ModelArmorConfig;
|
|
4470
|
-
/** The service tier to use for the request. For example,
|
|
4491
|
+
/** The service tier to use for the request. For example, ServiceTier.FLEX. */
|
|
4471
4492
|
serviceTier?: ServiceTier;
|
|
4472
4493
|
}
|
|
4473
4494
|
|
|
@@ -5376,8 +5397,8 @@ declare namespace GoogleMapsResult {
|
|
|
5376
5397
|
*/
|
|
5377
5398
|
place_id?: string;
|
|
5378
5399
|
/**
|
|
5379
|
-
* Snippets of reviews that are used to generate answers about the
|
|
5380
|
-
*
|
|
5400
|
+
* Snippets of reviews that are used to generate answers about the features of a
|
|
5401
|
+
* given place in Google Maps.
|
|
5381
5402
|
*/
|
|
5382
5403
|
review_snippets?: Array<Place.ReviewSnippet>;
|
|
5383
5404
|
/**
|
|
@@ -5387,8 +5408,8 @@ declare namespace GoogleMapsResult {
|
|
|
5387
5408
|
}
|
|
5388
5409
|
namespace Place {
|
|
5389
5410
|
/**
|
|
5390
|
-
* Encapsulates a snippet of a user review that answers a question about
|
|
5391
|
-
*
|
|
5411
|
+
* Encapsulates a snippet of a user review that answers a question about the
|
|
5412
|
+
* features of a specific place in Google Maps.
|
|
5392
5413
|
*/
|
|
5393
5414
|
interface ReviewSnippet {
|
|
5394
5415
|
/**
|
|
@@ -5474,7 +5495,7 @@ declare interface GoogleSearchCallContent {
|
|
|
5474
5495
|
/**
|
|
5475
5496
|
* The type of search grounding enabled.
|
|
5476
5497
|
*/
|
|
5477
|
-
search_type?: 'web_search' | 'image_search';
|
|
5498
|
+
search_type?: 'web_search' | 'image_search' | 'enterprise_web_search';
|
|
5478
5499
|
/**
|
|
5479
5500
|
* A signature hash for backend validation.
|
|
5480
5501
|
*/
|
|
@@ -6220,8 +6241,8 @@ declare interface Interaction {
|
|
|
6220
6241
|
*/
|
|
6221
6242
|
id: string;
|
|
6222
6243
|
/**
|
|
6223
|
-
* Required. Output only. The time at which the response was created in ISO 8601
|
|
6224
|
-
* (YYYY-MM-DDThh:mm:ssZ).
|
|
6244
|
+
* Required. Output only. The time at which the response was created in ISO 8601
|
|
6245
|
+
* format (YYYY-MM-DDThh:mm:ssZ).
|
|
6225
6246
|
*/
|
|
6226
6247
|
created: string;
|
|
6227
6248
|
/**
|
|
@@ -6229,8 +6250,8 @@ declare interface Interaction {
|
|
|
6229
6250
|
*/
|
|
6230
6251
|
status: 'in_progress' | 'requires_action' | 'completed' | 'failed' | 'cancelled' | 'incomplete';
|
|
6231
6252
|
/**
|
|
6232
|
-
* Required. Output only. The time at which the response was last updated in ISO
|
|
6233
|
-
* (YYYY-MM-DDThh:mm:ssZ).
|
|
6253
|
+
* Required. Output only. The time at which the response was last updated in ISO
|
|
6254
|
+
* 8601 format (YYYY-MM-DDThh:mm:ssZ).
|
|
6234
6255
|
*/
|
|
6235
6256
|
updated: string;
|
|
6236
6257
|
/**
|
|
@@ -6258,8 +6279,8 @@ declare interface Interaction {
|
|
|
6258
6279
|
*/
|
|
6259
6280
|
previous_interaction_id?: string;
|
|
6260
6281
|
/**
|
|
6261
|
-
* Enforces that the generated response is a JSON object that complies with
|
|
6262
|
-
*
|
|
6282
|
+
* Enforces that the generated response is a JSON object that complies with the
|
|
6283
|
+
* JSON schema specified in this field.
|
|
6263
6284
|
*/
|
|
6264
6285
|
response_format?: unknown;
|
|
6265
6286
|
/**
|
|
@@ -6269,7 +6290,7 @@ declare interface Interaction {
|
|
|
6269
6290
|
/**
|
|
6270
6291
|
* The requested modalities of the response (TEXT, IMAGE, AUDIO).
|
|
6271
6292
|
*/
|
|
6272
|
-
response_modalities?: Array<'text' | 'image' | 'audio'>;
|
|
6293
|
+
response_modalities?: Array<'text' | 'image' | 'audio' | 'video' | 'document'>;
|
|
6273
6294
|
/**
|
|
6274
6295
|
* Output only. The role of the interaction.
|
|
6275
6296
|
*/
|
|
@@ -6302,13 +6323,12 @@ declare interface InteractionCancelParams {
|
|
|
6302
6323
|
declare interface InteractionCompleteEvent {
|
|
6303
6324
|
event_type: 'interaction.complete';
|
|
6304
6325
|
/**
|
|
6305
|
-
* Required. The completed interaction with empty outputs to reduce the payload
|
|
6306
|
-
* Use the preceding ContentDelta events for the actual output.
|
|
6326
|
+
* Required. The completed interaction with empty outputs to reduce the payload
|
|
6327
|
+
* size. Use the preceding ContentDelta events for the actual output.
|
|
6307
6328
|
*/
|
|
6308
6329
|
interaction: Interaction;
|
|
6309
6330
|
/**
|
|
6310
|
-
* The event_id token to be used to resume the interaction stream, from
|
|
6311
|
-
* this event.
|
|
6331
|
+
* The event_id token to be used to resume the interaction stream, from this event.
|
|
6312
6332
|
*/
|
|
6313
6333
|
event_id?: string;
|
|
6314
6334
|
}
|
|
@@ -6341,25 +6361,30 @@ declare interface InteractionGetParamsBase {
|
|
|
6341
6361
|
*/
|
|
6342
6362
|
include_input?: boolean;
|
|
6343
6363
|
/**
|
|
6344
|
-
* Query param: Optional. If set, resumes the interaction stream from the next
|
|
6364
|
+
* Query param: Optional. If set, resumes the interaction stream from the next
|
|
6365
|
+
* chunk after the event marked by the event id. Can only be used if `stream` is
|
|
6366
|
+
* true.
|
|
6345
6367
|
*/
|
|
6346
6368
|
last_event_id?: string;
|
|
6347
6369
|
/**
|
|
6348
|
-
* Query param: If set to true, the generated content will be streamed
|
|
6370
|
+
* Query param: If set to true, the generated content will be streamed
|
|
6371
|
+
* incrementally.
|
|
6349
6372
|
*/
|
|
6350
6373
|
stream?: boolean;
|
|
6351
6374
|
}
|
|
6352
6375
|
|
|
6353
6376
|
declare interface InteractionGetParamsNonStreaming extends InteractionGetParamsBase {
|
|
6354
6377
|
/**
|
|
6355
|
-
* Query param: If set to true, the generated content will be streamed
|
|
6378
|
+
* Query param: If set to true, the generated content will be streamed
|
|
6379
|
+
* incrementally.
|
|
6356
6380
|
*/
|
|
6357
6381
|
stream?: false;
|
|
6358
6382
|
}
|
|
6359
6383
|
|
|
6360
6384
|
declare interface InteractionGetParamsStreaming extends InteractionGetParamsBase {
|
|
6361
6385
|
/**
|
|
6362
|
-
* Query param: If set to true, the generated content will be streamed
|
|
6386
|
+
* Query param: If set to true, the generated content will be streamed
|
|
6387
|
+
* incrementally.
|
|
6363
6388
|
*/
|
|
6364
6389
|
stream: true;
|
|
6365
6390
|
}
|
|
@@ -6456,8 +6481,7 @@ declare interface InteractionStartEvent {
|
|
|
6456
6481
|
*/
|
|
6457
6482
|
interaction: Interaction;
|
|
6458
6483
|
/**
|
|
6459
|
-
* The event_id token to be used to resume the interaction stream, from
|
|
6460
|
-
* this event.
|
|
6484
|
+
* The event_id token to be used to resume the interaction stream, from this event.
|
|
6461
6485
|
*/
|
|
6462
6486
|
event_id?: string;
|
|
6463
6487
|
}
|
|
@@ -6467,8 +6491,7 @@ declare interface InteractionStatusUpdate {
|
|
|
6467
6491
|
interaction_id: string;
|
|
6468
6492
|
status: 'in_progress' | 'requires_action' | 'completed' | 'failed' | 'cancelled' | 'incomplete';
|
|
6469
6493
|
/**
|
|
6470
|
-
* The event_id token to be used to resume the interaction stream, from
|
|
6471
|
-
* this event.
|
|
6494
|
+
* The event_id token to be used to resume the interaction stream, from this event.
|
|
6472
6495
|
*/
|
|
6473
6496
|
event_id?: string;
|
|
6474
6497
|
}
|
|
@@ -7859,7 +7882,8 @@ export declare interface Model {
|
|
|
7859
7882
|
}
|
|
7860
7883
|
|
|
7861
7884
|
/**
|
|
7862
|
-
* The model that will complete your prompt.\n\nSee
|
|
7885
|
+
* The model that will complete your prompt.\n\nSee
|
|
7886
|
+
* [models](https://ai.google.dev/gemini-api/docs/models) for additional details.
|
|
7863
7887
|
*/
|
|
7864
7888
|
declare type Model_2 = 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro' | 'gemini-2.5-pro-preview-tts' | 'gemini-3-flash-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-pro-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'lyria-3-clip-preview' | 'lyria-3-pro-preview' | (string & {});
|
|
7865
7889
|
|
|
@@ -8122,29 +8146,15 @@ export declare class Models extends BaseModule {
|
|
|
8122
8146
|
/**
|
|
8123
8147
|
* Recontextualizes an image.
|
|
8124
8148
|
*
|
|
8125
|
-
* There
|
|
8126
|
-
* 1)
|
|
8127
|
-
* and contexts.
|
|
8128
|
-
* 2) Virtual Try-On: Generate images of persons modeling fashion products.
|
|
8149
|
+
* There is one type of recontextualization currently supported:
|
|
8150
|
+
* 1) Virtual Try-On: Generate images of persons modeling fashion products.
|
|
8129
8151
|
*
|
|
8130
8152
|
* @param params - The parameters for recontextualizing an image.
|
|
8131
8153
|
* @return The response from the API.
|
|
8132
8154
|
*
|
|
8133
8155
|
* @example
|
|
8134
8156
|
* ```ts
|
|
8135
|
-
* const
|
|
8136
|
-
* model: 'imagen-product-recontext-preview-06-30',
|
|
8137
|
-
* source: {
|
|
8138
|
-
* prompt: 'In a modern kitchen setting.',
|
|
8139
|
-
* productImages: [productImage],
|
|
8140
|
-
* },
|
|
8141
|
-
* config: {
|
|
8142
|
-
* numberOfImages: 1,
|
|
8143
|
-
* },
|
|
8144
|
-
* });
|
|
8145
|
-
* console.log(response1?.generatedImages?.[0]?.image?.imageBytes);
|
|
8146
|
-
*
|
|
8147
|
-
* const response2 = await ai.models.recontextImage({
|
|
8157
|
+
* const response = await ai.models.recontextImage({
|
|
8148
8158
|
* model: 'virtual-try-on-001',
|
|
8149
8159
|
* source: {
|
|
8150
8160
|
* personImage: personImage,
|
|
@@ -8154,7 +8164,7 @@ export declare class Models extends BaseModule {
|
|
|
8154
8164
|
* numberOfImages: 1,
|
|
8155
8165
|
* },
|
|
8156
8166
|
* });
|
|
8157
|
-
* console.log(
|
|
8167
|
+
* console.log(response?.generatedImages?.[0]?.image?.imageBytes);
|
|
8158
8168
|
* ```
|
|
8159
8169
|
*/
|
|
8160
8170
|
recontextImage(params: types.RecontextImageParameters): Promise<types.RecontextImageResponse>;
|
|
@@ -8813,8 +8823,8 @@ declare interface PlaceCitation {
|
|
|
8813
8823
|
*/
|
|
8814
8824
|
place_id?: string;
|
|
8815
8825
|
/**
|
|
8816
|
-
* Snippets of reviews that are used to generate answers about the
|
|
8817
|
-
*
|
|
8826
|
+
* Snippets of reviews that are used to generate answers about the features of a
|
|
8827
|
+
* given place in Google Maps.
|
|
8818
8828
|
*/
|
|
8819
8829
|
review_snippets?: Array<PlaceCitation.ReviewSnippet>;
|
|
8820
8830
|
/**
|
|
@@ -8831,8 +8841,8 @@ declare interface PlaceCitation {
|
|
|
8831
8841
|
|
|
8832
8842
|
declare namespace PlaceCitation {
|
|
8833
8843
|
/**
|
|
8834
|
-
* Encapsulates a snippet of a user review that answers a question about
|
|
8835
|
-
*
|
|
8844
|
+
* Encapsulates a snippet of a user review that answers a question about the
|
|
8845
|
+
* features of a specific place in Google Maps.
|
|
8836
8846
|
*/
|
|
8837
8847
|
interface ReviewSnippet {
|
|
8838
8848
|
/**
|
|
@@ -9648,19 +9658,19 @@ export declare enum ServiceTier {
|
|
|
9648
9658
|
/**
|
|
9649
9659
|
* Default service tier, which is standard.
|
|
9650
9660
|
*/
|
|
9651
|
-
|
|
9661
|
+
UNSPECIFIED = "unspecified",
|
|
9652
9662
|
/**
|
|
9653
9663
|
* Flex service tier.
|
|
9654
9664
|
*/
|
|
9655
|
-
|
|
9665
|
+
FLEX = "flex",
|
|
9656
9666
|
/**
|
|
9657
9667
|
* Standard service tier.
|
|
9658
9668
|
*/
|
|
9659
|
-
|
|
9669
|
+
STANDARD = "standard",
|
|
9660
9670
|
/**
|
|
9661
9671
|
* Priority service tier.
|
|
9662
9672
|
*/
|
|
9663
|
-
|
|
9673
|
+
PRIORITY = "priority"
|
|
9664
9674
|
}
|
|
9665
9675
|
|
|
9666
9676
|
/**
|
|
@@ -10320,7 +10330,7 @@ export declare interface Tool {
|
|
|
10320
10330
|
/**
|
|
10321
10331
|
* A tool that can be used by the model.
|
|
10322
10332
|
*/
|
|
10323
|
-
declare type Tool_2 = Function_2 | Tool_2.CodeExecution | Tool_2.URLContext | Tool_2.ComputerUse | Tool_2.MCPServer | Tool_2.GoogleSearch | Tool_2.FileSearch | Tool_2.GoogleMaps;
|
|
10333
|
+
declare type Tool_2 = Function_2 | Tool_2.CodeExecution | Tool_2.URLContext | Tool_2.ComputerUse | Tool_2.MCPServer | Tool_2.GoogleSearch | Tool_2.FileSearch | Tool_2.GoogleMaps | Tool_2.Retrieval;
|
|
10324
10334
|
|
|
10325
10335
|
declare namespace Tool_2 {
|
|
10326
10336
|
/**
|
|
@@ -10369,8 +10379,7 @@ declare namespace Tool_2 {
|
|
|
10369
10379
|
*/
|
|
10370
10380
|
name?: string;
|
|
10371
10381
|
/**
|
|
10372
|
-
* The full URL for the MCPServer endpoint.
|
|
10373
|
-
* Example: "https://api.example.com/mcp"
|
|
10382
|
+
* The full URL for the MCPServer endpoint. Example: "https://api.example.com/mcp"
|
|
10374
10383
|
*/
|
|
10375
10384
|
url?: string;
|
|
10376
10385
|
}
|
|
@@ -10382,7 +10391,7 @@ declare namespace Tool_2 {
|
|
|
10382
10391
|
/**
|
|
10383
10392
|
* The types of search grounding to enable.
|
|
10384
10393
|
*/
|
|
10385
|
-
search_types?: Array<'web_search' | 'image_search'>;
|
|
10394
|
+
search_types?: Array<'web_search' | 'image_search' | 'enterprise_web_search'>;
|
|
10386
10395
|
}
|
|
10387
10396
|
/**
|
|
10388
10397
|
* A tool that can be used by the model to search files.
|
|
@@ -10421,6 +10430,35 @@ declare namespace Tool_2 {
|
|
|
10421
10430
|
*/
|
|
10422
10431
|
longitude?: number;
|
|
10423
10432
|
}
|
|
10433
|
+
/**
|
|
10434
|
+
* A tool that can be used by the model to retrieve files.
|
|
10435
|
+
*/
|
|
10436
|
+
interface Retrieval {
|
|
10437
|
+
type: 'retrieval';
|
|
10438
|
+
/**
|
|
10439
|
+
* The types of file retrieval to enable.
|
|
10440
|
+
*/
|
|
10441
|
+
retrieval_types?: Array<'vertex_ai_search'>;
|
|
10442
|
+
/**
|
|
10443
|
+
* Used to specify configuration for VertexAISearch.
|
|
10444
|
+
*/
|
|
10445
|
+
vertex_ai_search_config?: Retrieval.VertexAISearchConfig;
|
|
10446
|
+
}
|
|
10447
|
+
namespace Retrieval {
|
|
10448
|
+
/**
|
|
10449
|
+
* Used to specify configuration for VertexAISearch.
|
|
10450
|
+
*/
|
|
10451
|
+
interface VertexAISearchConfig {
|
|
10452
|
+
/**
|
|
10453
|
+
* Optional. Used to specify Vertex AI Search datastores.
|
|
10454
|
+
*/
|
|
10455
|
+
datastores?: Array<string>;
|
|
10456
|
+
/**
|
|
10457
|
+
* Optional. Used to specify Vertex AI Search engine.
|
|
10458
|
+
*/
|
|
10459
|
+
engine?: string;
|
|
10460
|
+
}
|
|
10461
|
+
}
|
|
10424
10462
|
}
|
|
10425
10463
|
|
|
10426
10464
|
/** A predicted server-side `ToolCall` returned from the model.
|
|
@@ -10861,8 +10899,7 @@ export declare interface TuningValidationDataset {
|
|
|
10861
10899
|
declare interface Turn {
|
|
10862
10900
|
content?: Array<Content_2> | string;
|
|
10863
10901
|
/**
|
|
10864
|
-
* The originator of this turn. Must be user for input or model for
|
|
10865
|
-
* model output.
|
|
10902
|
+
* The originator of this turn. Must be user for input or model for model output.
|
|
10866
10903
|
*/
|
|
10867
10904
|
role?: string;
|
|
10868
10905
|
}
|
|
@@ -11911,7 +11948,7 @@ declare namespace Usage {
|
|
|
11911
11948
|
/**
|
|
11912
11949
|
* The modality associated with the token count.
|
|
11913
11950
|
*/
|
|
11914
|
-
modality?: 'text' | 'image' | 'audio';
|
|
11951
|
+
modality?: 'text' | 'image' | 'audio' | 'video' | 'document';
|
|
11915
11952
|
/**
|
|
11916
11953
|
* Number of tokens for the modality.
|
|
11917
11954
|
*/
|
|
@@ -11924,7 +11961,7 @@ declare namespace Usage {
|
|
|
11924
11961
|
/**
|
|
11925
11962
|
* The modality associated with the token count.
|
|
11926
11963
|
*/
|
|
11927
|
-
modality?: 'text' | 'image' | 'audio';
|
|
11964
|
+
modality?: 'text' | 'image' | 'audio' | 'video' | 'document';
|
|
11928
11965
|
/**
|
|
11929
11966
|
* Number of tokens for the modality.
|
|
11930
11967
|
*/
|
|
@@ -11937,7 +11974,7 @@ declare namespace Usage {
|
|
|
11937
11974
|
/**
|
|
11938
11975
|
* The modality associated with the token count.
|
|
11939
11976
|
*/
|
|
11940
|
-
modality?: 'text' | 'image' | 'audio';
|
|
11977
|
+
modality?: 'text' | 'image' | 'audio' | 'video' | 'document';
|
|
11941
11978
|
/**
|
|
11942
11979
|
* Number of tokens for the modality.
|
|
11943
11980
|
*/
|
|
@@ -11950,7 +11987,7 @@ declare namespace Usage {
|
|
|
11950
11987
|
/**
|
|
11951
11988
|
* The modality associated with the token count.
|
|
11952
11989
|
*/
|
|
11953
|
-
modality?: 'text' | 'image' | 'audio';
|
|
11990
|
+
modality?: 'text' | 'image' | 'audio' | 'video' | 'document';
|
|
11954
11991
|
/**
|
|
11955
11992
|
* Number of tokens for the modality.
|
|
11956
11993
|
*/
|
package/dist/index.cjs
CHANGED
|
@@ -1548,19 +1548,19 @@ exports.ServiceTier = void 0;
|
|
|
1548
1548
|
/**
|
|
1549
1549
|
* Default service tier, which is standard.
|
|
1550
1550
|
*/
|
|
1551
|
-
ServiceTier["
|
|
1551
|
+
ServiceTier["UNSPECIFIED"] = "unspecified";
|
|
1552
1552
|
/**
|
|
1553
1553
|
* Flex service tier.
|
|
1554
1554
|
*/
|
|
1555
|
-
ServiceTier["
|
|
1555
|
+
ServiceTier["FLEX"] = "flex";
|
|
1556
1556
|
/**
|
|
1557
1557
|
* Standard service tier.
|
|
1558
1558
|
*/
|
|
1559
|
-
ServiceTier["
|
|
1559
|
+
ServiceTier["STANDARD"] = "standard";
|
|
1560
1560
|
/**
|
|
1561
1561
|
* Priority service tier.
|
|
1562
1562
|
*/
|
|
1563
|
-
ServiceTier["
|
|
1563
|
+
ServiceTier["PRIORITY"] = "priority";
|
|
1564
1564
|
})(exports.ServiceTier || (exports.ServiceTier = {}));
|
|
1565
1565
|
/** Options for feature selection preference. */
|
|
1566
1566
|
exports.FeatureSelectionPreference = void 0;
|
|
@@ -7429,7 +7429,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
7429
7429
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
7430
7430
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
7431
7431
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
7432
|
-
const SDK_VERSION = '1.
|
|
7432
|
+
const SDK_VERSION = '1.49.0'; // x-release-please-version
|
|
7433
7433
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
7434
7434
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
7435
7435
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -9814,7 +9814,8 @@ class BaseInteractions extends APIResource {
|
|
|
9814
9814
|
return this._client.delete(path `/${api_version}/interactions/${id}`, options);
|
|
9815
9815
|
}
|
|
9816
9816
|
/**
|
|
9817
|
-
* Cancels an interaction by id. This only applies to background interactions that
|
|
9817
|
+
* Cancels an interaction by id. This only applies to background interactions that
|
|
9818
|
+
* are still running.
|
|
9818
9819
|
*
|
|
9819
9820
|
* @example
|
|
9820
9821
|
* ```ts
|
|
@@ -10670,7 +10671,7 @@ class BaseGeminiNextGenAPIClient {
|
|
|
10670
10671
|
if (this.apiKey) {
|
|
10671
10672
|
return buildHeaders([{ 'x-goog-api-key': this.apiKey }]);
|
|
10672
10673
|
}
|
|
10673
|
-
if (this.clientAdapter.isVertexAI()) {
|
|
10674
|
+
if (this.clientAdapter && this.clientAdapter.isVertexAI()) {
|
|
10674
10675
|
return buildHeaders([await this.clientAdapter.getAuthHeaders()]);
|
|
10675
10676
|
}
|
|
10676
10677
|
return undefined;
|
|
@@ -13475,8 +13476,9 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject, root
|
|
|
13475
13476
|
if (parentObject !== undefined && fromModelArmorConfig != null) {
|
|
13476
13477
|
setValueByPath(parentObject, ['modelArmorConfig'], fromModelArmorConfig);
|
|
13477
13478
|
}
|
|
13478
|
-
|
|
13479
|
-
|
|
13479
|
+
const fromServiceTier = getValueByPath(fromObject, ['serviceTier']);
|
|
13480
|
+
if (parentObject !== undefined && fromServiceTier != null) {
|
|
13481
|
+
setValueByPath(parentObject, ['serviceTier'], fromServiceTier);
|
|
13480
13482
|
}
|
|
13481
13483
|
return toObject;
|
|
13482
13484
|
}
|
|
@@ -17781,29 +17783,15 @@ class Models extends BaseModule {
|
|
|
17781
17783
|
/**
|
|
17782
17784
|
* Recontextualizes an image.
|
|
17783
17785
|
*
|
|
17784
|
-
* There
|
|
17785
|
-
* 1)
|
|
17786
|
-
* and contexts.
|
|
17787
|
-
* 2) Virtual Try-On: Generate images of persons modeling fashion products.
|
|
17786
|
+
* There is one type of recontextualization currently supported:
|
|
17787
|
+
* 1) Virtual Try-On: Generate images of persons modeling fashion products.
|
|
17788
17788
|
*
|
|
17789
17789
|
* @param params - The parameters for recontextualizing an image.
|
|
17790
17790
|
* @return The response from the API.
|
|
17791
17791
|
*
|
|
17792
17792
|
* @example
|
|
17793
17793
|
* ```ts
|
|
17794
|
-
* const
|
|
17795
|
-
* model: 'imagen-product-recontext-preview-06-30',
|
|
17796
|
-
* source: {
|
|
17797
|
-
* prompt: 'In a modern kitchen setting.',
|
|
17798
|
-
* productImages: [productImage],
|
|
17799
|
-
* },
|
|
17800
|
-
* config: {
|
|
17801
|
-
* numberOfImages: 1,
|
|
17802
|
-
* },
|
|
17803
|
-
* });
|
|
17804
|
-
* console.log(response1?.generatedImages?.[0]?.image?.imageBytes);
|
|
17805
|
-
*
|
|
17806
|
-
* const response2 = await ai.models.recontextImage({
|
|
17794
|
+
* const response = await ai.models.recontextImage({
|
|
17807
17795
|
* model: 'virtual-try-on-001',
|
|
17808
17796
|
* source: {
|
|
17809
17797
|
* personImage: personImage,
|
|
@@ -17813,7 +17801,7 @@ class Models extends BaseModule {
|
|
|
17813
17801
|
* numberOfImages: 1,
|
|
17814
17802
|
* },
|
|
17815
17803
|
* });
|
|
17816
|
-
* console.log(
|
|
17804
|
+
* console.log(response?.generatedImages?.[0]?.image?.imageBytes);
|
|
17817
17805
|
* ```
|
|
17818
17806
|
*/
|
|
17819
17807
|
async recontextImage(params) {
|
|
@@ -20614,9 +20602,6 @@ class GoogleGenAI {
|
|
|
20614
20602
|
return this._interactions;
|
|
20615
20603
|
}
|
|
20616
20604
|
console.warn('GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions.');
|
|
20617
|
-
if (this.vertexai) {
|
|
20618
|
-
throw new Error('This version of the GenAI SDK does not support Vertex AI API for interactions.');
|
|
20619
|
-
}
|
|
20620
20605
|
const httpOpts = this.httpOptions;
|
|
20621
20606
|
// Unsupported Options Warnings
|
|
20622
20607
|
if (httpOpts === null || httpOpts === void 0 ? void 0 : httpOpts.extraBody) {
|