Skip to content

Commit 92053a6

Browse files
committed
fix imagen docs
1 parent 61df28b commit 92053a6

17 files changed

+57
-210
lines changed

.changeset/hungry-tables-exercise.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
'firebase': patch
23
'@firebase/ai': patch
34
---
45

.changeset/loud-tigers-compare.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
'firebase': patch
23
'@firebase/ai': patch
34
---
45

common/api-review/ai.api.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ export function getAI(app?: FirebaseApp, options?: AIOptions): AI;
545545
// @public
546546
export function getGenerativeModel(ai: AI, modelParams: ModelParams | HybridParams, requestOptions?: RequestOptions): GenerativeModel;
547547

548-
// @beta
548+
// @public
549549
export function getImagenModel(ai: AI, modelParams: ImagenModelParams, requestOptions?: RequestOptions): ImagenModel;
550550

551551
// @beta
@@ -702,7 +702,7 @@ export interface HybridParams {
702702
onDeviceParams?: OnDeviceParams;
703703
}
704704

705-
// @beta
705+
// @public
706706
export const ImagenAspectRatio: {
707707
readonly SQUARE: "1:1";
708708
readonly LANDSCAPE_3x4: "3:4";
@@ -711,16 +711,16 @@ export const ImagenAspectRatio: {
711711
readonly PORTRAIT_9x16: "9:16";
712712
};
713713

714-
// @beta
714+
// @public
715715
export type ImagenAspectRatio = (typeof ImagenAspectRatio)[keyof typeof ImagenAspectRatio];
716716

717-
// @beta
717+
// @public
718718
export interface ImagenGCSImage {
719719
gcsURI: string;
720720
mimeType: string;
721721
}
722722

723-
// @beta
723+
// @public
724724
export interface ImagenGenerationConfig {
725725
addWatermark?: boolean;
726726
aspectRatio?: ImagenAspectRatio;
@@ -729,27 +729,27 @@ export interface ImagenGenerationConfig {
729729
numberOfImages?: number;
730730
}
731731

732-
// @beta
732+
// @public
733733
export interface ImagenGenerationResponse<T extends ImagenInlineImage | ImagenGCSImage> {
734734
filteredReason?: string;
735735
images: T[];
736736
}
737737

738-
// @beta
738+
// @public
739739
export class ImagenImageFormat {
740740
compressionQuality?: number;
741741
static jpeg(compressionQuality?: number): ImagenImageFormat;
742742
mimeType: string;
743743
static png(): ImagenImageFormat;
744744
}
745745

746-
// @beta
746+
// @public
747747
export interface ImagenInlineImage {
748748
bytesBase64Encoded: string;
749749
mimeType: string;
750750
}
751751

752-
// @beta
752+
// @public
753753
export class ImagenModel extends AIModel {
754754
constructor(ai: AI, modelParams: ImagenModelParams, requestOptions?: RequestOptions | undefined);
755755
generateImages(prompt: string): Promise<ImagenGenerationResponse<ImagenInlineImage>>;
@@ -761,35 +761,35 @@ export class ImagenModel extends AIModel {
761761
safetySettings?: ImagenSafetySettings;
762762
}
763763

764-
// @beta
764+
// @public
765765
export interface ImagenModelParams {
766766
generationConfig?: ImagenGenerationConfig;
767767
model: string;
768768
safetySettings?: ImagenSafetySettings;
769769
}
770770

771-
// @beta
771+
// @public
772772
export const ImagenPersonFilterLevel: {
773773
readonly BLOCK_ALL: "dont_allow";
774774
readonly ALLOW_ADULT: "allow_adult";
775775
readonly ALLOW_ALL: "allow_all";
776776
};
777777

778-
// @beta
778+
// @public
779779
export type ImagenPersonFilterLevel = (typeof ImagenPersonFilterLevel)[keyof typeof ImagenPersonFilterLevel];
780780

781-
// @beta
781+
// @public
782782
export const ImagenSafetyFilterLevel: {
783783
readonly BLOCK_LOW_AND_ABOVE: "block_low_and_above";
784784
readonly BLOCK_MEDIUM_AND_ABOVE: "block_medium_and_above";
785785
readonly BLOCK_ONLY_HIGH: "block_only_high";
786786
readonly BLOCK_NONE: "block_none";
787787
};
788788

789-
// @beta
789+
// @public
790790
export type ImagenSafetyFilterLevel = (typeof ImagenSafetyFilterLevel)[keyof typeof ImagenSafetyFilterLevel];
791791

792-
// @beta
792+
// @public
793793
export interface ImagenSafetySettings {
794794
personFilterLevel?: ImagenPersonFilterLevel;
795795
safetyFilterLevel?: ImagenSafetyFilterLevel;

docs-devsite/ai.imagengcsimage.md

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ https://github.com/firebase/firebase-js-sdk
1010
{% endcomment %}
1111

1212
# ImagenGCSImage interface
13-
> 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.
14-
>
15-
1613
An image generated by Imagen, stored in a Cloud Storage for Firebase bucket.
1714

1815
This feature is not available yet.
@@ -27,14 +24,11 @@ export interface ImagenGCSImage
2724

2825
| Property | Type | Description |
2926
| --- | --- | --- |
30-
| [gcsURI](./ai.imagengcsimage.md#imagengcsimagegcsuri) | string | <b><i>(Public Preview)</i></b> The URI of the file stored in a Cloud Storage for Firebase bucket. |
31-
| [mimeType](./ai.imagengcsimage.md#imagengcsimagemimetype) | string | <b><i>(Public Preview)</i></b> The MIME type of the image; either <code>&quot;image/png&quot;</code> or <code>&quot;image/jpeg&quot;</code>.<!-- -->To request a different format, set the <code>imageFormat</code> property in your [ImagenGenerationConfig](./ai.imagengenerationconfig.md#imagengenerationconfig_interface)<!-- -->. |
27+
| [gcsURI](./ai.imagengcsimage.md#imagengcsimagegcsuri) | string | The URI of the file stored in a Cloud Storage for Firebase bucket. |
28+
| [mimeType](./ai.imagengcsimage.md#imagengcsimagemimetype) | string | The MIME type of the image; either <code>&quot;image/png&quot;</code> or <code>&quot;image/jpeg&quot;</code>.<!-- -->To request a different format, set the <code>imageFormat</code> property in your [ImagenGenerationConfig](./ai.imagengenerationconfig.md#imagengenerationconfig_interface)<!-- -->. |
3229

3330
## ImagenGCSImage.gcsURI
3431

35-
> 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.
36-
>
37-
3832
The URI of the file stored in a Cloud Storage for Firebase bucket.
3933

4034
<b>Signature:</b>
@@ -49,9 +43,6 @@ gcsURI: string;
4943

5044
## ImagenGCSImage.mimeType
5145

52-
> 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.
53-
>
54-
5546
The MIME type of the image; either `"image/png"` or `"image/jpeg"`<!-- -->.
5647

5748
To request a different format, set the `imageFormat` property in your [ImagenGenerationConfig](./ai.imagengenerationconfig.md#imagengenerationconfig_interface)<!-- -->.

docs-devsite/ai.imagengenerationconfig.md

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ https://github.com/firebase/firebase-js-sdk
1010
{% endcomment %}
1111

1212
# ImagenGenerationConfig interface
13-
> 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.
14-
>
15-
1613
Configuration options for generating images with Imagen.
1714

1815
See the [documentation](http://firebase.google.com/docs/vertex-ai/generate-images-imagen) for more details.
@@ -27,17 +24,14 @@ export interface ImagenGenerationConfig
2724

2825
| Property | Type | Description |
2926
| --- | --- | --- |
30-
| [addWatermark](./ai.imagengenerationconfig.md#imagengenerationconfigaddwatermark) | boolean | <b><i>(Public Preview)</i></b> Whether to add an invisible watermark to generated images.<!-- -->If set to <code>true</code>, an invisible SynthID watermark is embedded in generated images to indicate that they are AI generated. If set to <code>false</code>, watermarking will be disabled.<!-- -->For Imagen 3 models, the default value is <code>true</code>; see the <a href="http://firebase.google.com/docs/vertex-ai/model-parameters#imagen">addWatermark</a> documentation for more details.<!-- -->When using the Gemini Developer API ([GoogleAIBackend](./ai.googleaibackend.md#googleaibackend_class)<!-- -->), this will default to true, and cannot be turned off. |
31-
| [aspectRatio](./ai.imagengenerationconfig.md#imagengenerationconfigaspectratio) | [ImagenAspectRatio](./ai.md#imagenaspectratio) | <b><i>(Public Preview)</i></b> The aspect ratio of the generated images. The default value is square 1:1. Supported aspect ratios depend on the Imagen model, see [ImagenAspectRatio](./ai.md#imagenaspectratio) for more details. |
32-
| [imageFormat](./ai.imagengenerationconfig.md#imagengenerationconfigimageformat) | [ImagenImageFormat](./ai.imagenimageformat.md#imagenimageformat_class) | <b><i>(Public Preview)</i></b> The image format of the generated images. The default is PNG.<!-- -->See [ImagenImageFormat](./ai.imagenimageformat.md#imagenimageformat_class) for more details. |
33-
| [negativePrompt](./ai.imagengenerationconfig.md#imagengenerationconfignegativeprompt) | string | <b><i>(Public Preview)</i></b> 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.<!-- -->This is no longer supported in the Gemini Developer API ([GoogleAIBackend](./ai.googleaibackend.md#googleaibackend_class)<!-- -->) in versions greater than <code>imagen-3.0-generate-002</code>. |
34-
| [numberOfImages](./ai.imagengenerationconfig.md#imagengenerationconfignumberofimages) | number | <b><i>(Public Preview)</i></b> 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 <a href="http://firebase.google.com/docs/vertex-ai/model-parameters#imagen">sampleCount</a> documentation for more details. |
27+
| [addWatermark](./ai.imagengenerationconfig.md#imagengenerationconfigaddwatermark) | boolean | Whether to add an invisible watermark to generated images.<!-- -->If set to <code>true</code>, an invisible SynthID watermark is embedded in generated images to indicate that they are AI generated. If set to <code>false</code>, watermarking will be disabled.<!-- -->For Imagen 3 models, the default value is <code>true</code>; see the <a href="http://firebase.google.com/docs/vertex-ai/model-parameters#imagen">addWatermark</a> documentation for more details.<!-- -->When using the Gemini Developer API ([GoogleAIBackend](./ai.googleaibackend.md#googleaibackend_class)<!-- -->), this will default to true, and cannot be turned off. |
28+
| [aspectRatio](./ai.imagengenerationconfig.md#imagengenerationconfigaspectratio) | [ImagenAspectRatio](./ai.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](./ai.md#imagenaspectratio) for more details. |
29+
| [imageFormat](./ai.imagengenerationconfig.md#imagengenerationconfigimageformat) | [ImagenImageFormat](./ai.imagenimageformat.md#imagenimageformat_class) | The image format of the generated images. The default is PNG.<!-- -->See [ImagenImageFormat](./ai.imagenimageformat.md#imagenimageformat_class) for more details. |
30+
| [negativePrompt](./ai.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 [documentation](http://firebase.google.com/docs/vertex-ai/model-parameters#imagen) for more details.<!-- -->This is no longer supported in the Gemini Developer API ([GoogleAIBackend](./ai.googleaibackend.md#googleaibackend_class)<!-- -->) in versions greater than <code>imagen-3.0-generate-002</code>. |
31+
| [numberOfImages](./ai.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 <a href="http://firebase.google.com/docs/vertex-ai/model-parameters#imagen">sampleCount</a> documentation for more details. |
3532

3633
## ImagenGenerationConfig.addWatermark
3734

38-
> 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.
39-
>
40-
4135
Whether to add an invisible watermark to generated images.
4236

4337
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.
@@ -54,9 +48,6 @@ addWatermark?: boolean;
5448

5549
## ImagenGenerationConfig.aspectRatio
5650

57-
> 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.
58-
>
59-
6051
The aspect ratio of the generated images. The default value is square 1:1. Supported aspect ratios depend on the Imagen model, see [ImagenAspectRatio](./ai.md#imagenaspectratio) for more details.
6152

6253
<b>Signature:</b>
@@ -67,9 +58,6 @@ aspectRatio?: ImagenAspectRatio;
6758

6859
## ImagenGenerationConfig.imageFormat
6960

70-
> 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.
71-
>
72-
7361
The image format of the generated images. The default is PNG.
7462

7563
See [ImagenImageFormat](./ai.imagenimageformat.md#imagenimageformat_class) for more details.
@@ -82,9 +70,6 @@ imageFormat?: ImagenImageFormat;
8270

8371
## ImagenGenerationConfig.negativePrompt
8472

85-
> 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.
86-
>
87-
8873
A description of what should be omitted from the generated images.
8974

9075
Support for negative prompts depends on the Imagen model.
@@ -101,9 +86,6 @@ negativePrompt?: string;
10186

10287
## ImagenGenerationConfig.numberOfImages
10388

104-
> 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.
105-
>
106-
10789
The number of images to generate. The default value is 1.
10890

10991
The number of sample images that may be generated in each request depends on the model (typically up to 4); see the <a href="http://firebase.google.com/docs/vertex-ai/model-parameters#imagen">sampleCount</a> documentation for more details.

docs-devsite/ai.imagengenerationresponse.md

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ https://github.com/firebase/firebase-js-sdk
1010
{% endcomment %}
1111

1212
# ImagenGenerationResponse interface
13-
> 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.
14-
>
15-
1613
The response from a request to generate images with Imagen.
1714

1815
<b>Signature:</b>
@@ -25,14 +22,11 @@ export interface ImagenGenerationResponse<T extends ImagenInlineImage | ImagenGC
2522

2623
| Property | Type | Description |
2724
| --- | --- | --- |
28-
| [filteredReason](./ai.imagengenerationresponse.md#imagengenerationresponsefilteredreason) | string | <b><i>(Public Preview)</i></b> 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](./ai.md#imagensafetyfilterlevel)<!-- -->, [ImagenPersonFilterLevel](./ai.md#imagenpersonfilterlevel)<!-- -->, or filtering included in the model. The filter levels may be adjusted in your [ImagenSafetySettings](./ai.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. |
29-
| [images](./ai.imagengenerationresponse.md#imagengenerationresponseimages) | T\[\] | <b><i>(Public Preview)</i></b> 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 <code>filteredReason</code>. |
25+
| [filteredReason](./ai.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](./ai.md#imagensafetyfilterlevel)<!-- -->, [ImagenPersonFilterLevel](./ai.md#imagenpersonfilterlevel)<!-- -->, or filtering included in the model. The filter levels may be adjusted in your [ImagenSafetySettings](./ai.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. |
26+
| [images](./ai.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 <code>filteredReason</code>. |
3027

3128
## ImagenGenerationResponse.filteredReason
3229

33-
> 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.
34-
>
35-
3630
The reason that images were filtered out. This property will only be defined if one or more images were filtered.
3731

3832
Images may be filtered out due to the [ImagenSafetyFilterLevel](./ai.md#imagensafetyfilterlevel)<!-- -->, [ImagenPersonFilterLevel](./ai.md#imagenpersonfilterlevel)<!-- -->, or filtering included in the model. The filter levels may be adjusted in your [ImagenSafetySettings](./ai.imagensafetysettings.md#imagensafetysettings_interface)<!-- -->.
@@ -47,9 +41,6 @@ filteredReason?: string;
4741

4842
## ImagenGenerationResponse.images
4943

50-
> 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.
51-
>
52-
5344
The images generated by Imagen.
5445

5546
The number of images generated may be fewer than the number requested if one or more were filtered out; see `filteredReason`<!-- -->.

docs-devsite/ai.imagenimageformat.md

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ https://github.com/firebase/firebase-js-sdk
1010
{% endcomment %}
1111

1212
# ImagenImageFormat class
13-
> 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.
14-
>
15-
1613
Defines the image format for images generated by Imagen.
1714

1815
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](./ai.imagenmodelparams.md#imagenmodelparams_interface)<!-- -->.
@@ -27,21 +24,18 @@ export declare class ImagenImageFormat
2724

2825
| Property | Modifiers | Type | Description |
2926
| --- | --- | --- | --- |
30-
| [compressionQuality](./ai.imagenimageformat.md#imagenimageformatcompressionquality) | | number | <b><i>(Public Preview)</i></b> The level of compression (a number between 0 and 100). |
31-
| [mimeType](./ai.imagenimageformat.md#imagenimageformatmimetype) | | string | <b><i>(Public Preview)</i></b> The MIME type. |
27+
| [compressionQuality](./ai.imagenimageformat.md#imagenimageformatcompressionquality) | | number | The level of compression (a number between 0 and 100). |
28+
| [mimeType](./ai.imagenimageformat.md#imagenimageformatmimetype) | | string | The MIME type. |
3229

3330
## Methods
3431

3532
| Method | Modifiers | Description |
3633
| --- | --- | --- |
37-
| [jpeg(compressionQuality)](./ai.imagenimageformat.md#imagenimageformatjpeg) | <code>static</code> | <b><i>(Public Preview)</i></b> Creates an [ImagenImageFormat](./ai.imagenimageformat.md#imagenimageformat_class) for a JPEG image. |
38-
| [png()](./ai.imagenimageformat.md#imagenimageformatpng) | <code>static</code> | <b><i>(Public Preview)</i></b> Creates an [ImagenImageFormat](./ai.imagenimageformat.md#imagenimageformat_class) for a PNG image. |
34+
| [jpeg(compressionQuality)](./ai.imagenimageformat.md#imagenimageformatjpeg) | <code>static</code> | Creates an [ImagenImageFormat](./ai.imagenimageformat.md#imagenimageformat_class) for a JPEG image. |
35+
| [png()](./ai.imagenimageformat.md#imagenimageformatpng) | <code>static</code> | Creates an [ImagenImageFormat](./ai.imagenimageformat.md#imagenimageformat_class) for a PNG image. |
3936

4037
## ImagenImageFormat.compressionQuality
4138

42-
> 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.
43-
>
44-
4539
The level of compression (a number between 0 and 100).
4640

4741
<b>Signature:</b>
@@ -52,9 +46,6 @@ compressionQuality?: number;
5246

5347
## ImagenImageFormat.mimeType
5448

55-
> 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.
56-
>
57-
5849
The MIME type.
5950

6051
<b>Signature:</b>
@@ -65,9 +56,6 @@ mimeType: string;
6556

6657
## ImagenImageFormat.jpeg()
6758

68-
> 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.
69-
>
70-
7159
Creates an [ImagenImageFormat](./ai.imagenimageformat.md#imagenimageformat_class) for a JPEG image.
7260

7361
<b>Signature:</b>
@@ -90,9 +78,6 @@ An [ImagenImageFormat](./ai.imagenimageformat.md#imagenimageformat_class) object
9078

9179
## ImagenImageFormat.png()
9280

93-
> 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.
94-
>
95-
9681
Creates an [ImagenImageFormat](./ai.imagenimageformat.md#imagenimageformat_class) for a PNG image.
9782

9883
<b>Signature:</b>

0 commit comments

Comments
 (0)