From 54cf6d51a4476a8b461fceb205cbced2fc1b73a1 Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Fri, 7 Feb 2025 12:37:13 -0500 Subject: [PATCH 01/14] Revert "remove public docs" This reverts commit f0955630d319b05fd85af39bb8d149caf11481d5. --- common/api-review/vertexai.api.md | 61 +++-------- docs-devsite/vertexai.imagengcsimage.md | 10 +- .../vertexai.imagengenerationconfig.md | 24 ++++- .../vertexai.imagengenerationresponse.md | 10 +- docs-devsite/vertexai.imagenimageformat.md | 41 +++++-- docs-devsite/vertexai.imageninlineimage.md | 16 ++- docs-devsite/vertexai.imagenmodel.md | 80 +++++++++++--- docs-devsite/vertexai.imagenmodelparams.md | 14 ++- docs-devsite/vertexai.imagensafetysettings.md | 10 +- docs-devsite/vertexai.md | 58 +++++----- docs-devsite/vertexai.vertexaimodel.md | 8 +- packages/vertexai/src/api.ts | 9 ++ packages/vertexai/src/models/imagen-model.ts | 81 ++++++++++++++ .../vertexai/src/models/vertexai-model.ts | 9 ++ .../src/requests/imagen-image-format.ts | 46 ++++++++ .../vertexai/src/types/imagen/requests.ts | 100 ++++++++++++++++++ .../vertexai/src/types/imagen/responses.ts | 37 +++++++ 17 files changed, 490 insertions(+), 124 deletions(-) diff --git a/common/api-review/vertexai.api.md b/common/api-review/vertexai.api.md index a1cd9cba066..bce0b106229 100644 --- a/common/api-review/vertexai.api.md +++ b/common/api-review/vertexai.api.md @@ -346,7 +346,7 @@ export class GenerativeModel extends VertexAIModel { // @public export function getGenerativeModel(vertexAI: VertexAI, modelParams: ModelParams, requestOptions?: RequestOptions): GenerativeModel; -// @public (undocumented) +// @public export function getImagenModel(vertexAI: VertexAI, modelParams: ImagenModelParams, requestOptions?: RequestOptions): ImagenModel; // @public @@ -430,122 +430,88 @@ export enum HarmSeverity { HARM_SEVERITY_NEGLIGIBLE = "HARM_SEVERITY_NEGLIGIBLE" } -// @public (undocumented) +// @public export enum ImagenAspectRatio { - // (undocumented) LANDSCAPE_16x9 = "16:9", - // (undocumented) LANDSCAPE_3x4 = "3:4", - // (undocumented) PORTRAIT_4x3 = "4:3", - // (undocumented) PORTRAIT_9x16 = "9:16", - // (undocumented) SQUARE = "1:1" } -// @public (undocumented) +// @public export interface ImagenGCSImage { - // (undocumented) gcsURI: string; - // (undocumented) mimeType: string; } -// @public (undocumented) +// @public export interface ImagenGenerationConfig { - // (undocumented) addWatermark?: boolean; - // (undocumented) aspectRatio?: ImagenAspectRatio; - // (undocumented) imageFormat?: ImagenImageFormat; - // (undocumented) negativePrompt?: string; - // (undocumented) numberOfImages?: number; } -// @public (undocumented) +// @public export interface ImagenGenerationResponse { - // (undocumented) filteredReason?: string; - // (undocumented) images: T[]; } // @public export class ImagenImageFormat { - // (undocumented) compressionQuality?: number; - // (undocumented) static jpeg(compressionQuality?: number): ImagenImageFormat; - // (undocumented) mimeType: string; - // (undocumented) static png(): ImagenImageFormat; } // @public export interface ImagenInlineImage { - // (undocumented) bytesBase64Encoded: string; - // (undocumented) mimeType: string; } -// @public (undocumented) +// @public export class ImagenModel extends VertexAIModel { constructor(vertexAI: VertexAI, modelParams: ImagenModelParams, requestOptions?: RequestOptions | undefined); - // (undocumented) + // @beta generateImages(prompt: string): Promise>; - // (undocumented) + // @beta generateImagesGCS(prompt: string, gcsURI: string): Promise>; - // (undocumented) generationConfig?: ImagenGenerationConfig; // (undocumented) requestOptions?: RequestOptions | undefined; - // (undocumented) safetySettings?: ImagenSafetySettings; } -// @public (undocumented) +// @public export interface ImagenModelParams { - // (undocumented) generationConfig?: ImagenGenerationConfig; - // (undocumented) model: string; - // (undocumented) safetySettings?: ImagenSafetySettings; } -// @public (undocumented) +// @public export enum ImagenPersonFilterLevel { - // (undocumented) ALLOW_ADULT = "allow_adult", - // (undocumented) ALLOW_ALL = "allow_all", - // (undocumented) BLOCK_ALL = "dont_allow" } -// @public (undocumented) +// @public export enum ImagenSafetyFilterLevel { - // (undocumented) BLOCK_LOW_AND_ABOVE = "block_low_and_above", - // (undocumented) BLOCK_MEDIUM_AND_ABOVE = "block_medium_and_above", - // (undocumented) BLOCK_NONE = "block_none", - // (undocumented) BLOCK_ONLY_HIGH = "block_only_high" } -// @public (undocumented) +// @public export interface ImagenSafetySettings { - // (undocumented) personFilterLevel?: ImagenPersonFilterLevel; - // (undocumented) safetyFilterLevel?: ImagenSafetyFilterLevel; } @@ -838,13 +804,12 @@ export const enum VertexAIErrorCode { RESPONSE_ERROR = "response-error" } -// @public (undocumented) +// @public export abstract class VertexAIModel { // @internal protected constructor(vertexAI: VertexAI, modelName: string); // @internal (undocumented) protected _apiSettings: ApiSettings; - // (undocumented) readonly model: string; static normalizeModelName(modelName: string): string; } diff --git a/docs-devsite/vertexai.imagengcsimage.md b/docs-devsite/vertexai.imagengcsimage.md index af4717129f7..af9887ba9dd 100644 --- a/docs-devsite/vertexai.imagengcsimage.md +++ b/docs-devsite/vertexai.imagengcsimage.md @@ -10,6 +10,8 @@ https://github.com/firebase/firebase-js-sdk {% endcomment %} # ImagenGCSImage interface +An image generated by Imagen, stored in Google Cloud Storage (GCS). + Signature: ```typescript @@ -20,11 +22,13 @@ export interface ImagenGCSImage | Property | Type | Description | | --- | --- | --- | -| [gcsURI](./vertexai.imagengcsimage.md#imagengcsimagegcsuri) | string | | -| [mimeType](./vertexai.imagengcsimage.md#imagengcsimagemimetype) | string | | +| [gcsURI](./vertexai.imagengcsimage.md#imagengcsimagegcsuri) | string | The Google Cloud Storage (GCS) URI where the image is stored. | +| [mimeType](./vertexai.imagengcsimage.md#imagengcsimagemimetype) | string | The MIME type of the image. | ## ImagenGCSImage.gcsURI +The Google Cloud Storage (GCS) URI where the image is stored. + Signature: ```typescript @@ -33,6 +37,8 @@ gcsURI: string; ## ImagenGCSImage.mimeType +The MIME type of the image. + Signature: ```typescript diff --git a/docs-devsite/vertexai.imagengenerationconfig.md b/docs-devsite/vertexai.imagengenerationconfig.md index 4b2e91f01a7..d41260b2c07 100644 --- a/docs-devsite/vertexai.imagengenerationconfig.md +++ b/docs-devsite/vertexai.imagengenerationconfig.md @@ -10,6 +10,10 @@ https://github.com/firebase/firebase-js-sdk {% endcomment %} # ImagenGenerationConfig interface +Configuration options for generating images with Imagen. + +See the \[Google Cloud Docs\](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api\#rest\_1). + Signature: ```typescript @@ -20,14 +24,16 @@ export interface ImagenGenerationConfig | Property | Type | Description | | --- | --- | --- | -| [addWatermark](./vertexai.imagengenerationconfig.md#imagengenerationconfigaddwatermark) | boolean | | -| [aspectRatio](./vertexai.imagengenerationconfig.md#imagengenerationconfigaspectratio) | [ImagenAspectRatio](./vertexai.md#imagenaspectratio) | | -| [imageFormat](./vertexai.imagengenerationconfig.md#imagengenerationconfigimageformat) | [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) | | -| [negativePrompt](./vertexai.imagengenerationconfig.md#imagengenerationconfignegativeprompt) | string | | -| [numberOfImages](./vertexai.imagengenerationconfig.md#imagengenerationconfignumberofimages) | number | | +| [addWatermark](./vertexai.imagengenerationconfig.md#imagengenerationconfigaddwatermark) | boolean | If true, adds a SynthID watermark to the generated images. | +| [aspectRatio](./vertexai.imagengenerationconfig.md#imagengenerationconfigaspectratio) | [ImagenAspectRatio](./vertexai.md#imagenaspectratio) | The aspect ratio of the generated images. The default value is 1:1. used. | +| [imageFormat](./vertexai.imagengenerationconfig.md#imagengenerationconfigimageformat) | [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) | The image format of the generated images. The default is PNG. | +| [negativePrompt](./vertexai.imagengenerationconfig.md#imagengenerationconfignegativeprompt) | string | A description of what should be omitted from the generated images. | +| [numberOfImages](./vertexai.imagengenerationconfig.md#imagengenerationconfignumberofimages) | number | The number of images to generate. Must be between 1 and 4. The default value is 1. | ## ImagenGenerationConfig.addWatermark +If true, adds a SynthID watermark to the generated images. + Signature: ```typescript @@ -36,6 +42,8 @@ addWatermark?: boolean; ## ImagenGenerationConfig.aspectRatio +The aspect ratio of the generated images. The default value is 1:1. used. + Signature: ```typescript @@ -44,6 +52,8 @@ aspectRatio?: ImagenAspectRatio; ## ImagenGenerationConfig.imageFormat +The image format of the generated images. The default is PNG. + Signature: ```typescript @@ -52,6 +62,8 @@ imageFormat?: ImagenImageFormat; ## ImagenGenerationConfig.negativePrompt +A description of what should be omitted from the generated images. + Signature: ```typescript @@ -60,6 +72,8 @@ negativePrompt?: string; ## ImagenGenerationConfig.numberOfImages +The number of images to generate. Must be between 1 and 4. The default value is 1. + Signature: ```typescript diff --git a/docs-devsite/vertexai.imagengenerationresponse.md b/docs-devsite/vertexai.imagengenerationresponse.md index 320e2b68533..624698b5ff7 100644 --- a/docs-devsite/vertexai.imagengenerationresponse.md +++ b/docs-devsite/vertexai.imagengenerationresponse.md @@ -10,6 +10,8 @@ https://github.com/firebase/firebase-js-sdk {% endcomment %} # ImagenGenerationResponse interface +The response from a request to generate images with Imagen. + Signature: ```typescript @@ -20,11 +22,13 @@ export interface ImagenGenerationResponse. | +| [images](./vertexai.imagengenerationresponse.md#imagengenerationresponseimages) | T\[\] | The images generated by Imagen. If all images were filtered due to safety reasons, this array will be empty. | ## ImagenGenerationResponse.filteredReason +The reason why any images were filtered. This field is only present if one or more images were filtered. For the mappings of error codes to reasons, see [https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen\#safety-categories](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-categories). + Signature: ```typescript @@ -33,6 +37,8 @@ filteredReason?: string; ## ImagenGenerationResponse.images +The images generated by Imagen. If all images were filtered due to safety reasons, this array will be empty. + Signature: ```typescript diff --git a/docs-devsite/vertexai.imagenimageformat.md b/docs-devsite/vertexai.imagenimageformat.md index f52af54d9f4..93d7f1d8fe7 100644 --- a/docs-devsite/vertexai.imagenimageformat.md +++ b/docs-devsite/vertexai.imagenimageformat.md @@ -10,13 +10,9 @@ https://github.com/firebase/firebase-js-sdk {% endcomment %} # ImagenImageFormat class - Copyright 2025 Google LLC +Defines the image format for images output by Imagen. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. +Use this class to specify the desired format (JPEG or PNG) and compression quality for images generated by Imagen. This is typically included as part of [ImagenModelParams](./vertexai.imagenmodelparams.md#imagenmodelparams_interface). Signature: @@ -28,18 +24,20 @@ export declare class ImagenImageFormat | Property | Modifiers | Type | Description | | --- | --- | --- | --- | -| [compressionQuality](./vertexai.imagenimageformat.md#imagenimageformatcompressionquality) | | number | | -| [mimeType](./vertexai.imagenimageformat.md#imagenimageformatmimetype) | | string | | +| [compressionQuality](./vertexai.imagenimageformat.md#imagenimageformatcompressionquality) | | number | The level of compression (a number between 0 and 100). | +| [mimeType](./vertexai.imagenimageformat.md#imagenimageformatmimetype) | | string | The MIME type. | ## Methods | Method | Modifiers | Description | | --- | --- | --- | -| [jpeg(compressionQuality)](./vertexai.imagenimageformat.md#imagenimageformatjpeg) | static | | -| [png()](./vertexai.imagenimageformat.md#imagenimageformatpng) | static | | +| [jpeg(compressionQuality)](./vertexai.imagenimageformat.md#imagenimageformatjpeg) | static | Creates an ImagenImageFormat for a JPEG image. | +| [png()](./vertexai.imagenimageformat.md#imagenimageformatpng) | static | Creates an ImageImageFormat for a PNG image. | ## ImagenImageFormat.compressionQuality +The level of compression (a number between 0 and 100). + Signature: ```typescript @@ -48,6 +46,8 @@ compressionQuality?: number; ## ImagenImageFormat.mimeType +The MIME type. + Signature: ```typescript @@ -56,6 +56,8 @@ mimeType: string; ## ImagenImageFormat.jpeg() +Creates an ImagenImageFormat for a JPEG image. + Signature: ```typescript @@ -66,14 +68,18 @@ static jpeg(compressionQuality?: number): ImagenImageFormat; | Parameter | Type | Description | | --- | --- | --- | -| compressionQuality | number | | +| compressionQuality | number | The level of compression (a number between 0 and 100). | Returns: [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) +ImagenImageFormat + ## ImagenImageFormat.png() +Creates an ImageImageFormat for a PNG image. + Signature: ```typescript @@ -83,3 +89,16 @@ static png(): ImagenImageFormat; [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) +ImageImageFormat + +### Example + + +```javascript +const imagenModelParams = { + // ... other ImagenModelParams + imageFormat: ImagenImageFormat.jpeg(75) // JPEG with a compression level of 75. +} + +``` + diff --git a/docs-devsite/vertexai.imageninlineimage.md b/docs-devsite/vertexai.imageninlineimage.md index b1b2fb3e52c..6d3a3972445 100644 --- a/docs-devsite/vertexai.imageninlineimage.md +++ b/docs-devsite/vertexai.imageninlineimage.md @@ -10,13 +10,7 @@ https://github.com/firebase/firebase-js-sdk {% endcomment %} # ImagenInlineImage interface - Copyright 2025 Google LLC - -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. +An image generated by Imagen, represented as inline bytes. Signature: @@ -28,11 +22,13 @@ export interface ImagenInlineImage | Property | Type | Description | | --- | --- | --- | -| [bytesBase64Encoded](./vertexai.imageninlineimage.md#imageninlineimagebytesbase64encoded) | string | | -| [mimeType](./vertexai.imageninlineimage.md#imageninlineimagemimetype) | string | | +| [bytesBase64Encoded](./vertexai.imageninlineimage.md#imageninlineimagebytesbase64encoded) | string | The image data encoded as a base64 string. | +| [mimeType](./vertexai.imageninlineimage.md#imageninlineimagemimetype) | string | The MIME type of the image. | ## ImagenInlineImage.bytesBase64Encoded +The image data encoded as a base64 string. + Signature: ```typescript @@ -41,6 +37,8 @@ bytesBase64Encoded: string; ## ImagenInlineImage.mimeType +The MIME type of the image. + Signature: ```typescript diff --git a/docs-devsite/vertexai.imagenmodel.md b/docs-devsite/vertexai.imagenmodel.md index c2730170180..b38684f7e12 100644 --- a/docs-devsite/vertexai.imagenmodel.md +++ b/docs-devsite/vertexai.imagenmodel.md @@ -10,6 +10,10 @@ https://github.com/firebase/firebase-js-sdk {% endcomment %} # ImagenModel class +Class for Imagen model APIs. + +This class provides methods for generating images using the Imagen model. You can generate images inline as base64-encoded strings, or directly to Google Cloud Storage (GCS). + Signature: ```typescript @@ -21,26 +25,26 @@ export declare class ImagenModel extends VertexAIModel | Constructor | Modifiers | Description | | --- | --- | --- | -| [(constructor)(vertexAI, modelParams, requestOptions)](./vertexai.imagenmodel.md#imagenmodelconstructor) | | Constructs a new instance of the ImagenModel class | +| [(constructor)(vertexAI, modelParams, requestOptions)](./vertexai.imagenmodel.md#imagenmodelconstructor) | | Constructs a new instance of the [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) class. | ## Properties | Property | Modifiers | Type | Description | | --- | --- | --- | --- | -| [generationConfig](./vertexai.imagenmodel.md#imagenmodelgenerationconfig) | | [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface) | | +| [generationConfig](./vertexai.imagenmodel.md#imagenmodelgenerationconfig) | | [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface) | The Imagen Generation Configuration. | | [requestOptions](./vertexai.imagenmodel.md#imagenmodelrequestoptions) | | [RequestOptions](./vertexai.requestoptions.md#requestoptions_interface) \| undefined | | -| [safetySettings](./vertexai.imagenmodel.md#imagenmodelsafetysettings) | | [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface) | | +| [safetySettings](./vertexai.imagenmodel.md#imagenmodelsafetysettings) | | [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface) | Safety settings for filtering inappropriate content. | ## Methods | Method | Modifiers | Description | | --- | --- | --- | -| [generateImages(prompt)](./vertexai.imagenmodel.md#imagenmodelgenerateimages) | | | -| [generateImagesGCS(prompt, gcsURI)](./vertexai.imagenmodel.md#imagenmodelgenerateimagesgcs) | | | +| [generateImages(prompt)](./vertexai.imagenmodel.md#imagenmodelgenerateimages) | | Generates images using the Imagen model and returns them as base64-encoded strings. | +| [generateImagesGCS(prompt, gcsURI)](./vertexai.imagenmodel.md#imagenmodelgenerateimagesgcs) | | Generates images to Google Cloud Storage (GCS) using the Imagen model. | ## ImagenModel.(constructor) -Constructs a new instance of the `ImagenModel` class +Constructs a new instance of the [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) class. Signature: @@ -52,16 +56,22 @@ constructor(vertexAI: VertexAI, modelParams: ImagenModelParams, requestOptions?: | Parameter | Type | Description | | --- | --- | --- | -| vertexAI | [VertexAI](./vertexai.vertexai.md#vertexai_interface) | | -| modelParams | [ImagenModelParams](./vertexai.imagenmodelparams.md#imagenmodelparams_interface) | | -| requestOptions | [RequestOptions](./vertexai.requestoptions.md#requestoptions_interface) \| undefined | | +| vertexAI | [VertexAI](./vertexai.vertexai.md#vertexai_interface) | An instance of the Vertex AI in Firebase SDK. | +| modelParams | [ImagenModelParams](./vertexai.imagenmodelparams.md#imagenmodelparams_interface) | Parameters to use when making Imagen requests. | +| requestOptions | [RequestOptions](./vertexai.requestoptions.md#requestoptions_interface) \| undefined | Additional options to use when making requests. | + +#### Exceptions + +If the `apiKey` or `projectId` fields are missing in your Firebase config. ## ImagenModel.generationConfig +The Imagen Generation Configuration. + Signature: ```typescript -generationConfig?: ImagenGenerationConfig; +readonly generationConfig?: ImagenGenerationConfig; ``` ## ImagenModel.requestOptions @@ -69,19 +79,25 @@ generationConfig?: ImagenGenerationConfig; Signature: ```typescript -requestOptions?: RequestOptions | undefined; +readonly requestOptions?: RequestOptions | undefined; ``` ## ImagenModel.safetySettings +Safety settings for filtering inappropriate content. + Signature: ```typescript -safetySettings?: ImagenSafetySettings; +readonly safetySettings?: ImagenSafetySettings; ``` ## ImagenModel.generateImages() +Generates images using the Imagen model and returns them as base64-encoded strings. + +If the prompt was not blocked, but one or more of the generated images were filtered, the returned object will have a `filteredReason` property. If all images are filtered, the `images` array will be empty. + Signature: ```typescript @@ -92,14 +108,24 @@ generateImages(prompt: string): PromiseReturns: Promise<[ImagenGenerationResponse](./vertexai.imagengenerationresponse.md#imagengenerationresponse_interface)<[ImagenInlineImage](./vertexai.imageninlineimage.md#imageninlineimage_interface)>> +A promise that resolves to an [ImagenGenerationResponse](./vertexai.imagengenerationresponse.md#imagengenerationresponse_interface) object containing the generated images. + +#### Exceptions + +If the request to generate images fails. This happens if the prompt is blocked. + ## ImagenModel.generateImagesGCS() +Generates images to Google Cloud Storage (GCS) using the Imagen model. + +If the prompt was not blocked, but one or more of the generated images were filtered, the returned object will have a `filteredReason` property. If all images are filtered, the `images` array will be empty. + Signature: ```typescript @@ -110,10 +136,34 @@ generateImagesGCS(prompt: string, gcsURI: string): Promisegs://my-bucket/my-directory/. | Returns: Promise<[ImagenGenerationResponse](./vertexai.imagengenerationresponse.md#imagengenerationresponse_interface)<[ImagenGCSImage](./vertexai.imagengcsimage.md#imagengcsimage_interface)>> +A promise that resolves to an [ImagenGenerationResponse](./vertexai.imagengenerationresponse.md#imagengenerationresponse_interface) object containing the URLs of the generated images. + +#### Exceptions + +If the request fails to generate images fails. This happens if the prompt is blocked. + +### Example + + +```javascript +const imagen = new ImagenModel( + vertexAI, + { + model: 'imagen-3.0-generate-001' + } +); + +const response = await imagen.generateImages('A photo of a cat'); +if (response.images.length > 0) { + console.log(response.images[0].bytesBase64Encoded); +} + +``` + diff --git a/docs-devsite/vertexai.imagenmodelparams.md b/docs-devsite/vertexai.imagenmodelparams.md index 21dbd533006..1ad6fe03cd5 100644 --- a/docs-devsite/vertexai.imagenmodelparams.md +++ b/docs-devsite/vertexai.imagenmodelparams.md @@ -10,6 +10,8 @@ https://github.com/firebase/firebase-js-sdk {% endcomment %} # ImagenModelParams interface +Parameters for configuring an [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class). + Signature: ```typescript @@ -20,12 +22,14 @@ export interface ImagenModelParams | Property | Type | Description | | --- | --- | --- | -| [generationConfig](./vertexai.imagenmodelparams.md#imagenmodelparamsgenerationconfig) | [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface) | | -| [model](./vertexai.imagenmodelparams.md#imagenmodelparamsmodel) | string | | -| [safetySettings](./vertexai.imagenmodelparams.md#imagenmodelparamssafetysettings) | [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface) | | +| [generationConfig](./vertexai.imagenmodelparams.md#imagenmodelparamsgenerationconfig) | [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface) | The Imagen Generation Configuration. | +| [model](./vertexai.imagenmodelparams.md#imagenmodelparamsmodel) | string | The Imagen model to use for generating images. For example: imagen-3.0-generate-001. | +| [safetySettings](./vertexai.imagenmodelparams.md#imagenmodelparamssafetysettings) | [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface) | Safety settings for filtering inappropriate content. | ## ImagenModelParams.generationConfig +The Imagen Generation Configuration. + Signature: ```typescript @@ -34,6 +38,8 @@ generationConfig?: ImagenGenerationConfig; ## ImagenModelParams.model +The Imagen model to use for generating images. For example: `imagen-3.0-generate-001`. + Signature: ```typescript @@ -42,6 +48,8 @@ model: string; ## ImagenModelParams.safetySettings +Safety settings for filtering inappropriate content. + Signature: ```typescript diff --git a/docs-devsite/vertexai.imagensafetysettings.md b/docs-devsite/vertexai.imagensafetysettings.md index 0f5ea97c3e4..a544b9688bc 100644 --- a/docs-devsite/vertexai.imagensafetysettings.md +++ b/docs-devsite/vertexai.imagensafetysettings.md @@ -10,6 +10,8 @@ https://github.com/firebase/firebase-js-sdk {% endcomment %} # ImagenSafetySettings interface +Safety settings for Imagen. + Signature: ```typescript @@ -20,11 +22,13 @@ export interface ImagenSafetySettings | Property | Type | Description | | --- | --- | --- | -| [personFilterLevel](./vertexai.imagensafetysettings.md#imagensafetysettingspersonfilterlevel) | [ImagenPersonFilterLevel](./vertexai.md#imagenpersonfilterlevel) | | -| [safetyFilterLevel](./vertexai.imagensafetysettings.md#imagensafetysettingssafetyfilterlevel) | [ImagenSafetyFilterLevel](./vertexai.md#imagensafetyfilterlevel) | | +| [personFilterLevel](./vertexai.imagensafetysettings.md#imagensafetysettingspersonfilterlevel) | [ImagenPersonFilterLevel](./vertexai.md#imagenpersonfilterlevel) | The person filter level to use. | +| [safetyFilterLevel](./vertexai.imagensafetysettings.md#imagensafetysettingssafetyfilterlevel) | [ImagenSafetyFilterLevel](./vertexai.md#imagensafetyfilterlevel) | The safety filter level to use. | ## ImagenSafetySettings.personFilterLevel +The person filter level to use. + Signature: ```typescript @@ -33,6 +37,8 @@ personFilterLevel?: ImagenPersonFilterLevel; ## ImagenSafetySettings.safetyFilterLevel +The safety filter level to use. + Signature: ```typescript diff --git a/docs-devsite/vertexai.md b/docs-devsite/vertexai.md index efc0cb92402..f8016829c9f 100644 --- a/docs-devsite/vertexai.md +++ b/docs-devsite/vertexai.md @@ -20,7 +20,7 @@ The Vertex AI in Firebase Web SDK. | [getVertexAI(app, options)](./vertexai.md#getvertexai_04094cf) | Returns a [VertexAI](./vertexai.vertexai.md#vertexai_interface) instance for the given app. | | function(vertexAI, ...) | | [getGenerativeModel(vertexAI, modelParams, requestOptions)](./vertexai.md#getgenerativemodel_e3037c9) | Returns a [GenerativeModel](./vertexai.generativemodel.md#generativemodel_class) class with methods for inference and other functionality. | -| [getImagenModel(vertexAI, modelParams, requestOptions)](./vertexai.md#getimagenmodel_812c375) | | +| [getImagenModel(vertexAI, modelParams, requestOptions)](./vertexai.md#getimagenmodel_812c375) | Returns a [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) class with methods for using Imagen. | ## Classes @@ -30,15 +30,15 @@ The Vertex AI in Firebase Web SDK. | [BooleanSchema](./vertexai.booleanschema.md#booleanschema_class) | Schema class for "boolean" types. | | [ChatSession](./vertexai.chatsession.md#chatsession_class) | ChatSession class that enables sending chat messages and stores history of sent and received messages so far. | | [GenerativeModel](./vertexai.generativemodel.md#generativemodel_class) | Class for generative model APIs. | -| [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) | Copyright 2025 Google LLCLicensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. | -| [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) | | +| [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) | Defines the image format for images output by Imagen.Use this class to specify the desired format (JPEG or PNG) and compression quality for images generated by Imagen. This is typically included as part of [ImagenModelParams](./vertexai.imagenmodelparams.md#imagenmodelparams_interface). | +| [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) | Class for Imagen model APIs.This class provides methods for generating images using the Imagen model. You can generate images inline as base64-encoded strings, or directly to Google Cloud Storage (GCS). | | [IntegerSchema](./vertexai.integerschema.md#integerschema_class) | Schema class for "integer" types. | | [NumberSchema](./vertexai.numberschema.md#numberschema_class) | Schema class for "number" types. | | [ObjectSchema](./vertexai.objectschema.md#objectschema_class) | Schema class for "object" types. The properties param must be a map of Schema objects. | | [Schema](./vertexai.schema.md#schema_class) | Parent class encompassing all Schema types, with static methods that allow building specific Schema types. This class can be converted with JSON.stringify() into a JSON string accepted by Vertex AI REST endpoints. (This string conversion is automatically done when calling SDK methods.) | | [StringSchema](./vertexai.stringschema.md#stringschema_class) | Schema class for "string" types. Can be used with or without enum values. | | [VertexAIError](./vertexai.vertexaierror.md#vertexaierror_class) | Error class for the Vertex AI in Firebase SDK. | -| [VertexAIModel](./vertexai.vertexaimodel.md#vertexaimodel_class) | | +| [VertexAIModel](./vertexai.vertexaimodel.md#vertexaimodel_class) | Base class for Vertex AI in Firebase model APIs. | ## Enumerations @@ -52,9 +52,9 @@ The Vertex AI in Firebase Web SDK. | [HarmCategory](./vertexai.md#harmcategory) | Harm categories that would cause prompts or candidates to be blocked. | | [HarmProbability](./vertexai.md#harmprobability) | Probability that a prompt or candidate matches a harm category. | | [HarmSeverity](./vertexai.md#harmseverity) | Harm severity levels. | -| [ImagenAspectRatio](./vertexai.md#imagenaspectratio) | | -| [ImagenPersonFilterLevel](./vertexai.md#imagenpersonfilterlevel) | | -| [ImagenSafetyFilterLevel](./vertexai.md#imagensafetyfilterlevel) | | +| [ImagenAspectRatio](./vertexai.md#imagenaspectratio) | Aspect ratios for Imagen images. | +| [ImagenPersonFilterLevel](./vertexai.md#imagenpersonfilterlevel) | Person filter levels for Imagen. | +| [ImagenSafetyFilterLevel](./vertexai.md#imagensafetyfilterlevel) | Safety filter levels for Imagen | | [SchemaType](./vertexai.md#schematype) | Contains the list of OpenAPI data types as defined by the [OpenAPI specification](https://swagger.io/docs/specification/data-models/data-types/) | | [VertexAIErrorCode](./vertexai.md#vertexaierrorcode) | Standardized error codes that [VertexAIError](./vertexai.vertexaierror.md#vertexaierror_class) can have. | @@ -90,12 +90,12 @@ The Vertex AI in Firebase Web SDK. | [GenerativeContentBlob](./vertexai.generativecontentblob.md#generativecontentblob_interface) | Interface for sending an image. | | [GroundingAttribution](./vertexai.groundingattribution.md#groundingattribution_interface) | | | [GroundingMetadata](./vertexai.groundingmetadata.md#groundingmetadata_interface) | Metadata returned to client when grounding is enabled. | -| [ImagenGCSImage](./vertexai.imagengcsimage.md#imagengcsimage_interface) | | -| [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface) | | -| [ImagenGenerationResponse](./vertexai.imagengenerationresponse.md#imagengenerationresponse_interface) | | -| [ImagenInlineImage](./vertexai.imageninlineimage.md#imageninlineimage_interface) | Copyright 2025 Google LLCLicensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. | -| [ImagenModelParams](./vertexai.imagenmodelparams.md#imagenmodelparams_interface) | | -| [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface) | | +| [ImagenGCSImage](./vertexai.imagengcsimage.md#imagengcsimage_interface) | An image generated by Imagen, stored in Google Cloud Storage (GCS). | +| [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface) | Configuration options for generating images with Imagen.See the \[Google Cloud Docs\](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api\#rest\_1). | +| [ImagenGenerationResponse](./vertexai.imagengenerationresponse.md#imagengenerationresponse_interface) | The response from a request to generate images with Imagen. | +| [ImagenInlineImage](./vertexai.imageninlineimage.md#imageninlineimage_interface) | An image generated by Imagen, represented as inline bytes. | +| [ImagenModelParams](./vertexai.imagenmodelparams.md#imagenmodelparams_interface) | Parameters for configuring an [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class). | +| [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface) | Safety settings for Imagen. | | [InlineDataPart](./vertexai.inlinedatapart.md#inlinedatapart_interface) | Content part interface if the part represents an image. | | [ModelParams](./vertexai.modelparams.md#modelparams_interface) | Params passed to [getGenerativeModel()](./vertexai.md#getgenerativemodel_e3037c9). | | [ObjectSchemaInterface](./vertexai.objectschemainterface.md#objectschemainterface_interface) | Interface for [ObjectSchema](./vertexai.objectschema.md#objectschema_class) class. | @@ -182,6 +182,8 @@ export declare function getGenerativeModel(vertexAI: VertexAI, modelParams: Mode ### getImagenModel(vertexAI, modelParams, requestOptions) {:#getimagenmodel_812c375} +Returns a [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) class with methods for using Imagen. + Signature: ```typescript @@ -398,6 +400,8 @@ export declare enum HarmSeverity ## ImagenAspectRatio +Aspect ratios for Imagen images. + Signature: ```typescript @@ -408,14 +412,16 @@ export declare enum ImagenAspectRatio | Member | Value | Description | | --- | --- | --- | -| LANDSCAPE\_16x9 | "16:9" | | -| LANDSCAPE\_3x4 | "3:4" | | -| PORTRAIT\_4x3 | "4:3" | | -| PORTRAIT\_9x16 | "9:16" | | -| SQUARE | "1:1" | | +| LANDSCAPE\_16x9 | "16:9" | Landscape 16:9 aspect ratio. | +| LANDSCAPE\_3x4 | "3:4" | Landscape 3:4 aspect ratio. | +| PORTRAIT\_4x3 | "4:3" | Portrait 4:3 aspect ratio. | +| PORTRAIT\_9x16 | "9:16" | Portrait 9:16 aspect ratio. | +| SQUARE | "1:1" | Square 1:1 aspect ratio. | ## ImagenPersonFilterLevel +Person filter levels for Imagen. + Signature: ```typescript @@ -426,12 +432,14 @@ export declare enum ImagenPersonFilterLevel | Member | Value | Description | | --- | --- | --- | -| ALLOW\_ADULT | "allow_adult" | | -| ALLOW\_ALL | "allow_all" | | -| BLOCK\_ALL | "dont_allow" | | +| ALLOW\_ADULT | "allow_adult" | Allow only adults in generated images. | +| ALLOW\_ALL | "allow_all" | Allow all person generation. | +| BLOCK\_ALL | "dont_allow" | Do not allow any person generation. | ## ImagenSafetyFilterLevel +Safety filter levels for Imagen + Signature: ```typescript @@ -442,10 +450,10 @@ export declare enum ImagenSafetyFilterLevel | Member | Value | Description | | --- | --- | --- | -| BLOCK\_LOW\_AND\_ABOVE | "block_low_and_above" | | -| BLOCK\_MEDIUM\_AND\_ABOVE | "block_medium_and_above" | | -| BLOCK\_NONE | "block_none" | | -| BLOCK\_ONLY\_HIGH | "block_only_high" | | +| BLOCK\_LOW\_AND\_ABOVE | "block_low_and_above" | Block images with low or higher safety severity. | +| BLOCK\_MEDIUM\_AND\_ABOVE | "block_medium_and_above" | Block images with medium or higher safety severity. | +| BLOCK\_NONE | "block_none" | Do not block any images based on safety. | +| BLOCK\_ONLY\_HIGH | "block_only_high" | Block images with high safety severity. | ## SchemaType diff --git a/docs-devsite/vertexai.vertexaimodel.md b/docs-devsite/vertexai.vertexaimodel.md index 31d7e1d9c32..ad35e68dded 100644 --- a/docs-devsite/vertexai.vertexaimodel.md +++ b/docs-devsite/vertexai.vertexaimodel.md @@ -10,19 +10,21 @@ https://github.com/firebase/firebase-js-sdk {% endcomment %} # VertexAIModel class +Base class for Vertex AI in Firebase model APIs. + The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `VertexAIModel` class. Signature: ```typescript -export declare abstract class VertexAIModel +export declare class VertexAIModel ``` ## Properties | Property | Modifiers | Type | Description | | --- | --- | --- | --- | -| [model](./vertexai.vertexaimodel.md#vertexaimodelmodel) | | string | | +| [model](./vertexai.vertexaimodel.md#vertexaimodelmodel) | | string | The fully qualified model resource name to use for generating images (e.g. publishers/google/models/imagen-3.0-generate-001). | ## Methods @@ -32,6 +34,8 @@ export declare abstract class VertexAIModel ## VertexAIModel.model +The fully qualified model resource name to use for generating images (e.g. `publishers/google/models/imagen-3.0-generate-001`). + Signature: ```typescript diff --git a/packages/vertexai/src/api.ts b/packages/vertexai/src/api.ts index 8b7477f306d..cb1e6c2437d 100644 --- a/packages/vertexai/src/api.ts +++ b/packages/vertexai/src/api.ts @@ -82,6 +82,15 @@ export function getGenerativeModel( return new GenerativeModel(vertexAI, modelParams, requestOptions); } +/** + * Returns a {@link ImagenModel} class with methods for using Imagen. + * + * @beta + * This feature is in public preview and is not intended for production use. + * The API is subject to change. + * + * @public + */ export function getImagenModel( vertexAI: VertexAI, modelParams: ImagenModelParams, diff --git a/packages/vertexai/src/models/imagen-model.ts b/packages/vertexai/src/models/imagen-model.ts index 8d9ab93b6ba..0668ddcdf3b 100644 --- a/packages/vertexai/src/models/imagen-model.ts +++ b/packages/vertexai/src/models/imagen-model.ts @@ -30,10 +30,50 @@ import { } from '../types'; import { VertexAIModel } from './vertexai-model'; +/** + * Class for Imagen model APIs. + * + * This class provides methods for generating images using the Imagen model. + * You can generate images inline as base64-encoded strings, or directly to + * Google Cloud Storage (GCS). + * + * @example + * ```javascript + * const imagen = new ImagenModel( + * vertexAI, + * { + * model: 'imagen-3.0-generate-001' + * } + * ); + * + * const response = await imagen.generateImages('A photo of a cat'); + * if (response.images.length > 0) { + * console.log(response.images[0].bytesBase64Encoded); + * } + * ``` + * + * @public + */ export class ImagenModel extends VertexAIModel { + /** + * The Imagen Generation Configuration. + */ generationConfig?: ImagenGenerationConfig; + /** + * Safety settings for filtering inappropriate content. + */ safetySettings?: ImagenSafetySettings; + /** + * Constructs a new instance of the {@link ImagenModel} class. + * + * @param vertexAI - An instance of the Vertex AI in Firebase SDK. + * @param modelParams - Parameters to use when making Imagen requests. + * @param requestOptions - Additional options to use when making requests. + * + * @throws If the `apiKey` or `projectId` fields are missing in your + * Firebase config. + */ constructor( vertexAI: VertexAI, modelParams: ImagenModelParams, @@ -45,6 +85,26 @@ export class ImagenModel extends VertexAIModel { this.safetySettings = safetySettings; } + /** + * Generates images using the Imagen model and returns them as + * base64-encoded strings. + * + * @beta + * This feature is in public preview and is not intended for production use. + * The API is subject to change. + * + * @param prompt - The text prompt used to generate the images. + * @returns A promise that resolves to an {@link ImagenGenerationResponse} + * object containing the generated images. + * + * @throws If the request to generate images fails. This happens if the + * prompt is blocked. + * + * @remarks + * If the prompt was not blocked, but one or more of the generated images were filtered, the + * returned object will have a `filteredReason` property. + * If all images are filtered, the `images` array will be empty. + */ async generateImages( prompt: string ): Promise> { @@ -63,6 +123,27 @@ export class ImagenModel extends VertexAIModel { return handlePredictResponse(response); } + /** + * Generates images to Google Cloud Storage (GCS) using the Imagen model. + * + * @beta + * This feature is in public preview and is not intended for production use. + * The API is subject to change. + * + * @param prompt - The text prompt used to generate the images. + * @param gcsURI - The GCS URI where the images should be stored. + * This should be a directory. For example, `gs://my-bucket/my-directory/`. + * @returns A promise that resolves to an {@link ImagenGenerationResponse} + * object containing the URLs of the generated images. + * + * @throws If the request fails to generate images fails. This happens if + * the prompt is blocked. + * + * @remarks + * If the prompt was not blocked, but one or more of the generated images were filtered, the + * returned object will have a `filteredReason` property. + * If all images are filtered, the `images` array will be empty. + */ async generateImagesGCS( prompt: string, gcsURI: string diff --git a/packages/vertexai/src/models/vertexai-model.ts b/packages/vertexai/src/models/vertexai-model.ts index 5bed60d6279..23a8466f32b 100644 --- a/packages/vertexai/src/models/vertexai-model.ts +++ b/packages/vertexai/src/models/vertexai-model.ts @@ -21,7 +21,16 @@ import { VertexAIService } from '../service'; import { ApiSettings } from '../types/internal'; import { _isFirebaseServerApp } from '@firebase/app'; +/** + * Base class for Vertex AI in Firebase model APIs. + * + * @public + */ export abstract class VertexAIModel { + /** + * The fully qualified model resource name to use for generating images + * (e.g. `publishers/google/models/imagen-3.0-generate-001`). + */ readonly model: string; /** diff --git a/packages/vertexai/src/requests/imagen-image-format.ts b/packages/vertexai/src/requests/imagen-image-format.ts index e6dbab041a6..27fb10e2a9a 100644 --- a/packages/vertexai/src/requests/imagen-image-format.ts +++ b/packages/vertexai/src/requests/imagen-image-format.ts @@ -17,14 +17,49 @@ import { logger } from '../logger'; +/** + * Defines the image format for images output by Imagen. + * + * Use this class to specify the desired format (JPEG or PNG) and compression quality + * for images generated by Imagen. This is typically included as part of + * {@link ImagenModelParams}. + * + * @example + * ```javascript + * const imagenModelParams = { + * // ... other ImagenModelParams + * imageFormat: ImagenImageFormat.jpeg(75) // JPEG with a compression level of 75. + * } + * ``` + * + * @public + */ export class ImagenImageFormat { + /** + * The MIME type. + */ mimeType: string; + /** + * The level of compression (a number between 0 and 100). + */ compressionQuality?: number; private constructor() { this.mimeType = 'image/png'; } + /** + * Creates an {@link ImagenImageFormat} for a JPEG image. + * + * @beta + * This feature is in public preview and is not intended for production use. + * The API is subject to change. + * + * @param compressionQuality - The level of compression (a number between 0 and 100). + * @returns An {@link ImagenImageFormat} object for a JPEG image. + * + * @public + */ static jpeg(compressionQuality?: number): ImagenImageFormat { if ( compressionQuality && @@ -37,6 +72,17 @@ export class ImagenImageFormat { return { mimeType: 'image/jpeg', compressionQuality }; } + /** + * Creates an {@link ImagenImageFormat} for a PNG image. + * + * @beta + * This feature is in public preview and is not intended for production use. + * The API is subject to change. + * + * @returns An {@link ImagenImageFormat} object for a PNG image. + * + * @public + */ static png(): ImagenImageFormat { return { mimeType: 'image/png' }; } diff --git a/packages/vertexai/src/types/imagen/requests.ts b/packages/vertexai/src/types/imagen/requests.ts index cf72391dc41..0df0ac12202 100644 --- a/packages/vertexai/src/types/imagen/requests.ts +++ b/packages/vertexai/src/types/imagen/requests.ts @@ -17,42 +17,142 @@ import { ImagenImageFormat } from '../../requests/imagen-image-format'; +/** + * Parameters for configuring an {@link ImagenModel}. + * + * @public + */ export interface ImagenModelParams { + /** + * The Imagen model to use for generating images. + * For example: `imagen-3.0-generate-001`. + */ model: string; + /** + * The Imagen Generation Configuration. + */ generationConfig?: ImagenGenerationConfig; + /** + * Safety settings for filtering inappropriate content. + */ safetySettings?: ImagenSafetySettings; } +/** + * Configuration options for generating images with Imagen. + * + * See the [Google Cloud Docs](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#rest_1). + * + * @public + */ export interface ImagenGenerationConfig { + /** + * A description of what should be omitted from the generated images. + */ negativePrompt?: string; + /** + * The number of images to generate. Must be between 1 and 4. The default value is 1. + */ numberOfImages?: number; + /** + * The aspect ratio of the generated images. The default value is 1:1. + * used. + */ aspectRatio?: ImagenAspectRatio; + /** + * The image format of the generated images. The default is PNG. + */ imageFormat?: ImagenImageFormat; + /** + * If true, adds a SynthID watermark to the generated images. + */ addWatermark?: boolean; } +/** + * Safety filter levels for Imagen + * + * @public + */ export enum ImagenSafetyFilterLevel { + /** + * Block images with low or higher safety severity. + */ BLOCK_LOW_AND_ABOVE = 'block_low_and_above', + /** + * Block images with medium or higher safety severity. + */ BLOCK_MEDIUM_AND_ABOVE = 'block_medium_and_above', + /** + * Block images with high safety severity. + */ BLOCK_ONLY_HIGH = 'block_only_high', + /** + * Do not block any images based on safety. + */ BLOCK_NONE = 'block_none' } +/** + * Person filter levels for Imagen. + * + * @public + */ export enum ImagenPersonFilterLevel { + /** + * Do not allow any person generation. + */ BLOCK_ALL = 'dont_allow', + /** + * Allow only adults in generated images. + */ ALLOW_ADULT = 'allow_adult', + /** + * Allow all person generation. + */ ALLOW_ALL = 'allow_all' } +/** + * Safety settings for Imagen. + * + * @public + */ export interface ImagenSafetySettings { + /** + * The safety filter level to use. + */ safetyFilterLevel?: ImagenSafetyFilterLevel; + /** + * The person filter level to use. + */ personFilterLevel?: ImagenPersonFilterLevel; } +/** + * Aspect ratios for Imagen images. + * + * @public + */ export enum ImagenAspectRatio { + /** + * Square 1:1 aspect ratio. + */ SQUARE = '1:1', + /** + * Landscape 3:4 aspect ratio. + */ LANDSCAPE_3x4 = '3:4', + /** + * Portrait 4:3 aspect ratio. + */ PORTRAIT_4x3 = '4:3', + /** + * Landscape 16:9 aspect ratio. + */ LANDSCAPE_16x9 = '16:9', + /** + * Portrait 9:16 aspect ratio. + */ PORTRAIT_9x16 = '9:16' } diff --git a/packages/vertexai/src/types/imagen/responses.ts b/packages/vertexai/src/types/imagen/responses.ts index 514acc601b1..dcd43706f90 100644 --- a/packages/vertexai/src/types/imagen/responses.ts +++ b/packages/vertexai/src/types/imagen/responses.ts @@ -15,19 +15,56 @@ * limitations under the License. */ +/** + * An image generated by Imagen, represented as inline bytes. + * + * @public + */ export interface ImagenInlineImage { + /** + * The MIME type of the image. + */ mimeType: string; + /** + * The image data encoded as a base64 string. + */ bytesBase64Encoded: string; } +/** + * An image generated by Imagen, stored in Google Cloud Storage (GCS). + * + * @public + */ export interface ImagenGCSImage { + /** + * The MIME type of the image. + */ mimeType: string; + /** + * The Google Cloud Storage (GCS) URI where the image is stored. + */ gcsURI: string; } +/** + * The response from a request to generate images with Imagen. + * + * @public + */ export interface ImagenGenerationResponse< T extends ImagenInlineImage | ImagenGCSImage > { + /** + * The images generated by Imagen. + * If all images were filtered due to safety reasons, this array will be empty. + */ images: T[]; + /** + * The reason why any images were filtered. This field is only present if one + * or more images were filtered. + * For the mappings of error codes to reasons, see + * {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-categories}. + */ filteredReason?: string; } From 95c70932b76268c48719134636bc695969605d41 Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Fri, 7 Feb 2025 15:29:51 -0500 Subject: [PATCH 02/14] update docs --- docs-devsite/vertexai.imagengcsimage.md | 16 ++- .../vertexai.imagengenerationconfig.md | 30 +++-- .../vertexai.imagengenerationresponse.md | 14 ++- docs-devsite/vertexai.imagenimageformat.md | 18 +-- docs-devsite/vertexai.imageninlineimage.md | 12 +- docs-devsite/vertexai.imagenmodel.md | 26 +++-- docs-devsite/vertexai.imagenmodelparams.md | 16 ++- docs-devsite/vertexai.imagensafetysettings.md | 12 +- docs-devsite/vertexai.md | 70 +++++++----- docs-devsite/vertexai.vertexaimodel.md | 2 +- packages/vertexai/src/api.ts | 16 ++- packages/vertexai/src/models/imagen-model.ts | 16 +-- .../src/requests/imagen-image-format.ts | 10 +- .../vertexai/src/types/imagen/requests.ts | 107 +++++++++++++----- .../vertexai/src/types/imagen/responses.ts | 33 ++++-- 15 files changed, 271 insertions(+), 127 deletions(-) diff --git a/docs-devsite/vertexai.imagengcsimage.md b/docs-devsite/vertexai.imagengcsimage.md index af9887ba9dd..a3eb9b062d7 100644 --- a/docs-devsite/vertexai.imagengcsimage.md +++ b/docs-devsite/vertexai.imagengcsimage.md @@ -10,7 +10,7 @@ https://github.com/firebase/firebase-js-sdk {% endcomment %} # ImagenGCSImage interface -An image generated by Imagen, stored in Google Cloud Storage (GCS). +An image generated by Imagen, stored in Cloud Storage (GCS) for Firebase. Signature: @@ -22,12 +22,12 @@ export interface ImagenGCSImage | Property | Type | Description | | --- | --- | --- | -| [gcsURI](./vertexai.imagengcsimage.md#imagengcsimagegcsuri) | string | The Google Cloud Storage (GCS) URI where the image is stored. | -| [mimeType](./vertexai.imagengcsimage.md#imagengcsimagemimetype) | string | The MIME type of the image. | +| [gcsURI](./vertexai.imagengcsimage.md#imagengcsimagegcsuri) | string | The URI of the file in Cloud Storage (GCS) for Firestore. | +| [mimeType](./vertexai.imagengcsimage.md#imagengcsimagemimetype) | string | The MIME type of the image; either "image/png" or "image/jpeg".To request a different format, set the imageFormat property in your [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface). | ## ImagenGCSImage.gcsURI -The Google Cloud Storage (GCS) URI where the image is stored. +The URI of the file in Cloud Storage (GCS) for Firestore. Signature: @@ -35,9 +35,15 @@ The Google Cloud Storage (GCS) URI where the image is stored. gcsURI: string; ``` +### Example + +`"gs://bucket-name/path/sample_0.jpg"`. + ## ImagenGCSImage.mimeType -The MIME type of the image. +The MIME type of the image; either `"image/png"` or `"image/jpeg"`. + +To request a different format, set the `imageFormat` property in your [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface). Signature: diff --git a/docs-devsite/vertexai.imagengenerationconfig.md b/docs-devsite/vertexai.imagengenerationconfig.md index d41260b2c07..b5eed7b8148 100644 --- a/docs-devsite/vertexai.imagengenerationconfig.md +++ b/docs-devsite/vertexai.imagengenerationconfig.md @@ -12,7 +12,7 @@ https://github.com/firebase/firebase-js-sdk # ImagenGenerationConfig interface Configuration options for generating images with Imagen. -See the \[Google Cloud Docs\](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api\#rest\_1). +See the \[Cloud documentation\](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images) for more details. Signature: @@ -24,15 +24,19 @@ export interface ImagenGenerationConfig | Property | Type | Description | | --- | --- | --- | -| [addWatermark](./vertexai.imagengenerationconfig.md#imagengenerationconfigaddwatermark) | boolean | If true, adds a SynthID watermark to the generated images. | -| [aspectRatio](./vertexai.imagengenerationconfig.md#imagengenerationconfigaspectratio) | [ImagenAspectRatio](./vertexai.md#imagenaspectratio) | The aspect ratio of the generated images. The default value is 1:1. used. | -| [imageFormat](./vertexai.imagengenerationconfig.md#imagengenerationconfigimageformat) | [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) | The image format of the generated images. The default is PNG. | -| [negativePrompt](./vertexai.imagengenerationconfig.md#imagengenerationconfignegativeprompt) | string | A description of what should be omitted from the generated images. | -| [numberOfImages](./vertexai.imagengenerationconfig.md#imagengenerationconfignumberofimages) | number | The number of images to generate. Must be between 1 and 4. The default value is 1. | +| [addWatermark](./vertexai.imagengenerationconfig.md#imagengenerationconfigaddwatermark) | boolean | Whether to add an invisible watermark to generated images.If set to true, an invisible SynthID watermark is embedded in generated images to indicate that they are AI generated. If set to false, watermarking will be disabled.The default value depends on the Imagen model; see the \[addWatermark\](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api\#parameter\_list) documentation for more details. | +| [aspectRatio](./vertexai.imagengenerationconfig.md#imagengenerationconfigaspectratio) | [ImagenAspectRatio](./vertexai.md#imagenaspectratio) | The aspect ratio of the generated images. The default value is square 1:1. Supported aspect ratios depend on the Imagen model, see [ImagenAspectRatio](./vertexai.md#imagenaspectratio) for more details. | +| [imageFormat](./vertexai.imagengenerationconfig.md#imagengenerationconfigimageformat) | [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) | The image format of the generated images. The default is PNG.See [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for more details. | +| [negativePrompt](./vertexai.imagengenerationconfig.md#imagengenerationconfignegativeprompt) | string | A description of what should be omitted from the generated images.Support for negative prompts depends on the Imagen model.See the \[Cloud documentation\](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images\#negative-prompt) for more details. | +| [numberOfImages](./vertexai.imagengenerationconfig.md#imagengenerationconfignumberofimages) | number | The number of images to generate. The default value is 1.The number of sample images that may be generated in each request depends on the model (typically up to 4); see the \[sampleCount\](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api\#parameter\_list) documentation for more details. | ## ImagenGenerationConfig.addWatermark -If true, adds a SynthID watermark to the generated images. +Whether to add an invisible watermark to generated images. + +If set to `true`, an invisible SynthID watermark is embedded in generated images to indicate that they are AI generated. If set to `false`, watermarking will be disabled. + +The default value depends on the Imagen model; see the \[`addWatermark`\](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api\#parameter\_list) documentation for more details. Signature: @@ -42,7 +46,7 @@ addWatermark?: boolean; ## ImagenGenerationConfig.aspectRatio -The aspect ratio of the generated images. The default value is 1:1. used. +The aspect ratio of the generated images. The default value is square 1:1. Supported aspect ratios depend on the Imagen model, see [ImagenAspectRatio](./vertexai.md#imagenaspectratio) for more details. Signature: @@ -54,6 +58,8 @@ aspectRatio?: ImagenAspectRatio; The image format of the generated images. The default is PNG. +See [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for more details. + Signature: ```typescript @@ -64,6 +70,10 @@ imageFormat?: ImagenImageFormat; A description of what should be omitted from the generated images. +Support for negative prompts depends on the Imagen model. + +See the \[Cloud documentation\](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images\#negative-prompt) for more details. + Signature: ```typescript @@ -72,7 +82,9 @@ negativePrompt?: string; ## ImagenGenerationConfig.numberOfImages -The number of images to generate. Must be between 1 and 4. The default value is 1. +The number of images to generate. The default value is 1. + +The number of sample images that may be generated in each request depends on the model (typically up to 4); see the \[`sampleCount`\](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api\#parameter\_list) documentation for more details. Signature: diff --git a/docs-devsite/vertexai.imagengenerationresponse.md b/docs-devsite/vertexai.imagengenerationresponse.md index 624698b5ff7..632052a3a33 100644 --- a/docs-devsite/vertexai.imagengenerationresponse.md +++ b/docs-devsite/vertexai.imagengenerationresponse.md @@ -22,12 +22,16 @@ export interface ImagenGenerationResponse. | -| [images](./vertexai.imagengenerationresponse.md#imagengenerationresponseimages) | T\[\] | The images generated by Imagen. If all images were filtered due to safety reasons, this array will be empty. | +| [filteredReason](./vertexai.imagengenerationresponse.md#imagengenerationresponsefilteredreason) | string | The reason that images were filtered out. This property will only be defined if one or more images were filtered.Images may be filtered out due to the [ImagenSafetyFilterLevel](./vertexai.md#imagensafetyfilterlevel), [ImagenPersonFilterLevel](./vertexai.md#imagenpersonfilterlevel), or filtering included in the model. The filter levels may be adjusted in your [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface).See the \[Responsible AI and usage guidelines for Imagen\](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen) for more details. | +| [images](./vertexai.imagengenerationresponse.md#imagengenerationresponseimages) | T\[\] | The images generated by Imagen.The number of images generated may be fewer than the number requested if one or more were filtered out; see filteredReason. | ## ImagenGenerationResponse.filteredReason -The reason why any images were filtered. This field is only present if one or more images were filtered. For the mappings of error codes to reasons, see [https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen\#safety-categories](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-categories). +The reason that images were filtered out. This property will only be defined if one or more images were filtered. + +Images may be filtered out due to the [ImagenSafetyFilterLevel](./vertexai.md#imagensafetyfilterlevel), [ImagenPersonFilterLevel](./vertexai.md#imagenpersonfilterlevel), or filtering included in the model. The filter levels may be adjusted in your [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface). + +See the \[Responsible AI and usage guidelines for Imagen\](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen) for more details. Signature: @@ -37,7 +41,9 @@ filteredReason?: string; ## ImagenGenerationResponse.images -The images generated by Imagen. If all images were filtered due to safety reasons, this array will be empty. +The images generated by Imagen. + +The number of images generated may be fewer than the number requested if one or more were filtered out; see `filteredReason`. Signature: diff --git a/docs-devsite/vertexai.imagenimageformat.md b/docs-devsite/vertexai.imagenimageformat.md index 93d7f1d8fe7..d130dbcf0d7 100644 --- a/docs-devsite/vertexai.imagenimageformat.md +++ b/docs-devsite/vertexai.imagenimageformat.md @@ -12,7 +12,7 @@ https://github.com/firebase/firebase-js-sdk # ImagenImageFormat class Defines the image format for images output by Imagen. -Use this class to specify the desired format (JPEG or PNG) and compression quality for images generated by Imagen. This is typically included as part of [ImagenModelParams](./vertexai.imagenmodelparams.md#imagenmodelparams_interface). +Use this class to specify the desired format (JPEG or PNG) and compression quality for images generated by Imagen. This is typically included as part of [ImagenModelParams](./vertexai.imagenmodelparams.md#imagenmodelparams_interface). Signature: @@ -31,8 +31,8 @@ export declare class ImagenImageFormat | Method | Modifiers | Description | | --- | --- | --- | -| [jpeg(compressionQuality)](./vertexai.imagenimageformat.md#imagenimageformatjpeg) | static | Creates an ImagenImageFormat for a JPEG image. | -| [png()](./vertexai.imagenimageformat.md#imagenimageformatpng) | static | Creates an ImageImageFormat for a PNG image. | +| [jpeg(compressionQuality)](./vertexai.imagenimageformat.md#imagenimageformatjpeg) | static | Creates an [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for a JPEG image.For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. | +| [png()](./vertexai.imagenimageformat.md#imagenimageformatpng) | static | Creates an [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for a PNG image.For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. | ## ImagenImageFormat.compressionQuality @@ -56,7 +56,9 @@ mimeType: string; ## ImagenImageFormat.jpeg() -Creates an ImagenImageFormat for a JPEG image. +Creates an [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for a JPEG image. + +For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. Signature: @@ -74,11 +76,13 @@ static jpeg(compressionQuality?: number): ImagenImageFormat; [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) -ImagenImageFormat +An [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) object for a JPEG image. ## ImagenImageFormat.png() -Creates an ImageImageFormat for a PNG image. +Creates an [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for a PNG image. + +For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. Signature: @@ -89,7 +93,7 @@ static png(): ImagenImageFormat; [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) -ImageImageFormat +An [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) object for a PNG image. ### Example diff --git a/docs-devsite/vertexai.imageninlineimage.md b/docs-devsite/vertexai.imageninlineimage.md index 6d3a3972445..ba465007a83 100644 --- a/docs-devsite/vertexai.imageninlineimage.md +++ b/docs-devsite/vertexai.imageninlineimage.md @@ -10,7 +10,7 @@ https://github.com/firebase/firebase-js-sdk {% endcomment %} # ImagenInlineImage interface -An image generated by Imagen, represented as inline bytes. +An image generated by Imagen, represented as inline data. Signature: @@ -22,12 +22,12 @@ export interface ImagenInlineImage | Property | Type | Description | | --- | --- | --- | -| [bytesBase64Encoded](./vertexai.imageninlineimage.md#imageninlineimagebytesbase64encoded) | string | The image data encoded as a base64 string. | -| [mimeType](./vertexai.imageninlineimage.md#imageninlineimagemimetype) | string | The MIME type of the image. | +| [bytesBase64Encoded](./vertexai.imageninlineimage.md#imageninlineimagebytesbase64encoded) | string | The base64-encoded image data. | +| [mimeType](./vertexai.imageninlineimage.md#imageninlineimagemimetype) | string | The MIME type of the image; either "image/png" or "image/jpeg".To request a different format, set the imageFormat property in your [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface). | ## ImagenInlineImage.bytesBase64Encoded -The image data encoded as a base64 string. +The base64-encoded image data. Signature: @@ -37,7 +37,9 @@ bytesBase64Encoded: string; ## ImagenInlineImage.mimeType -The MIME type of the image. +The MIME type of the image; either `"image/png"` or `"image/jpeg"`. + +To request a different format, set the `imageFormat` property in your [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface). Signature: diff --git a/docs-devsite/vertexai.imagenmodel.md b/docs-devsite/vertexai.imagenmodel.md index b38684f7e12..f1d7e9399d9 100644 --- a/docs-devsite/vertexai.imagenmodel.md +++ b/docs-devsite/vertexai.imagenmodel.md @@ -39,8 +39,8 @@ export declare class ImagenModel extends VertexAIModel | Method | Modifiers | Description | | --- | --- | --- | -| [generateImages(prompt)](./vertexai.imagenmodel.md#imagenmodelgenerateimages) | | Generates images using the Imagen model and returns them as base64-encoded strings. | -| [generateImagesGCS(prompt, gcsURI)](./vertexai.imagenmodel.md#imagenmodelgenerateimagesgcs) | | Generates images to Google Cloud Storage (GCS) using the Imagen model. | +| [generateImages(prompt)](./vertexai.imagenmodel.md#imagenmodelgenerateimages) | | (BETA) Generates images using the Imagen model and returns them as base64-encoded strings.For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. | +| [generateImagesGCS(prompt, gcsURI)](./vertexai.imagenmodel.md#imagenmodelgenerateimagesgcs) | | (BETA) Generates images to Google Cloud Storage (GCS) using the Imagen model.For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. | ## ImagenModel.(constructor) @@ -71,7 +71,7 @@ The Imagen Generation Configuration. Signature: ```typescript -readonly generationConfig?: ImagenGenerationConfig; +generationConfig?: ImagenGenerationConfig; ``` ## ImagenModel.requestOptions @@ -79,7 +79,7 @@ readonly generationConfig?: ImagenGenerationConfig; Signature: ```typescript -readonly requestOptions?: RequestOptions | undefined; +requestOptions?: RequestOptions | undefined; ``` ## ImagenModel.safetySettings @@ -89,13 +89,18 @@ Safety settings for filtering inappropriate content. Signature: ```typescript -readonly safetySettings?: ImagenSafetySettings; +safetySettings?: ImagenSafetySettings; ``` ## ImagenModel.generateImages() +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + Generates images using the Imagen model and returns them as base64-encoded strings. +For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. + If the prompt was not blocked, but one or more of the generated images were filtered, the returned object will have a `filteredReason` property. If all images are filtered, the `images` array will be empty. Signature: @@ -108,7 +113,7 @@ generateImages(prompt: string): PromiseReturns: @@ -122,8 +127,13 @@ If the request to generate images fails. This happens if the prompt is blocked. ## ImagenModel.generateImagesGCS() +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + Generates images to Google Cloud Storage (GCS) using the Imagen model. +For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. + If the prompt was not blocked, but one or more of the generated images were filtered, the returned object will have a `filteredReason` property. If all images are filtered, the `images` array will be empty. Signature: @@ -136,8 +146,8 @@ generateImagesGCS(prompt: string, gcsURI: string): Promisegs://my-bucket/my-directory/. | +| prompt | string | A text prompt describing the image(s) to generate. | +| gcsURI | string | The Google Cloud Storage (GCS) URI where the images should be stored. This should be a directory. For example, gs://my-bucket/my-directory/. | Returns: diff --git a/docs-devsite/vertexai.imagenmodelparams.md b/docs-devsite/vertexai.imagenmodelparams.md index 1ad6fe03cd5..8ba9e2af7bf 100644 --- a/docs-devsite/vertexai.imagenmodelparams.md +++ b/docs-devsite/vertexai.imagenmodelparams.md @@ -22,13 +22,13 @@ export interface ImagenModelParams | Property | Type | Description | | --- | --- | --- | -| [generationConfig](./vertexai.imagenmodelparams.md#imagenmodelparamsgenerationconfig) | [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface) | The Imagen Generation Configuration. | -| [model](./vertexai.imagenmodelparams.md#imagenmodelparamsmodel) | string | The Imagen model to use for generating images. For example: imagen-3.0-generate-001. | -| [safetySettings](./vertexai.imagenmodelparams.md#imagenmodelparamssafetysettings) | [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface) | Safety settings for filtering inappropriate content. | +| [generationConfig](./vertexai.imagenmodelparams.md#imagenmodelparamsgenerationconfig) | [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface) | Configuration options for generating images with Imagen. | +| [model](./vertexai.imagenmodelparams.md#imagenmodelparamsmodel) | string | The Imagen model to use for generating images. For example: imagen-3.0-generate-002.Only Imagen 3 models (named imagen-3.0-*) are supported.See \[model versions\](https://cloud.google.com/vertex-ai/generative-ai/docs/image/model-versioning) for a full list of supported Imagen 3 models. | +| [safetySettings](./vertexai.imagenmodelparams.md#imagenmodelparamssafetysettings) | [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface) | Safety settings for filtering potentially inappropriate content. | ## ImagenModelParams.generationConfig -The Imagen Generation Configuration. +Configuration options for generating images with Imagen. Signature: @@ -38,7 +38,11 @@ generationConfig?: ImagenGenerationConfig; ## ImagenModelParams.model -The Imagen model to use for generating images. For example: `imagen-3.0-generate-001`. +The Imagen model to use for generating images. For example: `imagen-3.0-generate-002`. + +Only Imagen 3 models (named `imagen-3.0-*`) are supported. + +See \[model versions\](https://cloud.google.com/vertex-ai/generative-ai/docs/image/model-versioning) for a full list of supported Imagen 3 models. Signature: @@ -48,7 +52,7 @@ model: string; ## ImagenModelParams.safetySettings -Safety settings for filtering inappropriate content. +Safety settings for filtering potentially inappropriate content. Signature: diff --git a/docs-devsite/vertexai.imagensafetysettings.md b/docs-devsite/vertexai.imagensafetysettings.md index a544b9688bc..f5a5d352843 100644 --- a/docs-devsite/vertexai.imagensafetysettings.md +++ b/docs-devsite/vertexai.imagensafetysettings.md @@ -10,7 +10,9 @@ https://github.com/firebase/firebase-js-sdk {% endcomment %} # ImagenSafetySettings interface -Safety settings for Imagen. +Settings for controlling the aggressiveness of filtering out sensitive content. + +See the \[Responsible AI and usage guidelines\](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen\#config-safety-filters) for more details. Signature: @@ -22,12 +24,12 @@ export interface ImagenSafetySettings | Property | Type | Description | | --- | --- | --- | -| [personFilterLevel](./vertexai.imagensafetysettings.md#imagensafetysettingspersonfilterlevel) | [ImagenPersonFilterLevel](./vertexai.md#imagenpersonfilterlevel) | The person filter level to use. | -| [safetyFilterLevel](./vertexai.imagensafetysettings.md#imagensafetysettingssafetyfilterlevel) | [ImagenSafetyFilterLevel](./vertexai.md#imagensafetyfilterlevel) | The safety filter level to use. | +| [personFilterLevel](./vertexai.imagensafetysettings.md#imagensafetysettingspersonfilterlevel) | [ImagenPersonFilterLevel](./vertexai.md#imagenpersonfilterlevel) | A filter level controlling whether generation of images containing people or faces is allowed. | +| [safetyFilterLevel](./vertexai.imagensafetysettings.md#imagensafetysettingssafetyfilterlevel) | [ImagenSafetyFilterLevel](./vertexai.md#imagensafetyfilterlevel) | A filter level controlling how aggressive to filter out sensitive content from generated images. | ## ImagenSafetySettings.personFilterLevel -The person filter level to use. +A filter level controlling whether generation of images containing people or faces is allowed. Signature: @@ -37,7 +39,7 @@ personFilterLevel?: ImagenPersonFilterLevel; ## ImagenSafetySettings.safetyFilterLevel -The safety filter level to use. +A filter level controlling how aggressive to filter out sensitive content from generated images. Signature: diff --git a/docs-devsite/vertexai.md b/docs-devsite/vertexai.md index f8016829c9f..a8e7fb1030e 100644 --- a/docs-devsite/vertexai.md +++ b/docs-devsite/vertexai.md @@ -20,7 +20,7 @@ The Vertex AI in Firebase Web SDK. | [getVertexAI(app, options)](./vertexai.md#getvertexai_04094cf) | Returns a [VertexAI](./vertexai.vertexai.md#vertexai_interface) instance for the given app. | | function(vertexAI, ...) | | [getGenerativeModel(vertexAI, modelParams, requestOptions)](./vertexai.md#getgenerativemodel_e3037c9) | Returns a [GenerativeModel](./vertexai.generativemodel.md#generativemodel_class) class with methods for inference and other functionality. | -| [getImagenModel(vertexAI, modelParams, requestOptions)](./vertexai.md#getimagenmodel_812c375) | Returns a [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) class with methods for using Imagen. | +| [getImagenModel(vertexAI, modelParams, requestOptions)](./vertexai.md#getimagenmodel_812c375) | Returns an [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) class with methods for using Imagen.For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways.Only Imagen 3 models (named imagen-3.0-*) are supported. | ## Classes @@ -30,7 +30,7 @@ The Vertex AI in Firebase Web SDK. | [BooleanSchema](./vertexai.booleanschema.md#booleanschema_class) | Schema class for "boolean" types. | | [ChatSession](./vertexai.chatsession.md#chatsession_class) | ChatSession class that enables sending chat messages and stores history of sent and received messages so far. | | [GenerativeModel](./vertexai.generativemodel.md#generativemodel_class) | Class for generative model APIs. | -| [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) | Defines the image format for images output by Imagen.Use this class to specify the desired format (JPEG or PNG) and compression quality for images generated by Imagen. This is typically included as part of [ImagenModelParams](./vertexai.imagenmodelparams.md#imagenmodelparams_interface). | +| [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) | Defines the image format for images output by Imagen.Use this class to specify the desired format (JPEG or PNG) and compression quality for images generated by Imagen. This is typically included as part of [ImagenModelParams](./vertexai.imagenmodelparams.md#imagenmodelparams_interface). | | [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) | Class for Imagen model APIs.This class provides methods for generating images using the Imagen model. You can generate images inline as base64-encoded strings, or directly to Google Cloud Storage (GCS). | | [IntegerSchema](./vertexai.integerschema.md#integerschema_class) | Schema class for "integer" types. | | [NumberSchema](./vertexai.numberschema.md#numberschema_class) | Schema class for "number" types. | @@ -52,9 +52,9 @@ The Vertex AI in Firebase Web SDK. | [HarmCategory](./vertexai.md#harmcategory) | Harm categories that would cause prompts or candidates to be blocked. | | [HarmProbability](./vertexai.md#harmprobability) | Probability that a prompt or candidate matches a harm category. | | [HarmSeverity](./vertexai.md#harmseverity) | Harm severity levels. | -| [ImagenAspectRatio](./vertexai.md#imagenaspectratio) | Aspect ratios for Imagen images. | -| [ImagenPersonFilterLevel](./vertexai.md#imagenpersonfilterlevel) | Person filter levels for Imagen. | -| [ImagenSafetyFilterLevel](./vertexai.md#imagensafetyfilterlevel) | Safety filter levels for Imagen | +| [ImagenAspectRatio](./vertexai.md#imagenaspectratio) | Aspect ratios for Imagen images.To specify an aspect ratio for generated images, set the aspectRatio property in your [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface).See the the \[Cloud documentation\](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images\#aspect-ratio) for more details and examples of the supported aspect ratios. | +| [ImagenPersonFilterLevel](./vertexai.md#imagenpersonfilterlevel) | A filter level controlling whether generation of images containing people or faces is allowed.See the \[personGeneration\](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api\#parameter\_list) documentation for more details. | +| [ImagenSafetyFilterLevel](./vertexai.md#imagensafetyfilterlevel) | A filter level controlling how aggressively to filter sensitive content.Text prompts provided as inputs and images (generated or uploaded) through Imagen on Vertex AI are assessed against a list of safety filters, which include 'harmful categories' (for example, violence, sexual, derogatory, and toxic). This filter level controls how aggressively to filter out potentially harmful content from responses. See the \[safetySetting\](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api\#parameter\_list) documentation and the \[Responsible AI and usage guidelines\](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen\#safety-filters) for more details. | | [SchemaType](./vertexai.md#schematype) | Contains the list of OpenAPI data types as defined by the [OpenAPI specification](https://swagger.io/docs/specification/data-models/data-types/) | | [VertexAIErrorCode](./vertexai.md#vertexaierrorcode) | Standardized error codes that [VertexAIError](./vertexai.vertexaierror.md#vertexaierror_class) can have. | @@ -90,12 +90,12 @@ The Vertex AI in Firebase Web SDK. | [GenerativeContentBlob](./vertexai.generativecontentblob.md#generativecontentblob_interface) | Interface for sending an image. | | [GroundingAttribution](./vertexai.groundingattribution.md#groundingattribution_interface) | | | [GroundingMetadata](./vertexai.groundingmetadata.md#groundingmetadata_interface) | Metadata returned to client when grounding is enabled. | -| [ImagenGCSImage](./vertexai.imagengcsimage.md#imagengcsimage_interface) | An image generated by Imagen, stored in Google Cloud Storage (GCS). | -| [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface) | Configuration options for generating images with Imagen.See the \[Google Cloud Docs\](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api\#rest\_1). | +| [ImagenGCSImage](./vertexai.imagengcsimage.md#imagengcsimage_interface) | An image generated by Imagen, stored in Cloud Storage (GCS) for Firebase. | +| [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface) | Configuration options for generating images with Imagen.See the \[Cloud documentation\](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images) for more details. | | [ImagenGenerationResponse](./vertexai.imagengenerationresponse.md#imagengenerationresponse_interface) | The response from a request to generate images with Imagen. | -| [ImagenInlineImage](./vertexai.imageninlineimage.md#imageninlineimage_interface) | An image generated by Imagen, represented as inline bytes. | +| [ImagenInlineImage](./vertexai.imageninlineimage.md#imageninlineimage_interface) | An image generated by Imagen, represented as inline data. | | [ImagenModelParams](./vertexai.imagenmodelparams.md#imagenmodelparams_interface) | Parameters for configuring an [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class). | -| [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface) | Safety settings for Imagen. | +| [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface) | Settings for controlling the aggressiveness of filtering out sensitive content.See the \[Responsible AI and usage guidelines\](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen\#config-safety-filters) for more details. | | [InlineDataPart](./vertexai.inlinedatapart.md#inlinedatapart_interface) | Content part interface if the part represents an image. | | [ModelParams](./vertexai.modelparams.md#modelparams_interface) | Params passed to [getGenerativeModel()](./vertexai.md#getgenerativemodel_e3037c9). | | [ObjectSchemaInterface](./vertexai.objectschemainterface.md#objectschemainterface_interface) | Interface for [ObjectSchema](./vertexai.objectschema.md#objectschema_class) class. | @@ -182,7 +182,11 @@ export declare function getGenerativeModel(vertexAI: VertexAI, modelParams: Mode ### getImagenModel(vertexAI, modelParams, requestOptions) {:#getimagenmodel_812c375} -Returns a [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) class with methods for using Imagen. +Returns an [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) class with methods for using Imagen. + +For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. + +Only Imagen 3 models (named `imagen-3.0-*`) are supported. Signature: @@ -194,14 +198,18 @@ export declare function getImagenModel(vertexAI: VertexAI, modelParams: ImagenMo | Parameter | Type | Description | | --- | --- | --- | -| vertexAI | [VertexAI](./vertexai.vertexai.md#vertexai_interface) | | -| modelParams | [ImagenModelParams](./vertexai.imagenmodelparams.md#imagenmodelparams_interface) | | -| requestOptions | [RequestOptions](./vertexai.requestoptions.md#requestoptions_interface) | | +| vertexAI | [VertexAI](./vertexai.vertexai.md#vertexai_interface) | An instance of the Vertex AI in Firebase SDK. | +| modelParams | [ImagenModelParams](./vertexai.imagenmodelparams.md#imagenmodelparams_interface) | Parameters to use when making Imagen requests. | +| requestOptions | [RequestOptions](./vertexai.requestoptions.md#requestoptions_interface) | Additional options to use when making requests. | Returns: [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) +#### Exceptions + +If the `apiKey` or `projectId` fields are missing in your Firebase config. + ## POSSIBLE\_ROLES Possible roles. @@ -402,6 +410,10 @@ export declare enum HarmSeverity Aspect ratios for Imagen images. +To specify an aspect ratio for generated images, set the `aspectRatio` property in your [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface). + +See the the \[Cloud documentation\](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images\#aspect-ratio) for more details and examples of the supported aspect ratios. + Signature: ```typescript @@ -412,15 +424,17 @@ export declare enum ImagenAspectRatio | Member | Value | Description | | --- | --- | --- | -| LANDSCAPE\_16x9 | "16:9" | Landscape 16:9 aspect ratio. | -| LANDSCAPE\_3x4 | "3:4" | Landscape 3:4 aspect ratio. | -| PORTRAIT\_4x3 | "4:3" | Portrait 4:3 aspect ratio. | -| PORTRAIT\_9x16 | "9:16" | Portrait 9:16 aspect ratio. | -| SQUARE | "1:1" | Square 1:1 aspect ratio. | +| LANDSCAPE\_16x9 | "16:9" | Landscape (16:9) aspect ratio. | +| LANDSCAPE\_3x4 | "3:4" | Landscape (3:4) aspect ratio. | +| PORTRAIT\_4x3 | "4:3" | Portrait (4:3) aspect ratio. | +| PORTRAIT\_9x16 | "9:16" | Portrait (9:16) aspect ratio. | +| SQUARE | "1:1" | Square (1:1) aspect ratio. | ## ImagenPersonFilterLevel -Person filter levels for Imagen. +A filter level controlling whether generation of images containing people or faces is allowed. + +See the \[`personGeneration`\](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api\#parameter\_list) documentation for more details. Signature: @@ -432,13 +446,15 @@ export declare enum ImagenPersonFilterLevel | Member | Value | Description | | --- | --- | --- | -| ALLOW\_ADULT | "allow_adult" | Allow only adults in generated images. | -| ALLOW\_ALL | "allow_all" | Allow all person generation. | -| BLOCK\_ALL | "dont_allow" | Do not allow any person generation. | +| ALLOW\_ADULT | "allow_adult" | Allow generation of images containing adults only; images of children are filtered out.Generation of images containing people or faces may require your use case to be reviewed and approved by Cloud support; see the \[Responsible AI and usage guidelines\](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen\#person-face-gen) for more details. | +| ALLOW\_ALL | "allow_all" | Allow generation of images containing adults only; images of children are filtered out.Generation of images containing people or faces may require your use case to be reviewed and approved by Cloud support; see the \[Responsible AI and usage guidelines\](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen\#person-face-gen) for more details. | +| BLOCK\_ALL | "dont_allow" | Disallow generation of images containing people or faces; images of people are filtered out. | ## ImagenSafetyFilterLevel -Safety filter levels for Imagen +A filter level controlling how aggressively to filter sensitive content. + +Text prompts provided as inputs and images (generated or uploaded) through Imagen on Vertex AI are assessed against a list of safety filters, which include 'harmful categories' (for example, `violence`, `sexual`, `derogatory`, and `toxic`). This filter level controls how aggressively to filter out potentially harmful content from responses. See the \[`safetySetting`\](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api\#parameter\_list) documentation and the \[Responsible AI and usage guidelines\](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen\#safety-filters) for more details. Signature: @@ -450,10 +466,10 @@ export declare enum ImagenSafetyFilterLevel | Member | Value | Description | | --- | --- | --- | -| BLOCK\_LOW\_AND\_ABOVE | "block_low_and_above" | Block images with low or higher safety severity. | -| BLOCK\_MEDIUM\_AND\_ABOVE | "block_medium_and_above" | Block images with medium or higher safety severity. | -| BLOCK\_NONE | "block_none" | Do not block any images based on safety. | -| BLOCK\_ONLY\_HIGH | "block_only_high" | Block images with high safety severity. | +| BLOCK\_LOW\_AND\_ABOVE | "block_low_and_above" | The most aggressive filtering level; most strict blocking. | +| BLOCK\_MEDIUM\_AND\_ABOVE | "block_medium_and_above" | Blocks some sensitive prompts and responses. | +| BLOCK\_NONE | "block_none" | The least aggressive filtering level; blocks very few sensitive prompts and responses.Access to this feature is restricted and may require your case to be reviewed and approved by Cloud support. | +| BLOCK\_ONLY\_HIGH | "block_only_high" | Blocks few sensitive prompts and responses. | ## SchemaType diff --git a/docs-devsite/vertexai.vertexaimodel.md b/docs-devsite/vertexai.vertexaimodel.md index ad35e68dded..37ce90652e6 100644 --- a/docs-devsite/vertexai.vertexaimodel.md +++ b/docs-devsite/vertexai.vertexaimodel.md @@ -17,7 +17,7 @@ The constructor for this class is marked as internal. Third-party code should no Signature: ```typescript -export declare class VertexAIModel +export declare abstract class VertexAIModel ``` ## Properties diff --git a/packages/vertexai/src/api.ts b/packages/vertexai/src/api.ts index cb1e6c2437d..5ff6ae0051a 100644 --- a/packages/vertexai/src/api.ts +++ b/packages/vertexai/src/api.ts @@ -83,11 +83,21 @@ export function getGenerativeModel( } /** - * Returns a {@link ImagenModel} class with methods for using Imagen. + * Returns an {@link ImagenModel} class with methods for using Imagen. * * @beta - * This feature is in public preview and is not intended for production use. - * The API is subject to change. + * For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which + * means that the feature is not subject to any SLA or deprecation policy and could change in + * backwards-incompatible ways. + * + * Only Imagen 3 models (named `imagen-3.0-*`) are supported. + * + * @param vertexAI - An instance of the Vertex AI in Firebase SDK. + * @param modelParams - Parameters to use when making Imagen requests. + * @param requestOptions - Additional options to use when making requests. + * + * @throws If the `apiKey` or `projectId` fields are missing in your + * Firebase config. * * @public */ diff --git a/packages/vertexai/src/models/imagen-model.ts b/packages/vertexai/src/models/imagen-model.ts index 0668ddcdf3b..54e41408213 100644 --- a/packages/vertexai/src/models/imagen-model.ts +++ b/packages/vertexai/src/models/imagen-model.ts @@ -90,10 +90,11 @@ export class ImagenModel extends VertexAIModel { * base64-encoded strings. * * @beta - * This feature is in public preview and is not intended for production use. - * The API is subject to change. + * For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which + * means that the feature is not subject to any SLA or deprecation policy and could change in + * backwards-incompatible ways. * - * @param prompt - The text prompt used to generate the images. + * @param prompt - A text prompt describing the image(s) to generate. * @returns A promise that resolves to an {@link ImagenGenerationResponse} * object containing the generated images. * @@ -127,11 +128,12 @@ export class ImagenModel extends VertexAIModel { * Generates images to Google Cloud Storage (GCS) using the Imagen model. * * @beta - * This feature is in public preview and is not intended for production use. - * The API is subject to change. + * For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which + * means that the feature is not subject to any SLA or deprecation policy and could change in + * backwards-incompatible ways. * - * @param prompt - The text prompt used to generate the images. - * @param gcsURI - The GCS URI where the images should be stored. + * @param prompt - A text prompt describing the image(s) to generate. + * @param gcsURI - The Google Cloud Storage (GCS) URI where the images should be stored. * This should be a directory. For example, `gs://my-bucket/my-directory/`. * @returns A promise that resolves to an {@link ImagenGenerationResponse} * object containing the URLs of the generated images. diff --git a/packages/vertexai/src/requests/imagen-image-format.ts b/packages/vertexai/src/requests/imagen-image-format.ts index 27fb10e2a9a..857799ca587 100644 --- a/packages/vertexai/src/requests/imagen-image-format.ts +++ b/packages/vertexai/src/requests/imagen-image-format.ts @@ -52,8 +52,9 @@ export class ImagenImageFormat { * Creates an {@link ImagenImageFormat} for a JPEG image. * * @beta - * This feature is in public preview and is not intended for production use. - * The API is subject to change. + * For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which + * means that the feature is not subject to any SLA or deprecation policy and could change in + * backwards-incompatible ways. * * @param compressionQuality - The level of compression (a number between 0 and 100). * @returns An {@link ImagenImageFormat} object for a JPEG image. @@ -76,8 +77,9 @@ export class ImagenImageFormat { * Creates an {@link ImagenImageFormat} for a PNG image. * * @beta - * This feature is in public preview and is not intended for production use. - * The API is subject to change. + * For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which + * means that the feature is not subject to any SLA or deprecation policy and could change in + * backwards-incompatible ways. * * @returns An {@link ImagenImageFormat} object for a PNG image. * diff --git a/packages/vertexai/src/types/imagen/requests.ts b/packages/vertexai/src/types/imagen/requests.ts index 0df0ac12202..9ea39165272 100644 --- a/packages/vertexai/src/types/imagen/requests.ts +++ b/packages/vertexai/src/types/imagen/requests.ts @@ -25,15 +25,20 @@ import { ImagenImageFormat } from '../../requests/imagen-image-format'; export interface ImagenModelParams { /** * The Imagen model to use for generating images. - * For example: `imagen-3.0-generate-001`. + * For example: `imagen-3.0-generate-002`. + * + * Only Imagen 3 models (named `imagen-3.0-*`) are supported. + * + * See [model versions](https://cloud.google.com/vertex-ai/generative-ai/docs/image/model-versioning) + * for a full list of supported Imagen 3 models. */ model: string; /** - * The Imagen Generation Configuration. + * Configuration options for generating images with Imagen. */ generationConfig?: ImagenGenerationConfig; /** - * Safety settings for filtering inappropriate content. + * Safety settings for filtering potentially inappropriate content. */ safetySettings?: ImagenSafetySettings; } @@ -41,118 +46,168 @@ export interface ImagenModelParams { /** * Configuration options for generating images with Imagen. * - * See the [Google Cloud Docs](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#rest_1). + * See the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images) for more details. * * @public */ export interface ImagenGenerationConfig { /** * A description of what should be omitted from the generated images. + * + * Support for negative prompts depends on the Imagen model. + * + * See the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images#negative-prompt) for more details. */ negativePrompt?: string; /** - * The number of images to generate. Must be between 1 and 4. The default value is 1. + * The number of images to generate. The default value is 1. + * + * The number of sample images that may be generated in each request depends on the model + * (typically up to 4); see the [`sampleCount`](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) + * documentation for more details. */ numberOfImages?: number; /** - * The aspect ratio of the generated images. The default value is 1:1. - * used. + * The aspect ratio of the generated images. The default value is square 1:1. + * Supported aspect ratios depend on the Imagen model, see {@link ImagenAspectRatio} + * for more details. */ aspectRatio?: ImagenAspectRatio; /** * The image format of the generated images. The default is PNG. + * + * See {@link ImagenImageFormat} for more details. */ imageFormat?: ImagenImageFormat; /** - * If true, adds a SynthID watermark to the generated images. + * Whether to add an invisible watermark to generated images. + * + * If set to `true`, an invisible SynthID watermark is embedded in generated images to indicate + * that they are AI generated. If set to `false`, watermarking will be disabled. + * + * The default value depends on the Imagen model; see the [`addWatermark`](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) + * documentation for more details. */ addWatermark?: boolean; } /** - * Safety filter levels for Imagen + * A filter level controlling how aggressively to filter sensitive content. + * + * Text prompts provided as inputs and images (generated or uploaded) through Imagen on Vertex AI + * are assessed against a list of safety filters, which include 'harmful categories' (for example, + * `violence`, `sexual`, `derogatory`, and `toxic`). This filter level controls how aggressively to + * filter out potentially harmful content from responses. See the [`safetySetting`](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) + * documentation and the [Responsible AI and usage guidelines](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-filters) + * for more details. * * @public */ export enum ImagenSafetyFilterLevel { /** - * Block images with low or higher safety severity. + * The most aggressive filtering level; most strict blocking. */ BLOCK_LOW_AND_ABOVE = 'block_low_and_above', /** - * Block images with medium or higher safety severity. + * Blocks some sensitive prompts and responses. */ BLOCK_MEDIUM_AND_ABOVE = 'block_medium_and_above', /** - * Block images with high safety severity. + * Blocks few sensitive prompts and responses. */ BLOCK_ONLY_HIGH = 'block_only_high', /** - * Do not block any images based on safety. + * The least aggressive filtering level; blocks very few sensitive prompts and responses. + * + * Access to this feature is restricted and may require your case to be reviewed and approved by + * Cloud support. */ BLOCK_NONE = 'block_none' } /** - * Person filter levels for Imagen. + * A filter level controlling whether generation of images containing people or faces is allowed. + * + * See the [`personGeneration`](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) + * documentation for more details. * * @public */ export enum ImagenPersonFilterLevel { /** - * Do not allow any person generation. + * Disallow generation of images containing people or faces; images of people are filtered out. */ BLOCK_ALL = 'dont_allow', /** - * Allow only adults in generated images. + * Allow generation of images containing adults only; images of children are filtered out. + + * Generation of images containing people or faces may require your use case to be + * reviewed and approved by Cloud support; see the [Responsible AI and usage + * guidelines](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#person-face-gen) + * for more details. */ ALLOW_ADULT = 'allow_adult', - /** - * Allow all person generation. + /** + * Allow generation of images containing adults only; images of children are filtered out. + * + * Generation of images containing people or faces may require your use case to be + * reviewed and approved by Cloud support; see the [Responsible AI and usage + * guidelines](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#person-face-gen) + * for more details. */ ALLOW_ALL = 'allow_all' } /** - * Safety settings for Imagen. + * Settings for controlling the aggressiveness of filtering out sensitive content. + * + * See the [Responsible AI and usage guidelines](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#config-safety-filters) + * for more details. * * @public */ export interface ImagenSafetySettings { /** - * The safety filter level to use. + * A filter level controlling how aggressive to filter out sensitive content from generated + * images. */ safetyFilterLevel?: ImagenSafetyFilterLevel; /** - * The person filter level to use. + * A filter level controlling whether generation of images containing people or faces is allowed. */ personFilterLevel?: ImagenPersonFilterLevel; } /** * Aspect ratios for Imagen images. + * + * To specify an aspect ratio for generated images, set the `aspectRatio` property in your + * {@link ImagenGenerationConfig}. + * + * See the the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images#aspect-ratio) + * for more details and examples of the supported aspect ratios. * * @public */ export enum ImagenAspectRatio { /** - * Square 1:1 aspect ratio. + * Square (1:1) aspect ratio. */ SQUARE = '1:1', /** - * Landscape 3:4 aspect ratio. + * Landscape (3:4) aspect ratio. */ LANDSCAPE_3x4 = '3:4', /** - * Portrait 4:3 aspect ratio. + * Portrait (4:3) aspect ratio. */ PORTRAIT_4x3 = '4:3', /** - * Landscape 16:9 aspect ratio. + * Landscape (16:9) aspect ratio. */ LANDSCAPE_16x9 = '16:9', /** - * Portrait 9:16 aspect ratio. + * Portrait (9:16) aspect ratio. */ PORTRAIT_9x16 = '9:16' } diff --git a/packages/vertexai/src/types/imagen/responses.ts b/packages/vertexai/src/types/imagen/responses.ts index dcd43706f90..bd0e479159d 100644 --- a/packages/vertexai/src/types/imagen/responses.ts +++ b/packages/vertexai/src/types/imagen/responses.ts @@ -16,33 +16,39 @@ */ /** - * An image generated by Imagen, represented as inline bytes. + * An image generated by Imagen, represented as inline data. * * @public */ export interface ImagenInlineImage { /** - * The MIME type of the image. + * The MIME type of the image; either `"image/png"` or `"image/jpeg"`. + * + * To request a different format, set the `imageFormat` property in your {@link ImagenGenerationConfig}. */ mimeType: string; /** - * The image data encoded as a base64 string. + * The base64-encoded image data. */ bytesBase64Encoded: string; } /** - * An image generated by Imagen, stored in Google Cloud Storage (GCS). + * An image generated by Imagen, stored in Cloud Storage (GCS) for Firebase. * * @public */ export interface ImagenGCSImage { /** - * The MIME type of the image. + * The MIME type of the image; either `"image/png"` or `"image/jpeg"`. + * + * To request a different format, set the `imageFormat` property in your {@link ImagenGenerationConfig}. */ mimeType: string; /** - * The Google Cloud Storage (GCS) URI where the image is stored. + * The URI of the file in Cloud Storage (GCS) for Firestore. + * + * @example `"gs://bucket-name/path/sample_0.jpg"`. */ gcsURI: string; } @@ -57,14 +63,21 @@ export interface ImagenGenerationResponse< > { /** * The images generated by Imagen. - * If all images were filtered due to safety reasons, this array will be empty. + * + * The number of images generated may be fewer than the number requested if one or more were + * filtered out; see `filteredReason`. */ images: T[]; /** - * The reason why any images were filtered. This field is only present if one + * The reason that images were filtered out. This property will only be defined if one * or more images were filtered. - * For the mappings of error codes to reasons, see - * {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-categories}. + * + * Images may be filtered out due to the {@link ImagenSafetyFilterLevel}, + * {@link ImagenPersonFilterLevel}, or filtering included in the model. + * The filter levels may be adjusted in your {@link ImagenSafetySettings}. + * + * See the [Responsible AI and usage guidelines for Imagen](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen) + * for more details. */ filteredReason?: string; } From 225e8b019150362cf576425bc3de3eca883281bc Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Fri, 7 Feb 2025 16:01:07 -0500 Subject: [PATCH 03/14] update docs --- .../vertexai.imagengenerationconfig.md | 14 +++++----- .../vertexai.imagengenerationresponse.md | 4 +-- docs-devsite/vertexai.imagenmodel.md | 8 +++--- docs-devsite/vertexai.imagenmodelparams.md | 4 +-- docs-devsite/vertexai.imagensafetysettings.md | 2 +- docs-devsite/vertexai.md | 28 +++++++++---------- packages/vertexai/src/api.ts | 4 +-- packages/vertexai/src/models/imagen-model.ts | 6 ++-- .../vertexai/src/types/imagen/requests.ts | 26 ++++++++--------- .../vertexai/src/types/imagen/responses.ts | 2 +- 10 files changed, 47 insertions(+), 51 deletions(-) diff --git a/docs-devsite/vertexai.imagengenerationconfig.md b/docs-devsite/vertexai.imagengenerationconfig.md index b5eed7b8148..08bf68d02a6 100644 --- a/docs-devsite/vertexai.imagengenerationconfig.md +++ b/docs-devsite/vertexai.imagengenerationconfig.md @@ -12,7 +12,7 @@ https://github.com/firebase/firebase-js-sdk # ImagenGenerationConfig interface Configuration options for generating images with Imagen. -See the \[Cloud documentation\](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images) for more details. +See the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images) for more details. Signature: @@ -24,11 +24,11 @@ export interface ImagenGenerationConfig | Property | Type | Description | | --- | --- | --- | -| [addWatermark](./vertexai.imagengenerationconfig.md#imagengenerationconfigaddwatermark) | boolean | Whether to add an invisible watermark to generated images.If set to true, an invisible SynthID watermark is embedded in generated images to indicate that they are AI generated. If set to false, watermarking will be disabled.The default value depends on the Imagen model; see the \[addWatermark\](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api\#parameter\_list) documentation for more details. | +| [addWatermark](./vertexai.imagengenerationconfig.md#imagengenerationconfigaddwatermark) | boolean | Whether to add an invisible watermark to generated images.If set to true, an invisible SynthID watermark is embedded in generated images to indicate that they are AI generated. If set to false, watermarking will be disabled.The default value depends on the Imagen model; see the [addWatermark](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation for more details. | | [aspectRatio](./vertexai.imagengenerationconfig.md#imagengenerationconfigaspectratio) | [ImagenAspectRatio](./vertexai.md#imagenaspectratio) | The aspect ratio of the generated images. The default value is square 1:1. Supported aspect ratios depend on the Imagen model, see [ImagenAspectRatio](./vertexai.md#imagenaspectratio) for more details. | | [imageFormat](./vertexai.imagengenerationconfig.md#imagengenerationconfigimageformat) | [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) | The image format of the generated images. The default is PNG.See [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for more details. | -| [negativePrompt](./vertexai.imagengenerationconfig.md#imagengenerationconfignegativeprompt) | string | A description of what should be omitted from the generated images.Support for negative prompts depends on the Imagen model.See the \[Cloud documentation\](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images\#negative-prompt) for more details. | -| [numberOfImages](./vertexai.imagengenerationconfig.md#imagengenerationconfignumberofimages) | number | The number of images to generate. The default value is 1.The number of sample images that may be generated in each request depends on the model (typically up to 4); see the \[sampleCount\](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api\#parameter\_list) documentation for more details. | +| [negativePrompt](./vertexai.imagengenerationconfig.md#imagengenerationconfignegativeprompt) | string | A description of what should be omitted from the generated images.Support for negative prompts depends on the Imagen model.See the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images#negative-prompt) for more details. | +| [numberOfImages](./vertexai.imagengenerationconfig.md#imagengenerationconfignumberofimages) | number | The number of images to generate. The default value is 1.The number of sample images that may be generated in each request depends on the model (typically up to 4); see the [sampleCount](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation for more details. | ## ImagenGenerationConfig.addWatermark @@ -36,7 +36,7 @@ Whether to add an invisible watermark to generated images. If set to `true`, an invisible SynthID watermark is embedded in generated images to indicate that they are AI generated. If set to `false`, watermarking will be disabled. -The default value depends on the Imagen model; see the \[`addWatermark`\](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api\#parameter\_list) documentation for more details. +The default value depends on the Imagen model; see the [addWatermark](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation for more details. Signature: @@ -72,7 +72,7 @@ A description of what should be omitted from the generated images. Support for negative prompts depends on the Imagen model. -See the \[Cloud documentation\](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images\#negative-prompt) for more details. +See the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images#negative-prompt) for more details. Signature: @@ -84,7 +84,7 @@ negativePrompt?: string; The number of images to generate. The default value is 1. -The number of sample images that may be generated in each request depends on the model (typically up to 4); see the \[`sampleCount`\](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api\#parameter\_list) documentation for more details. +The number of sample images that may be generated in each request depends on the model (typically up to 4); see the [sampleCount](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation for more details. Signature: diff --git a/docs-devsite/vertexai.imagengenerationresponse.md b/docs-devsite/vertexai.imagengenerationresponse.md index 632052a3a33..35e1caceaae 100644 --- a/docs-devsite/vertexai.imagengenerationresponse.md +++ b/docs-devsite/vertexai.imagengenerationresponse.md @@ -22,7 +22,7 @@ export interface ImagenGenerationResponseImages may be filtered out due to the [ImagenSafetyFilterLevel](./vertexai.md#imagensafetyfilterlevel), [ImagenPersonFilterLevel](./vertexai.md#imagenpersonfilterlevel), or filtering included in the model. The filter levels may be adjusted in your [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface).See the \[Responsible AI and usage guidelines for Imagen\](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen) for more details. | +| [filteredReason](./vertexai.imagengenerationresponse.md#imagengenerationresponsefilteredreason) | string | The reason that images were filtered out. This property will only be defined if one or more images were filtered.Images may be filtered out due to the [ImagenSafetyFilterLevel](./vertexai.md#imagensafetyfilterlevel), [ImagenPersonFilterLevel](./vertexai.md#imagenpersonfilterlevel), or filtering included in the model. The filter levels may be adjusted in your [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface).See the [Responsible AI and usage guidelines for Imagen](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen) for more details. | | [images](./vertexai.imagengenerationresponse.md#imagengenerationresponseimages) | T\[\] | The images generated by Imagen.The number of images generated may be fewer than the number requested if one or more were filtered out; see filteredReason. | ## ImagenGenerationResponse.filteredReason @@ -31,7 +31,7 @@ The reason that images were filtered out. This property will only be defined if Images may be filtered out due to the [ImagenSafetyFilterLevel](./vertexai.md#imagensafetyfilterlevel), [ImagenPersonFilterLevel](./vertexai.md#imagenpersonfilterlevel), or filtering included in the model. The filter levels may be adjusted in your [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface). -See the \[Responsible AI and usage guidelines for Imagen\](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen) for more details. +See the [Responsible AI and usage guidelines for Imagen](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen) for more details. Signature: diff --git a/docs-devsite/vertexai.imagenmodel.md b/docs-devsite/vertexai.imagenmodel.md index f1d7e9399d9..02882900c5a 100644 --- a/docs-devsite/vertexai.imagenmodel.md +++ b/docs-devsite/vertexai.imagenmodel.md @@ -12,7 +12,7 @@ https://github.com/firebase/firebase-js-sdk # ImagenModel class Class for Imagen model APIs. -This class provides methods for generating images using the Imagen model. You can generate images inline as base64-encoded strings, or directly to Google Cloud Storage (GCS). +This class provides methods for generating images using the Imagen model. Signature: @@ -25,7 +25,7 @@ export declare class ImagenModel extends VertexAIModel | Constructor | Modifiers | Description | | --- | --- | --- | -| [(constructor)(vertexAI, modelParams, requestOptions)](./vertexai.imagenmodel.md#imagenmodelconstructor) | | Constructs a new instance of the [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) class. | +| [(constructor)(vertexAI, modelParams, requestOptions)](./vertexai.imagenmodel.md#imagenmodelconstructor) | | Constructs a new instance of the [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) class. | ## Properties @@ -44,7 +44,7 @@ export declare class ImagenModel extends VertexAIModel ## ImagenModel.(constructor) -Constructs a new instance of the [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) class. +Constructs a new instance of the [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) class. Signature: @@ -153,7 +153,7 @@ generateImagesGCS(prompt: string, gcsURI: string): Promise<[ImagenGCSImage](./vertexai.imagengcsimage.md#imagengcsimage_interface)>> -A promise that resolves to an [ImagenGenerationResponse](./vertexai.imagengenerationresponse.md#imagengenerationresponse_interface) object containing the URLs of the generated images. +A promise that resolves to an [ImagenGenerationResponse](./vertexai.imagengenerationresponse.md#imagengenerationresponse_interface) object containing the URLs of the generated images. #### Exceptions diff --git a/docs-devsite/vertexai.imagenmodelparams.md b/docs-devsite/vertexai.imagenmodelparams.md index 8ba9e2af7bf..45c0ddef767 100644 --- a/docs-devsite/vertexai.imagenmodelparams.md +++ b/docs-devsite/vertexai.imagenmodelparams.md @@ -23,7 +23,7 @@ export interface ImagenModelParams | Property | Type | Description | | --- | --- | --- | | [generationConfig](./vertexai.imagenmodelparams.md#imagenmodelparamsgenerationconfig) | [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface) | Configuration options for generating images with Imagen. | -| [model](./vertexai.imagenmodelparams.md#imagenmodelparamsmodel) | string | The Imagen model to use for generating images. For example: imagen-3.0-generate-002.Only Imagen 3 models (named imagen-3.0-*) are supported.See \[model versions\](https://cloud.google.com/vertex-ai/generative-ai/docs/image/model-versioning) for a full list of supported Imagen 3 models. | +| [model](./vertexai.imagenmodelparams.md#imagenmodelparamsmodel) | string | The Imagen model to use for generating images. For example: imagen-3.0-generate-002.Only Imagen 3 models (named imagen-3.0-*) are supported.See [model versions](https://cloud.google.com/vertex-ai/generative-ai/docs/image/model-versioning) for a full list of supported Imagen 3 models. | | [safetySettings](./vertexai.imagenmodelparams.md#imagenmodelparamssafetysettings) | [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface) | Safety settings for filtering potentially inappropriate content. | ## ImagenModelParams.generationConfig @@ -42,7 +42,7 @@ The Imagen model to use for generating images. For example: `imagen-3.0-generate Only Imagen 3 models (named `imagen-3.0-*`) are supported. -See \[model versions\](https://cloud.google.com/vertex-ai/generative-ai/docs/image/model-versioning) for a full list of supported Imagen 3 models. +See [model versions](https://cloud.google.com/vertex-ai/generative-ai/docs/image/model-versioning) for a full list of supported Imagen 3 models. Signature: diff --git a/docs-devsite/vertexai.imagensafetysettings.md b/docs-devsite/vertexai.imagensafetysettings.md index f5a5d352843..ad97a1c178f 100644 --- a/docs-devsite/vertexai.imagensafetysettings.md +++ b/docs-devsite/vertexai.imagensafetysettings.md @@ -12,7 +12,7 @@ https://github.com/firebase/firebase-js-sdk # ImagenSafetySettings interface Settings for controlling the aggressiveness of filtering out sensitive content. -See the \[Responsible AI and usage guidelines\](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen\#config-safety-filters) for more details. +See the [https://www.newyorker.com/magazine/2018/12/10/the-friendship-that-made-google-huge](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#config-safety-filters) for more details. Signature: diff --git a/docs-devsite/vertexai.md b/docs-devsite/vertexai.md index a8e7fb1030e..5553526ca18 100644 --- a/docs-devsite/vertexai.md +++ b/docs-devsite/vertexai.md @@ -20,7 +20,7 @@ The Vertex AI in Firebase Web SDK. | [getVertexAI(app, options)](./vertexai.md#getvertexai_04094cf) | Returns a [VertexAI](./vertexai.vertexai.md#vertexai_interface) instance for the given app. | | function(vertexAI, ...) | | [getGenerativeModel(vertexAI, modelParams, requestOptions)](./vertexai.md#getgenerativemodel_e3037c9) | Returns a [GenerativeModel](./vertexai.generativemodel.md#generativemodel_class) class with methods for inference and other functionality. | -| [getImagenModel(vertexAI, modelParams, requestOptions)](./vertexai.md#getimagenmodel_812c375) | Returns an [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) class with methods for using Imagen.For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways.Only Imagen 3 models (named imagen-3.0-*) are supported. | +| [getImagenModel(vertexAI, modelParams, requestOptions)](./vertexai.md#getimagenmodel_812c375) | Returns an [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) class with methods for using Imagen.Only Imagen 3 models (named imagen-3.0-*) are supported.For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. | ## Classes @@ -31,7 +31,7 @@ The Vertex AI in Firebase Web SDK. | [ChatSession](./vertexai.chatsession.md#chatsession_class) | ChatSession class that enables sending chat messages and stores history of sent and received messages so far. | | [GenerativeModel](./vertexai.generativemodel.md#generativemodel_class) | Class for generative model APIs. | | [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) | Defines the image format for images output by Imagen.Use this class to specify the desired format (JPEG or PNG) and compression quality for images generated by Imagen. This is typically included as part of [ImagenModelParams](./vertexai.imagenmodelparams.md#imagenmodelparams_interface). | -| [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) | Class for Imagen model APIs.This class provides methods for generating images using the Imagen model. You can generate images inline as base64-encoded strings, or directly to Google Cloud Storage (GCS). | +| [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) | Class for Imagen model APIs.This class provides methods for generating images using the Imagen model. | | [IntegerSchema](./vertexai.integerschema.md#integerschema_class) | Schema class for "integer" types. | | [NumberSchema](./vertexai.numberschema.md#numberschema_class) | Schema class for "number" types. | | [ObjectSchema](./vertexai.objectschema.md#objectschema_class) | Schema class for "object" types. The properties param must be a map of Schema objects. | @@ -52,9 +52,9 @@ The Vertex AI in Firebase Web SDK. | [HarmCategory](./vertexai.md#harmcategory) | Harm categories that would cause prompts or candidates to be blocked. | | [HarmProbability](./vertexai.md#harmprobability) | Probability that a prompt or candidate matches a harm category. | | [HarmSeverity](./vertexai.md#harmseverity) | Harm severity levels. | -| [ImagenAspectRatio](./vertexai.md#imagenaspectratio) | Aspect ratios for Imagen images.To specify an aspect ratio for generated images, set the aspectRatio property in your [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface).See the the \[Cloud documentation\](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images\#aspect-ratio) for more details and examples of the supported aspect ratios. | -| [ImagenPersonFilterLevel](./vertexai.md#imagenpersonfilterlevel) | A filter level controlling whether generation of images containing people or faces is allowed.See the \[personGeneration\](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api\#parameter\_list) documentation for more details. | -| [ImagenSafetyFilterLevel](./vertexai.md#imagensafetyfilterlevel) | A filter level controlling how aggressively to filter sensitive content.Text prompts provided as inputs and images (generated or uploaded) through Imagen on Vertex AI are assessed against a list of safety filters, which include 'harmful categories' (for example, violence, sexual, derogatory, and toxic). This filter level controls how aggressively to filter out potentially harmful content from responses. See the \[safetySetting\](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api\#parameter\_list) documentation and the \[Responsible AI and usage guidelines\](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen\#safety-filters) for more details. | +| [ImagenAspectRatio](./vertexai.md#imagenaspectratio) | Aspect ratios for Imagen images.To specify an aspect ratio for generated images, set the aspectRatio property in your [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface).See the the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images#aspect-ratio) for more details and examples of the supported aspect ratios. | +| [ImagenPersonFilterLevel](./vertexai.md#imagenpersonfilterlevel) | A filter level controlling whether generation of images containing people or faces is allowed.See the [\`personGeneration\`](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation for more details. | +| [ImagenSafetyFilterLevel](./vertexai.md#imagensafetyfilterlevel) | A filter level controlling how aggressively to filter sensitive content.Text prompts provided as inputs and images (generated or uploaded) through Imagen on Vertex AI are assessed against a list of safety filters, which include 'harmful categories' (for example, violence, sexual, derogatory, and toxic). This filter level controls how aggressively to filter out potentially harmful content from responses. See the [\`safetySetting\`](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation and the [Responsible AI and usage guidelines](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-filters) for more details. | | [SchemaType](./vertexai.md#schematype) | Contains the list of OpenAPI data types as defined by the [OpenAPI specification](https://swagger.io/docs/specification/data-models/data-types/) | | [VertexAIErrorCode](./vertexai.md#vertexaierrorcode) | Standardized error codes that [VertexAIError](./vertexai.vertexaierror.md#vertexaierror_class) can have. | @@ -91,11 +91,11 @@ The Vertex AI in Firebase Web SDK. | [GroundingAttribution](./vertexai.groundingattribution.md#groundingattribution_interface) | | | [GroundingMetadata](./vertexai.groundingmetadata.md#groundingmetadata_interface) | Metadata returned to client when grounding is enabled. | | [ImagenGCSImage](./vertexai.imagengcsimage.md#imagengcsimage_interface) | An image generated by Imagen, stored in Cloud Storage (GCS) for Firebase. | -| [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface) | Configuration options for generating images with Imagen.See the \[Cloud documentation\](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images) for more details. | +| [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface) | Configuration options for generating images with Imagen.See the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images) for more details. | | [ImagenGenerationResponse](./vertexai.imagengenerationresponse.md#imagengenerationresponse_interface) | The response from a request to generate images with Imagen. | | [ImagenInlineImage](./vertexai.imageninlineimage.md#imageninlineimage_interface) | An image generated by Imagen, represented as inline data. | | [ImagenModelParams](./vertexai.imagenmodelparams.md#imagenmodelparams_interface) | Parameters for configuring an [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class). | -| [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface) | Settings for controlling the aggressiveness of filtering out sensitive content.See the \[Responsible AI and usage guidelines\](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen\#config-safety-filters) for more details. | +| [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface) | Settings for controlling the aggressiveness of filtering out sensitive content.See the [https://www.newyorker.com/magazine/2018/12/10/the-friendship-that-made-google-huge](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#config-safety-filters) for more details. | | [InlineDataPart](./vertexai.inlinedatapart.md#inlinedatapart_interface) | Content part interface if the part represents an image. | | [ModelParams](./vertexai.modelparams.md#modelparams_interface) | Params passed to [getGenerativeModel()](./vertexai.md#getgenerativemodel_e3037c9). | | [ObjectSchemaInterface](./vertexai.objectschemainterface.md#objectschemainterface_interface) | Interface for [ObjectSchema](./vertexai.objectschema.md#objectschema_class) class. | @@ -184,10 +184,10 @@ export declare function getGenerativeModel(vertexAI: VertexAI, modelParams: Mode Returns an [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) class with methods for using Imagen. -For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. - Only Imagen 3 models (named `imagen-3.0-*`) are supported. +For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. + Signature: ```typescript @@ -412,7 +412,7 @@ Aspect ratios for Imagen images. To specify an aspect ratio for generated images, set the `aspectRatio` property in your [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface). -See the the \[Cloud documentation\](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images\#aspect-ratio) for more details and examples of the supported aspect ratios. +See the the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images#aspect-ratio) for more details and examples of the supported aspect ratios. Signature: @@ -434,7 +434,7 @@ export declare enum ImagenAspectRatio A filter level controlling whether generation of images containing people or faces is allowed. -See the \[`personGeneration`\](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api\#parameter\_list) documentation for more details. +See the [\`personGeneration\`](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation for more details. Signature: @@ -446,15 +446,15 @@ export declare enum ImagenPersonFilterLevel | Member | Value | Description | | --- | --- | --- | -| ALLOW\_ADULT | "allow_adult" | Allow generation of images containing adults only; images of children are filtered out.Generation of images containing people or faces may require your use case to be reviewed and approved by Cloud support; see the \[Responsible AI and usage guidelines\](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen\#person-face-gen) for more details. | -| ALLOW\_ALL | "allow_all" | Allow generation of images containing adults only; images of children are filtered out.Generation of images containing people or faces may require your use case to be reviewed and approved by Cloud support; see the \[Responsible AI and usage guidelines\](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen\#person-face-gen) for more details. | +| ALLOW\_ADULT | "allow_adult" | Allow generation of images containing adults only; images of children are filtered out.Generation of images containing people or faces may require your use case to be reviewed and approved by Cloud support; see the [Responsible AI and usage guidelines](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#person-face-gen) for more details. | +| ALLOW\_ALL | "allow_all" | Allow generation of images containing adults only; images of children are filtered out.Generation of images containing people or faces may require your use case to be reviewed and approved by Cloud support; see the [Responsible AI and usage guidelines](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#person-face-gen) for more details. | | BLOCK\_ALL | "dont_allow" | Disallow generation of images containing people or faces; images of people are filtered out. | ## ImagenSafetyFilterLevel A filter level controlling how aggressively to filter sensitive content. -Text prompts provided as inputs and images (generated or uploaded) through Imagen on Vertex AI are assessed against a list of safety filters, which include 'harmful categories' (for example, `violence`, `sexual`, `derogatory`, and `toxic`). This filter level controls how aggressively to filter out potentially harmful content from responses. See the \[`safetySetting`\](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api\#parameter\_list) documentation and the \[Responsible AI and usage guidelines\](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen\#safety-filters) for more details. +Text prompts provided as inputs and images (generated or uploaded) through Imagen on Vertex AI are assessed against a list of safety filters, which include 'harmful categories' (for example, `violence`, `sexual`, `derogatory`, and `toxic`). This filter level controls how aggressively to filter out potentially harmful content from responses. See the [\`safetySetting\`](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation and the [Responsible AI and usage guidelines](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-filters) for more details. Signature: diff --git a/packages/vertexai/src/api.ts b/packages/vertexai/src/api.ts index 5ff6ae0051a..d052ab29241 100644 --- a/packages/vertexai/src/api.ts +++ b/packages/vertexai/src/api.ts @@ -84,14 +84,14 @@ export function getGenerativeModel( /** * Returns an {@link ImagenModel} class with methods for using Imagen. + * + * Only Imagen 3 models (named `imagen-3.0-*`) are supported. * * @beta * For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which * means that the feature is not subject to any SLA or deprecation policy and could change in * backwards-incompatible ways. * - * Only Imagen 3 models (named `imagen-3.0-*`) are supported. - * * @param vertexAI - An instance of the Vertex AI in Firebase SDK. * @param modelParams - Parameters to use when making Imagen requests. * @param requestOptions - Additional options to use when making requests. diff --git a/packages/vertexai/src/models/imagen-model.ts b/packages/vertexai/src/models/imagen-model.ts index 54e41408213..e0e47d3965f 100644 --- a/packages/vertexai/src/models/imagen-model.ts +++ b/packages/vertexai/src/models/imagen-model.ts @@ -34,8 +34,6 @@ import { VertexAIModel } from './vertexai-model'; * Class for Imagen model APIs. * * This class provides methods for generating images using the Imagen model. - * You can generate images inline as base64-encoded strings, or directly to - * Google Cloud Storage (GCS). * * @example * ```javascript @@ -65,7 +63,7 @@ export class ImagenModel extends VertexAIModel { safetySettings?: ImagenSafetySettings; /** - * Constructs a new instance of the {@link ImagenModel} class. + * Constructs a new instance of the {@link ImagenModel} class. * * @param vertexAI - An instance of the Vertex AI in Firebase SDK. * @param modelParams - Parameters to use when making Imagen requests. @@ -135,7 +133,7 @@ export class ImagenModel extends VertexAIModel { * @param prompt - A text prompt describing the image(s) to generate. * @param gcsURI - The Google Cloud Storage (GCS) URI where the images should be stored. * This should be a directory. For example, `gs://my-bucket/my-directory/`. - * @returns A promise that resolves to an {@link ImagenGenerationResponse} + * @returns A promise that resolves to an {@link ImagenGenerationResponse} * object containing the URLs of the generated images. * * @throws If the request fails to generate images fails. This happens if diff --git a/packages/vertexai/src/types/imagen/requests.ts b/packages/vertexai/src/types/imagen/requests.ts index 9ea39165272..9bbe6c0f02a 100644 --- a/packages/vertexai/src/types/imagen/requests.ts +++ b/packages/vertexai/src/types/imagen/requests.ts @@ -29,7 +29,7 @@ export interface ImagenModelParams { * * Only Imagen 3 models (named `imagen-3.0-*`) are supported. * - * See [model versions](https://cloud.google.com/vertex-ai/generative-ai/docs/image/model-versioning) + * See {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/model-versioning | model versions} * for a full list of supported Imagen 3 models. */ model: string; @@ -46,7 +46,7 @@ export interface ImagenModelParams { /** * Configuration options for generating images with Imagen. * - * See the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images) for more details. + * See the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images | Cloud documentation} for more details. * * @public */ @@ -56,14 +56,14 @@ export interface ImagenGenerationConfig { * * Support for negative prompts depends on the Imagen model. * - * See the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images#negative-prompt) for more details. + * See the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images#negative-prompt | Cloud documentation} for more details. */ negativePrompt?: string; /** * The number of images to generate. The default value is 1. * * The number of sample images that may be generated in each request depends on the model - * (typically up to 4); see the [`sampleCount`](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) + * (typically up to 4); see the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list | sampleCount} * documentation for more details. */ numberOfImages?: number; @@ -85,7 +85,7 @@ export interface ImagenGenerationConfig { * If set to `true`, an invisible SynthID watermark is embedded in generated images to indicate * that they are AI generated. If set to `false`, watermarking will be disabled. * - * The default value depends on the Imagen model; see the [`addWatermark`](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) + * The default value depends on the Imagen model; see the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list | addWatermark } * documentation for more details. */ addWatermark?: boolean; @@ -97,8 +97,8 @@ export interface ImagenGenerationConfig { * Text prompts provided as inputs and images (generated or uploaded) through Imagen on Vertex AI * are assessed against a list of safety filters, which include 'harmful categories' (for example, * `violence`, `sexual`, `derogatory`, and `toxic`). This filter level controls how aggressively to - * filter out potentially harmful content from responses. See the [`safetySetting`](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) - * documentation and the [Responsible AI and usage guidelines](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-filters) + * filter out potentially harmful content from responses. See the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list | `safetySetting`} + * documentation and the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-filters | Responsible AI and usage guidelines} * for more details. * * @public @@ -128,7 +128,7 @@ export enum ImagenSafetyFilterLevel { /** * A filter level controlling whether generation of images containing people or faces is allowed. * - * See the [`personGeneration`](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) + * See the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list | `personGeneration`} * documentation for more details. * * @public @@ -142,8 +142,7 @@ export enum ImagenPersonFilterLevel { * Allow generation of images containing adults only; images of children are filtered out. * Generation of images containing people or faces may require your use case to be - * reviewed and approved by Cloud support; see the [Responsible AI and usage - * guidelines](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#person-face-gen) + * reviewed and approved by Cloud support; see the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#person-face-gen | Responsible AI and usage guidelines} * for more details. */ ALLOW_ADULT = 'allow_adult', @@ -151,8 +150,7 @@ export enum ImagenPersonFilterLevel { * Allow generation of images containing adults only; images of children are filtered out. * * Generation of images containing people or faces may require your use case to be - * reviewed and approved by Cloud support; see the [Responsible AI and usage - * guidelines](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#person-face-gen) + * reviewed and approved by Cloud support; see the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#person-face-gen | Responsible AI and usage guidelines} * for more details. */ ALLOW_ALL = 'allow_all' @@ -161,7 +159,7 @@ export enum ImagenPersonFilterLevel { /** * Settings for controlling the aggressiveness of filtering out sensitive content. * - * See the [Responsible AI and usage guidelines](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#config-safety-filters) + * See the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#config-safety-filters | https://www.newyorker.com/magazine/2018/12/10/the-friendship-that-made-google-huge} * for more details. * * @public @@ -184,7 +182,7 @@ export interface ImagenSafetySettings { * To specify an aspect ratio for generated images, set the `aspectRatio` property in your * {@link ImagenGenerationConfig}. * - * See the the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images#aspect-ratio) + * See the the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images#aspect-ratio | Cloud documentation } * for more details and examples of the supported aspect ratios. * * @public diff --git a/packages/vertexai/src/types/imagen/responses.ts b/packages/vertexai/src/types/imagen/responses.ts index bd0e479159d..fc12f771bba 100644 --- a/packages/vertexai/src/types/imagen/responses.ts +++ b/packages/vertexai/src/types/imagen/responses.ts @@ -76,7 +76,7 @@ export interface ImagenGenerationResponse< * {@link ImagenPersonFilterLevel}, or filtering included in the model. * The filter levels may be adjusted in your {@link ImagenSafetySettings}. * - * See the [Responsible AI and usage guidelines for Imagen](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen) + * See the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen | Responsible AI and usage guidelines for Imagen} * for more details. */ filteredReason?: string; From 3da6b4bd4b4fe2d8c98ba55543571e46ae89dae0 Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Fri, 7 Feb 2025 16:02:35 -0500 Subject: [PATCH 04/14] format --- packages/vertexai/src/api.ts | 6 ++-- .../vertexai/src/types/imagen/requests.ts | 28 +++++++++---------- .../vertexai/src/types/imagen/responses.ts | 14 +++++----- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/packages/vertexai/src/api.ts b/packages/vertexai/src/api.ts index d052ab29241..c45fe21f90d 100644 --- a/packages/vertexai/src/api.ts +++ b/packages/vertexai/src/api.ts @@ -84,18 +84,18 @@ export function getGenerativeModel( /** * Returns an {@link ImagenModel} class with methods for using Imagen. - * + * * Only Imagen 3 models (named `imagen-3.0-*`) are supported. * * @beta * For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which * means that the feature is not subject to any SLA or deprecation policy and could change in * backwards-incompatible ways. - * + * * @param vertexAI - An instance of the Vertex AI in Firebase SDK. * @param modelParams - Parameters to use when making Imagen requests. * @param requestOptions - Additional options to use when making requests. - * + * * @throws If the `apiKey` or `projectId` fields are missing in your * Firebase config. * diff --git a/packages/vertexai/src/types/imagen/requests.ts b/packages/vertexai/src/types/imagen/requests.ts index 9bbe6c0f02a..24abd13207a 100644 --- a/packages/vertexai/src/types/imagen/requests.ts +++ b/packages/vertexai/src/types/imagen/requests.ts @@ -26,9 +26,9 @@ export interface ImagenModelParams { /** * The Imagen model to use for generating images. * For example: `imagen-3.0-generate-002`. - * + * * Only Imagen 3 models (named `imagen-3.0-*`) are supported. - * + * * See {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/model-versioning | model versions} * for a full list of supported Imagen 3 models. */ @@ -53,15 +53,15 @@ export interface ImagenModelParams { export interface ImagenGenerationConfig { /** * A description of what should be omitted from the generated images. - * + * * Support for negative prompts depends on the Imagen model. - * + * * See the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images#negative-prompt | Cloud documentation} for more details. */ negativePrompt?: string; /** * The number of images to generate. The default value is 1. - * + * * The number of sample images that may be generated in each request depends on the model * (typically up to 4); see the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list | sampleCount} * documentation for more details. @@ -75,16 +75,16 @@ export interface ImagenGenerationConfig { aspectRatio?: ImagenAspectRatio; /** * The image format of the generated images. The default is PNG. - * + * * See {@link ImagenImageFormat} for more details. */ imageFormat?: ImagenImageFormat; /** * Whether to add an invisible watermark to generated images. - * + * * If set to `true`, an invisible SynthID watermark is embedded in generated images to indicate * that they are AI generated. If set to `false`, watermarking will be disabled. - * + * * The default value depends on the Imagen model; see the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list | addWatermark } * documentation for more details. */ @@ -118,7 +118,7 @@ export enum ImagenSafetyFilterLevel { BLOCK_ONLY_HIGH = 'block_only_high', /** * The least aggressive filtering level; blocks very few sensitive prompts and responses. - * + * * Access to this feature is restricted and may require your case to be reviewed and approved by * Cloud support. */ @@ -146,9 +146,9 @@ export enum ImagenPersonFilterLevel { * for more details. */ ALLOW_ADULT = 'allow_adult', - /** + /** * Allow generation of images containing adults only; images of children are filtered out. - * + * * Generation of images containing people or faces may require your use case to be * reviewed and approved by Cloud support; see the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#person-face-gen | Responsible AI and usage guidelines} * for more details. @@ -178,11 +178,11 @@ export interface ImagenSafetySettings { /** * Aspect ratios for Imagen images. - * + * * To specify an aspect ratio for generated images, set the `aspectRatio` property in your * {@link ImagenGenerationConfig}. - * - * See the the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images#aspect-ratio | Cloud documentation } + * + * See the the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images#aspect-ratio | Cloud documentation } * for more details and examples of the supported aspect ratios. * * @public diff --git a/packages/vertexai/src/types/imagen/responses.ts b/packages/vertexai/src/types/imagen/responses.ts index fc12f771bba..95851d4c830 100644 --- a/packages/vertexai/src/types/imagen/responses.ts +++ b/packages/vertexai/src/types/imagen/responses.ts @@ -23,7 +23,7 @@ export interface ImagenInlineImage { /** * The MIME type of the image; either `"image/png"` or `"image/jpeg"`. - * + * * To request a different format, set the `imageFormat` property in your {@link ImagenGenerationConfig}. */ mimeType: string; @@ -41,13 +41,13 @@ export interface ImagenInlineImage { export interface ImagenGCSImage { /** * The MIME type of the image; either `"image/png"` or `"image/jpeg"`. - * + * * To request a different format, set the `imageFormat` property in your {@link ImagenGenerationConfig}. */ mimeType: string; /** * The URI of the file in Cloud Storage (GCS) for Firestore. - * + * * @example `"gs://bucket-name/path/sample_0.jpg"`. */ gcsURI: string; @@ -63,7 +63,7 @@ export interface ImagenGenerationResponse< > { /** * The images generated by Imagen. - * + * * The number of images generated may be fewer than the number requested if one or more were * filtered out; see `filteredReason`. */ @@ -71,11 +71,11 @@ export interface ImagenGenerationResponse< /** * The reason that images were filtered out. This property will only be defined if one * or more images were filtered. - * - * Images may be filtered out due to the {@link ImagenSafetyFilterLevel}, + * + * Images may be filtered out due to the {@link ImagenSafetyFilterLevel}, * {@link ImagenPersonFilterLevel}, or filtering included in the model. * The filter levels may be adjusted in your {@link ImagenSafetySettings}. - * + * * See the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen | Responsible AI and usage guidelines for Imagen} * for more details. */ From 3277ceb7f06f73a3148d61d83f2c90c01bc6ebac Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Mon, 10 Feb 2025 10:47:30 -0500 Subject: [PATCH 05/14] minor fixes --- docs-devsite/vertexai.imagenmodel.md | 8 ++++---- docs-devsite/vertexai.vertexaimodel.md | 4 ++-- packages/vertexai/src/models/imagen-model.ts | 6 +++--- packages/vertexai/src/models/vertexai-model.ts | 2 +- packages/vertexai/src/types/imagen/internal.ts | 2 +- packages/vertexai/src/types/imagen/requests.ts | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs-devsite/vertexai.imagenmodel.md b/docs-devsite/vertexai.imagenmodel.md index 02882900c5a..ac980711da2 100644 --- a/docs-devsite/vertexai.imagenmodel.md +++ b/docs-devsite/vertexai.imagenmodel.md @@ -40,7 +40,7 @@ export declare class ImagenModel extends VertexAIModel | Method | Modifiers | Description | | --- | --- | --- | | [generateImages(prompt)](./vertexai.imagenmodel.md#imagenmodelgenerateimages) | | (BETA) Generates images using the Imagen model and returns them as base64-encoded strings.For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. | -| [generateImagesGCS(prompt, gcsURI)](./vertexai.imagenmodel.md#imagenmodelgenerateimagesgcs) | | (BETA) Generates images to Google Cloud Storage (GCS) using the Imagen model.For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. | +| [generateImagesGCS(prompt, gcsURI)](./vertexai.imagenmodel.md#imagenmodelgenerateimagesgcs) | | (BETA) Generates images to Cloud Storage (GCS) for Firebase using the Imagen model.For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. | ## ImagenModel.(constructor) @@ -130,7 +130,7 @@ If the request to generate images fails. This happens if the prompt is blocked. > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Generates images to Google Cloud Storage (GCS) using the Imagen model. +Generates images to Cloud Storage (GCS) for Firebase using the Imagen model. For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. @@ -147,7 +147,7 @@ generateImagesGCS(prompt: string, gcsURI: string): Promisegs://my-bucket/my-directory/. | +| gcsURI | string | The Cloud Storage (GCS) for Firebase URI where the images should be stored. This should be a directory. For example, gs://my-bucket/my-directory/. | Returns: @@ -166,7 +166,7 @@ If the request fails to generate images fails. This happens if the prompt is blo const imagen = new ImagenModel( vertexAI, { - model: 'imagen-3.0-generate-001' + model: 'imagen-3.0-generate-002' } ); diff --git a/docs-devsite/vertexai.vertexaimodel.md b/docs-devsite/vertexai.vertexaimodel.md index 37ce90652e6..503ff0a2558 100644 --- a/docs-devsite/vertexai.vertexaimodel.md +++ b/docs-devsite/vertexai.vertexaimodel.md @@ -24,7 +24,7 @@ export declare abstract class VertexAIModel | Property | Modifiers | Type | Description | | --- | --- | --- | --- | -| [model](./vertexai.vertexaimodel.md#vertexaimodelmodel) | | string | The fully qualified model resource name to use for generating images (e.g. publishers/google/models/imagen-3.0-generate-001). | +| [model](./vertexai.vertexaimodel.md#vertexaimodelmodel) | | string | The fully qualified model resource name to use for generating images (e.g. publishers/google/models/imagen-3.0-generate-002). | ## Methods @@ -34,7 +34,7 @@ export declare abstract class VertexAIModel ## VertexAIModel.model -The fully qualified model resource name to use for generating images (e.g. `publishers/google/models/imagen-3.0-generate-001`). +The fully qualified model resource name to use for generating images (e.g. `publishers/google/models/imagen-3.0-generate-002`). Signature: diff --git a/packages/vertexai/src/models/imagen-model.ts b/packages/vertexai/src/models/imagen-model.ts index e0e47d3965f..437c2cb6768 100644 --- a/packages/vertexai/src/models/imagen-model.ts +++ b/packages/vertexai/src/models/imagen-model.ts @@ -40,7 +40,7 @@ import { VertexAIModel } from './vertexai-model'; * const imagen = new ImagenModel( * vertexAI, * { - * model: 'imagen-3.0-generate-001' + * model: 'imagen-3.0-generate-002' * } * ); * @@ -123,7 +123,7 @@ export class ImagenModel extends VertexAIModel { } /** - * Generates images to Google Cloud Storage (GCS) using the Imagen model. + * Generates images to Cloud Storage (GCS) for Firebase using the Imagen model. * * @beta * For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which @@ -131,7 +131,7 @@ export class ImagenModel extends VertexAIModel { * backwards-incompatible ways. * * @param prompt - A text prompt describing the image(s) to generate. - * @param gcsURI - The Google Cloud Storage (GCS) URI where the images should be stored. + * @param gcsURI - The Cloud Storage (GCS) for Firebase URI where the images should be stored. * This should be a directory. For example, `gs://my-bucket/my-directory/`. * @returns A promise that resolves to an {@link ImagenGenerationResponse} * object containing the URLs of the generated images. diff --git a/packages/vertexai/src/models/vertexai-model.ts b/packages/vertexai/src/models/vertexai-model.ts index 23a8466f32b..1bd3782d7f2 100644 --- a/packages/vertexai/src/models/vertexai-model.ts +++ b/packages/vertexai/src/models/vertexai-model.ts @@ -29,7 +29,7 @@ import { _isFirebaseServerApp } from '@firebase/app'; export abstract class VertexAIModel { /** * The fully qualified model resource name to use for generating images - * (e.g. `publishers/google/models/imagen-3.0-generate-001`). + * (e.g. `publishers/google/models/imagen-3.0-generate-002`). */ readonly model: string; diff --git a/packages/vertexai/src/types/imagen/internal.ts b/packages/vertexai/src/types/imagen/internal.ts index fb81e634617..78bc3d27334 100644 --- a/packages/vertexai/src/types/imagen/internal.ts +++ b/packages/vertexai/src/types/imagen/internal.ts @@ -121,7 +121,7 @@ export interface PredictRequestBody { */ export type ImagenGenerationParams = { /** - * The Google Cloud Storage (GCS) URI where the images should be stored + * The Cloud Storage (GCS) for Firebase URI where the images should be stored * (for GCS requests only). */ gcsURI?: string; diff --git a/packages/vertexai/src/types/imagen/requests.ts b/packages/vertexai/src/types/imagen/requests.ts index 24abd13207a..aad514a7486 100644 --- a/packages/vertexai/src/types/imagen/requests.ts +++ b/packages/vertexai/src/types/imagen/requests.ts @@ -140,7 +140,7 @@ export enum ImagenPersonFilterLevel { BLOCK_ALL = 'dont_allow', /** * Allow generation of images containing adults only; images of children are filtered out. - + * * Generation of images containing people or faces may require your use case to be * reviewed and approved by Cloud support; see the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#person-face-gen | Responsible AI and usage guidelines} * for more details. From a9c70b8ee73af4c5ed0bd97f95ce84e0b76905b0 Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Mon, 10 Feb 2025 10:54:22 -0500 Subject: [PATCH 06/14] format --- packages/vertexai/src/types/imagen/requests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vertexai/src/types/imagen/requests.ts b/packages/vertexai/src/types/imagen/requests.ts index aad514a7486..774a05c83f2 100644 --- a/packages/vertexai/src/types/imagen/requests.ts +++ b/packages/vertexai/src/types/imagen/requests.ts @@ -140,7 +140,7 @@ export enum ImagenPersonFilterLevel { BLOCK_ALL = 'dont_allow', /** * Allow generation of images containing adults only; images of children are filtered out. - * + * * Generation of images containing people or faces may require your use case to be * reviewed and approved by Cloud support; see the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#person-face-gen | Responsible AI and usage guidelines} * for more details. From 1320f62253ca5a559b19c9c86edabec48912aa1f Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Wed, 12 Feb 2025 10:45:28 -0500 Subject: [PATCH 07/14] mark all APIs beta instead of public --- common/api-review/vertexai.api.md | 27 ++++----- docs-devsite/vertexai.imagengcsimage.md | 13 +++- .../vertexai.imagengenerationconfig.md | 28 +++++++-- .../vertexai.imagengenerationresponse.md | 13 +++- docs-devsite/vertexai.imagenimageformat.md | 23 +++++-- docs-devsite/vertexai.imageninlineimage.md | 13 +++- docs-devsite/vertexai.imagenmodel.md | 58 ++++++------------ docs-devsite/vertexai.imagenmodelparams.md | 18 +++++- docs-devsite/vertexai.imagensafetysettings.md | 13 +++- docs-devsite/vertexai.md | 60 +++++++++++-------- packages/vertexai/src/api.ts | 2 - packages/vertexai/src/models/imagen-model.ts | 7 +-- .../src/requests/imagen-image-format.ts | 6 +- .../vertexai/src/types/imagen/requests.ts | 12 ++-- .../vertexai/src/types/imagen/responses.ts | 6 +- 15 files changed, 181 insertions(+), 118 deletions(-) diff --git a/common/api-review/vertexai.api.md b/common/api-review/vertexai.api.md index bce0b106229..590ca86e6a1 100644 --- a/common/api-review/vertexai.api.md +++ b/common/api-review/vertexai.api.md @@ -346,7 +346,7 @@ export class GenerativeModel extends VertexAIModel { // @public export function getGenerativeModel(vertexAI: VertexAI, modelParams: ModelParams, requestOptions?: RequestOptions): GenerativeModel; -// @public +// @beta export function getImagenModel(vertexAI: VertexAI, modelParams: ImagenModelParams, requestOptions?: RequestOptions): ImagenModel; // @public @@ -430,7 +430,7 @@ export enum HarmSeverity { HARM_SEVERITY_NEGLIGIBLE = "HARM_SEVERITY_NEGLIGIBLE" } -// @public +// @beta export enum ImagenAspectRatio { LANDSCAPE_16x9 = "16:9", LANDSCAPE_3x4 = "3:4", @@ -439,13 +439,13 @@ export enum ImagenAspectRatio { SQUARE = "1:1" } -// @public +// @beta export interface ImagenGCSImage { gcsURI: string; mimeType: string; } -// @public +// @beta export interface ImagenGenerationConfig { addWatermark?: boolean; aspectRatio?: ImagenAspectRatio; @@ -454,13 +454,13 @@ export interface ImagenGenerationConfig { numberOfImages?: number; } -// @public +// @beta export interface ImagenGenerationResponse { filteredReason?: string; images: T[]; } -// @public +// @beta export class ImagenImageFormat { compressionQuality?: number; static jpeg(compressionQuality?: number): ImagenImageFormat; @@ -468,18 +468,17 @@ export class ImagenImageFormat { static png(): ImagenImageFormat; } -// @public +// @beta export interface ImagenInlineImage { bytesBase64Encoded: string; mimeType: string; } -// @public +// @beta export class ImagenModel extends VertexAIModel { constructor(vertexAI: VertexAI, modelParams: ImagenModelParams, requestOptions?: RequestOptions | undefined); - // @beta generateImages(prompt: string): Promise>; - // @beta + // @internal generateImagesGCS(prompt: string, gcsURI: string): Promise>; generationConfig?: ImagenGenerationConfig; // (undocumented) @@ -487,21 +486,21 @@ export class ImagenModel extends VertexAIModel { safetySettings?: ImagenSafetySettings; } -// @public +// @beta export interface ImagenModelParams { generationConfig?: ImagenGenerationConfig; model: string; safetySettings?: ImagenSafetySettings; } -// @public +// @beta export enum ImagenPersonFilterLevel { ALLOW_ADULT = "allow_adult", ALLOW_ALL = "allow_all", BLOCK_ALL = "dont_allow" } -// @public +// @beta export enum ImagenSafetyFilterLevel { BLOCK_LOW_AND_ABOVE = "block_low_and_above", BLOCK_MEDIUM_AND_ABOVE = "block_medium_and_above", @@ -509,7 +508,7 @@ export enum ImagenSafetyFilterLevel { BLOCK_ONLY_HIGH = "block_only_high" } -// @public +// @beta export interface ImagenSafetySettings { personFilterLevel?: ImagenPersonFilterLevel; safetyFilterLevel?: ImagenSafetyFilterLevel; diff --git a/docs-devsite/vertexai.imagengcsimage.md b/docs-devsite/vertexai.imagengcsimage.md index a3eb9b062d7..fae3250df94 100644 --- a/docs-devsite/vertexai.imagengcsimage.md +++ b/docs-devsite/vertexai.imagengcsimage.md @@ -10,6 +10,9 @@ https://github.com/firebase/firebase-js-sdk {% endcomment %} # ImagenGCSImage interface +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + An image generated by Imagen, stored in Cloud Storage (GCS) for Firebase. Signature: @@ -22,11 +25,14 @@ export interface ImagenGCSImage | Property | Type | Description | | --- | --- | --- | -| [gcsURI](./vertexai.imagengcsimage.md#imagengcsimagegcsuri) | string | The URI of the file in Cloud Storage (GCS) for Firestore. | -| [mimeType](./vertexai.imagengcsimage.md#imagengcsimagemimetype) | string | The MIME type of the image; either "image/png" or "image/jpeg".To request a different format, set the imageFormat property in your [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface). | +| [gcsURI](./vertexai.imagengcsimage.md#imagengcsimagegcsuri) | string | (BETA) The URI of the file in Cloud Storage (GCS) for Firestore. | +| [mimeType](./vertexai.imagengcsimage.md#imagengcsimagemimetype) | string | (BETA) The MIME type of the image; either "image/png" or "image/jpeg".To request a different format, set the imageFormat property in your [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface). | ## ImagenGCSImage.gcsURI +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + The URI of the file in Cloud Storage (GCS) for Firestore. Signature: @@ -41,6 +47,9 @@ gcsURI: string; ## ImagenGCSImage.mimeType +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + The MIME type of the image; either `"image/png"` or `"image/jpeg"`. To request a different format, set the `imageFormat` property in your [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface). diff --git a/docs-devsite/vertexai.imagengenerationconfig.md b/docs-devsite/vertexai.imagengenerationconfig.md index 08bf68d02a6..f986045d8fa 100644 --- a/docs-devsite/vertexai.imagengenerationconfig.md +++ b/docs-devsite/vertexai.imagengenerationconfig.md @@ -10,6 +10,9 @@ https://github.com/firebase/firebase-js-sdk {% endcomment %} # ImagenGenerationConfig interface +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + Configuration options for generating images with Imagen. See the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images) for more details. @@ -24,14 +27,17 @@ export interface ImagenGenerationConfig | Property | Type | Description | | --- | --- | --- | -| [addWatermark](./vertexai.imagengenerationconfig.md#imagengenerationconfigaddwatermark) | boolean | Whether to add an invisible watermark to generated images.If set to true, an invisible SynthID watermark is embedded in generated images to indicate that they are AI generated. If set to false, watermarking will be disabled.The default value depends on the Imagen model; see the [addWatermark](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation for more details. | -| [aspectRatio](./vertexai.imagengenerationconfig.md#imagengenerationconfigaspectratio) | [ImagenAspectRatio](./vertexai.md#imagenaspectratio) | The aspect ratio of the generated images. The default value is square 1:1. Supported aspect ratios depend on the Imagen model, see [ImagenAspectRatio](./vertexai.md#imagenaspectratio) for more details. | -| [imageFormat](./vertexai.imagengenerationconfig.md#imagengenerationconfigimageformat) | [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) | The image format of the generated images. The default is PNG.See [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for more details. | -| [negativePrompt](./vertexai.imagengenerationconfig.md#imagengenerationconfignegativeprompt) | string | A description of what should be omitted from the generated images.Support for negative prompts depends on the Imagen model.See the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images#negative-prompt) for more details. | -| [numberOfImages](./vertexai.imagengenerationconfig.md#imagengenerationconfignumberofimages) | number | The number of images to generate. The default value is 1.The number of sample images that may be generated in each request depends on the model (typically up to 4); see the [sampleCount](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation for more details. | +| [addWatermark](./vertexai.imagengenerationconfig.md#imagengenerationconfigaddwatermark) | boolean | (BETA) Whether to add an invisible watermark to generated images.If set to true, an invisible SynthID watermark is embedded in generated images to indicate that they are AI generated. If set to false, watermarking will be disabled.The default value depends on the Imagen model; see the [addWatermark](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation for more details. | +| [aspectRatio](./vertexai.imagengenerationconfig.md#imagengenerationconfigaspectratio) | [ImagenAspectRatio](./vertexai.md#imagenaspectratio) | (BETA) The aspect ratio of the generated images. The default value is square 1:1. Supported aspect ratios depend on the Imagen model, see [ImagenAspectRatio](./vertexai.md#imagenaspectratio) for more details. | +| [imageFormat](./vertexai.imagengenerationconfig.md#imagengenerationconfigimageformat) | [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) | (BETA) The image format of the generated images. The default is PNG.See [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for more details. | +| [negativePrompt](./vertexai.imagengenerationconfig.md#imagengenerationconfignegativeprompt) | string | (BETA) A description of what should be omitted from the generated images.Support for negative prompts depends on the Imagen model.See the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images#negative-prompt) for more details. | +| [numberOfImages](./vertexai.imagengenerationconfig.md#imagengenerationconfignumberofimages) | number | (BETA) The number of images to generate. The default value is 1.The number of sample images that may be generated in each request depends on the model (typically up to 4); see the [sampleCount](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation for more details. | ## ImagenGenerationConfig.addWatermark +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + Whether to add an invisible watermark to generated images. If set to `true`, an invisible SynthID watermark is embedded in generated images to indicate that they are AI generated. If set to `false`, watermarking will be disabled. @@ -46,6 +52,9 @@ addWatermark?: boolean; ## ImagenGenerationConfig.aspectRatio +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + The aspect ratio of the generated images. The default value is square 1:1. Supported aspect ratios depend on the Imagen model, see [ImagenAspectRatio](./vertexai.md#imagenaspectratio) for more details. Signature: @@ -56,6 +65,9 @@ aspectRatio?: ImagenAspectRatio; ## ImagenGenerationConfig.imageFormat +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + The image format of the generated images. The default is PNG. See [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for more details. @@ -68,6 +80,9 @@ imageFormat?: ImagenImageFormat; ## ImagenGenerationConfig.negativePrompt +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + A description of what should be omitted from the generated images. Support for negative prompts depends on the Imagen model. @@ -82,6 +97,9 @@ negativePrompt?: string; ## ImagenGenerationConfig.numberOfImages +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + The number of images to generate. The default value is 1. The number of sample images that may be generated in each request depends on the model (typically up to 4); see the [sampleCount](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation for more details. diff --git a/docs-devsite/vertexai.imagengenerationresponse.md b/docs-devsite/vertexai.imagengenerationresponse.md index 35e1caceaae..50f1ccd2e0d 100644 --- a/docs-devsite/vertexai.imagengenerationresponse.md +++ b/docs-devsite/vertexai.imagengenerationresponse.md @@ -10,6 +10,9 @@ https://github.com/firebase/firebase-js-sdk {% endcomment %} # ImagenGenerationResponse interface +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + The response from a request to generate images with Imagen. Signature: @@ -22,11 +25,14 @@ export interface ImagenGenerationResponseImages may be filtered out due to the [ImagenSafetyFilterLevel](./vertexai.md#imagensafetyfilterlevel), [ImagenPersonFilterLevel](./vertexai.md#imagenpersonfilterlevel), or filtering included in the model. The filter levels may be adjusted in your [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface).See the [Responsible AI and usage guidelines for Imagen](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen) for more details. | -| [images](./vertexai.imagengenerationresponse.md#imagengenerationresponseimages) | T\[\] | The images generated by Imagen.The number of images generated may be fewer than the number requested if one or more were filtered out; see filteredReason. | +| [filteredReason](./vertexai.imagengenerationresponse.md#imagengenerationresponsefilteredreason) | string | (BETA) The reason that images were filtered out. This property will only be defined if one or more images were filtered.Images may be filtered out due to the [ImagenSafetyFilterLevel](./vertexai.md#imagensafetyfilterlevel), [ImagenPersonFilterLevel](./vertexai.md#imagenpersonfilterlevel), or filtering included in the model. The filter levels may be adjusted in your [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface).See the [Responsible AI and usage guidelines for Imagen](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen) for more details. | +| [images](./vertexai.imagengenerationresponse.md#imagengenerationresponseimages) | T\[\] | (BETA) The images generated by Imagen.The number of images generated may be fewer than the number requested if one or more were filtered out; see filteredReason. | ## ImagenGenerationResponse.filteredReason +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + The reason that images were filtered out. This property will only be defined if one or more images were filtered. Images may be filtered out due to the [ImagenSafetyFilterLevel](./vertexai.md#imagensafetyfilterlevel), [ImagenPersonFilterLevel](./vertexai.md#imagenpersonfilterlevel), or filtering included in the model. The filter levels may be adjusted in your [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface). @@ -41,6 +47,9 @@ filteredReason?: string; ## ImagenGenerationResponse.images +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + The images generated by Imagen. The number of images generated may be fewer than the number requested if one or more were filtered out; see `filteredReason`. diff --git a/docs-devsite/vertexai.imagenimageformat.md b/docs-devsite/vertexai.imagenimageformat.md index d130dbcf0d7..437450dc259 100644 --- a/docs-devsite/vertexai.imagenimageformat.md +++ b/docs-devsite/vertexai.imagenimageformat.md @@ -10,6 +10,9 @@ https://github.com/firebase/firebase-js-sdk {% endcomment %} # ImagenImageFormat class +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + Defines the image format for images output by Imagen. Use this class to specify the desired format (JPEG or PNG) and compression quality for images generated by Imagen. This is typically included as part of [ImagenModelParams](./vertexai.imagenmodelparams.md#imagenmodelparams_interface). @@ -24,18 +27,21 @@ export declare class ImagenImageFormat | Property | Modifiers | Type | Description | | --- | --- | --- | --- | -| [compressionQuality](./vertexai.imagenimageformat.md#imagenimageformatcompressionquality) | | number | The level of compression (a number between 0 and 100). | -| [mimeType](./vertexai.imagenimageformat.md#imagenimageformatmimetype) | | string | The MIME type. | +| [compressionQuality](./vertexai.imagenimageformat.md#imagenimageformatcompressionquality) | | number | (BETA) The level of compression (a number between 0 and 100). | +| [mimeType](./vertexai.imagenimageformat.md#imagenimageformatmimetype) | | string | (BETA) The MIME type. | ## Methods | Method | Modifiers | Description | | --- | --- | --- | -| [jpeg(compressionQuality)](./vertexai.imagenimageformat.md#imagenimageformatjpeg) | static | Creates an [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for a JPEG image.For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. | -| [png()](./vertexai.imagenimageformat.md#imagenimageformatpng) | static | Creates an [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for a PNG image.For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. | +| [jpeg(compressionQuality)](./vertexai.imagenimageformat.md#imagenimageformatjpeg) | static | (BETA) Creates an [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for a JPEG image.For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. | +| [png()](./vertexai.imagenimageformat.md#imagenimageformatpng) | static | (BETA) Creates an [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for a PNG image.For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. | ## ImagenImageFormat.compressionQuality +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + The level of compression (a number between 0 and 100). Signature: @@ -46,6 +52,9 @@ compressionQuality?: number; ## ImagenImageFormat.mimeType +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + The MIME type. Signature: @@ -56,6 +65,9 @@ mimeType: string; ## ImagenImageFormat.jpeg() +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + Creates an [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for a JPEG image. For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. @@ -80,6 +92,9 @@ An [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_c ## ImagenImageFormat.png() +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + Creates an [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for a PNG image. For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. diff --git a/docs-devsite/vertexai.imageninlineimage.md b/docs-devsite/vertexai.imageninlineimage.md index ba465007a83..aac325a4d00 100644 --- a/docs-devsite/vertexai.imageninlineimage.md +++ b/docs-devsite/vertexai.imageninlineimage.md @@ -10,6 +10,9 @@ https://github.com/firebase/firebase-js-sdk {% endcomment %} # ImagenInlineImage interface +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + An image generated by Imagen, represented as inline data. Signature: @@ -22,11 +25,14 @@ export interface ImagenInlineImage | Property | Type | Description | | --- | --- | --- | -| [bytesBase64Encoded](./vertexai.imageninlineimage.md#imageninlineimagebytesbase64encoded) | string | The base64-encoded image data. | -| [mimeType](./vertexai.imageninlineimage.md#imageninlineimagemimetype) | string | The MIME type of the image; either "image/png" or "image/jpeg".To request a different format, set the imageFormat property in your [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface). | +| [bytesBase64Encoded](./vertexai.imageninlineimage.md#imageninlineimagebytesbase64encoded) | string | (BETA) The base64-encoded image data. | +| [mimeType](./vertexai.imageninlineimage.md#imageninlineimagemimetype) | string | (BETA) The MIME type of the image; either "image/png" or "image/jpeg".To request a different format, set the imageFormat property in your [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface). | ## ImagenInlineImage.bytesBase64Encoded +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + The base64-encoded image data. Signature: @@ -37,6 +43,9 @@ bytesBase64Encoded: string; ## ImagenInlineImage.mimeType +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + The MIME type of the image; either `"image/png"` or `"image/jpeg"`. To request a different format, set the `imageFormat` property in your [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface). diff --git a/docs-devsite/vertexai.imagenmodel.md b/docs-devsite/vertexai.imagenmodel.md index ac980711da2..a7e6f1ab12e 100644 --- a/docs-devsite/vertexai.imagenmodel.md +++ b/docs-devsite/vertexai.imagenmodel.md @@ -10,6 +10,9 @@ https://github.com/firebase/firebase-js-sdk {% endcomment %} # ImagenModel class +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + Class for Imagen model APIs. This class provides methods for generating images using the Imagen model. @@ -25,25 +28,27 @@ export declare class ImagenModel extends VertexAIModel | Constructor | Modifiers | Description | | --- | --- | --- | -| [(constructor)(vertexAI, modelParams, requestOptions)](./vertexai.imagenmodel.md#imagenmodelconstructor) | | Constructs a new instance of the [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) class. | +| [(constructor)(vertexAI, modelParams, requestOptions)](./vertexai.imagenmodel.md#imagenmodelconstructor) | | (BETA) Constructs a new instance of the [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) class. | ## Properties | Property | Modifiers | Type | Description | | --- | --- | --- | --- | -| [generationConfig](./vertexai.imagenmodel.md#imagenmodelgenerationconfig) | | [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface) | The Imagen Generation Configuration. | -| [requestOptions](./vertexai.imagenmodel.md#imagenmodelrequestoptions) | | [RequestOptions](./vertexai.requestoptions.md#requestoptions_interface) \| undefined | | -| [safetySettings](./vertexai.imagenmodel.md#imagenmodelsafetysettings) | | [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface) | Safety settings for filtering inappropriate content. | +| [generationConfig](./vertexai.imagenmodel.md#imagenmodelgenerationconfig) | | [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface) | (BETA) The Imagen Generation Configuration. | +| [requestOptions](./vertexai.imagenmodel.md#imagenmodelrequestoptions) | | [RequestOptions](./vertexai.requestoptions.md#requestoptions_interface) \| undefined | (BETA) | +| [safetySettings](./vertexai.imagenmodel.md#imagenmodelsafetysettings) | | [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface) | (BETA) Safety settings for filtering inappropriate content. | ## Methods | Method | Modifiers | Description | | --- | --- | --- | | [generateImages(prompt)](./vertexai.imagenmodel.md#imagenmodelgenerateimages) | | (BETA) Generates images using the Imagen model and returns them as base64-encoded strings.For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. | -| [generateImagesGCS(prompt, gcsURI)](./vertexai.imagenmodel.md#imagenmodelgenerateimagesgcs) | | (BETA) Generates images to Cloud Storage (GCS) for Firebase using the Imagen model.For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. | ## ImagenModel.(constructor) +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + Constructs a new instance of the [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) class. Signature: @@ -66,6 +71,9 @@ If the `apiKey` or `projectId` fields are missing in your Firebase config. ## ImagenModel.generationConfig +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + The Imagen Generation Configuration. Signature: @@ -76,6 +84,9 @@ generationConfig?: ImagenGenerationConfig; ## ImagenModel.requestOptions +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + Signature: ```typescript @@ -84,6 +95,9 @@ requestOptions?: RequestOptions | undefined; ## ImagenModel.safetySettings +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + Safety settings for filtering inappropriate content. Signature: @@ -125,40 +139,6 @@ A promise that resolves to an [ImagenGenerationResponse](./vertexai.imagengenera If the request to generate images fails. This happens if the prompt is blocked. -## ImagenModel.generateImagesGCS() - -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> - -Generates images to Cloud Storage (GCS) for Firebase using the Imagen model. - -For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. - -If the prompt was not blocked, but one or more of the generated images were filtered, the returned object will have a `filteredReason` property. If all images are filtered, the `images` array will be empty. - -Signature: - -```typescript -generateImagesGCS(prompt: string, gcsURI: string): Promise>; -``` - -#### Parameters - -| Parameter | Type | Description | -| --- | --- | --- | -| prompt | string | A text prompt describing the image(s) to generate. | -| gcsURI | string | The Cloud Storage (GCS) for Firebase URI where the images should be stored. This should be a directory. For example, gs://my-bucket/my-directory/. | - -Returns: - -Promise<[ImagenGenerationResponse](./vertexai.imagengenerationresponse.md#imagengenerationresponse_interface)<[ImagenGCSImage](./vertexai.imagengcsimage.md#imagengcsimage_interface)>> - -A promise that resolves to an [ImagenGenerationResponse](./vertexai.imagengenerationresponse.md#imagengenerationresponse_interface) object containing the URLs of the generated images. - -#### Exceptions - -If the request fails to generate images fails. This happens if the prompt is blocked. - ### Example diff --git a/docs-devsite/vertexai.imagenmodelparams.md b/docs-devsite/vertexai.imagenmodelparams.md index 45c0ddef767..9930c9d9431 100644 --- a/docs-devsite/vertexai.imagenmodelparams.md +++ b/docs-devsite/vertexai.imagenmodelparams.md @@ -10,6 +10,9 @@ https://github.com/firebase/firebase-js-sdk {% endcomment %} # ImagenModelParams interface +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + Parameters for configuring an [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class). Signature: @@ -22,12 +25,15 @@ export interface ImagenModelParams | Property | Type | Description | | --- | --- | --- | -| [generationConfig](./vertexai.imagenmodelparams.md#imagenmodelparamsgenerationconfig) | [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface) | Configuration options for generating images with Imagen. | -| [model](./vertexai.imagenmodelparams.md#imagenmodelparamsmodel) | string | The Imagen model to use for generating images. For example: imagen-3.0-generate-002.Only Imagen 3 models (named imagen-3.0-*) are supported.See [model versions](https://cloud.google.com/vertex-ai/generative-ai/docs/image/model-versioning) for a full list of supported Imagen 3 models. | -| [safetySettings](./vertexai.imagenmodelparams.md#imagenmodelparamssafetysettings) | [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface) | Safety settings for filtering potentially inappropriate content. | +| [generationConfig](./vertexai.imagenmodelparams.md#imagenmodelparamsgenerationconfig) | [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface) | (BETA) Configuration options for generating images with Imagen. | +| [model](./vertexai.imagenmodelparams.md#imagenmodelparamsmodel) | string | (BETA) The Imagen model to use for generating images. For example: imagen-3.0-generate-002.Only Imagen 3 models (named imagen-3.0-*) are supported.See [model versions](https://cloud.google.com/vertex-ai/generative-ai/docs/image/model-versioning) for a full list of supported Imagen 3 models. | +| [safetySettings](./vertexai.imagenmodelparams.md#imagenmodelparamssafetysettings) | [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface) | (BETA) Safety settings for filtering potentially inappropriate content. | ## ImagenModelParams.generationConfig +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + Configuration options for generating images with Imagen. Signature: @@ -38,6 +44,9 @@ generationConfig?: ImagenGenerationConfig; ## ImagenModelParams.model +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + The Imagen model to use for generating images. For example: `imagen-3.0-generate-002`. Only Imagen 3 models (named `imagen-3.0-*`) are supported. @@ -52,6 +61,9 @@ model: string; ## ImagenModelParams.safetySettings +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + Safety settings for filtering potentially inappropriate content. Signature: diff --git a/docs-devsite/vertexai.imagensafetysettings.md b/docs-devsite/vertexai.imagensafetysettings.md index ad97a1c178f..a070fe7aea7 100644 --- a/docs-devsite/vertexai.imagensafetysettings.md +++ b/docs-devsite/vertexai.imagensafetysettings.md @@ -10,6 +10,9 @@ https://github.com/firebase/firebase-js-sdk {% endcomment %} # ImagenSafetySettings interface +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + Settings for controlling the aggressiveness of filtering out sensitive content. See the [https://www.newyorker.com/magazine/2018/12/10/the-friendship-that-made-google-huge](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#config-safety-filters) for more details. @@ -24,11 +27,14 @@ export interface ImagenSafetySettings | Property | Type | Description | | --- | --- | --- | -| [personFilterLevel](./vertexai.imagensafetysettings.md#imagensafetysettingspersonfilterlevel) | [ImagenPersonFilterLevel](./vertexai.md#imagenpersonfilterlevel) | A filter level controlling whether generation of images containing people or faces is allowed. | -| [safetyFilterLevel](./vertexai.imagensafetysettings.md#imagensafetysettingssafetyfilterlevel) | [ImagenSafetyFilterLevel](./vertexai.md#imagensafetyfilterlevel) | A filter level controlling how aggressive to filter out sensitive content from generated images. | +| [personFilterLevel](./vertexai.imagensafetysettings.md#imagensafetysettingspersonfilterlevel) | [ImagenPersonFilterLevel](./vertexai.md#imagenpersonfilterlevel) | (BETA) A filter level controlling whether generation of images containing people or faces is allowed. | +| [safetyFilterLevel](./vertexai.imagensafetysettings.md#imagensafetysettingssafetyfilterlevel) | [ImagenSafetyFilterLevel](./vertexai.md#imagensafetyfilterlevel) | (BETA) A filter level controlling how aggressive to filter out sensitive content from generated images. | ## ImagenSafetySettings.personFilterLevel +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + A filter level controlling whether generation of images containing people or faces is allowed. Signature: @@ -39,6 +45,9 @@ personFilterLevel?: ImagenPersonFilterLevel; ## ImagenSafetySettings.safetyFilterLevel +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + A filter level controlling how aggressive to filter out sensitive content from generated images. Signature: diff --git a/docs-devsite/vertexai.md b/docs-devsite/vertexai.md index 5553526ca18..85608ca8a74 100644 --- a/docs-devsite/vertexai.md +++ b/docs-devsite/vertexai.md @@ -20,7 +20,7 @@ The Vertex AI in Firebase Web SDK. | [getVertexAI(app, options)](./vertexai.md#getvertexai_04094cf) | Returns a [VertexAI](./vertexai.vertexai.md#vertexai_interface) instance for the given app. | | function(vertexAI, ...) | | [getGenerativeModel(vertexAI, modelParams, requestOptions)](./vertexai.md#getgenerativemodel_e3037c9) | Returns a [GenerativeModel](./vertexai.generativemodel.md#generativemodel_class) class with methods for inference and other functionality. | -| [getImagenModel(vertexAI, modelParams, requestOptions)](./vertexai.md#getimagenmodel_812c375) | Returns an [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) class with methods for using Imagen.Only Imagen 3 models (named imagen-3.0-*) are supported.For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. | +| [getImagenModel(vertexAI, modelParams, requestOptions)](./vertexai.md#getimagenmodel_812c375) | (BETA) Returns an [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) class with methods for using Imagen.Only Imagen 3 models (named imagen-3.0-*) are supported.For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. | ## Classes @@ -30,8 +30,8 @@ The Vertex AI in Firebase Web SDK. | [BooleanSchema](./vertexai.booleanschema.md#booleanschema_class) | Schema class for "boolean" types. | | [ChatSession](./vertexai.chatsession.md#chatsession_class) | ChatSession class that enables sending chat messages and stores history of sent and received messages so far. | | [GenerativeModel](./vertexai.generativemodel.md#generativemodel_class) | Class for generative model APIs. | -| [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) | Defines the image format for images output by Imagen.Use this class to specify the desired format (JPEG or PNG) and compression quality for images generated by Imagen. This is typically included as part of [ImagenModelParams](./vertexai.imagenmodelparams.md#imagenmodelparams_interface). | -| [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) | Class for Imagen model APIs.This class provides methods for generating images using the Imagen model. | +| [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) | (BETA) Defines the image format for images output by Imagen.Use this class to specify the desired format (JPEG or PNG) and compression quality for images generated by Imagen. This is typically included as part of [ImagenModelParams](./vertexai.imagenmodelparams.md#imagenmodelparams_interface). | +| [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) | (BETA) Class for Imagen model APIs.This class provides methods for generating images using the Imagen model. | | [IntegerSchema](./vertexai.integerschema.md#integerschema_class) | Schema class for "integer" types. | | [NumberSchema](./vertexai.numberschema.md#numberschema_class) | Schema class for "number" types. | | [ObjectSchema](./vertexai.objectschema.md#objectschema_class) | Schema class for "object" types. The properties param must be a map of Schema objects. | @@ -52,9 +52,9 @@ The Vertex AI in Firebase Web SDK. | [HarmCategory](./vertexai.md#harmcategory) | Harm categories that would cause prompts or candidates to be blocked. | | [HarmProbability](./vertexai.md#harmprobability) | Probability that a prompt or candidate matches a harm category. | | [HarmSeverity](./vertexai.md#harmseverity) | Harm severity levels. | -| [ImagenAspectRatio](./vertexai.md#imagenaspectratio) | Aspect ratios for Imagen images.To specify an aspect ratio for generated images, set the aspectRatio property in your [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface).See the the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images#aspect-ratio) for more details and examples of the supported aspect ratios. | -| [ImagenPersonFilterLevel](./vertexai.md#imagenpersonfilterlevel) | A filter level controlling whether generation of images containing people or faces is allowed.See the [\`personGeneration\`](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation for more details. | -| [ImagenSafetyFilterLevel](./vertexai.md#imagensafetyfilterlevel) | A filter level controlling how aggressively to filter sensitive content.Text prompts provided as inputs and images (generated or uploaded) through Imagen on Vertex AI are assessed against a list of safety filters, which include 'harmful categories' (for example, violence, sexual, derogatory, and toxic). This filter level controls how aggressively to filter out potentially harmful content from responses. See the [\`safetySetting\`](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation and the [Responsible AI and usage guidelines](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-filters) for more details. | +| [ImagenAspectRatio](./vertexai.md#imagenaspectratio) | (BETA) Aspect ratios for Imagen images.To specify an aspect ratio for generated images, set the aspectRatio property in your [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface).See the the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images#aspect-ratio) for more details and examples of the supported aspect ratios. | +| [ImagenPersonFilterLevel](./vertexai.md#imagenpersonfilterlevel) | (BETA) A filter level controlling whether generation of images containing people or faces is allowed.See the [\`personGeneration\`](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation for more details. | +| [ImagenSafetyFilterLevel](./vertexai.md#imagensafetyfilterlevel) | (BETA) A filter level controlling how aggressively to filter sensitive content.Text prompts provided as inputs and images (generated or uploaded) through Imagen on Vertex AI are assessed against a list of safety filters, which include 'harmful categories' (for example, violence, sexual, derogatory, and toxic). This filter level controls how aggressively to filter out potentially harmful content from responses. See the [\`safetySetting\`](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation and the [Responsible AI and usage guidelines](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-filters) for more details. | | [SchemaType](./vertexai.md#schematype) | Contains the list of OpenAPI data types as defined by the [OpenAPI specification](https://swagger.io/docs/specification/data-models/data-types/) | | [VertexAIErrorCode](./vertexai.md#vertexaierrorcode) | Standardized error codes that [VertexAIError](./vertexai.vertexaierror.md#vertexaierror_class) can have. | @@ -90,12 +90,12 @@ The Vertex AI in Firebase Web SDK. | [GenerativeContentBlob](./vertexai.generativecontentblob.md#generativecontentblob_interface) | Interface for sending an image. | | [GroundingAttribution](./vertexai.groundingattribution.md#groundingattribution_interface) | | | [GroundingMetadata](./vertexai.groundingmetadata.md#groundingmetadata_interface) | Metadata returned to client when grounding is enabled. | -| [ImagenGCSImage](./vertexai.imagengcsimage.md#imagengcsimage_interface) | An image generated by Imagen, stored in Cloud Storage (GCS) for Firebase. | -| [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface) | Configuration options for generating images with Imagen.See the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images) for more details. | -| [ImagenGenerationResponse](./vertexai.imagengenerationresponse.md#imagengenerationresponse_interface) | The response from a request to generate images with Imagen. | -| [ImagenInlineImage](./vertexai.imageninlineimage.md#imageninlineimage_interface) | An image generated by Imagen, represented as inline data. | -| [ImagenModelParams](./vertexai.imagenmodelparams.md#imagenmodelparams_interface) | Parameters for configuring an [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class). | -| [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface) | Settings for controlling the aggressiveness of filtering out sensitive content.See the [https://www.newyorker.com/magazine/2018/12/10/the-friendship-that-made-google-huge](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#config-safety-filters) for more details. | +| [ImagenGCSImage](./vertexai.imagengcsimage.md#imagengcsimage_interface) | (BETA) An image generated by Imagen, stored in Cloud Storage (GCS) for Firebase. | +| [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface) | (BETA) Configuration options for generating images with Imagen.See the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images) for more details. | +| [ImagenGenerationResponse](./vertexai.imagengenerationresponse.md#imagengenerationresponse_interface) | (BETA) The response from a request to generate images with Imagen. | +| [ImagenInlineImage](./vertexai.imageninlineimage.md#imageninlineimage_interface) | (BETA) An image generated by Imagen, represented as inline data. | +| [ImagenModelParams](./vertexai.imagenmodelparams.md#imagenmodelparams_interface) | (BETA) Parameters for configuring an [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class). | +| [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface) | (BETA) Settings for controlling the aggressiveness of filtering out sensitive content.See the [https://www.newyorker.com/magazine/2018/12/10/the-friendship-that-made-google-huge](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#config-safety-filters) for more details. | | [InlineDataPart](./vertexai.inlinedatapart.md#inlinedatapart_interface) | Content part interface if the part represents an image. | | [ModelParams](./vertexai.modelparams.md#modelparams_interface) | Params passed to [getGenerativeModel()](./vertexai.md#getgenerativemodel_e3037c9). | | [ObjectSchemaInterface](./vertexai.objectschemainterface.md#objectschemainterface_interface) | Interface for [ObjectSchema](./vertexai.objectschema.md#objectschema_class) class. | @@ -182,6 +182,9 @@ export declare function getGenerativeModel(vertexAI: VertexAI, modelParams: Mode ### getImagenModel(vertexAI, modelParams, requestOptions) {:#getimagenmodel_812c375} +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + Returns an [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) class with methods for using Imagen. Only Imagen 3 models (named `imagen-3.0-*`) are supported. @@ -408,6 +411,9 @@ export declare enum HarmSeverity ## ImagenAspectRatio +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + Aspect ratios for Imagen images. To specify an aspect ratio for generated images, set the `aspectRatio` property in your [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface). @@ -424,14 +430,17 @@ export declare enum ImagenAspectRatio | Member | Value | Description | | --- | --- | --- | -| LANDSCAPE\_16x9 | "16:9" | Landscape (16:9) aspect ratio. | -| LANDSCAPE\_3x4 | "3:4" | Landscape (3:4) aspect ratio. | -| PORTRAIT\_4x3 | "4:3" | Portrait (4:3) aspect ratio. | -| PORTRAIT\_9x16 | "9:16" | Portrait (9:16) aspect ratio. | -| SQUARE | "1:1" | Square (1:1) aspect ratio. | +| LANDSCAPE\_16x9 | "16:9" | (BETA) Landscape (16:9) aspect ratio. | +| LANDSCAPE\_3x4 | "3:4" | (BETA) Landscape (3:4) aspect ratio. | +| PORTRAIT\_4x3 | "4:3" | (BETA) Portrait (4:3) aspect ratio. | +| PORTRAIT\_9x16 | "9:16" | (BETA) Portrait (9:16) aspect ratio. | +| SQUARE | "1:1" | (BETA) Square (1:1) aspect ratio. | ## ImagenPersonFilterLevel +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + A filter level controlling whether generation of images containing people or faces is allowed. See the [\`personGeneration\`](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation for more details. @@ -446,12 +455,15 @@ export declare enum ImagenPersonFilterLevel | Member | Value | Description | | --- | --- | --- | -| ALLOW\_ADULT | "allow_adult" | Allow generation of images containing adults only; images of children are filtered out.Generation of images containing people or faces may require your use case to be reviewed and approved by Cloud support; see the [Responsible AI and usage guidelines](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#person-face-gen) for more details. | -| ALLOW\_ALL | "allow_all" | Allow generation of images containing adults only; images of children are filtered out.Generation of images containing people or faces may require your use case to be reviewed and approved by Cloud support; see the [Responsible AI and usage guidelines](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#person-face-gen) for more details. | -| BLOCK\_ALL | "dont_allow" | Disallow generation of images containing people or faces; images of people are filtered out. | +| ALLOW\_ADULT | "allow_adult" | (BETA) Allow generation of images containing adults only; images of children are filtered out.Generation of images containing people or faces may require your use case to be reviewed and approved by Cloud support; see the [Responsible AI and usage guidelines](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#person-face-gen) for more details. | +| ALLOW\_ALL | "allow_all" | (BETA) Allow generation of images containing adults only; images of children are filtered out.Generation of images containing people or faces may require your use case to be reviewed and approved by Cloud support; see the [Responsible AI and usage guidelines](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#person-face-gen) for more details. | +| BLOCK\_ALL | "dont_allow" | (BETA) Disallow generation of images containing people or faces; images of people are filtered out. | ## ImagenSafetyFilterLevel +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + A filter level controlling how aggressively to filter sensitive content. Text prompts provided as inputs and images (generated or uploaded) through Imagen on Vertex AI are assessed against a list of safety filters, which include 'harmful categories' (for example, `violence`, `sexual`, `derogatory`, and `toxic`). This filter level controls how aggressively to filter out potentially harmful content from responses. See the [\`safetySetting\`](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation and the [Responsible AI and usage guidelines](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-filters) for more details. @@ -466,10 +478,10 @@ export declare enum ImagenSafetyFilterLevel | Member | Value | Description | | --- | --- | --- | -| BLOCK\_LOW\_AND\_ABOVE | "block_low_and_above" | The most aggressive filtering level; most strict blocking. | -| BLOCK\_MEDIUM\_AND\_ABOVE | "block_medium_and_above" | Blocks some sensitive prompts and responses. | -| BLOCK\_NONE | "block_none" | The least aggressive filtering level; blocks very few sensitive prompts and responses.Access to this feature is restricted and may require your case to be reviewed and approved by Cloud support. | -| BLOCK\_ONLY\_HIGH | "block_only_high" | Blocks few sensitive prompts and responses. | +| BLOCK\_LOW\_AND\_ABOVE | "block_low_and_above" | (BETA) The most aggressive filtering level; most strict blocking. | +| BLOCK\_MEDIUM\_AND\_ABOVE | "block_medium_and_above" | (BETA) Blocks some sensitive prompts and responses. | +| BLOCK\_NONE | "block_none" | (BETA) The least aggressive filtering level; blocks very few sensitive prompts and responses.Access to this feature is restricted and may require your case to be reviewed and approved by Cloud support. | +| BLOCK\_ONLY\_HIGH | "block_only_high" | (BETA) Blocks few sensitive prompts and responses. | ## SchemaType diff --git a/packages/vertexai/src/api.ts b/packages/vertexai/src/api.ts index c45fe21f90d..7fa7fd7f5ea 100644 --- a/packages/vertexai/src/api.ts +++ b/packages/vertexai/src/api.ts @@ -98,8 +98,6 @@ export function getGenerativeModel( * * @throws If the `apiKey` or `projectId` fields are missing in your * Firebase config. - * - * @public */ export function getImagenModel( vertexAI: VertexAI, diff --git a/packages/vertexai/src/models/imagen-model.ts b/packages/vertexai/src/models/imagen-model.ts index 437c2cb6768..5e880a59059 100644 --- a/packages/vertexai/src/models/imagen-model.ts +++ b/packages/vertexai/src/models/imagen-model.ts @@ -50,7 +50,7 @@ import { VertexAIModel } from './vertexai-model'; * } * ``` * - * @public + * @beta */ export class ImagenModel extends VertexAIModel { /** @@ -125,10 +125,7 @@ export class ImagenModel extends VertexAIModel { /** * Generates images to Cloud Storage (GCS) for Firebase using the Imagen model. * - * @beta - * For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which - * means that the feature is not subject to any SLA or deprecation policy and could change in - * backwards-incompatible ways. + * @internal This method is temporarily internal. * * @param prompt - A text prompt describing the image(s) to generate. * @param gcsURI - The Cloud Storage (GCS) for Firebase URI where the images should be stored. diff --git a/packages/vertexai/src/requests/imagen-image-format.ts b/packages/vertexai/src/requests/imagen-image-format.ts index 857799ca587..c3b6fd8e405 100644 --- a/packages/vertexai/src/requests/imagen-image-format.ts +++ b/packages/vertexai/src/requests/imagen-image-format.ts @@ -32,7 +32,7 @@ import { logger } from '../logger'; * } * ``` * - * @public + * @beta */ export class ImagenImageFormat { /** @@ -58,8 +58,6 @@ export class ImagenImageFormat { * * @param compressionQuality - The level of compression (a number between 0 and 100). * @returns An {@link ImagenImageFormat} object for a JPEG image. - * - * @public */ static jpeg(compressionQuality?: number): ImagenImageFormat { if ( @@ -82,8 +80,6 @@ export class ImagenImageFormat { * backwards-incompatible ways. * * @returns An {@link ImagenImageFormat} object for a PNG image. - * - * @public */ static png(): ImagenImageFormat { return { mimeType: 'image/png' }; diff --git a/packages/vertexai/src/types/imagen/requests.ts b/packages/vertexai/src/types/imagen/requests.ts index 774a05c83f2..22eed9639f4 100644 --- a/packages/vertexai/src/types/imagen/requests.ts +++ b/packages/vertexai/src/types/imagen/requests.ts @@ -20,7 +20,7 @@ import { ImagenImageFormat } from '../../requests/imagen-image-format'; /** * Parameters for configuring an {@link ImagenModel}. * - * @public + * @beta */ export interface ImagenModelParams { /** @@ -48,7 +48,7 @@ export interface ImagenModelParams { * * See the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images | Cloud documentation} for more details. * - * @public + * @beta */ export interface ImagenGenerationConfig { /** @@ -101,7 +101,7 @@ export interface ImagenGenerationConfig { * documentation and the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-filters | Responsible AI and usage guidelines} * for more details. * - * @public + * @beta */ export enum ImagenSafetyFilterLevel { /** @@ -131,7 +131,7 @@ export enum ImagenSafetyFilterLevel { * See the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list | `personGeneration`} * documentation for more details. * - * @public + * @beta */ export enum ImagenPersonFilterLevel { /** @@ -162,7 +162,7 @@ export enum ImagenPersonFilterLevel { * See the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#config-safety-filters | https://www.newyorker.com/magazine/2018/12/10/the-friendship-that-made-google-huge} * for more details. * - * @public + * @beta */ export interface ImagenSafetySettings { /** @@ -185,7 +185,7 @@ export interface ImagenSafetySettings { * See the the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images#aspect-ratio | Cloud documentation } * for more details and examples of the supported aspect ratios. * - * @public + * @beta */ export enum ImagenAspectRatio { /** diff --git a/packages/vertexai/src/types/imagen/responses.ts b/packages/vertexai/src/types/imagen/responses.ts index 95851d4c830..a611eed813e 100644 --- a/packages/vertexai/src/types/imagen/responses.ts +++ b/packages/vertexai/src/types/imagen/responses.ts @@ -18,7 +18,7 @@ /** * An image generated by Imagen, represented as inline data. * - * @public + * @beta */ export interface ImagenInlineImage { /** @@ -36,7 +36,7 @@ export interface ImagenInlineImage { /** * An image generated by Imagen, stored in Cloud Storage (GCS) for Firebase. * - * @public + * @beta */ export interface ImagenGCSImage { /** @@ -56,7 +56,7 @@ export interface ImagenGCSImage { /** * The response from a request to generate images with Imagen. * - * @public + * @beta */ export interface ImagenGenerationResponse< T extends ImagenInlineImage | ImagenGCSImage From 50a1f5c08e4a661fc09f0fe0998ab81efc871a73 Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Wed, 12 Feb 2025 13:10:13 -0500 Subject: [PATCH 08/14] review fixes --- common/api-review/vertexai.api.md | 2 +- docs-devsite/vertexai.imagengcsimage.md | 17 +++++------------ docs-devsite/vertexai.imagengenerationconfig.md | 2 +- docs-devsite/vertexai.imagenimageformat.md | 2 +- docs-devsite/vertexai.imagenmodel.md | 8 ++++---- docs-devsite/vertexai.imagenmodelparams.md | 6 +++--- docs-devsite/vertexai.imagensafetysettings.md | 2 +- docs-devsite/vertexai.md | 10 +++++----- docs-devsite/vertexai.vertexaimodel.md | 4 ++-- packages/vertexai/src/models/imagen-model.ts | 6 +++--- packages/vertexai/src/models/vertexai-model.ts | 2 +- .../src/requests/imagen-image-format.ts | 2 +- packages/vertexai/src/types/imagen/requests.ts | 9 +++++---- packages/vertexai/src/types/imagen/responses.ts | 4 ++-- 14 files changed, 35 insertions(+), 41 deletions(-) diff --git a/common/api-review/vertexai.api.md b/common/api-review/vertexai.api.md index 590ca86e6a1..4521aaf2b70 100644 --- a/common/api-review/vertexai.api.md +++ b/common/api-review/vertexai.api.md @@ -439,7 +439,7 @@ export enum ImagenAspectRatio { SQUARE = "1:1" } -// @beta +// @public export interface ImagenGCSImage { gcsURI: string; mimeType: string; diff --git a/docs-devsite/vertexai.imagengcsimage.md b/docs-devsite/vertexai.imagengcsimage.md index fae3250df94..37110da5b62 100644 --- a/docs-devsite/vertexai.imagengcsimage.md +++ b/docs-devsite/vertexai.imagengcsimage.md @@ -10,11 +10,10 @@ https://github.com/firebase/firebase-js-sdk {% endcomment %} # ImagenGCSImage interface -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> - An image generated by Imagen, stored in Cloud Storage (GCS) for Firebase. +This feature is not available yet. + Signature: ```typescript @@ -25,15 +24,12 @@ export interface ImagenGCSImage | Property | Type | Description | | --- | --- | --- | -| [gcsURI](./vertexai.imagengcsimage.md#imagengcsimagegcsuri) | string | (BETA) The URI of the file in Cloud Storage (GCS) for Firestore. | -| [mimeType](./vertexai.imagengcsimage.md#imagengcsimagemimetype) | string | (BETA) The MIME type of the image; either "image/png" or "image/jpeg".To request a different format, set the imageFormat property in your [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface). | +| [gcsURI](./vertexai.imagengcsimage.md#imagengcsimagegcsuri) | string | The URI of the file stored in a Cloud Storage (GCS) for Firestore bucket. | +| [mimeType](./vertexai.imagengcsimage.md#imagengcsimagemimetype) | string | The MIME type of the image; either "image/png" or "image/jpeg".To request a different format, set the imageFormat property in your [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface). | ## ImagenGCSImage.gcsURI -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> - -The URI of the file in Cloud Storage (GCS) for Firestore. +The URI of the file stored in a Cloud Storage (GCS) for Firestore bucket. Signature: @@ -47,9 +43,6 @@ gcsURI: string; ## ImagenGCSImage.mimeType -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> - The MIME type of the image; either `"image/png"` or `"image/jpeg"`. To request a different format, set the `imageFormat` property in your [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface). diff --git a/docs-devsite/vertexai.imagengenerationconfig.md b/docs-devsite/vertexai.imagengenerationconfig.md index f986045d8fa..600524caae1 100644 --- a/docs-devsite/vertexai.imagengenerationconfig.md +++ b/docs-devsite/vertexai.imagengenerationconfig.md @@ -15,7 +15,7 @@ https://github.com/firebase/firebase-js-sdk Configuration options for generating images with Imagen. -See the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images) for more details. +See the [documentation](http://firebase.google.com/docs/vertex-ai/generate-images) for more details. Signature: diff --git a/docs-devsite/vertexai.imagenimageformat.md b/docs-devsite/vertexai.imagenimageformat.md index 437450dc259..6c08e8d204d 100644 --- a/docs-devsite/vertexai.imagenimageformat.md +++ b/docs-devsite/vertexai.imagenimageformat.md @@ -13,7 +13,7 @@ https://github.com/firebase/firebase-js-sdk > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Defines the image format for images output by Imagen. +Defines the image format for images generated by Imagen. Use this class to specify the desired format (JPEG or PNG) and compression quality for images generated by Imagen. This is typically included as part of [ImagenModelParams](./vertexai.imagenmodelparams.md#imagenmodelparams_interface). diff --git a/docs-devsite/vertexai.imagenmodel.md b/docs-devsite/vertexai.imagenmodel.md index a7e6f1ab12e..9136c98aa37 100644 --- a/docs-devsite/vertexai.imagenmodel.md +++ b/docs-devsite/vertexai.imagenmodel.md @@ -34,7 +34,7 @@ export declare class ImagenModel extends VertexAIModel | Property | Modifiers | Type | Description | | --- | --- | --- | --- | -| [generationConfig](./vertexai.imagenmodel.md#imagenmodelgenerationconfig) | | [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface) | (BETA) The Imagen Generation Configuration. | +| [generationConfig](./vertexai.imagenmodel.md#imagenmodelgenerationconfig) | | [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface) | (BETA) The Imagen generation configuration. | | [requestOptions](./vertexai.imagenmodel.md#imagenmodelrequestoptions) | | [RequestOptions](./vertexai.requestoptions.md#requestoptions_interface) \| undefined | (BETA) | | [safetySettings](./vertexai.imagenmodel.md#imagenmodelsafetysettings) | | [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface) | (BETA) Safety settings for filtering inappropriate content. | @@ -62,7 +62,7 @@ constructor(vertexAI: VertexAI, modelParams: ImagenModelParams, requestOptions?: | Parameter | Type | Description | | --- | --- | --- | | vertexAI | [VertexAI](./vertexai.vertexai.md#vertexai_interface) | An instance of the Vertex AI in Firebase SDK. | -| modelParams | [ImagenModelParams](./vertexai.imagenmodelparams.md#imagenmodelparams_interface) | Parameters to use when making Imagen requests. | +| modelParams | [ImagenModelParams](./vertexai.imagenmodelparams.md#imagenmodelparams_interface) | Parameters to use when making requests to Imagen. | | requestOptions | [RequestOptions](./vertexai.requestoptions.md#requestoptions_interface) \| undefined | Additional options to use when making requests. | #### Exceptions @@ -74,7 +74,7 @@ If the `apiKey` or `projectId` fields are missing in your Firebase config. > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -The Imagen Generation Configuration. +The Imagen generation configuration. Signature: @@ -133,7 +133,7 @@ generateImages(prompt: string): Promise<[ImagenInlineImage](./vertexai.imageninlineimage.md#imageninlineimage_interface)>> -A promise that resolves to an [ImagenGenerationResponse](./vertexai.imagengenerationresponse.md#imagengenerationresponse_interface) object containing the generated images. +A promise that resolves to an [ImagenGenerationResponse](./vertexai.imagengenerationresponse.md#imagengenerationresponse_interface) object containing the generated images. #### Exceptions diff --git a/docs-devsite/vertexai.imagenmodelparams.md b/docs-devsite/vertexai.imagenmodelparams.md index 9930c9d9431..55f08b0d45c 100644 --- a/docs-devsite/vertexai.imagenmodelparams.md +++ b/docs-devsite/vertexai.imagenmodelparams.md @@ -13,7 +13,7 @@ https://github.com/firebase/firebase-js-sdk > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Parameters for configuring an [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class). +Parameters for configuring an [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class). Signature: @@ -26,7 +26,7 @@ export interface ImagenModelParams | Property | Type | Description | | --- | --- | --- | | [generationConfig](./vertexai.imagenmodelparams.md#imagenmodelparamsgenerationconfig) | [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface) | (BETA) Configuration options for generating images with Imagen. | -| [model](./vertexai.imagenmodelparams.md#imagenmodelparamsmodel) | string | (BETA) The Imagen model to use for generating images. For example: imagen-3.0-generate-002.Only Imagen 3 models (named imagen-3.0-*) are supported.See [model versions](https://cloud.google.com/vertex-ai/generative-ai/docs/image/model-versioning) for a full list of supported Imagen 3 models. | +| [model](./vertexai.imagenmodelparams.md#imagenmodelparamsmodel) | string | (BETA) The Imagen model to use for generating images. For example: imagen-3.0-generate-002.Only Imagen 3 models (named imagen-3.0-*) are supported.See [model versions](https://firebase.google.com/docs/vertex-ai/models) for a full list of supported Imagen 3 models. | | [safetySettings](./vertexai.imagenmodelparams.md#imagenmodelparamssafetysettings) | [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface) | (BETA) Safety settings for filtering potentially inappropriate content. | ## ImagenModelParams.generationConfig @@ -51,7 +51,7 @@ The Imagen model to use for generating images. For example: `imagen-3.0-generate Only Imagen 3 models (named `imagen-3.0-*`) are supported. -See [model versions](https://cloud.google.com/vertex-ai/generative-ai/docs/image/model-versioning) for a full list of supported Imagen 3 models. +See [model versions](https://firebase.google.com/docs/vertex-ai/models) for a full list of supported Imagen 3 models. Signature: diff --git a/docs-devsite/vertexai.imagensafetysettings.md b/docs-devsite/vertexai.imagensafetysettings.md index a070fe7aea7..a7abbd86187 100644 --- a/docs-devsite/vertexai.imagensafetysettings.md +++ b/docs-devsite/vertexai.imagensafetysettings.md @@ -15,7 +15,7 @@ https://github.com/firebase/firebase-js-sdk Settings for controlling the aggressiveness of filtering out sensitive content. -See the [https://www.newyorker.com/magazine/2018/12/10/the-friendship-that-made-google-huge](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#config-safety-filters) for more details. +See the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#config-safety-filters) for more details. Signature: diff --git a/docs-devsite/vertexai.md b/docs-devsite/vertexai.md index 85608ca8a74..f7e2a97088a 100644 --- a/docs-devsite/vertexai.md +++ b/docs-devsite/vertexai.md @@ -30,7 +30,7 @@ The Vertex AI in Firebase Web SDK. | [BooleanSchema](./vertexai.booleanschema.md#booleanschema_class) | Schema class for "boolean" types. | | [ChatSession](./vertexai.chatsession.md#chatsession_class) | ChatSession class that enables sending chat messages and stores history of sent and received messages so far. | | [GenerativeModel](./vertexai.generativemodel.md#generativemodel_class) | Class for generative model APIs. | -| [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) | (BETA) Defines the image format for images output by Imagen.Use this class to specify the desired format (JPEG or PNG) and compression quality for images generated by Imagen. This is typically included as part of [ImagenModelParams](./vertexai.imagenmodelparams.md#imagenmodelparams_interface). | +| [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) | (BETA) Defines the image format for images generated by Imagen.Use this class to specify the desired format (JPEG or PNG) and compression quality for images generated by Imagen. This is typically included as part of [ImagenModelParams](./vertexai.imagenmodelparams.md#imagenmodelparams_interface). | | [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) | (BETA) Class for Imagen model APIs.This class provides methods for generating images using the Imagen model. | | [IntegerSchema](./vertexai.integerschema.md#integerschema_class) | Schema class for "integer" types. | | [NumberSchema](./vertexai.numberschema.md#numberschema_class) | Schema class for "number" types. | @@ -90,12 +90,12 @@ The Vertex AI in Firebase Web SDK. | [GenerativeContentBlob](./vertexai.generativecontentblob.md#generativecontentblob_interface) | Interface for sending an image. | | [GroundingAttribution](./vertexai.groundingattribution.md#groundingattribution_interface) | | | [GroundingMetadata](./vertexai.groundingmetadata.md#groundingmetadata_interface) | Metadata returned to client when grounding is enabled. | -| [ImagenGCSImage](./vertexai.imagengcsimage.md#imagengcsimage_interface) | (BETA) An image generated by Imagen, stored in Cloud Storage (GCS) for Firebase. | -| [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface) | (BETA) Configuration options for generating images with Imagen.See the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images) for more details. | +| [ImagenGCSImage](./vertexai.imagengcsimage.md#imagengcsimage_interface) | An image generated by Imagen, stored in Cloud Storage (GCS) for Firebase.This feature is not available yet. | +| [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface) | (BETA) Configuration options for generating images with Imagen.See the [documentation](http://firebase.google.com/docs/vertex-ai/generate-images) for more details. | | [ImagenGenerationResponse](./vertexai.imagengenerationresponse.md#imagengenerationresponse_interface) | (BETA) The response from a request to generate images with Imagen. | | [ImagenInlineImage](./vertexai.imageninlineimage.md#imageninlineimage_interface) | (BETA) An image generated by Imagen, represented as inline data. | -| [ImagenModelParams](./vertexai.imagenmodelparams.md#imagenmodelparams_interface) | (BETA) Parameters for configuring an [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class). | -| [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface) | (BETA) Settings for controlling the aggressiveness of filtering out sensitive content.See the [https://www.newyorker.com/magazine/2018/12/10/the-friendship-that-made-google-huge](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#config-safety-filters) for more details. | +| [ImagenModelParams](./vertexai.imagenmodelparams.md#imagenmodelparams_interface) | (BETA) Parameters for configuring an [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class). | +| [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface) | (BETA) Settings for controlling the aggressiveness of filtering out sensitive content.See the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#config-safety-filters) for more details. | | [InlineDataPart](./vertexai.inlinedatapart.md#inlinedatapart_interface) | Content part interface if the part represents an image. | | [ModelParams](./vertexai.modelparams.md#modelparams_interface) | Params passed to [getGenerativeModel()](./vertexai.md#getgenerativemodel_e3037c9). | | [ObjectSchemaInterface](./vertexai.objectschemainterface.md#objectschemainterface_interface) | Interface for [ObjectSchema](./vertexai.objectschema.md#objectschema_class) class. | diff --git a/docs-devsite/vertexai.vertexaimodel.md b/docs-devsite/vertexai.vertexaimodel.md index 503ff0a2558..5c3244fe1e5 100644 --- a/docs-devsite/vertexai.vertexaimodel.md +++ b/docs-devsite/vertexai.vertexaimodel.md @@ -24,7 +24,7 @@ export declare abstract class VertexAIModel | Property | Modifiers | Type | Description | | --- | --- | --- | --- | -| [model](./vertexai.vertexaimodel.md#vertexaimodelmodel) | | string | The fully qualified model resource name to use for generating images (e.g. publishers/google/models/imagen-3.0-generate-002). | +| [model](./vertexai.vertexaimodel.md#vertexaimodelmodel) | | string | The fully qualified model resource name to use for generating images (for example, publishers/google/models/imagen-3.0-generate-002). | ## Methods @@ -34,7 +34,7 @@ export declare abstract class VertexAIModel ## VertexAIModel.model -The fully qualified model resource name to use for generating images (e.g. `publishers/google/models/imagen-3.0-generate-002`). +The fully qualified model resource name to use for generating images (for example, `publishers/google/models/imagen-3.0-generate-002`). Signature: diff --git a/packages/vertexai/src/models/imagen-model.ts b/packages/vertexai/src/models/imagen-model.ts index 5e880a59059..eb5fc54b1b3 100644 --- a/packages/vertexai/src/models/imagen-model.ts +++ b/packages/vertexai/src/models/imagen-model.ts @@ -54,7 +54,7 @@ import { VertexAIModel } from './vertexai-model'; */ export class ImagenModel extends VertexAIModel { /** - * The Imagen Generation Configuration. + * The Imagen generation configuration. */ generationConfig?: ImagenGenerationConfig; /** @@ -66,7 +66,7 @@ export class ImagenModel extends VertexAIModel { * Constructs a new instance of the {@link ImagenModel} class. * * @param vertexAI - An instance of the Vertex AI in Firebase SDK. - * @param modelParams - Parameters to use when making Imagen requests. + * @param modelParams - Parameters to use when making requests to Imagen. * @param requestOptions - Additional options to use when making requests. * * @throws If the `apiKey` or `projectId` fields are missing in your @@ -93,7 +93,7 @@ export class ImagenModel extends VertexAIModel { * backwards-incompatible ways. * * @param prompt - A text prompt describing the image(s) to generate. - * @returns A promise that resolves to an {@link ImagenGenerationResponse} + * @returns A promise that resolves to an {@link ImagenGenerationResponse} * object containing the generated images. * * @throws If the request to generate images fails. This happens if the diff --git a/packages/vertexai/src/models/vertexai-model.ts b/packages/vertexai/src/models/vertexai-model.ts index 1bd3782d7f2..4e211c0cf94 100644 --- a/packages/vertexai/src/models/vertexai-model.ts +++ b/packages/vertexai/src/models/vertexai-model.ts @@ -29,7 +29,7 @@ import { _isFirebaseServerApp } from '@firebase/app'; export abstract class VertexAIModel { /** * The fully qualified model resource name to use for generating images - * (e.g. `publishers/google/models/imagen-3.0-generate-002`). + * (for example, `publishers/google/models/imagen-3.0-generate-002`). */ readonly model: string; diff --git a/packages/vertexai/src/requests/imagen-image-format.ts b/packages/vertexai/src/requests/imagen-image-format.ts index c3b6fd8e405..75661bdfb91 100644 --- a/packages/vertexai/src/requests/imagen-image-format.ts +++ b/packages/vertexai/src/requests/imagen-image-format.ts @@ -18,7 +18,7 @@ import { logger } from '../logger'; /** - * Defines the image format for images output by Imagen. + * Defines the image format for images generated by Imagen. * * Use this class to specify the desired format (JPEG or PNG) and compression quality * for images generated by Imagen. This is typically included as part of diff --git a/packages/vertexai/src/types/imagen/requests.ts b/packages/vertexai/src/types/imagen/requests.ts index 22eed9639f4..d02b0206caf 100644 --- a/packages/vertexai/src/types/imagen/requests.ts +++ b/packages/vertexai/src/types/imagen/requests.ts @@ -18,7 +18,7 @@ import { ImagenImageFormat } from '../../requests/imagen-image-format'; /** - * Parameters for configuring an {@link ImagenModel}. + * Parameters for configuring an {@link ImagenModel}. * * @beta */ @@ -29,7 +29,7 @@ export interface ImagenModelParams { * * Only Imagen 3 models (named `imagen-3.0-*`) are supported. * - * See {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/model-versioning | model versions} + * See {@link https://firebase.google.com/docs/vertex-ai/models | model versions} * for a full list of supported Imagen 3 models. */ model: string; @@ -46,7 +46,8 @@ export interface ImagenModelParams { /** * Configuration options for generating images with Imagen. * - * See the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images | Cloud documentation} for more details. + * See the {@link http://firebase.google.com/docs/vertex-ai/generate-images | documentation} for + * more details. * * @beta */ @@ -159,7 +160,7 @@ export enum ImagenPersonFilterLevel { /** * Settings for controlling the aggressiveness of filtering out sensitive content. * - * See the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#config-safety-filters | https://www.newyorker.com/magazine/2018/12/10/the-friendship-that-made-google-huge} + * See the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#config-safety-filters | Cloud documentation } * for more details. * * @beta diff --git a/packages/vertexai/src/types/imagen/responses.ts b/packages/vertexai/src/types/imagen/responses.ts index a611eed813e..5b973bdbe30 100644 --- a/packages/vertexai/src/types/imagen/responses.ts +++ b/packages/vertexai/src/types/imagen/responses.ts @@ -36,7 +36,7 @@ export interface ImagenInlineImage { /** * An image generated by Imagen, stored in Cloud Storage (GCS) for Firebase. * - * @beta + * This feature is not available yet. */ export interface ImagenGCSImage { /** @@ -46,7 +46,7 @@ export interface ImagenGCSImage { */ mimeType: string; /** - * The URI of the file in Cloud Storage (GCS) for Firestore. + * The URI of the file stored in a Cloud Storage (GCS) for Firestore bucket. * * @example `"gs://bucket-name/path/sample_0.jpg"`. */ From 431ea661a0f579a820b199482784c9dea746b8fa Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Wed, 12 Feb 2025 14:57:02 -0500 Subject: [PATCH 09/14] format --- packages/vertexai/src/types/imagen/requests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vertexai/src/types/imagen/requests.ts b/packages/vertexai/src/types/imagen/requests.ts index d02b0206caf..59ef340c17a 100644 --- a/packages/vertexai/src/types/imagen/requests.ts +++ b/packages/vertexai/src/types/imagen/requests.ts @@ -46,7 +46,7 @@ export interface ImagenModelParams { /** * Configuration options for generating images with Imagen. * - * See the {@link http://firebase.google.com/docs/vertex-ai/generate-images | documentation} for + * See the {@link http://firebase.google.com/docs/vertex-ai/generate-images | documentation} for * more details. * * @beta From ade589d4a2edb5cc3d9c40ea6d337dcef23a1b2d Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Thu, 13 Feb 2025 13:49:43 -0500 Subject: [PATCH 10/14] Replace (BETA) with (Public Preview) in docs --- .../vertexai.imagengenerationconfig.md | 10 ++-- .../vertexai.imagengenerationresponse.md | 4 +- docs-devsite/vertexai.imagenimageformat.md | 8 ++-- docs-devsite/vertexai.imageninlineimage.md | 4 +- docs-devsite/vertexai.imagenmodel.md | 10 ++-- docs-devsite/vertexai.imagenmodelparams.md | 6 +-- docs-devsite/vertexai.imagensafetysettings.md | 4 +- docs-devsite/vertexai.md | 46 +++++++++---------- 8 files changed, 46 insertions(+), 46 deletions(-) diff --git a/docs-devsite/vertexai.imagengenerationconfig.md b/docs-devsite/vertexai.imagengenerationconfig.md index 600524caae1..024fdf051e5 100644 --- a/docs-devsite/vertexai.imagengenerationconfig.md +++ b/docs-devsite/vertexai.imagengenerationconfig.md @@ -27,11 +27,11 @@ export interface ImagenGenerationConfig | Property | Type | Description | | --- | --- | --- | -| [addWatermark](./vertexai.imagengenerationconfig.md#imagengenerationconfigaddwatermark) | boolean | (BETA) Whether to add an invisible watermark to generated images.If set to true, an invisible SynthID watermark is embedded in generated images to indicate that they are AI generated. If set to false, watermarking will be disabled.The default value depends on the Imagen model; see the [addWatermark](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation for more details. | -| [aspectRatio](./vertexai.imagengenerationconfig.md#imagengenerationconfigaspectratio) | [ImagenAspectRatio](./vertexai.md#imagenaspectratio) | (BETA) The aspect ratio of the generated images. The default value is square 1:1. Supported aspect ratios depend on the Imagen model, see [ImagenAspectRatio](./vertexai.md#imagenaspectratio) for more details. | -| [imageFormat](./vertexai.imagengenerationconfig.md#imagengenerationconfigimageformat) | [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) | (BETA) The image format of the generated images. The default is PNG.See [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for more details. | -| [negativePrompt](./vertexai.imagengenerationconfig.md#imagengenerationconfignegativeprompt) | string | (BETA) A description of what should be omitted from the generated images.Support for negative prompts depends on the Imagen model.See the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images#negative-prompt) for more details. | -| [numberOfImages](./vertexai.imagengenerationconfig.md#imagengenerationconfignumberofimages) | number | (BETA) The number of images to generate. The default value is 1.The number of sample images that may be generated in each request depends on the model (typically up to 4); see the [sampleCount](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation for more details. | +| [addWatermark](./vertexai.imagengenerationconfig.md#imagengenerationconfigaddwatermark) | boolean | (Public Preview) Whether to add an invisible watermark to generated images.If set to true, an invisible SynthID watermark is embedded in generated images to indicate that they are AI generated. If set to false, watermarking will be disabled.The default value depends on the Imagen model; see the [addWatermark](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation for more details. | +| [aspectRatio](./vertexai.imagengenerationconfig.md#imagengenerationconfigaspectratio) | [ImagenAspectRatio](./vertexai.md#imagenaspectratio) | (Public Preview) The aspect ratio of the generated images. The default value is square 1:1. Supported aspect ratios depend on the Imagen model, see [ImagenAspectRatio](./vertexai.md#imagenaspectratio) for more details. | +| [imageFormat](./vertexai.imagengenerationconfig.md#imagengenerationconfigimageformat) | [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) | (Public Preview) The image format of the generated images. The default is PNG.See [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for more details. | +| [negativePrompt](./vertexai.imagengenerationconfig.md#imagengenerationconfignegativeprompt) | string | (Public Preview) A description of what should be omitted from the generated images.Support for negative prompts depends on the Imagen model.See the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images#negative-prompt) for more details. | +| [numberOfImages](./vertexai.imagengenerationconfig.md#imagengenerationconfignumberofimages) | number | (Public Preview) The number of images to generate. The default value is 1.The number of sample images that may be generated in each request depends on the model (typically up to 4); see the [sampleCount](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation for more details. | ## ImagenGenerationConfig.addWatermark diff --git a/docs-devsite/vertexai.imagengenerationresponse.md b/docs-devsite/vertexai.imagengenerationresponse.md index 50f1ccd2e0d..32ed69718f9 100644 --- a/docs-devsite/vertexai.imagengenerationresponse.md +++ b/docs-devsite/vertexai.imagengenerationresponse.md @@ -25,8 +25,8 @@ export interface ImagenGenerationResponse(BETA) The reason that images were filtered out. This property will only be defined if one or more images were filtered.Images may be filtered out due to the [ImagenSafetyFilterLevel](./vertexai.md#imagensafetyfilterlevel), [ImagenPersonFilterLevel](./vertexai.md#imagenpersonfilterlevel), or filtering included in the model. The filter levels may be adjusted in your [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface).See the [Responsible AI and usage guidelines for Imagen](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen) for more details. | -| [images](./vertexai.imagengenerationresponse.md#imagengenerationresponseimages) | T\[\] | (BETA) The images generated by Imagen.The number of images generated may be fewer than the number requested if one or more were filtered out; see filteredReason. | +| [filteredReason](./vertexai.imagengenerationresponse.md#imagengenerationresponsefilteredreason) | string | (Public Preview) The reason that images were filtered out. This property will only be defined if one or more images were filtered.Images may be filtered out due to the [ImagenSafetyFilterLevel](./vertexai.md#imagensafetyfilterlevel), [ImagenPersonFilterLevel](./vertexai.md#imagenpersonfilterlevel), or filtering included in the model. The filter levels may be adjusted in your [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface).See the [Responsible AI and usage guidelines for Imagen](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen) for more details. | +| [images](./vertexai.imagengenerationresponse.md#imagengenerationresponseimages) | T\[\] | (Public Preview) The images generated by Imagen.The number of images generated may be fewer than the number requested if one or more were filtered out; see filteredReason. | ## ImagenGenerationResponse.filteredReason diff --git a/docs-devsite/vertexai.imagenimageformat.md b/docs-devsite/vertexai.imagenimageformat.md index 6c08e8d204d..c77cb424a8e 100644 --- a/docs-devsite/vertexai.imagenimageformat.md +++ b/docs-devsite/vertexai.imagenimageformat.md @@ -27,15 +27,15 @@ export declare class ImagenImageFormat | Property | Modifiers | Type | Description | | --- | --- | --- | --- | -| [compressionQuality](./vertexai.imagenimageformat.md#imagenimageformatcompressionquality) | | number | (BETA) The level of compression (a number between 0 and 100). | -| [mimeType](./vertexai.imagenimageformat.md#imagenimageformatmimetype) | | string | (BETA) The MIME type. | +| [compressionQuality](./vertexai.imagenimageformat.md#imagenimageformatcompressionquality) | | number | (Public Preview) The level of compression (a number between 0 and 100). | +| [mimeType](./vertexai.imagenimageformat.md#imagenimageformatmimetype) | | string | (Public Preview) The MIME type. | ## Methods | Method | Modifiers | Description | | --- | --- | --- | -| [jpeg(compressionQuality)](./vertexai.imagenimageformat.md#imagenimageformatjpeg) | static | (BETA) Creates an [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for a JPEG image.For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. | -| [png()](./vertexai.imagenimageformat.md#imagenimageformatpng) | static | (BETA) Creates an [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for a PNG image.For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. | +| [jpeg(compressionQuality)](./vertexai.imagenimageformat.md#imagenimageformatjpeg) | static | (Public Preview) Creates an [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for a JPEG image.For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. | +| [png()](./vertexai.imagenimageformat.md#imagenimageformatpng) | static | (Public Preview) Creates an [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for a PNG image.For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. | ## ImagenImageFormat.compressionQuality diff --git a/docs-devsite/vertexai.imageninlineimage.md b/docs-devsite/vertexai.imageninlineimage.md index aac325a4d00..19fe8a67764 100644 --- a/docs-devsite/vertexai.imageninlineimage.md +++ b/docs-devsite/vertexai.imageninlineimage.md @@ -25,8 +25,8 @@ export interface ImagenInlineImage | Property | Type | Description | | --- | --- | --- | -| [bytesBase64Encoded](./vertexai.imageninlineimage.md#imageninlineimagebytesbase64encoded) | string | (BETA) The base64-encoded image data. | -| [mimeType](./vertexai.imageninlineimage.md#imageninlineimagemimetype) | string | (BETA) The MIME type of the image; either "image/png" or "image/jpeg".To request a different format, set the imageFormat property in your [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface). | +| [bytesBase64Encoded](./vertexai.imageninlineimage.md#imageninlineimagebytesbase64encoded) | string | (Public Preview) The base64-encoded image data. | +| [mimeType](./vertexai.imageninlineimage.md#imageninlineimagemimetype) | string | (Public Preview) The MIME type of the image; either "image/png" or "image/jpeg".To request a different format, set the imageFormat property in your [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface). | ## ImagenInlineImage.bytesBase64Encoded diff --git a/docs-devsite/vertexai.imagenmodel.md b/docs-devsite/vertexai.imagenmodel.md index 9136c98aa37..3ad6d336eb8 100644 --- a/docs-devsite/vertexai.imagenmodel.md +++ b/docs-devsite/vertexai.imagenmodel.md @@ -28,21 +28,21 @@ export declare class ImagenModel extends VertexAIModel | Constructor | Modifiers | Description | | --- | --- | --- | -| [(constructor)(vertexAI, modelParams, requestOptions)](./vertexai.imagenmodel.md#imagenmodelconstructor) | | (BETA) Constructs a new instance of the [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) class. | +| [(constructor)(vertexAI, modelParams, requestOptions)](./vertexai.imagenmodel.md#imagenmodelconstructor) | | (Public Preview) Constructs a new instance of the [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) class. | ## Properties | Property | Modifiers | Type | Description | | --- | --- | --- | --- | -| [generationConfig](./vertexai.imagenmodel.md#imagenmodelgenerationconfig) | | [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface) | (BETA) The Imagen generation configuration. | -| [requestOptions](./vertexai.imagenmodel.md#imagenmodelrequestoptions) | | [RequestOptions](./vertexai.requestoptions.md#requestoptions_interface) \| undefined | (BETA) | -| [safetySettings](./vertexai.imagenmodel.md#imagenmodelsafetysettings) | | [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface) | (BETA) Safety settings for filtering inappropriate content. | +| [generationConfig](./vertexai.imagenmodel.md#imagenmodelgenerationconfig) | | [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface) | (Public Preview) The Imagen generation configuration. | +| [requestOptions](./vertexai.imagenmodel.md#imagenmodelrequestoptions) | | [RequestOptions](./vertexai.requestoptions.md#requestoptions_interface) \| undefined | (Public Preview) | +| [safetySettings](./vertexai.imagenmodel.md#imagenmodelsafetysettings) | | [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface) | (Public Preview) Safety settings for filtering inappropriate content. | ## Methods | Method | Modifiers | Description | | --- | --- | --- | -| [generateImages(prompt)](./vertexai.imagenmodel.md#imagenmodelgenerateimages) | | (BETA) Generates images using the Imagen model and returns them as base64-encoded strings.For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. | +| [generateImages(prompt)](./vertexai.imagenmodel.md#imagenmodelgenerateimages) | | (Public Preview) Generates images using the Imagen model and returns them as base64-encoded strings.For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. | ## ImagenModel.(constructor) diff --git a/docs-devsite/vertexai.imagenmodelparams.md b/docs-devsite/vertexai.imagenmodelparams.md index 55f08b0d45c..66c4bb0bfe6 100644 --- a/docs-devsite/vertexai.imagenmodelparams.md +++ b/docs-devsite/vertexai.imagenmodelparams.md @@ -25,9 +25,9 @@ export interface ImagenModelParams | Property | Type | Description | | --- | --- | --- | -| [generationConfig](./vertexai.imagenmodelparams.md#imagenmodelparamsgenerationconfig) | [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface) | (BETA) Configuration options for generating images with Imagen. | -| [model](./vertexai.imagenmodelparams.md#imagenmodelparamsmodel) | string | (BETA) The Imagen model to use for generating images. For example: imagen-3.0-generate-002.Only Imagen 3 models (named imagen-3.0-*) are supported.See [model versions](https://firebase.google.com/docs/vertex-ai/models) for a full list of supported Imagen 3 models. | -| [safetySettings](./vertexai.imagenmodelparams.md#imagenmodelparamssafetysettings) | [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface) | (BETA) Safety settings for filtering potentially inappropriate content. | +| [generationConfig](./vertexai.imagenmodelparams.md#imagenmodelparamsgenerationconfig) | [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface) | (Public Preview) Configuration options for generating images with Imagen. | +| [model](./vertexai.imagenmodelparams.md#imagenmodelparamsmodel) | string | (Public Preview) The Imagen model to use for generating images. For example: imagen-3.0-generate-002.Only Imagen 3 models (named imagen-3.0-*) are supported.See [model versions](https://firebase.google.com/docs/vertex-ai/models) for a full list of supported Imagen 3 models. | +| [safetySettings](./vertexai.imagenmodelparams.md#imagenmodelparamssafetysettings) | [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface) | (Public Preview) Safety settings for filtering potentially inappropriate content. | ## ImagenModelParams.generationConfig diff --git a/docs-devsite/vertexai.imagensafetysettings.md b/docs-devsite/vertexai.imagensafetysettings.md index a7abbd86187..1d7c01bd273 100644 --- a/docs-devsite/vertexai.imagensafetysettings.md +++ b/docs-devsite/vertexai.imagensafetysettings.md @@ -27,8 +27,8 @@ export interface ImagenSafetySettings | Property | Type | Description | | --- | --- | --- | -| [personFilterLevel](./vertexai.imagensafetysettings.md#imagensafetysettingspersonfilterlevel) | [ImagenPersonFilterLevel](./vertexai.md#imagenpersonfilterlevel) | (BETA) A filter level controlling whether generation of images containing people or faces is allowed. | -| [safetyFilterLevel](./vertexai.imagensafetysettings.md#imagensafetysettingssafetyfilterlevel) | [ImagenSafetyFilterLevel](./vertexai.md#imagensafetyfilterlevel) | (BETA) A filter level controlling how aggressive to filter out sensitive content from generated images. | +| [personFilterLevel](./vertexai.imagensafetysettings.md#imagensafetysettingspersonfilterlevel) | [ImagenPersonFilterLevel](./vertexai.md#imagenpersonfilterlevel) | (Public Preview) A filter level controlling whether generation of images containing people or faces is allowed. | +| [safetyFilterLevel](./vertexai.imagensafetysettings.md#imagensafetysettingssafetyfilterlevel) | [ImagenSafetyFilterLevel](./vertexai.md#imagensafetyfilterlevel) | (Public Preview) A filter level controlling how aggressive to filter out sensitive content from generated images. | ## ImagenSafetySettings.personFilterLevel diff --git a/docs-devsite/vertexai.md b/docs-devsite/vertexai.md index f7e2a97088a..2d4476b1a02 100644 --- a/docs-devsite/vertexai.md +++ b/docs-devsite/vertexai.md @@ -20,7 +20,7 @@ The Vertex AI in Firebase Web SDK. | [getVertexAI(app, options)](./vertexai.md#getvertexai_04094cf) | Returns a [VertexAI](./vertexai.vertexai.md#vertexai_interface) instance for the given app. | | function(vertexAI, ...) | | [getGenerativeModel(vertexAI, modelParams, requestOptions)](./vertexai.md#getgenerativemodel_e3037c9) | Returns a [GenerativeModel](./vertexai.generativemodel.md#generativemodel_class) class with methods for inference and other functionality. | -| [getImagenModel(vertexAI, modelParams, requestOptions)](./vertexai.md#getimagenmodel_812c375) | (BETA) Returns an [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) class with methods for using Imagen.Only Imagen 3 models (named imagen-3.0-*) are supported.For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. | +| [getImagenModel(vertexAI, modelParams, requestOptions)](./vertexai.md#getimagenmodel_812c375) | (Public Preview) Returns an [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) class with methods for using Imagen.Only Imagen 3 models (named imagen-3.0-*) are supported.For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. | ## Classes @@ -30,8 +30,8 @@ The Vertex AI in Firebase Web SDK. | [BooleanSchema](./vertexai.booleanschema.md#booleanschema_class) | Schema class for "boolean" types. | | [ChatSession](./vertexai.chatsession.md#chatsession_class) | ChatSession class that enables sending chat messages and stores history of sent and received messages so far. | | [GenerativeModel](./vertexai.generativemodel.md#generativemodel_class) | Class for generative model APIs. | -| [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) | (BETA) Defines the image format for images generated by Imagen.Use this class to specify the desired format (JPEG or PNG) and compression quality for images generated by Imagen. This is typically included as part of [ImagenModelParams](./vertexai.imagenmodelparams.md#imagenmodelparams_interface). | -| [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) | (BETA) Class for Imagen model APIs.This class provides methods for generating images using the Imagen model. | +| [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) | (Public Preview) Defines the image format for images generated by Imagen.Use this class to specify the desired format (JPEG or PNG) and compression quality for images generated by Imagen. This is typically included as part of [ImagenModelParams](./vertexai.imagenmodelparams.md#imagenmodelparams_interface). | +| [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) | (Public Preview) Class for Imagen model APIs.This class provides methods for generating images using the Imagen model. | | [IntegerSchema](./vertexai.integerschema.md#integerschema_class) | Schema class for "integer" types. | | [NumberSchema](./vertexai.numberschema.md#numberschema_class) | Schema class for "number" types. | | [ObjectSchema](./vertexai.objectschema.md#objectschema_class) | Schema class for "object" types. The properties param must be a map of Schema objects. | @@ -52,9 +52,9 @@ The Vertex AI in Firebase Web SDK. | [HarmCategory](./vertexai.md#harmcategory) | Harm categories that would cause prompts or candidates to be blocked. | | [HarmProbability](./vertexai.md#harmprobability) | Probability that a prompt or candidate matches a harm category. | | [HarmSeverity](./vertexai.md#harmseverity) | Harm severity levels. | -| [ImagenAspectRatio](./vertexai.md#imagenaspectratio) | (BETA) Aspect ratios for Imagen images.To specify an aspect ratio for generated images, set the aspectRatio property in your [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface).See the the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images#aspect-ratio) for more details and examples of the supported aspect ratios. | -| [ImagenPersonFilterLevel](./vertexai.md#imagenpersonfilterlevel) | (BETA) A filter level controlling whether generation of images containing people or faces is allowed.See the [\`personGeneration\`](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation for more details. | -| [ImagenSafetyFilterLevel](./vertexai.md#imagensafetyfilterlevel) | (BETA) A filter level controlling how aggressively to filter sensitive content.Text prompts provided as inputs and images (generated or uploaded) through Imagen on Vertex AI are assessed against a list of safety filters, which include 'harmful categories' (for example, violence, sexual, derogatory, and toxic). This filter level controls how aggressively to filter out potentially harmful content from responses. See the [\`safetySetting\`](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation and the [Responsible AI and usage guidelines](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-filters) for more details. | +| [ImagenAspectRatio](./vertexai.md#imagenaspectratio) | (Public Preview) Aspect ratios for Imagen images.To specify an aspect ratio for generated images, set the aspectRatio property in your [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface).See the the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images#aspect-ratio) for more details and examples of the supported aspect ratios. | +| [ImagenPersonFilterLevel](./vertexai.md#imagenpersonfilterlevel) | (Public Preview) A filter level controlling whether generation of images containing people or faces is allowed.See the [\`personGeneration\`](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation for more details. | +| [ImagenSafetyFilterLevel](./vertexai.md#imagensafetyfilterlevel) | (Public Preview) A filter level controlling how aggressively to filter sensitive content.Text prompts provided as inputs and images (generated or uploaded) through Imagen on Vertex AI are assessed against a list of safety filters, which include 'harmful categories' (for example, violence, sexual, derogatory, and toxic). This filter level controls how aggressively to filter out potentially harmful content from responses. See the [\`safetySetting\`](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation and the [Responsible AI and usage guidelines](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-filters) for more details. | | [SchemaType](./vertexai.md#schematype) | Contains the list of OpenAPI data types as defined by the [OpenAPI specification](https://swagger.io/docs/specification/data-models/data-types/) | | [VertexAIErrorCode](./vertexai.md#vertexaierrorcode) | Standardized error codes that [VertexAIError](./vertexai.vertexaierror.md#vertexaierror_class) can have. | @@ -91,11 +91,11 @@ The Vertex AI in Firebase Web SDK. | [GroundingAttribution](./vertexai.groundingattribution.md#groundingattribution_interface) | | | [GroundingMetadata](./vertexai.groundingmetadata.md#groundingmetadata_interface) | Metadata returned to client when grounding is enabled. | | [ImagenGCSImage](./vertexai.imagengcsimage.md#imagengcsimage_interface) | An image generated by Imagen, stored in Cloud Storage (GCS) for Firebase.This feature is not available yet. | -| [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface) | (BETA) Configuration options for generating images with Imagen.See the [documentation](http://firebase.google.com/docs/vertex-ai/generate-images) for more details. | -| [ImagenGenerationResponse](./vertexai.imagengenerationresponse.md#imagengenerationresponse_interface) | (BETA) The response from a request to generate images with Imagen. | -| [ImagenInlineImage](./vertexai.imageninlineimage.md#imageninlineimage_interface) | (BETA) An image generated by Imagen, represented as inline data. | -| [ImagenModelParams](./vertexai.imagenmodelparams.md#imagenmodelparams_interface) | (BETA) Parameters for configuring an [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class). | -| [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface) | (BETA) Settings for controlling the aggressiveness of filtering out sensitive content.See the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#config-safety-filters) for more details. | +| [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface) | (Public Preview) Configuration options for generating images with Imagen.See the [documentation](http://firebase.google.com/docs/vertex-ai/generate-images) for more details. | +| [ImagenGenerationResponse](./vertexai.imagengenerationresponse.md#imagengenerationresponse_interface) | (Public Preview) The response from a request to generate images with Imagen. | +| [ImagenInlineImage](./vertexai.imageninlineimage.md#imageninlineimage_interface) | (Public Preview) An image generated by Imagen, represented as inline data. | +| [ImagenModelParams](./vertexai.imagenmodelparams.md#imagenmodelparams_interface) | (Public Preview) Parameters for configuring an [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class). | +| [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface) | (Public Preview) Settings for controlling the aggressiveness of filtering out sensitive content.See the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#config-safety-filters) for more details. | | [InlineDataPart](./vertexai.inlinedatapart.md#inlinedatapart_interface) | Content part interface if the part represents an image. | | [ModelParams](./vertexai.modelparams.md#modelparams_interface) | Params passed to [getGenerativeModel()](./vertexai.md#getgenerativemodel_e3037c9). | | [ObjectSchemaInterface](./vertexai.objectschemainterface.md#objectschemainterface_interface) | Interface for [ObjectSchema](./vertexai.objectschema.md#objectschema_class) class. | @@ -430,11 +430,11 @@ export declare enum ImagenAspectRatio | Member | Value | Description | | --- | --- | --- | -| LANDSCAPE\_16x9 | "16:9" | (BETA) Landscape (16:9) aspect ratio. | -| LANDSCAPE\_3x4 | "3:4" | (BETA) Landscape (3:4) aspect ratio. | -| PORTRAIT\_4x3 | "4:3" | (BETA) Portrait (4:3) aspect ratio. | -| PORTRAIT\_9x16 | "9:16" | (BETA) Portrait (9:16) aspect ratio. | -| SQUARE | "1:1" | (BETA) Square (1:1) aspect ratio. | +| LANDSCAPE\_16x9 | "16:9" | (Public Preview) Landscape (16:9) aspect ratio. | +| LANDSCAPE\_3x4 | "3:4" | (Public Preview) Landscape (3:4) aspect ratio. | +| PORTRAIT\_4x3 | "4:3" | (Public Preview) Portrait (4:3) aspect ratio. | +| PORTRAIT\_9x16 | "9:16" | (Public Preview) Portrait (9:16) aspect ratio. | +| SQUARE | "1:1" | (Public Preview) Square (1:1) aspect ratio. | ## ImagenPersonFilterLevel @@ -455,9 +455,9 @@ export declare enum ImagenPersonFilterLevel | Member | Value | Description | | --- | --- | --- | -| ALLOW\_ADULT | "allow_adult" | (BETA) Allow generation of images containing adults only; images of children are filtered out.Generation of images containing people or faces may require your use case to be reviewed and approved by Cloud support; see the [Responsible AI and usage guidelines](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#person-face-gen) for more details. | -| ALLOW\_ALL | "allow_all" | (BETA) Allow generation of images containing adults only; images of children are filtered out.Generation of images containing people or faces may require your use case to be reviewed and approved by Cloud support; see the [Responsible AI and usage guidelines](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#person-face-gen) for more details. | -| BLOCK\_ALL | "dont_allow" | (BETA) Disallow generation of images containing people or faces; images of people are filtered out. | +| ALLOW\_ADULT | "allow_adult" | (Public Preview) Allow generation of images containing adults only; images of children are filtered out.Generation of images containing people or faces may require your use case to be reviewed and approved by Cloud support; see the [Responsible AI and usage guidelines](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#person-face-gen) for more details. | +| ALLOW\_ALL | "allow_all" | (Public Preview) Allow generation of images containing adults only; images of children are filtered out.Generation of images containing people or faces may require your use case to be reviewed and approved by Cloud support; see the [Responsible AI and usage guidelines](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#person-face-gen) for more details. | +| BLOCK\_ALL | "dont_allow" | (Public Preview) Disallow generation of images containing people or faces; images of people are filtered out. | ## ImagenSafetyFilterLevel @@ -478,10 +478,10 @@ export declare enum ImagenSafetyFilterLevel | Member | Value | Description | | --- | --- | --- | -| BLOCK\_LOW\_AND\_ABOVE | "block_low_and_above" | (BETA) The most aggressive filtering level; most strict blocking. | -| BLOCK\_MEDIUM\_AND\_ABOVE | "block_medium_and_above" | (BETA) Blocks some sensitive prompts and responses. | -| BLOCK\_NONE | "block_none" | (BETA) The least aggressive filtering level; blocks very few sensitive prompts and responses.Access to this feature is restricted and may require your case to be reviewed and approved by Cloud support. | -| BLOCK\_ONLY\_HIGH | "block_only_high" | (BETA) Blocks few sensitive prompts and responses. | +| BLOCK\_LOW\_AND\_ABOVE | "block_low_and_above" | (Public Preview) The most aggressive filtering level; most strict blocking. | +| BLOCK\_MEDIUM\_AND\_ABOVE | "block_medium_and_above" | (Public Preview) Blocks some sensitive prompts and responses. | +| BLOCK\_NONE | "block_none" | (Public Preview) The least aggressive filtering level; blocks very few sensitive prompts and responses.Access to this feature is restricted and may require your case to be reviewed and approved by Cloud support. | +| BLOCK\_ONLY\_HIGH | "block_only_high" | (Public Preview) Blocks few sensitive prompts and responses. | ## SchemaType From 718c7e2cc6049da09fa0d4c41e8cd510efd389ff Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Thu, 13 Feb 2025 14:40:49 -0500 Subject: [PATCH 11/14] fix links --- docs-devsite/vertexai.imagengenerationconfig.md | 8 ++++---- packages/vertexai/src/types/imagen/requests.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs-devsite/vertexai.imagengenerationconfig.md b/docs-devsite/vertexai.imagengenerationconfig.md index 024fdf051e5..1b91a1c9128 100644 --- a/docs-devsite/vertexai.imagengenerationconfig.md +++ b/docs-devsite/vertexai.imagengenerationconfig.md @@ -27,11 +27,11 @@ export interface ImagenGenerationConfig | Property | Type | Description | | --- | --- | --- | -| [addWatermark](./vertexai.imagengenerationconfig.md#imagengenerationconfigaddwatermark) | boolean | (Public Preview) Whether to add an invisible watermark to generated images.If set to true, an invisible SynthID watermark is embedded in generated images to indicate that they are AI generated. If set to false, watermarking will be disabled.The default value depends on the Imagen model; see the [addWatermark](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation for more details. | +| [addWatermark](./vertexai.imagengenerationconfig.md#imagengenerationconfigaddwatermark) | boolean | (Public Preview) Whether to add an invisible watermark to generated images.If set to true, an invisible SynthID watermark is embedded in generated images to indicate that they are AI generated. If set to false, watermarking will be disabled.The default value depends on the Imagen model; see the addWatermark documentation for more details. | | [aspectRatio](./vertexai.imagengenerationconfig.md#imagengenerationconfigaspectratio) | [ImagenAspectRatio](./vertexai.md#imagenaspectratio) | (Public Preview) The aspect ratio of the generated images. The default value is square 1:1. Supported aspect ratios depend on the Imagen model, see [ImagenAspectRatio](./vertexai.md#imagenaspectratio) for more details. | | [imageFormat](./vertexai.imagengenerationconfig.md#imagengenerationconfigimageformat) | [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) | (Public Preview) The image format of the generated images. The default is PNG.See [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for more details. | | [negativePrompt](./vertexai.imagengenerationconfig.md#imagengenerationconfignegativeprompt) | string | (Public Preview) A description of what should be omitted from the generated images.Support for negative prompts depends on the Imagen model.See the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images#negative-prompt) for more details. | -| [numberOfImages](./vertexai.imagengenerationconfig.md#imagengenerationconfignumberofimages) | number | (Public Preview) The number of images to generate. The default value is 1.The number of sample images that may be generated in each request depends on the model (typically up to 4); see the [sampleCount](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation for more details. | +| [numberOfImages](./vertexai.imagengenerationconfig.md#imagengenerationconfignumberofimages) | number | (Public Preview) The number of images to generate. The default value is 1.The number of sample images that may be generated in each request depends on the model (typically up to 4); see the sampleCount documentation for more details. | ## ImagenGenerationConfig.addWatermark @@ -42,7 +42,7 @@ Whether to add an invisible watermark to generated images. If set to `true`, an invisible SynthID watermark is embedded in generated images to indicate that they are AI generated. If set to `false`, watermarking will be disabled. -The default value depends on the Imagen model; see the [addWatermark](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation for more details. +The default value depends on the Imagen model; see the addWatermark documentation for more details. Signature: @@ -102,7 +102,7 @@ negativePrompt?: string; The number of images to generate. The default value is 1. -The number of sample images that may be generated in each request depends on the model (typically up to 4); see the [sampleCount](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation for more details. +The number of sample images that may be generated in each request depends on the model (typically up to 4); see the sampleCount documentation for more details. Signature: diff --git a/packages/vertexai/src/types/imagen/requests.ts b/packages/vertexai/src/types/imagen/requests.ts index 59ef340c17a..c2e7658b0c8 100644 --- a/packages/vertexai/src/types/imagen/requests.ts +++ b/packages/vertexai/src/types/imagen/requests.ts @@ -64,7 +64,7 @@ export interface ImagenGenerationConfig { * The number of images to generate. The default value is 1. * * The number of sample images that may be generated in each request depends on the model - * (typically up to 4); see the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list | sampleCount} + * (typically up to 4); see the sampleCount * documentation for more details. */ numberOfImages?: number; @@ -86,7 +86,7 @@ export interface ImagenGenerationConfig { * If set to `true`, an invisible SynthID watermark is embedded in generated images to indicate * that they are AI generated. If set to `false`, watermarking will be disabled. * - * The default value depends on the Imagen model; see the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list | addWatermark } + * The default value depends on the Imagen model; see the addWatermark * documentation for more details. */ addWatermark?: boolean; From e05b8d3b67c125953875c14936a32302b25fe82f Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Fri, 14 Feb 2025 11:11:52 -0500 Subject: [PATCH 12/14] another pass --- .../vertexai.imagengenerationconfig.md | 12 ++++++------ docs-devsite/vertexai.imagenimageformat.md | 8 ++------ docs-devsite/vertexai.imagenmodel.md | 4 +--- docs-devsite/vertexai.imagensafetysettings.md | 2 +- docs-devsite/vertexai.md | 18 ++++++++---------- packages/vertexai/src/api.ts | 7 ++----- packages/vertexai/src/models/imagen-model.ts | 9 +++------ .../src/requests/imagen-image-format.ts | 14 ++++---------- .../vertexai/src/requests/request-helpers.ts | 2 +- packages/vertexai/src/types/imagen/requests.ts | 16 ++++++++-------- 10 files changed, 36 insertions(+), 56 deletions(-) diff --git a/docs-devsite/vertexai.imagengenerationconfig.md b/docs-devsite/vertexai.imagengenerationconfig.md index 1b91a1c9128..aa3da59f71f 100644 --- a/docs-devsite/vertexai.imagengenerationconfig.md +++ b/docs-devsite/vertexai.imagengenerationconfig.md @@ -27,11 +27,11 @@ export interface ImagenGenerationConfig | Property | Type | Description | | --- | --- | --- | -| [addWatermark](./vertexai.imagengenerationconfig.md#imagengenerationconfigaddwatermark) | boolean | (Public Preview) Whether to add an invisible watermark to generated images.If set to true, an invisible SynthID watermark is embedded in generated images to indicate that they are AI generated. If set to false, watermarking will be disabled.The default value depends on the Imagen model; see the addWatermark documentation for more details. | +| [addWatermark](./vertexai.imagengenerationconfig.md#imagengenerationconfigaddwatermark) | boolean | (Public Preview) Whether to add an invisible watermark to generated images.If set to true, an invisible SynthID watermark is embedded in generated images to indicate that they are AI generated. If set to false, watermarking will be disabled.The default value depends on the Imagen model; see the addWatermark documentation for more details. | | [aspectRatio](./vertexai.imagengenerationconfig.md#imagengenerationconfigaspectratio) | [ImagenAspectRatio](./vertexai.md#imagenaspectratio) | (Public Preview) The aspect ratio of the generated images. The default value is square 1:1. Supported aspect ratios depend on the Imagen model, see [ImagenAspectRatio](./vertexai.md#imagenaspectratio) for more details. | | [imageFormat](./vertexai.imagengenerationconfig.md#imagengenerationconfigimageformat) | [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) | (Public Preview) The image format of the generated images. The default is PNG.See [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for more details. | -| [negativePrompt](./vertexai.imagengenerationconfig.md#imagengenerationconfignegativeprompt) | string | (Public Preview) A description of what should be omitted from the generated images.Support for negative prompts depends on the Imagen model.See the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images#negative-prompt) for more details. | -| [numberOfImages](./vertexai.imagengenerationconfig.md#imagengenerationconfignumberofimages) | number | (Public Preview) The number of images to generate. The default value is 1.The number of sample images that may be generated in each request depends on the model (typically up to 4); see the sampleCount documentation for more details. | +| [negativePrompt](./vertexai.imagengenerationconfig.md#imagengenerationconfignegativeprompt) | string | (Public Preview) A description of what should be omitted from the generated images.Support for negative prompts depends on the Imagen model.See the [documentation](http://firebase.google.com/docs/vertex-ai/generate-images) for more details. | +| [numberOfImages](./vertexai.imagengenerationconfig.md#imagengenerationconfignumberofimages) | number | (Public Preview) The number of images to generate. The default value is 1.The number of sample images that may be generated in each request depends on the model (typically up to 4); see the sampleCount documentation for more details. | ## ImagenGenerationConfig.addWatermark @@ -42,7 +42,7 @@ Whether to add an invisible watermark to generated images. If set to `true`, an invisible SynthID watermark is embedded in generated images to indicate that they are AI generated. If set to `false`, watermarking will be disabled. -The default value depends on the Imagen model; see the addWatermark documentation for more details. +The default value depends on the Imagen model; see the addWatermark documentation for more details. Signature: @@ -87,7 +87,7 @@ A description of what should be omitted from the generated images. Support for negative prompts depends on the Imagen model. -See the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images#negative-prompt) for more details. +See the [documentation](http://firebase.google.com/docs/vertex-ai/generate-images) for more details. Signature: @@ -102,7 +102,7 @@ negativePrompt?: string; The number of images to generate. The default value is 1. -The number of sample images that may be generated in each request depends on the model (typically up to 4); see the sampleCount documentation for more details. +The number of sample images that may be generated in each request depends on the model (typically up to 4); see the sampleCount documentation for more details. Signature: diff --git a/docs-devsite/vertexai.imagenimageformat.md b/docs-devsite/vertexai.imagenimageformat.md index c77cb424a8e..785c7c726fc 100644 --- a/docs-devsite/vertexai.imagenimageformat.md +++ b/docs-devsite/vertexai.imagenimageformat.md @@ -34,8 +34,8 @@ export declare class ImagenImageFormat | Method | Modifiers | Description | | --- | --- | --- | -| [jpeg(compressionQuality)](./vertexai.imagenimageformat.md#imagenimageformatjpeg) | static | (Public Preview) Creates an [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for a JPEG image.For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. | -| [png()](./vertexai.imagenimageformat.md#imagenimageformatpng) | static | (Public Preview) Creates an [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for a PNG image.For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. | +| [jpeg(compressionQuality)](./vertexai.imagenimageformat.md#imagenimageformatjpeg) | static | (Public Preview) Creates an [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for a JPEG image. | +| [png()](./vertexai.imagenimageformat.md#imagenimageformatpng) | static | (Public Preview) Creates an [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for a PNG image. | ## ImagenImageFormat.compressionQuality @@ -70,8 +70,6 @@ mimeType: string; Creates an [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for a JPEG image. -For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. - Signature: ```typescript @@ -97,8 +95,6 @@ An [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_c Creates an [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for a PNG image. -For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. - Signature: ```typescript diff --git a/docs-devsite/vertexai.imagenmodel.md b/docs-devsite/vertexai.imagenmodel.md index 3ad6d336eb8..63e15ff133a 100644 --- a/docs-devsite/vertexai.imagenmodel.md +++ b/docs-devsite/vertexai.imagenmodel.md @@ -42,7 +42,7 @@ export declare class ImagenModel extends VertexAIModel | Method | Modifiers | Description | | --- | --- | --- | -| [generateImages(prompt)](./vertexai.imagenmodel.md#imagenmodelgenerateimages) | | (Public Preview) Generates images using the Imagen model and returns them as base64-encoded strings.For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. | +| [generateImages(prompt)](./vertexai.imagenmodel.md#imagenmodelgenerateimages) | | (Public Preview) Generates images using the Imagen model and returns them as base64-encoded strings. | ## ImagenModel.(constructor) @@ -113,8 +113,6 @@ safetySettings?: ImagenSafetySettings; Generates images using the Imagen model and returns them as base64-encoded strings. -For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. - If the prompt was not blocked, but one or more of the generated images were filtered, the returned object will have a `filteredReason` property. If all images are filtered, the `images` array will be empty. Signature: diff --git a/docs-devsite/vertexai.imagensafetysettings.md b/docs-devsite/vertexai.imagensafetysettings.md index 1d7c01bd273..3cf7931a959 100644 --- a/docs-devsite/vertexai.imagensafetysettings.md +++ b/docs-devsite/vertexai.imagensafetysettings.md @@ -15,7 +15,7 @@ https://github.com/firebase/firebase-js-sdk Settings for controlling the aggressiveness of filtering out sensitive content. -See the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#config-safety-filters) for more details. +See the [documentation](http://firebase.google.com/docs/vertex-ai/generate-images) for more details. Signature: diff --git a/docs-devsite/vertexai.md b/docs-devsite/vertexai.md index 2d4476b1a02..01a6e9a97ed 100644 --- a/docs-devsite/vertexai.md +++ b/docs-devsite/vertexai.md @@ -20,7 +20,7 @@ The Vertex AI in Firebase Web SDK. | [getVertexAI(app, options)](./vertexai.md#getvertexai_04094cf) | Returns a [VertexAI](./vertexai.vertexai.md#vertexai_interface) instance for the given app. | | function(vertexAI, ...) | | [getGenerativeModel(vertexAI, modelParams, requestOptions)](./vertexai.md#getgenerativemodel_e3037c9) | Returns a [GenerativeModel](./vertexai.generativemodel.md#generativemodel_class) class with methods for inference and other functionality. | -| [getImagenModel(vertexAI, modelParams, requestOptions)](./vertexai.md#getimagenmodel_812c375) | (Public Preview) Returns an [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) class with methods for using Imagen.Only Imagen 3 models (named imagen-3.0-*) are supported.For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. | +| [getImagenModel(vertexAI, modelParams, requestOptions)](./vertexai.md#getimagenmodel_812c375) | (Public Preview) Returns an [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) class with methods for using Imagen.Only Imagen 3 models (named imagen-3.0-*) are supported. | ## Classes @@ -52,9 +52,9 @@ The Vertex AI in Firebase Web SDK. | [HarmCategory](./vertexai.md#harmcategory) | Harm categories that would cause prompts or candidates to be blocked. | | [HarmProbability](./vertexai.md#harmprobability) | Probability that a prompt or candidate matches a harm category. | | [HarmSeverity](./vertexai.md#harmseverity) | Harm severity levels. | -| [ImagenAspectRatio](./vertexai.md#imagenaspectratio) | (Public Preview) Aspect ratios for Imagen images.To specify an aspect ratio for generated images, set the aspectRatio property in your [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface).See the the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images#aspect-ratio) for more details and examples of the supported aspect ratios. | -| [ImagenPersonFilterLevel](./vertexai.md#imagenpersonfilterlevel) | (Public Preview) A filter level controlling whether generation of images containing people or faces is allowed.See the [\`personGeneration\`](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation for more details. | -| [ImagenSafetyFilterLevel](./vertexai.md#imagensafetyfilterlevel) | (Public Preview) A filter level controlling how aggressively to filter sensitive content.Text prompts provided as inputs and images (generated or uploaded) through Imagen on Vertex AI are assessed against a list of safety filters, which include 'harmful categories' (for example, violence, sexual, derogatory, and toxic). This filter level controls how aggressively to filter out potentially harmful content from responses. See the [\`safetySetting\`](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation and the [Responsible AI and usage guidelines](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-filters) for more details. | +| [ImagenAspectRatio](./vertexai.md#imagenaspectratio) | (Public Preview) Aspect ratios for Imagen images.To specify an aspect ratio for generated images, set the aspectRatio property in your [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface).See the the [documentation](http://firebase.google.com/docs/vertex-ai/generate-images) for more details and examples of the supported aspect ratios. | +| [ImagenPersonFilterLevel](./vertexai.md#imagenpersonfilterlevel) | (Public Preview) A filter level controlling whether generation of images containing people or faces is allowed.See the personGeneration documentation for more details. | +| [ImagenSafetyFilterLevel](./vertexai.md#imagensafetyfilterlevel) | (Public Preview) A filter level controlling how aggressively to filter sensitive content.Text prompts provided as inputs and images (generated or uploaded) through Imagen on Vertex AI are assessed against a list of safety filters, which include 'harmful categories' (for example, violence, sexual, derogatory, and toxic). This filter level controls how aggressively to filter out potentially harmful content from responses. See the [documentation](http://firebase.google.com/docs/vertex-ai/generate-images) and the [Responsible AI and usage guidelines](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-filters) for more details. | | [SchemaType](./vertexai.md#schematype) | Contains the list of OpenAPI data types as defined by the [OpenAPI specification](https://swagger.io/docs/specification/data-models/data-types/) | | [VertexAIErrorCode](./vertexai.md#vertexaierrorcode) | Standardized error codes that [VertexAIError](./vertexai.vertexaierror.md#vertexaierror_class) can have. | @@ -95,7 +95,7 @@ The Vertex AI in Firebase Web SDK. | [ImagenGenerationResponse](./vertexai.imagengenerationresponse.md#imagengenerationresponse_interface) | (Public Preview) The response from a request to generate images with Imagen. | | [ImagenInlineImage](./vertexai.imageninlineimage.md#imageninlineimage_interface) | (Public Preview) An image generated by Imagen, represented as inline data. | | [ImagenModelParams](./vertexai.imagenmodelparams.md#imagenmodelparams_interface) | (Public Preview) Parameters for configuring an [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class). | -| [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface) | (Public Preview) Settings for controlling the aggressiveness of filtering out sensitive content.See the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#config-safety-filters) for more details. | +| [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface) | (Public Preview) Settings for controlling the aggressiveness of filtering out sensitive content.See the [documentation](http://firebase.google.com/docs/vertex-ai/generate-images) for more details. | | [InlineDataPart](./vertexai.inlinedatapart.md#inlinedatapart_interface) | Content part interface if the part represents an image. | | [ModelParams](./vertexai.modelparams.md#modelparams_interface) | Params passed to [getGenerativeModel()](./vertexai.md#getgenerativemodel_e3037c9). | | [ObjectSchemaInterface](./vertexai.objectschemainterface.md#objectschemainterface_interface) | Interface for [ObjectSchema](./vertexai.objectschema.md#objectschema_class) class. | @@ -189,8 +189,6 @@ Returns an [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class)) are supported. -For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways. - Signature: ```typescript @@ -418,7 +416,7 @@ Aspect ratios for Imagen images. To specify an aspect ratio for generated images, set the `aspectRatio` property in your [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface). -See the the [Cloud documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images#aspect-ratio) for more details and examples of the supported aspect ratios. +See the the [documentation](http://firebase.google.com/docs/vertex-ai/generate-images) for more details and examples of the supported aspect ratios. Signature: @@ -443,7 +441,7 @@ export declare enum ImagenAspectRatio A filter level controlling whether generation of images containing people or faces is allowed. -See the [\`personGeneration\`](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation for more details. +See the personGeneration documentation for more details. Signature: @@ -466,7 +464,7 @@ export declare enum ImagenPersonFilterLevel A filter level controlling how aggressively to filter sensitive content. -Text prompts provided as inputs and images (generated or uploaded) through Imagen on Vertex AI are assessed against a list of safety filters, which include 'harmful categories' (for example, `violence`, `sexual`, `derogatory`, and `toxic`). This filter level controls how aggressively to filter out potentially harmful content from responses. See the [\`safetySetting\`](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list) documentation and the [Responsible AI and usage guidelines](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-filters) for more details. +Text prompts provided as inputs and images (generated or uploaded) through Imagen on Vertex AI are assessed against a list of safety filters, which include 'harmful categories' (for example, `violence`, `sexual`, `derogatory`, and `toxic`). This filter level controls how aggressively to filter out potentially harmful content from responses. See the [documentation](http://firebase.google.com/docs/vertex-ai/generate-images) and the [Responsible AI and usage guidelines](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-filters) for more details. Signature: diff --git a/packages/vertexai/src/api.ts b/packages/vertexai/src/api.ts index 7fa7fd7f5ea..dbf617eb4c3 100644 --- a/packages/vertexai/src/api.ts +++ b/packages/vertexai/src/api.ts @@ -87,17 +87,14 @@ export function getGenerativeModel( * * Only Imagen 3 models (named `imagen-3.0-*`) are supported. * - * @beta - * For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which - * means that the feature is not subject to any SLA or deprecation policy and could change in - * backwards-incompatible ways. - * * @param vertexAI - An instance of the Vertex AI in Firebase SDK. * @param modelParams - Parameters to use when making Imagen requests. * @param requestOptions - Additional options to use when making requests. * * @throws If the `apiKey` or `projectId` fields are missing in your * Firebase config. + * + * @beta */ export function getImagenModel( vertexAI: VertexAI, diff --git a/packages/vertexai/src/models/imagen-model.ts b/packages/vertexai/src/models/imagen-model.ts index eb5fc54b1b3..c218171cf69 100644 --- a/packages/vertexai/src/models/imagen-model.ts +++ b/packages/vertexai/src/models/imagen-model.ts @@ -87,11 +87,6 @@ export class ImagenModel extends VertexAIModel { * Generates images using the Imagen model and returns them as * base64-encoded strings. * - * @beta - * For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which - * means that the feature is not subject to any SLA or deprecation policy and could change in - * backwards-incompatible ways. - * * @param prompt - A text prompt describing the image(s) to generate. * @returns A promise that resolves to an {@link ImagenGenerationResponse} * object containing the generated images. @@ -103,6 +98,8 @@ export class ImagenModel extends VertexAIModel { * If the prompt was not blocked, but one or more of the generated images were filtered, the * returned object will have a `filteredReason` property. * If all images are filtered, the `images` array will be empty. + * + * @beta */ async generateImages( prompt: string @@ -128,7 +125,7 @@ export class ImagenModel extends VertexAIModel { * @internal This method is temporarily internal. * * @param prompt - A text prompt describing the image(s) to generate. - * @param gcsURI - The Cloud Storage (GCS) for Firebase URI where the images should be stored. + * @param gcsURI - The URI of file stored in a Cloud Storage (GCS) for Firebase bucket. * This should be a directory. For example, `gs://my-bucket/my-directory/`. * @returns A promise that resolves to an {@link ImagenGenerationResponse} * object containing the URLs of the generated images. diff --git a/packages/vertexai/src/requests/imagen-image-format.ts b/packages/vertexai/src/requests/imagen-image-format.ts index 75661bdfb91..283dc80bfaf 100644 --- a/packages/vertexai/src/requests/imagen-image-format.ts +++ b/packages/vertexai/src/requests/imagen-image-format.ts @@ -51,13 +51,10 @@ export class ImagenImageFormat { /** * Creates an {@link ImagenImageFormat} for a JPEG image. * - * @beta - * For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which - * means that the feature is not subject to any SLA or deprecation policy and could change in - * backwards-incompatible ways. - * * @param compressionQuality - The level of compression (a number between 0 and 100). * @returns An {@link ImagenImageFormat} object for a JPEG image. + * + * @beta */ static jpeg(compressionQuality?: number): ImagenImageFormat { if ( @@ -74,12 +71,9 @@ export class ImagenImageFormat { /** * Creates an {@link ImagenImageFormat} for a PNG image. * - * @beta - * For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which - * means that the feature is not subject to any SLA or deprecation policy and could change in - * backwards-incompatible ways. - * * @returns An {@link ImagenImageFormat} object for a PNG image. + * + * @beta */ static png(): ImagenImageFormat { return { mimeType: 'image/png' }; diff --git a/packages/vertexai/src/requests/request-helpers.ts b/packages/vertexai/src/requests/request-helpers.ts index 33d2fab266a..b99c327c044 100644 --- a/packages/vertexai/src/requests/request-helpers.ts +++ b/packages/vertexai/src/requests/request-helpers.ts @@ -126,7 +126,7 @@ export function formatGenerateContentInput( } /** - * Convert the user-defined parameters in {@link ImagenGenerationParams} to the format + * Convert the user-defined parameters in {@link ImagenGenerationParams} to the format * that is expected from the REST API. * * @internal diff --git a/packages/vertexai/src/types/imagen/requests.ts b/packages/vertexai/src/types/imagen/requests.ts index c2e7658b0c8..4e922c4cc2b 100644 --- a/packages/vertexai/src/types/imagen/requests.ts +++ b/packages/vertexai/src/types/imagen/requests.ts @@ -57,14 +57,14 @@ export interface ImagenGenerationConfig { * * Support for negative prompts depends on the Imagen model. * - * See the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images#negative-prompt | Cloud documentation} for more details. + * See the {@link http://firebase.google.com/docs/vertex-ai/generate-images | documentation} for more details. */ negativePrompt?: string; /** * The number of images to generate. The default value is 1. * * The number of sample images that may be generated in each request depends on the model - * (typically up to 4); see the sampleCount + * (typically up to 4); see the sampleCount * documentation for more details. */ numberOfImages?: number; @@ -86,7 +86,7 @@ export interface ImagenGenerationConfig { * If set to `true`, an invisible SynthID watermark is embedded in generated images to indicate * that they are AI generated. If set to `false`, watermarking will be disabled. * - * The default value depends on the Imagen model; see the addWatermark + * The default value depends on the Imagen model; see the addWatermark * documentation for more details. */ addWatermark?: boolean; @@ -98,8 +98,8 @@ export interface ImagenGenerationConfig { * Text prompts provided as inputs and images (generated or uploaded) through Imagen on Vertex AI * are assessed against a list of safety filters, which include 'harmful categories' (for example, * `violence`, `sexual`, `derogatory`, and `toxic`). This filter level controls how aggressively to - * filter out potentially harmful content from responses. See the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list | `safetySetting`} - * documentation and the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-filters | Responsible AI and usage guidelines} + * filter out potentially harmful content from responses. See the {@link http://firebase.google.com/docs/vertex-ai/generate-images | documentation } + * and the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-filters | Responsible AI and usage guidelines} * for more details. * * @beta @@ -129,7 +129,7 @@ export enum ImagenSafetyFilterLevel { /** * A filter level controlling whether generation of images containing people or faces is allowed. * - * See the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api#parameter_list | `personGeneration`} + * See the personGeneration * documentation for more details. * * @beta @@ -160,7 +160,7 @@ export enum ImagenPersonFilterLevel { /** * Settings for controlling the aggressiveness of filtering out sensitive content. * - * See the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#config-safety-filters | Cloud documentation } + * See the {@link http://firebase.google.com/docs/vertex-ai/generate-images | documentation } * for more details. * * @beta @@ -183,7 +183,7 @@ export interface ImagenSafetySettings { * To specify an aspect ratio for generated images, set the `aspectRatio` property in your * {@link ImagenGenerationConfig}. * - * See the the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/generate-images#aspect-ratio | Cloud documentation } + * See the the {@link http://firebase.google.com/docs/vertex-ai/generate-images | documentation } * for more details and examples of the supported aspect ratios. * * @beta From 44ab79d705a1f8c739050976b312ff971a726571 Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Fri, 14 Feb 2025 11:15:42 -0500 Subject: [PATCH 13/14] format --- packages/vertexai/src/api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vertexai/src/api.ts b/packages/vertexai/src/api.ts index dbf617eb4c3..752e75c7e23 100644 --- a/packages/vertexai/src/api.ts +++ b/packages/vertexai/src/api.ts @@ -93,7 +93,7 @@ export function getGenerativeModel( * * @throws If the `apiKey` or `projectId` fields are missing in your * Firebase config. - * + * * @beta */ export function getImagenModel( From 60bcae9d181c6136ddabb8f3be84a8501f051cf1 Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Wed, 19 Feb 2025 16:31:09 -0500 Subject: [PATCH 14/14] review fixes --- docs-devsite/vertexai.imagengcsimage.md | 6 +++--- docs-devsite/vertexai.imagengenerationconfig.md | 14 +++++++------- docs-devsite/vertexai.md | 4 ++-- packages/vertexai/src/models/imagen-model.ts | 4 ++-- packages/vertexai/src/types/imagen/internal.ts | 2 +- packages/vertexai/src/types/imagen/requests.ts | 8 ++++---- packages/vertexai/src/types/imagen/responses.ts | 4 ++-- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/docs-devsite/vertexai.imagengcsimage.md b/docs-devsite/vertexai.imagengcsimage.md index 37110da5b62..b094e63c1d8 100644 --- a/docs-devsite/vertexai.imagengcsimage.md +++ b/docs-devsite/vertexai.imagengcsimage.md @@ -10,7 +10,7 @@ https://github.com/firebase/firebase-js-sdk {% endcomment %} # ImagenGCSImage interface -An image generated by Imagen, stored in Cloud Storage (GCS) for Firebase. +An image generated by Imagen, stored in a Cloud Storage for Firebase bucket. This feature is not available yet. @@ -24,12 +24,12 @@ export interface ImagenGCSImage | Property | Type | Description | | --- | --- | --- | -| [gcsURI](./vertexai.imagengcsimage.md#imagengcsimagegcsuri) | string | The URI of the file stored in a Cloud Storage (GCS) for Firestore bucket. | +| [gcsURI](./vertexai.imagengcsimage.md#imagengcsimagegcsuri) | string | The URI of the file stored in a Cloud Storage for Firebase bucket. | | [mimeType](./vertexai.imagengcsimage.md#imagengcsimagemimetype) | string | The MIME type of the image; either "image/png" or "image/jpeg".To request a different format, set the imageFormat property in your [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface). | ## ImagenGCSImage.gcsURI -The URI of the file stored in a Cloud Storage (GCS) for Firestore bucket. +The URI of the file stored in a Cloud Storage for Firebase bucket. Signature: diff --git a/docs-devsite/vertexai.imagengenerationconfig.md b/docs-devsite/vertexai.imagengenerationconfig.md index aa3da59f71f..cee7734f789 100644 --- a/docs-devsite/vertexai.imagengenerationconfig.md +++ b/docs-devsite/vertexai.imagengenerationconfig.md @@ -15,7 +15,7 @@ https://github.com/firebase/firebase-js-sdk Configuration options for generating images with Imagen. -See the [documentation](http://firebase.google.com/docs/vertex-ai/generate-images) for more details. +See the [documentation](http://firebase.google.com/docs/vertex-ai/generate-images-imagen) for more details. Signature: @@ -27,11 +27,11 @@ export interface ImagenGenerationConfig | Property | Type | Description | | --- | --- | --- | -| [addWatermark](./vertexai.imagengenerationconfig.md#imagengenerationconfigaddwatermark) | boolean | (Public Preview) Whether to add an invisible watermark to generated images.If set to true, an invisible SynthID watermark is embedded in generated images to indicate that they are AI generated. If set to false, watermarking will be disabled.The default value depends on the Imagen model; see the addWatermark documentation for more details. | +| [addWatermark](./vertexai.imagengenerationconfig.md#imagengenerationconfigaddwatermark) | boolean | (Public Preview) Whether to add an invisible watermark to generated images.If set to true, an invisible SynthID watermark is embedded in generated images to indicate that they are AI generated. If set to false, watermarking will be disabled.For Imagen 3 models, the default value is true; see the addWatermark documentation for more details. | | [aspectRatio](./vertexai.imagengenerationconfig.md#imagengenerationconfigaspectratio) | [ImagenAspectRatio](./vertexai.md#imagenaspectratio) | (Public Preview) The aspect ratio of the generated images. The default value is square 1:1. Supported aspect ratios depend on the Imagen model, see [ImagenAspectRatio](./vertexai.md#imagenaspectratio) for more details. | | [imageFormat](./vertexai.imagengenerationconfig.md#imagengenerationconfigimageformat) | [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) | (Public Preview) The image format of the generated images. The default is PNG.See [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for more details. | -| [negativePrompt](./vertexai.imagengenerationconfig.md#imagengenerationconfignegativeprompt) | string | (Public Preview) A description of what should be omitted from the generated images.Support for negative prompts depends on the Imagen model.See the [documentation](http://firebase.google.com/docs/vertex-ai/generate-images) for more details. | -| [numberOfImages](./vertexai.imagengenerationconfig.md#imagengenerationconfignumberofimages) | number | (Public Preview) The number of images to generate. The default value is 1.The number of sample images that may be generated in each request depends on the model (typically up to 4); see the sampleCount documentation for more details. | +| [negativePrompt](./vertexai.imagengenerationconfig.md#imagengenerationconfignegativeprompt) | string | (Public Preview) A description of what should be omitted from the generated images.Support for negative prompts depends on the Imagen model.See the [documentation](http://firebase.google.com/docs/vertex-ai/model-parameters#imagen) for more details. | +| [numberOfImages](./vertexai.imagengenerationconfig.md#imagengenerationconfignumberofimages) | number | (Public Preview) The number of images to generate. The default value is 1.The number of sample images that may be generated in each request depends on the model (typically up to 4); see the sampleCount documentation for more details. | ## ImagenGenerationConfig.addWatermark @@ -42,7 +42,7 @@ Whether to add an invisible watermark to generated images. If set to `true`, an invisible SynthID watermark is embedded in generated images to indicate that they are AI generated. If set to `false`, watermarking will be disabled. -The default value depends on the Imagen model; see the addWatermark documentation for more details. +For Imagen 3 models, the default value is `true`; see the addWatermark documentation for more details. Signature: @@ -87,7 +87,7 @@ A description of what should be omitted from the generated images. Support for negative prompts depends on the Imagen model. -See the [documentation](http://firebase.google.com/docs/vertex-ai/generate-images) for more details. +See the [documentation](http://firebase.google.com/docs/vertex-ai/model-parameters#imagen) for more details. Signature: @@ -102,7 +102,7 @@ negativePrompt?: string; The number of images to generate. The default value is 1. -The number of sample images that may be generated in each request depends on the model (typically up to 4); see the sampleCount documentation for more details. +The number of sample images that may be generated in each request depends on the model (typically up to 4); see the sampleCount documentation for more details. Signature: diff --git a/docs-devsite/vertexai.md b/docs-devsite/vertexai.md index 01a6e9a97ed..1d284345c39 100644 --- a/docs-devsite/vertexai.md +++ b/docs-devsite/vertexai.md @@ -90,8 +90,8 @@ The Vertex AI in Firebase Web SDK. | [GenerativeContentBlob](./vertexai.generativecontentblob.md#generativecontentblob_interface) | Interface for sending an image. | | [GroundingAttribution](./vertexai.groundingattribution.md#groundingattribution_interface) | | | [GroundingMetadata](./vertexai.groundingmetadata.md#groundingmetadata_interface) | Metadata returned to client when grounding is enabled. | -| [ImagenGCSImage](./vertexai.imagengcsimage.md#imagengcsimage_interface) | An image generated by Imagen, stored in Cloud Storage (GCS) for Firebase.This feature is not available yet. | -| [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface) | (Public Preview) Configuration options for generating images with Imagen.See the [documentation](http://firebase.google.com/docs/vertex-ai/generate-images) for more details. | +| [ImagenGCSImage](./vertexai.imagengcsimage.md#imagengcsimage_interface) | An image generated by Imagen, stored in a Cloud Storage for Firebase bucket.This feature is not available yet. | +| [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface) | (Public Preview) Configuration options for generating images with Imagen.See the [documentation](http://firebase.google.com/docs/vertex-ai/generate-images-imagen) for more details. | | [ImagenGenerationResponse](./vertexai.imagengenerationresponse.md#imagengenerationresponse_interface) | (Public Preview) The response from a request to generate images with Imagen. | | [ImagenInlineImage](./vertexai.imageninlineimage.md#imageninlineimage_interface) | (Public Preview) An image generated by Imagen, represented as inline data. | | [ImagenModelParams](./vertexai.imagenmodelparams.md#imagenmodelparams_interface) | (Public Preview) Parameters for configuring an [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class). | diff --git a/packages/vertexai/src/models/imagen-model.ts b/packages/vertexai/src/models/imagen-model.ts index c218171cf69..89c740852a3 100644 --- a/packages/vertexai/src/models/imagen-model.ts +++ b/packages/vertexai/src/models/imagen-model.ts @@ -120,12 +120,12 @@ export class ImagenModel extends VertexAIModel { } /** - * Generates images to Cloud Storage (GCS) for Firebase using the Imagen model. + * Generates images to Cloud Storage for Firebase using the Imagen model. * * @internal This method is temporarily internal. * * @param prompt - A text prompt describing the image(s) to generate. - * @param gcsURI - The URI of file stored in a Cloud Storage (GCS) for Firebase bucket. + * @param gcsURI - The URI of file stored in a Cloud Storage for Firebase bucket. * This should be a directory. For example, `gs://my-bucket/my-directory/`. * @returns A promise that resolves to an {@link ImagenGenerationResponse} * object containing the URLs of the generated images. diff --git a/packages/vertexai/src/types/imagen/internal.ts b/packages/vertexai/src/types/imagen/internal.ts index 78bc3d27334..02a8a55e01c 100644 --- a/packages/vertexai/src/types/imagen/internal.ts +++ b/packages/vertexai/src/types/imagen/internal.ts @@ -121,7 +121,7 @@ export interface PredictRequestBody { */ export type ImagenGenerationParams = { /** - * The Cloud Storage (GCS) for Firebase URI where the images should be stored + * The Cloud Storage for Firebase bucket URI where the images should be stored * (for GCS requests only). */ gcsURI?: string; diff --git a/packages/vertexai/src/types/imagen/requests.ts b/packages/vertexai/src/types/imagen/requests.ts index 4e922c4cc2b..ac37488dfb5 100644 --- a/packages/vertexai/src/types/imagen/requests.ts +++ b/packages/vertexai/src/types/imagen/requests.ts @@ -46,7 +46,7 @@ export interface ImagenModelParams { /** * Configuration options for generating images with Imagen. * - * See the {@link http://firebase.google.com/docs/vertex-ai/generate-images | documentation} for + * See the {@link http://firebase.google.com/docs/vertex-ai/generate-images-imagen | documentation} for * more details. * * @beta @@ -57,14 +57,14 @@ export interface ImagenGenerationConfig { * * Support for negative prompts depends on the Imagen model. * - * See the {@link http://firebase.google.com/docs/vertex-ai/generate-images | documentation} for more details. + * See the {@link http://firebase.google.com/docs/vertex-ai/model-parameters#imagen | documentation} for more details. */ negativePrompt?: string; /** * The number of images to generate. The default value is 1. * * The number of sample images that may be generated in each request depends on the model - * (typically up to 4); see the sampleCount + * (typically up to 4); see the sampleCount * documentation for more details. */ numberOfImages?: number; @@ -86,7 +86,7 @@ export interface ImagenGenerationConfig { * If set to `true`, an invisible SynthID watermark is embedded in generated images to indicate * that they are AI generated. If set to `false`, watermarking will be disabled. * - * The default value depends on the Imagen model; see the addWatermark + * For Imagen 3 models, the default value is `true`; see the addWatermark * documentation for more details. */ addWatermark?: boolean; diff --git a/packages/vertexai/src/types/imagen/responses.ts b/packages/vertexai/src/types/imagen/responses.ts index 5b973bdbe30..c5cf5dd9057 100644 --- a/packages/vertexai/src/types/imagen/responses.ts +++ b/packages/vertexai/src/types/imagen/responses.ts @@ -34,7 +34,7 @@ export interface ImagenInlineImage { } /** - * An image generated by Imagen, stored in Cloud Storage (GCS) for Firebase. + * An image generated by Imagen, stored in a Cloud Storage for Firebase bucket. * * This feature is not available yet. */ @@ -46,7 +46,7 @@ export interface ImagenGCSImage { */ mimeType: string; /** - * The URI of the file stored in a Cloud Storage (GCS) for Firestore bucket. + * The URI of the file stored in a Cloud Storage for Firebase bucket. * * @example `"gs://bucket-name/path/sample_0.jpg"`. */