-
Notifications
You must be signed in to change notification settings - Fork 937
Add Image Generation support using Imagen #8683
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
ec35231
WIP
dlarocque 180f091
Introduce VertexAIModel base class, add documentation, and respond to…
dlarocque 497727f
Generate devsite docs
dlarocque 8471bbc
revert dataconnect change
dlarocque 5c518b1
formatting
dlarocque b680a2a
WIP
dlarocque d00cccd
Introduce VertexAIModel base class, add documentation, and respond to…
dlarocque 4b6c42f
Generate devsite docs
dlarocque 6215781
revert dataconnect change
dlarocque 025035a
formatting
dlarocque 2f8b45d
Fix ImagenRequestConfig comment
dlarocque 89a73de
Improve tests
dlarocque a0c8c89
Merge branch 'dl/vertex-imagen' of https://github.com/firebase/fireba…
dlarocque 80021f9
Formatting
dlarocque 858f260
Add ImagenGenerationResponse
dlarocque bfc2c0f
Formatting
dlarocque 886a4df
Update to match API changes
dlarocque b8dd77e
Merge branch 'main' into dl/vertex-imagen
dlarocque d967900
fixes
dlarocque d53d3dd
format
dlarocque ae0f87e
Update API reports
dlarocque 37aa71a
add changeset
dlarocque f7f919d
Merge branch 'main' into dl/vertex-imagen
dlarocque ece898f
update
dlarocque 967cd78
format
dlarocque b27a45e
Update API reports
dlarocque f095563
remove public docs
dlarocque 0cd9ae4
Merge branch 'main' into dl/vertex-imagen
dlarocque d6a4f24
Nest imageFormat in outputOptions
dlarocque 66b3b9f
remove unecessary console.log
dlarocque 48b658d
Log warning if compressionQuality outside of range
dlarocque c3173a9
format
dlarocque a33e819
Merge branch 'main' into dl/vertex-imagen
dlarocque 0e9ff0a
Merge branch 'main' into dl/vertex-imagen
dlarocque 0900f82
Imagen Documentation (#8776)
dlarocque 5e7df2f
Cleanup
dlarocque 4a306fa
update changeset
dlarocque File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'firebase': minor | ||
'@firebase/vertexai': minor | ||
--- | ||
|
||
**Public Preview** Added support for generating images using the Imagen 3 model. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
Project: /docs/reference/js/_project.yaml | ||
Book: /docs/reference/_book.yaml | ||
page_type: reference | ||
|
||
{% comment %} | ||
DO NOT EDIT THIS FILE! | ||
This is generated by the JS SDK team, and any local changes will be | ||
overwritten. Changes should be made in the source code at | ||
https://github.com/firebase/firebase-js-sdk | ||
{% endcomment %} | ||
|
||
# ImagenGCSImage interface | ||
An image generated by Imagen, stored in a Cloud Storage for Firebase bucket. | ||
|
||
This feature is not available yet. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export interface ImagenGCSImage | ||
``` | ||
|
||
## Properties | ||
|
||
| Property | Type | Description | | ||
| --- | --- | --- | | ||
| [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 <code>"image/png"</code> or <code>"image/jpeg"</code>.<!-- -->To request a different format, set the <code>imageFormat</code> property in your <code>[ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface)</code>. | | ||
|
||
## ImagenGCSImage.gcsURI | ||
|
||
The URI of the file stored in a Cloud Storage for Firebase bucket. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
gcsURI: string; | ||
``` | ||
|
||
### Example | ||
|
||
`"gs://bucket-name/path/sample_0.jpg"`<!-- -->. | ||
|
||
## ImagenGCSImage.mimeType | ||
|
||
The MIME type of the image; either `"image/png"` or `"image/jpeg"`<!-- -->. | ||
|
||
To request a different format, set the `imageFormat` property in your <code>[ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface)</code>. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
mimeType: string; | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
Project: /docs/reference/js/_project.yaml | ||
Book: /docs/reference/_book.yaml | ||
page_type: reference | ||
|
||
{% comment %} | ||
DO NOT EDIT THIS FILE! | ||
This is generated by the JS SDK team, and any local changes will be | ||
overwritten. Changes should be made in the source code at | ||
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. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export interface ImagenGenerationConfig | ||
``` | ||
|
||
## Properties | ||
|
||
| Property | Type | Description | | ||
| --- | --- | --- | | ||
| [addWatermark](./vertexai.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"><code>addWatermark</code></a> documentation for more details. | | ||
| [aspectRatio](./vertexai.imagengenerationconfig.md#imagengenerationconfigaspectratio) | [ImagenAspectRatio](./vertexai.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 <code>[ImagenAspectRatio](./vertexai.md#imagenaspectratio)</code> for more details. | | ||
| [imageFormat](./vertexai.imagengenerationconfig.md#imagengenerationconfigimageformat) | [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) | <b><i>(Public Preview)</i></b> The image format of the generated images. The default is PNG.<!-- -->See <code>[ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class)</code> for more details. | | ||
| [negativePrompt](./vertexai.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. | | ||
| [numberOfImages](./vertexai.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"><code>sampleCount</code></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. | ||
|
||
For Imagen 3 models, the default value is `true`<!-- -->; see the <a href="http://firebase.google.com/docs/vertex-ai/model-parameters#imagen"><code>addWatermark</code></a> documentation for more details. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
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 <code>[ImagenAspectRatio](./vertexai.md#imagenaspectratio)</code> for more details. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
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 <code>[ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class)</code> for more details. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
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. | ||
|
||
See the [documentation](http://firebase.google.com/docs/vertex-ai/model-parameters#imagen) for more details. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
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"><code>sampleCount</code></a> documentation for more details. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
numberOfImages?: number; | ||
``` |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.