@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/node/node.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
|
|
@@ -4283,6 +4296,8 @@ export declare interface LiveMusicGenerationConfig {
|
|
|
4283
4296
|
muteDrums?: boolean;
|
|
4284
4297
|
/** Whether the audio output should contain only bass and drums. */
|
|
4285
4298
|
onlyBassAndDrums?: boolean;
|
|
4299
|
+
/** The mode of music generation. Default mode is QUALITY. */
|
|
4300
|
+
musicGenerationMode?: MusicGenerationMode;
|
|
4286
4301
|
}
|
|
4287
4302
|
|
|
4288
4303
|
/** The playback control signal to apply to the music generation. */
|
|
@@ -5026,6 +5041,45 @@ export declare class Models extends BaseModule {
|
|
|
5026
5041
|
private generateImagesInternal;
|
|
5027
5042
|
private editImageInternal;
|
|
5028
5043
|
private upscaleImageInternal;
|
|
5044
|
+
/**
|
|
5045
|
+
* Recontextualizes an image.
|
|
5046
|
+
*
|
|
5047
|
+
* There are two types of recontextualization currently supported:
|
|
5048
|
+
* 1) Imagen Product Recontext - Generate images of products in new scenes
|
|
5049
|
+
* and contexts.
|
|
5050
|
+
* 2) Virtual Try-On: Generate images of persons modeling fashion products.
|
|
5051
|
+
*
|
|
5052
|
+
* @param params - The parameters for recontextualizing an image.
|
|
5053
|
+
* @return The response from the API.
|
|
5054
|
+
*
|
|
5055
|
+
* @example
|
|
5056
|
+
* ```ts
|
|
5057
|
+
* const response1 = await ai.models.recontextImage({
|
|
5058
|
+
* model: 'imagen-product-recontext-preview-06-30',
|
|
5059
|
+
* source: {
|
|
5060
|
+
* prompt: 'In a modern kitchen setting.',
|
|
5061
|
+
* productImages: [productImage],
|
|
5062
|
+
* },
|
|
5063
|
+
* config: {
|
|
5064
|
+
* numberOfImages: 1,
|
|
5065
|
+
* },
|
|
5066
|
+
* });
|
|
5067
|
+
* console.log(response1?.generatedImages?.[0]?.image?.imageBytes);
|
|
5068
|
+
*
|
|
5069
|
+
* const response2 = await ai.models.recontextImage({
|
|
5070
|
+
* model: 'virtual-try-on-preview-08-04',
|
|
5071
|
+
* source: {
|
|
5072
|
+
* personImage: personImage,
|
|
5073
|
+
* productImages: [productImage],
|
|
5074
|
+
* },
|
|
5075
|
+
* config: {
|
|
5076
|
+
* numberOfImages: 1,
|
|
5077
|
+
* },
|
|
5078
|
+
* });
|
|
5079
|
+
* console.log(response2?.generatedImages?.[0]?.image?.imageBytes);
|
|
5080
|
+
* ```
|
|
5081
|
+
*/
|
|
5082
|
+
recontextImage(params: types.RecontextImageParameters): Promise<types.RecontextImageResponse>;
|
|
5029
5083
|
/**
|
|
5030
5084
|
* Fetches information about a model by name.
|
|
5031
5085
|
*
|
|
@@ -5140,6 +5194,29 @@ export declare interface MultiSpeakerVoiceConfig {
|
|
|
5140
5194
|
speakerVoiceConfigs?: SpeakerVoiceConfig[];
|
|
5141
5195
|
}
|
|
5142
5196
|
|
|
5197
|
+
/** The mode of music generation. */
|
|
5198
|
+
export declare enum MusicGenerationMode {
|
|
5199
|
+
/**
|
|
5200
|
+
* Rely on the server default generation mode.
|
|
5201
|
+
*/
|
|
5202
|
+
MUSIC_GENERATION_MODE_UNSPECIFIED = "MUSIC_GENERATION_MODE_UNSPECIFIED",
|
|
5203
|
+
/**
|
|
5204
|
+
* Steer text prompts to regions of latent space with higher quality
|
|
5205
|
+
music.
|
|
5206
|
+
*/
|
|
5207
|
+
QUALITY = "QUALITY",
|
|
5208
|
+
/**
|
|
5209
|
+
* Steer text prompts to regions of latent space with a larger
|
|
5210
|
+
diversity of music.
|
|
5211
|
+
*/
|
|
5212
|
+
DIVERSITY = "DIVERSITY",
|
|
5213
|
+
/**
|
|
5214
|
+
* Steer text prompts to regions of latent space more likely to
|
|
5215
|
+
generate music with vocals.
|
|
5216
|
+
*/
|
|
5217
|
+
VOCALIZATION = "VOCALIZATION"
|
|
5218
|
+
}
|
|
5219
|
+
|
|
5143
5220
|
/** A long-running operation. */
|
|
5144
5221
|
export declare interface Operation<T> {
|
|
5145
5222
|
/** 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}`. */
|
|
@@ -5415,6 +5492,12 @@ export declare interface ProactivityConfig {
|
|
|
5415
5492
|
proactiveAudio?: boolean;
|
|
5416
5493
|
}
|
|
5417
5494
|
|
|
5495
|
+
/** An image of the product. */
|
|
5496
|
+
export declare interface ProductImage {
|
|
5497
|
+
/** An image of the product to be recontextualized. */
|
|
5498
|
+
productImage?: Image_2;
|
|
5499
|
+
}
|
|
5500
|
+
|
|
5418
5501
|
/** A RagChunk includes the content of a chunk of a RagFile, and associated metadata. */
|
|
5419
5502
|
export declare interface RagChunk {
|
|
5420
5503
|
/** If populated, represents where the chunk starts and ends in the document. */
|
|
@@ -5510,6 +5593,69 @@ export declare interface RealtimeInputConfig {
|
|
|
5510
5593
|
turnCoverage?: TurnCoverage;
|
|
5511
5594
|
}
|
|
5512
5595
|
|
|
5596
|
+
/** Configuration for recontextualizing an image. */
|
|
5597
|
+
export declare interface RecontextImageConfig {
|
|
5598
|
+
/** Used to override HTTP request options. */
|
|
5599
|
+
httpOptions?: HttpOptions;
|
|
5600
|
+
/** Abort signal which can be used to cancel the request.
|
|
5601
|
+
|
|
5602
|
+
NOTE: AbortSignal is a client-only operation. Using it to cancel an
|
|
5603
|
+
operation will not cancel the request in the service. You will still
|
|
5604
|
+
be charged usage for any applicable operations.
|
|
5605
|
+
*/
|
|
5606
|
+
abortSignal?: AbortSignal;
|
|
5607
|
+
/** Number of images to generate. */
|
|
5608
|
+
numberOfImages?: number;
|
|
5609
|
+
/** The number of sampling steps. A higher value has better image
|
|
5610
|
+
quality, while a lower value has better latency. */
|
|
5611
|
+
baseSteps?: number;
|
|
5612
|
+
/** Cloud Storage URI used to store the generated images. */
|
|
5613
|
+
outputGcsUri?: string;
|
|
5614
|
+
/** Random seed for image generation. */
|
|
5615
|
+
seed?: number;
|
|
5616
|
+
/** Filter level for safety filtering. */
|
|
5617
|
+
safetyFilterLevel?: SafetyFilterLevel;
|
|
5618
|
+
/** Whether allow to generate person images, and restrict to specific
|
|
5619
|
+
ages. */
|
|
5620
|
+
personGeneration?: PersonGeneration;
|
|
5621
|
+
/** MIME type of the generated image. */
|
|
5622
|
+
outputMimeType?: string;
|
|
5623
|
+
/** Compression quality of the generated image (for ``image/jpeg``
|
|
5624
|
+
only). */
|
|
5625
|
+
outputCompressionQuality?: number;
|
|
5626
|
+
/** Whether to use the prompt rewriting logic. */
|
|
5627
|
+
enhancePrompt?: boolean;
|
|
5628
|
+
}
|
|
5629
|
+
|
|
5630
|
+
/** The parameters for recontextualizing an image. */
|
|
5631
|
+
export declare interface RecontextImageParameters {
|
|
5632
|
+
/** ID of the model to use. For a list of models, see `Google models
|
|
5633
|
+
<https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models>`_. */
|
|
5634
|
+
model: string;
|
|
5635
|
+
/** A set of source input(s) for image recontextualization. */
|
|
5636
|
+
source: RecontextImageSource;
|
|
5637
|
+
/** Configuration for image recontextualization. */
|
|
5638
|
+
config?: RecontextImageConfig;
|
|
5639
|
+
}
|
|
5640
|
+
|
|
5641
|
+
/** The output images response. */
|
|
5642
|
+
export declare class RecontextImageResponse {
|
|
5643
|
+
/** List of generated images. */
|
|
5644
|
+
generatedImages?: GeneratedImage[];
|
|
5645
|
+
}
|
|
5646
|
+
|
|
5647
|
+
/** A set of source input(s) for image recontextualization. */
|
|
5648
|
+
export declare interface RecontextImageSource {
|
|
5649
|
+
/** A text prompt for guiding the model during image
|
|
5650
|
+
recontextualization. Not supported for Virtual Try-On. */
|
|
5651
|
+
prompt?: string;
|
|
5652
|
+
/** Image of the person or subject who will be wearing the
|
|
5653
|
+
product(s). */
|
|
5654
|
+
personImage?: Image_2;
|
|
5655
|
+
/** A list of product images. */
|
|
5656
|
+
productImages?: ProductImage[];
|
|
5657
|
+
}
|
|
5658
|
+
|
|
5513
5659
|
export declare type ReferenceImage = RawReferenceImage | MaskReferenceImage | ControlReferenceImage | StyleReferenceImage | SubjectReferenceImage;
|
|
5514
5660
|
|
|
5515
5661
|
/** Private class that represents a Reference image that is sent to API. */
|
|
@@ -6425,6 +6571,8 @@ export declare interface TuningExample {
|
|
|
6425
6571
|
|
|
6426
6572
|
/** A tuning job. */
|
|
6427
6573
|
export declare interface TuningJob {
|
|
6574
|
+
/** Used to retain the full HTTP response. */
|
|
6575
|
+
sdkHttpResponse?: HttpResponse;
|
|
6428
6576
|
/** Output only. Identifier. Resource name of a TuningJob. Format: `projects/{project}/locations/{location}/tuningJobs/{tuning_job}` */
|
|
6429
6577
|
name?: string;
|
|
6430
6578
|
/** Output only. The detailed state of the job. */
|
|
@@ -6473,6 +6621,8 @@ export declare interface TuningJob {
|
|
|
6473
6621
|
|
|
6474
6622
|
/** A long-running operation. */
|
|
6475
6623
|
export declare interface TuningOperation {
|
|
6624
|
+
/** Used to retain the full HTTP response. */
|
|
6625
|
+
sdkHttpResponse?: HttpResponse;
|
|
6476
6626
|
/** 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}`. */
|
|
6477
6627
|
name?: string;
|
|
6478
6628
|
/** 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. */
|
|
@@ -6633,6 +6783,7 @@ declare namespace types {
|
|
|
6633
6783
|
TurnCoverage,
|
|
6634
6784
|
FunctionResponseScheduling,
|
|
6635
6785
|
Scale,
|
|
6786
|
+
MusicGenerationMode,
|
|
6636
6787
|
LiveMusicPlaybackControl,
|
|
6637
6788
|
VideoMetadata,
|
|
6638
6789
|
Blob_2 as Blob,
|
|
@@ -6743,6 +6894,11 @@ declare namespace types {
|
|
|
6743
6894
|
EditImageConfig,
|
|
6744
6895
|
EditImageResponse,
|
|
6745
6896
|
UpscaleImageResponse,
|
|
6897
|
+
ProductImage,
|
|
6898
|
+
RecontextImageSource,
|
|
6899
|
+
RecontextImageConfig,
|
|
6900
|
+
RecontextImageParameters,
|
|
6901
|
+
RecontextImageResponse,
|
|
6746
6902
|
GetModelConfig,
|
|
6747
6903
|
GetModelParameters,
|
|
6748
6904
|
Endpoint,
|
|
@@ -7082,6 +7238,8 @@ export declare interface UpscaleImageParameters {
|
|
|
7082
7238
|
}
|
|
7083
7239
|
|
|
7084
7240
|
export declare class UpscaleImageResponse {
|
|
7241
|
+
/** Used to retain the full HTTP response. */
|
|
7242
|
+
sdkHttpResponse?: HttpResponse;
|
|
7085
7243
|
/** Generated images. */
|
|
7086
7244
|
generatedImages?: GeneratedImage[];
|
|
7087
7245
|
}
|
|
@@ -7117,7 +7275,15 @@ export declare enum UrlRetrievalStatus {
|
|
|
7117
7275
|
/**
|
|
7118
7276
|
* Url retrieval is failed due to error.
|
|
7119
7277
|
*/
|
|
7120
|
-
URL_RETRIEVAL_STATUS_ERROR = "URL_RETRIEVAL_STATUS_ERROR"
|
|
7278
|
+
URL_RETRIEVAL_STATUS_ERROR = "URL_RETRIEVAL_STATUS_ERROR",
|
|
7279
|
+
/**
|
|
7280
|
+
* Url retrieval is failed because the content is behind paywall.
|
|
7281
|
+
*/
|
|
7282
|
+
URL_RETRIEVAL_STATUS_PAYWALL = "URL_RETRIEVAL_STATUS_PAYWALL",
|
|
7283
|
+
/**
|
|
7284
|
+
* Url retrieval is failed because the content is unsafe.
|
|
7285
|
+
*/
|
|
7286
|
+
URL_RETRIEVAL_STATUS_UNSAFE = "URL_RETRIEVAL_STATUS_UNSAFE"
|
|
7121
7287
|
}
|
|
7122
7288
|
|
|
7123
7289
|
/** Usage metadata about response(s). */
|