@google/genai 1.11.0 → 1.13.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 +170 -4
- package/dist/index.cjs +448 -27
- package/dist/index.mjs +448 -28
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +448 -27
- package/dist/node/index.mjs +448 -28
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +170 -4
- package/dist/web/index.mjs +448 -28
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +170 -4
- package/package.json +17 -8
package/dist/genai.d.ts
CHANGED
|
@@ -1041,6 +1041,8 @@ export declare interface ComputeTokensParameters {
|
|
|
1041
1041
|
|
|
1042
1042
|
/** Response for computing tokens. */
|
|
1043
1043
|
export declare class ComputeTokensResponse {
|
|
1044
|
+
/** Used to retain the full HTTP response. */
|
|
1045
|
+
sdkHttpResponse?: HttpResponse;
|
|
1044
1046
|
/** Lists of tokens info from the input. A ComputeTokensRequest could have multiple instances with a prompt in each instance. We also need to return lists of tokens info for the request with multiple instances. */
|
|
1045
1047
|
tokensInfo?: TokensInfo[];
|
|
1046
1048
|
}
|
|
@@ -1168,6 +1170,8 @@ export declare interface CountTokensParameters {
|
|
|
1168
1170
|
|
|
1169
1171
|
/** Response for counting tokens. */
|
|
1170
1172
|
export declare class CountTokensResponse {
|
|
1173
|
+
/** Used to retain the full HTTP response. */
|
|
1174
|
+
sdkHttpResponse?: HttpResponse;
|
|
1171
1175
|
/** Total number of tokens. */
|
|
1172
1176
|
totalTokens?: number;
|
|
1173
1177
|
/** Number of tokens in the cached part of the prompt (the cached content). */
|
|
@@ -1595,6 +1599,8 @@ export declare class DeleteModelResponse {
|
|
|
1595
1599
|
|
|
1596
1600
|
/** The return value of delete operation. */
|
|
1597
1601
|
export declare interface DeleteResourceJob {
|
|
1602
|
+
/** Used to retain the full HTTP response. */
|
|
1603
|
+
sdkHttpResponse?: HttpResponse;
|
|
1598
1604
|
name?: string;
|
|
1599
1605
|
done?: boolean;
|
|
1600
1606
|
error?: JobError;
|
|
@@ -1771,6 +1777,8 @@ export declare interface EditImageParameters {
|
|
|
1771
1777
|
|
|
1772
1778
|
/** Response for the request to edit an image. */
|
|
1773
1779
|
export declare class EditImageResponse {
|
|
1780
|
+
/** Used to retain the full HTTP response. */
|
|
1781
|
+
sdkHttpResponse?: HttpResponse;
|
|
1774
1782
|
/** Generated images. */
|
|
1775
1783
|
generatedImages?: GeneratedImage[];
|
|
1776
1784
|
}
|
|
@@ -1844,6 +1852,8 @@ export declare interface EmbedContentParameters {
|
|
|
1844
1852
|
|
|
1845
1853
|
/** Response for the embed_content method. */
|
|
1846
1854
|
export declare class EmbedContentResponse {
|
|
1855
|
+
/** Used to retain the full HTTP response. */
|
|
1856
|
+
sdkHttpResponse?: HttpResponse;
|
|
1847
1857
|
/** The embeddings for each request, in the same order as provided in
|
|
1848
1858
|
the batch request.
|
|
1849
1859
|
*/
|
|
@@ -2493,9 +2503,6 @@ export declare class GenerateContentResponse {
|
|
|
2493
2503
|
/** Timestamp when the request is made to the server.
|
|
2494
2504
|
*/
|
|
2495
2505
|
createTime?: string;
|
|
2496
|
-
/** Identifier for each response.
|
|
2497
|
-
*/
|
|
2498
|
-
responseId?: string;
|
|
2499
2506
|
/** The history of automatic function calling.
|
|
2500
2507
|
*/
|
|
2501
2508
|
automaticFunctionCallingHistory?: Content[];
|
|
@@ -2503,6 +2510,8 @@ export declare class GenerateContentResponse {
|
|
|
2503
2510
|
modelVersion?: string;
|
|
2504
2511
|
/** Output only. Content filter results for a prompt sent in the request. Note: Sent only in the first stream chunk. Only happens when no candidates were generated due to content violations. */
|
|
2505
2512
|
promptFeedback?: GenerateContentResponsePromptFeedback;
|
|
2513
|
+
/** Output only. response_id is used to identify each response. It is the encoding of the event_id. */
|
|
2514
|
+
responseId?: string;
|
|
2506
2515
|
/** Usage metadata about the response(s). */
|
|
2507
2516
|
usageMetadata?: GenerateContentResponseUsageMetadata;
|
|
2508
2517
|
/**
|
|
@@ -2779,6 +2788,8 @@ export declare interface GenerateImagesParameters {
|
|
|
2779
2788
|
|
|
2780
2789
|
/** The output images response. */
|
|
2781
2790
|
export declare class GenerateImagesResponse {
|
|
2791
|
+
/** Used to retain the full HTTP response. */
|
|
2792
|
+
sdkHttpResponse?: HttpResponse;
|
|
2782
2793
|
/** List of generated images.
|
|
2783
2794
|
*/
|
|
2784
2795
|
generatedImages?: GeneratedImage[];
|
|
@@ -2841,6 +2852,8 @@ export declare class GenerateVideosOperation implements Operation<GenerateVideos
|
|
|
2841
2852
|
error?: Record<string, unknown>;
|
|
2842
2853
|
/** The response if the operation is successful. */
|
|
2843
2854
|
response?: GenerateVideosResponse;
|
|
2855
|
+
/** The full HTTP response. */
|
|
2856
|
+
sdkHttpResponse?: HttpResponse;
|
|
2844
2857
|
/**
|
|
2845
2858
|
* Instantiates an Operation of the same type as the one being called with the fields set from the API response.
|
|
2846
2859
|
* @internal
|
|
@@ -4271,6 +4284,8 @@ export declare interface LiveMusicGenerationConfig {
|
|
|
4271
4284
|
muteDrums?: boolean;
|
|
4272
4285
|
/** Whether the audio output should contain only bass and drums. */
|
|
4273
4286
|
onlyBassAndDrums?: boolean;
|
|
4287
|
+
/** The mode of music generation. Default mode is QUALITY. */
|
|
4288
|
+
musicGenerationMode?: MusicGenerationMode;
|
|
4274
4289
|
}
|
|
4275
4290
|
|
|
4276
4291
|
/** The playback control signal to apply to the music generation. */
|
|
@@ -5014,6 +5029,45 @@ export declare class Models extends BaseModule {
|
|
|
5014
5029
|
private generateImagesInternal;
|
|
5015
5030
|
private editImageInternal;
|
|
5016
5031
|
private upscaleImageInternal;
|
|
5032
|
+
/**
|
|
5033
|
+
* Recontextualizes an image.
|
|
5034
|
+
*
|
|
5035
|
+
* There are two types of recontextualization currently supported:
|
|
5036
|
+
* 1) Imagen Product Recontext - Generate images of products in new scenes
|
|
5037
|
+
* and contexts.
|
|
5038
|
+
* 2) Virtual Try-On: Generate images of persons modeling fashion products.
|
|
5039
|
+
*
|
|
5040
|
+
* @param params - The parameters for recontextualizing an image.
|
|
5041
|
+
* @return The response from the API.
|
|
5042
|
+
*
|
|
5043
|
+
* @example
|
|
5044
|
+
* ```ts
|
|
5045
|
+
* const response1 = await ai.models.recontextImage({
|
|
5046
|
+
* model: 'imagen-product-recontext-preview-06-30',
|
|
5047
|
+
* source: {
|
|
5048
|
+
* prompt: 'In a modern kitchen setting.',
|
|
5049
|
+
* productImages: [productImage],
|
|
5050
|
+
* },
|
|
5051
|
+
* config: {
|
|
5052
|
+
* numberOfImages: 1,
|
|
5053
|
+
* },
|
|
5054
|
+
* });
|
|
5055
|
+
* console.log(response1?.generatedImages?.[0]?.image?.imageBytes);
|
|
5056
|
+
*
|
|
5057
|
+
* const response2 = await ai.models.recontextImage({
|
|
5058
|
+
* model: 'virtual-try-on-preview-08-04',
|
|
5059
|
+
* source: {
|
|
5060
|
+
* personImage: personImage,
|
|
5061
|
+
* productImages: [productImage],
|
|
5062
|
+
* },
|
|
5063
|
+
* config: {
|
|
5064
|
+
* numberOfImages: 1,
|
|
5065
|
+
* },
|
|
5066
|
+
* });
|
|
5067
|
+
* console.log(response2?.generatedImages?.[0]?.image?.imageBytes);
|
|
5068
|
+
* ```
|
|
5069
|
+
*/
|
|
5070
|
+
recontextImage(params: types.RecontextImageParameters): Promise<types.RecontextImageResponse>;
|
|
5017
5071
|
/**
|
|
5018
5072
|
* Fetches information about a model by name.
|
|
5019
5073
|
*
|
|
@@ -5128,6 +5182,29 @@ export declare interface MultiSpeakerVoiceConfig {
|
|
|
5128
5182
|
speakerVoiceConfigs?: SpeakerVoiceConfig[];
|
|
5129
5183
|
}
|
|
5130
5184
|
|
|
5185
|
+
/** The mode of music generation. */
|
|
5186
|
+
export declare enum MusicGenerationMode {
|
|
5187
|
+
/**
|
|
5188
|
+
* Rely on the server default generation mode.
|
|
5189
|
+
*/
|
|
5190
|
+
MUSIC_GENERATION_MODE_UNSPECIFIED = "MUSIC_GENERATION_MODE_UNSPECIFIED",
|
|
5191
|
+
/**
|
|
5192
|
+
* Steer text prompts to regions of latent space with higher quality
|
|
5193
|
+
music.
|
|
5194
|
+
*/
|
|
5195
|
+
QUALITY = "QUALITY",
|
|
5196
|
+
/**
|
|
5197
|
+
* Steer text prompts to regions of latent space with a larger
|
|
5198
|
+
diversity of music.
|
|
5199
|
+
*/
|
|
5200
|
+
DIVERSITY = "DIVERSITY",
|
|
5201
|
+
/**
|
|
5202
|
+
* Steer text prompts to regions of latent space more likely to
|
|
5203
|
+
generate music with vocals.
|
|
5204
|
+
*/
|
|
5205
|
+
VOCALIZATION = "VOCALIZATION"
|
|
5206
|
+
}
|
|
5207
|
+
|
|
5131
5208
|
/** A long-running operation. */
|
|
5132
5209
|
export declare interface Operation<T> {
|
|
5133
5210
|
/** The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`. */
|
|
@@ -5403,6 +5480,12 @@ export declare interface ProactivityConfig {
|
|
|
5403
5480
|
proactiveAudio?: boolean;
|
|
5404
5481
|
}
|
|
5405
5482
|
|
|
5483
|
+
/** An image of the product. */
|
|
5484
|
+
export declare interface ProductImage {
|
|
5485
|
+
/** An image of the product to be recontextualized. */
|
|
5486
|
+
productImage?: Image_2;
|
|
5487
|
+
}
|
|
5488
|
+
|
|
5406
5489
|
/** A RagChunk includes the content of a chunk of a RagFile, and associated metadata. */
|
|
5407
5490
|
export declare interface RagChunk {
|
|
5408
5491
|
/** If populated, represents where the chunk starts and ends in the document. */
|
|
@@ -5498,6 +5581,69 @@ export declare interface RealtimeInputConfig {
|
|
|
5498
5581
|
turnCoverage?: TurnCoverage;
|
|
5499
5582
|
}
|
|
5500
5583
|
|
|
5584
|
+
/** Configuration for recontextualizing an image. */
|
|
5585
|
+
export declare interface RecontextImageConfig {
|
|
5586
|
+
/** Used to override HTTP request options. */
|
|
5587
|
+
httpOptions?: HttpOptions;
|
|
5588
|
+
/** Abort signal which can be used to cancel the request.
|
|
5589
|
+
|
|
5590
|
+
NOTE: AbortSignal is a client-only operation. Using it to cancel an
|
|
5591
|
+
operation will not cancel the request in the service. You will still
|
|
5592
|
+
be charged usage for any applicable operations.
|
|
5593
|
+
*/
|
|
5594
|
+
abortSignal?: AbortSignal;
|
|
5595
|
+
/** Number of images to generate. */
|
|
5596
|
+
numberOfImages?: number;
|
|
5597
|
+
/** The number of sampling steps. A higher value has better image
|
|
5598
|
+
quality, while a lower value has better latency. */
|
|
5599
|
+
baseSteps?: number;
|
|
5600
|
+
/** Cloud Storage URI used to store the generated images. */
|
|
5601
|
+
outputGcsUri?: string;
|
|
5602
|
+
/** Random seed for image generation. */
|
|
5603
|
+
seed?: number;
|
|
5604
|
+
/** Filter level for safety filtering. */
|
|
5605
|
+
safetyFilterLevel?: SafetyFilterLevel;
|
|
5606
|
+
/** Whether allow to generate person images, and restrict to specific
|
|
5607
|
+
ages. */
|
|
5608
|
+
personGeneration?: PersonGeneration;
|
|
5609
|
+
/** MIME type of the generated image. */
|
|
5610
|
+
outputMimeType?: string;
|
|
5611
|
+
/** Compression quality of the generated image (for ``image/jpeg``
|
|
5612
|
+
only). */
|
|
5613
|
+
outputCompressionQuality?: number;
|
|
5614
|
+
/** Whether to use the prompt rewriting logic. */
|
|
5615
|
+
enhancePrompt?: boolean;
|
|
5616
|
+
}
|
|
5617
|
+
|
|
5618
|
+
/** The parameters for recontextualizing an image. */
|
|
5619
|
+
export declare interface RecontextImageParameters {
|
|
5620
|
+
/** ID of the model to use. For a list of models, see `Google models
|
|
5621
|
+
<https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models>`_. */
|
|
5622
|
+
model: string;
|
|
5623
|
+
/** A set of source input(s) for image recontextualization. */
|
|
5624
|
+
source: RecontextImageSource;
|
|
5625
|
+
/** Configuration for image recontextualization. */
|
|
5626
|
+
config?: RecontextImageConfig;
|
|
5627
|
+
}
|
|
5628
|
+
|
|
5629
|
+
/** The output images response. */
|
|
5630
|
+
export declare class RecontextImageResponse {
|
|
5631
|
+
/** List of generated images. */
|
|
5632
|
+
generatedImages?: GeneratedImage[];
|
|
5633
|
+
}
|
|
5634
|
+
|
|
5635
|
+
/** A set of source input(s) for image recontextualization. */
|
|
5636
|
+
export declare interface RecontextImageSource {
|
|
5637
|
+
/** A text prompt for guiding the model during image
|
|
5638
|
+
recontextualization. Not supported for Virtual Try-On. */
|
|
5639
|
+
prompt?: string;
|
|
5640
|
+
/** Image of the person or subject who will be wearing the
|
|
5641
|
+
product(s). */
|
|
5642
|
+
personImage?: Image_2;
|
|
5643
|
+
/** A list of product images. */
|
|
5644
|
+
productImages?: ProductImage[];
|
|
5645
|
+
}
|
|
5646
|
+
|
|
5501
5647
|
export declare type ReferenceImage = RawReferenceImage | MaskReferenceImage | ControlReferenceImage | StyleReferenceImage | SubjectReferenceImage;
|
|
5502
5648
|
|
|
5503
5649
|
/** Private class that represents a Reference image that is sent to API. */
|
|
@@ -6413,6 +6559,8 @@ export declare interface TuningExample {
|
|
|
6413
6559
|
|
|
6414
6560
|
/** A tuning job. */
|
|
6415
6561
|
export declare interface TuningJob {
|
|
6562
|
+
/** Used to retain the full HTTP response. */
|
|
6563
|
+
sdkHttpResponse?: HttpResponse;
|
|
6416
6564
|
/** Output only. Identifier. Resource name of a TuningJob. Format: `projects/{project}/locations/{location}/tuningJobs/{tuning_job}` */
|
|
6417
6565
|
name?: string;
|
|
6418
6566
|
/** Output only. The detailed state of the job. */
|
|
@@ -6461,6 +6609,8 @@ export declare interface TuningJob {
|
|
|
6461
6609
|
|
|
6462
6610
|
/** A long-running operation. */
|
|
6463
6611
|
export declare interface TuningOperation {
|
|
6612
|
+
/** Used to retain the full HTTP response. */
|
|
6613
|
+
sdkHttpResponse?: HttpResponse;
|
|
6464
6614
|
/** The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`. */
|
|
6465
6615
|
name?: string;
|
|
6466
6616
|
/** Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. */
|
|
@@ -6621,6 +6771,7 @@ declare namespace types {
|
|
|
6621
6771
|
TurnCoverage,
|
|
6622
6772
|
FunctionResponseScheduling,
|
|
6623
6773
|
Scale,
|
|
6774
|
+
MusicGenerationMode,
|
|
6624
6775
|
LiveMusicPlaybackControl,
|
|
6625
6776
|
VideoMetadata,
|
|
6626
6777
|
Blob_2 as Blob,
|
|
@@ -6731,6 +6882,11 @@ declare namespace types {
|
|
|
6731
6882
|
EditImageConfig,
|
|
6732
6883
|
EditImageResponse,
|
|
6733
6884
|
UpscaleImageResponse,
|
|
6885
|
+
ProductImage,
|
|
6886
|
+
RecontextImageSource,
|
|
6887
|
+
RecontextImageConfig,
|
|
6888
|
+
RecontextImageParameters,
|
|
6889
|
+
RecontextImageResponse,
|
|
6734
6890
|
GetModelConfig,
|
|
6735
6891
|
GetModelParameters,
|
|
6736
6892
|
Endpoint,
|
|
@@ -7070,6 +7226,8 @@ export declare interface UpscaleImageParameters {
|
|
|
7070
7226
|
}
|
|
7071
7227
|
|
|
7072
7228
|
export declare class UpscaleImageResponse {
|
|
7229
|
+
/** Used to retain the full HTTP response. */
|
|
7230
|
+
sdkHttpResponse?: HttpResponse;
|
|
7073
7231
|
/** Generated images. */
|
|
7074
7232
|
generatedImages?: GeneratedImage[];
|
|
7075
7233
|
}
|
|
@@ -7105,7 +7263,15 @@ export declare enum UrlRetrievalStatus {
|
|
|
7105
7263
|
/**
|
|
7106
7264
|
* Url retrieval is failed due to error.
|
|
7107
7265
|
*/
|
|
7108
|
-
URL_RETRIEVAL_STATUS_ERROR = "URL_RETRIEVAL_STATUS_ERROR"
|
|
7266
|
+
URL_RETRIEVAL_STATUS_ERROR = "URL_RETRIEVAL_STATUS_ERROR",
|
|
7267
|
+
/**
|
|
7268
|
+
* Url retrieval is failed because the content is behind paywall.
|
|
7269
|
+
*/
|
|
7270
|
+
URL_RETRIEVAL_STATUS_PAYWALL = "URL_RETRIEVAL_STATUS_PAYWALL",
|
|
7271
|
+
/**
|
|
7272
|
+
* Url retrieval is failed because the content is unsafe.
|
|
7273
|
+
*/
|
|
7274
|
+
URL_RETRIEVAL_STATUS_UNSAFE = "URL_RETRIEVAL_STATUS_UNSAFE"
|
|
7109
7275
|
}
|
|
7110
7276
|
|
|
7111
7277
|
/** Usage metadata about response(s). */
|