Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/hungry-tables-exercise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'firebase': patch
'@firebase/ai': patch
---

Imagen Generation is now Generally Available (GA).
6 changes: 6 additions & 0 deletions .changeset/loud-tigers-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'firebase': patch
'@firebase/ai': patch
---

The Gemini Developer API is now Generally Available (GA).
30 changes: 15 additions & 15 deletions common/api-review/ai.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ export function getAI(app?: FirebaseApp, options?: AIOptions): AI;
// @public
export function getGenerativeModel(ai: AI, modelParams: ModelParams | HybridParams, requestOptions?: RequestOptions): GenerativeModel;

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

// @beta
Expand Down Expand Up @@ -712,7 +712,7 @@ export interface HybridParams {
onDeviceParams?: OnDeviceParams;
}

// @beta
// @public
export const ImagenAspectRatio: {
readonly SQUARE: "1:1";
readonly LANDSCAPE_3x4: "3:4";
Expand All @@ -721,16 +721,16 @@ export const ImagenAspectRatio: {
readonly PORTRAIT_9x16: "9:16";
};

// @beta
// @public
export type ImagenAspectRatio = (typeof ImagenAspectRatio)[keyof typeof ImagenAspectRatio];

// @beta
// @public
export interface ImagenGCSImage {
gcsURI: string;
mimeType: string;
}

// @beta
// @public
export interface ImagenGenerationConfig {
addWatermark?: boolean;
aspectRatio?: ImagenAspectRatio;
Expand All @@ -739,27 +739,27 @@ export interface ImagenGenerationConfig {
numberOfImages?: number;
}

// @beta
// @public
export interface ImagenGenerationResponse<T extends ImagenInlineImage | ImagenGCSImage> {
filteredReason?: string;
images: T[];
}

// @beta
// @public
export class ImagenImageFormat {
compressionQuality?: number;
static jpeg(compressionQuality?: number): ImagenImageFormat;
mimeType: string;
static png(): ImagenImageFormat;
}

// @beta
// @public
export interface ImagenInlineImage {
bytesBase64Encoded: string;
mimeType: string;
}

// @beta
// @public
export class ImagenModel extends AIModel {
constructor(ai: AI, modelParams: ImagenModelParams, requestOptions?: RequestOptions | undefined);
generateImages(prompt: string): Promise<ImagenGenerationResponse<ImagenInlineImage>>;
Expand All @@ -771,35 +771,35 @@ export class ImagenModel extends AIModel {
safetySettings?: ImagenSafetySettings;
}

// @beta
// @public
export interface ImagenModelParams {
generationConfig?: ImagenGenerationConfig;
model: string;
safetySettings?: ImagenSafetySettings;
}

// @beta
// @public
export const ImagenPersonFilterLevel: {
readonly BLOCK_ALL: "dont_allow";
readonly ALLOW_ADULT: "allow_adult";
readonly ALLOW_ALL: "allow_all";
};

// @beta
// @public
export type ImagenPersonFilterLevel = (typeof ImagenPersonFilterLevel)[keyof typeof ImagenPersonFilterLevel];

// @beta
// @public
export const ImagenSafetyFilterLevel: {
readonly BLOCK_LOW_AND_ABOVE: "block_low_and_above";
readonly BLOCK_MEDIUM_AND_ABOVE: "block_medium_and_above";
readonly BLOCK_ONLY_HIGH: "block_only_high";
readonly BLOCK_NONE: "block_none";
};

// @beta
// @public
export type ImagenSafetyFilterLevel = (typeof ImagenSafetyFilterLevel)[keyof typeof ImagenSafetyFilterLevel];

// @beta
// @public
export interface ImagenSafetySettings {
personFilterLevel?: ImagenPersonFilterLevel;
safetyFilterLevel?: ImagenSafetyFilterLevel;
Expand Down
13 changes: 2 additions & 11 deletions docs-devsite/ai.imagengcsimage.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ 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 a Cloud Storage for Firebase bucket.

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

| Property | Type | Description |
| --- | --- | --- |
| [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. |
| [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)<!-- -->. |
| [gcsURI](./ai.imagengcsimage.md#imagengcsimagegcsuri) | string | The URI of the file stored in a Cloud Storage for Firebase bucket. |
| [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)<!-- -->. |

## 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 stored in a Cloud Storage for Firebase bucket.

<b>Signature:</b>
Expand All @@ -49,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](./ai.imagengenerationconfig.md#imagengenerationconfig_interface)<!-- -->.
Expand Down
28 changes: 5 additions & 23 deletions docs-devsite/ai.imagengenerationconfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ 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 [documentation](http://firebase.google.com/docs/vertex-ai/generate-images-imagen) for more details.
Expand All @@ -27,17 +24,14 @@ export interface ImagenGenerationConfig

| Property | Type | Description |
| --- | --- | --- |
| [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. |
| [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. |
| [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. |
| [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>. |
| [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. |
| [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. |
| [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. |
| [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. |
| [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>. |
| [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. |

## 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.
Expand All @@ -54,9 +48,6 @@ 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](./ai.md#imagenaspectratio) for more details.

<b>Signature:</b>
Expand All @@ -67,9 +58,6 @@ 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](./ai.imagenimageformat.md#imagenimageformat_class) for more details.
Expand All @@ -82,9 +70,6 @@ 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.
Expand All @@ -101,9 +86,6 @@ 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 <a href="http://firebase.google.com/docs/vertex-ai/model-parameters#imagen">sampleCount</a> documentation for more details.
Expand Down
13 changes: 2 additions & 11 deletions docs-devsite/ai.imagengenerationresponse.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ 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.

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

| Property | Type | Description |
| --- | --- | --- |
| [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. |
| [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>. |
| [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. |
| [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>. |

## 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](./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)<!-- -->.
Expand All @@ -47,9 +41,6 @@ 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`<!-- -->.
Expand Down
Loading
Loading