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
4 changes: 3 additions & 1 deletion ai-logic/firebase-ai/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Unreleased

- [deprecated] All Imagen models are deprecated and will shut down as early as June 2026.
As a replacement, you can [migrate your apps to use Gemini Image models (the "Nano Banana" models)](https://firebase.google.com/docs/ai-logic/imagen-models-migration).
- [feature] Added support for Chat interactions using server prompt templates (#7986)
- [fixed] Fixed an issue causing network timeouts to throw the incorrect exception type, instead of
`RequestTimeoutException` (#7966)
- [fixed] Fixed missing `toString()` implemenation for `InferenceSource` (#7970)
- [fixed] Fixed missing `toString()` implementation for `InferenceSource` (#7970)
- [fixed] Fixed an issue causing the SDK to throw an exception if an unknown message was received
from the LiveAPI model, instead of ignoring it (#7975)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ import com.google.firebase.auth.internal.InternalAuthProvider
*
* See the documentation for a list of
* [supported models](https://firebase.google.com/docs/ai-logic/models).
*
* @deprecated **Deprecation Notice:** All Imagen models are deprecated and will shut down as early
* as June 2026. As a replacement, you can
* [migrate your apps to use Gemini Image models (the 'Nano Banana' models)](https://firebase.google.com/docs/ai-logic/imagen-models-migration)
*/
public class ImagenModel
internal constructor(
Expand Down Expand Up @@ -86,6 +90,10 @@ internal constructor(
* Generates an image, returning the result directly to the caller.
*
* @param prompt The input(s) given to the model as a prompt.
*
* @deprecated **Deprecation Notice:** All Imagen models are deprecated and will shut down as
* early as June 2026. As a replacement, you can
* [migrate your apps to use Gemini Image models (the 'Nano Banana' models)](https://firebase.google.com/docs/ai-logic/imagen-models-migration)
*/
public suspend fun generateImages(prompt: String): ImagenGenerationResponse<ImagenInlineImage> =
try {
Expand All @@ -104,6 +112,10 @@ internal constructor(
* @param referenceImages the image inputs given to the model as a prompt
* @param prompt the text input given to the model as a prompt
* @param config the editing configuration settings
*
* @deprecated **Deprecation Notice:** All Imagen models are deprecated and will shut down as
* early as June 2026. As a replacement, you can
* [migrate your apps to use Gemini Image models (the 'Nano Banana' models)](https://firebase.google.com/docs/ai-logic/imagen-models-migration)
*/
@PublicPreviewAPI
public suspend fun editImage(
Expand All @@ -129,6 +141,10 @@ internal constructor(
* @param prompt the text input given to the model as a prompt
* @param mask the mask which defines where in the image can be painted by Imagen.
* @param config the editing configuration settings, it should include an [ImagenEditMode]
*
* @deprecated **Deprecation Notice:** All Imagen models are deprecated and will shut down as
* early as June 2026. As a replacement, you can
* [migrate your apps to use Gemini Image models (the 'Nano Banana' models)](https://firebase.google.com/docs/ai-logic/imagen-models-migration)
*/
@PublicPreviewAPI
public suspend fun inpaintImage(
Expand All @@ -154,6 +170,10 @@ internal constructor(
* insufficient
* @param config the editing configuration settings
* @see [ImagenMaskReference.generateMaskAndPadForOutpainting]
*
* @deprecated **Deprecation Notice:** All Imagen models are deprecated and will shut down as
* early as June 2026. As a replacement, you can
* [migrate your apps to use Gemini Image models (the 'Nano Banana' models)](https://firebase.google.com/docs/ai-logic/imagen-models-migration)
*/
@PublicPreviewAPI
public suspend fun outpaintImage(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,21 @@ import com.google.firebase.ai.type.PublicPreviewAPI
* Wrapper class providing Java compatible methods for [ImagenModel].
*
* @see [ImagenModel]
*
* @deprecated **Deprecation Notice:** All Imagen models are deprecated and will shut down as early
* as June 2026. As a replacement, you can
* [migrate your apps to use Gemini Image models (the 'Nano Banana' models)](https://firebase.google.com/docs/ai-logic/imagen-models-migration)
*/
@PublicPreviewAPI
public abstract class ImagenModelFutures internal constructor() {
/**
* Generates an image, returning the result directly to the caller.
*
* @param prompt The main text prompt from which the image is generated.
*
* @deprecated **Deprecation Notice:** All Imagen models are deprecated and will shut down as
* early as June 2026. As a replacement, you can
* [migrate your apps to use Gemini Image models (the 'Nano Banana' models)](https://firebase.google.com/docs/ai-logic/imagen-models-migration)
*/
public abstract fun generateImages(
prompt: String,
Expand All @@ -52,6 +60,10 @@ public abstract class ImagenModelFutures internal constructor() {
* @param prompt the text input given to the model as a prompt
* @param referenceImages the image inputs given to the model as a prompt
* @param config the editing configuration settings
*
* @deprecated **Deprecation Notice:** All Imagen models are deprecated and will shut down as
* early as June 2026. As a replacement, you can
* [migrate your apps to use Gemini Image models (the 'Nano Banana' models)](https://firebase.google.com/docs/ai-logic/imagen-models-migration)
*/
public abstract fun editImage(
referenceImages: List<ImagenReferenceImage>,
Expand All @@ -65,6 +77,10 @@ public abstract class ImagenModelFutures internal constructor() {
*
* @param prompt the text input given to the model as a prompt
* @param referenceImages the image inputs given to the model as a prompt
*
* @deprecated **Deprecation Notice:** All Imagen models are deprecated and will shut down as
* early as June 2026. As a replacement, you can
* [migrate your apps to use Gemini Image models (the 'Nano Banana' models)](https://firebase.google.com/docs/ai-logic/imagen-models-migration)
*/
public abstract fun editImage(
referenceImages: List<ImagenReferenceImage>,
Expand All @@ -78,6 +94,10 @@ public abstract class ImagenModelFutures internal constructor() {
* @param prompt the text input given to the model as a prompt
* @param mask the mask which defines where in the image can be painted by imagen.
* @param config the editing configuration settings, it should include an [ImagenEditMode]
*
* @deprecated **Deprecation Notice:** All Imagen models are deprecated and will shut down as
* early as June 2026. As a replacement, you can
* [migrate your apps to use Gemini Image models (the 'Nano Banana' models)](https://firebase.google.com/docs/ai-logic/imagen-models-migration)
*/
public abstract fun inpaintImage(
image: ImagenInlineImage,
Expand All @@ -99,6 +119,10 @@ public abstract class ImagenModelFutures internal constructor() {
* insufficient
* @param config the editing configuration settings
* @see [ImagenMaskReference.generateMaskAndPadForOutpainting]
*
* @deprecated **Deprecation Notice:** All Imagen models are deprecated and will shut down as
* early as June 2026. As a replacement, you can
* [migrate your apps to use Gemini Image models (the 'Nano Banana' models)](https://firebase.google.com/docs/ai-logic/imagen-models-migration)
*/
public abstract fun outpaintImage(
image: ImagenInlineImage,
Expand All @@ -108,7 +132,13 @@ public abstract class ImagenModelFutures internal constructor() {
config: ImagenEditingConfig? = null,
): ListenableFuture<ImagenGenerationResponse<ImagenInlineImage>>

/** Returns the [ImagenModel] object wrapped by this object. */
/**
* Returns the [ImagenModel] object wrapped by this object.
*
* @deprecated **Deprecation Notice:** All Imagen models are deprecated and will shut down as
* early as June 2026. As a replacement, you can
* [migrate your apps to use Gemini Image models (the 'Nano Banana' models)](https://firebase.google.com/docs/ai-logic/imagen-models-migration)
*/
public abstract fun getImageModel(): ImagenModel

private class FuturesImpl(private val model: ImagenModel) : ImagenModelFutures() {
Expand Down Expand Up @@ -154,7 +184,13 @@ public abstract class ImagenModelFutures internal constructor() {

public companion object {

/** @return a [ImagenModelFutures] created around the provided [ImagenModel] */
/**
* @return a [ImagenModelFutures] created around the provided [ImagenModel]
*
* @deprecated **Deprecation Notice:** All Imagen models are deprecated and will shut down as
* early as June 2026. As a replacement, you can
* [migrate your apps to use Gemini Image models (the 'Nano Banana' models)](https://firebase.google.com/docs/ai-logic/imagen-models-migration)
*/
@JvmStatic public fun from(model: ImagenModel): ImagenModelFutures = FuturesImpl(model)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@

package com.google.firebase.ai.type

/** Represents the aspect ratio that the generated image should conform to. */
/**
* Represents the aspect ratio that the generated image should conform to.
*
* @deprecated **Deprecation Notice:** All Imagen models are deprecated and will shut down as early
* as June 2026. As a replacement, you can
* [migrate your apps to use Gemini Image models (the 'Nano Banana' models)](https://firebase.google.com/docs/ai-logic/imagen-models-migration)
*/
public class ImagenAspectRatio private constructor(internal val internalVal: String) {
public companion object {
/** A square image, useful for icons, profile pictures, etc. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@
*/
package com.google.firebase.ai.type

/** Represents a control type for controlled Imagen generation/editing */
/**
* Represents a control type for controlled Imagen generation/editing
*
* @deprecated **Deprecation Notice:** All Imagen models are deprecated and will shut down as early
* as June 2026. As a replacement, you can
* [migrate your apps to use Gemini Image models (the 'Nano Banana' models)](https://firebase.google.com/docs/ai-logic/imagen-models-migration)
*/
public class ImagenControlType internal constructor(internal val value: String) {
public companion object {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@
*/
package com.google.firebase.ai.type

/** Represents the edit mode for Imagen */
/**
* Represents the edit mode for Imagen
*
* @deprecated **Deprecation Notice:** All Imagen models are deprecated and will shut down as early
* as June 2026. As a replacement, you can
* [migrate your apps to use Gemini Image models (the 'Nano Banana' models)](https://firebase.google.com/docs/ai-logic/imagen-models-migration)
*/
public class ImagenEditMode private constructor(internal val value: String) {

public companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ import kotlinx.serialization.Serializable
* Contains the editing settings which are not specific to a reference image
* @param editMode holds the editing mode if the request is for inpainting or outpainting
* @param editSteps the number of intermediate steps to include in the editing process
*
* @deprecated **Deprecation Notice:** All Imagen models are deprecated and will shut down as early
* as June 2026. As a replacement, you can
* [migrate your apps to use Gemini Image models (the 'Nano Banana' models)](https://firebase.google.com/docs/ai-logic/imagen-models-migration)
*/
@PublicPreviewAPI
public class ImagenEditingConfig(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ package com.google.firebase.ai.type
* @param aspectRatio The aspect ratio of the generated images.
* @param imageFormat The file format/compression of the generated images.
* @param addWatermark Adds an invisible watermark to mark the image as AI generated.
*
* @deprecated **Deprecation Notice:** All Imagen models are deprecated and will shut down as early
* as June 2026. As a replacement, you can
* [migrate your apps to use Gemini Image models (the 'Nano Banana' models)](https://firebase.google.com/docs/ai-logic/imagen-models-migration)
*/
import kotlin.jvm.JvmField

Expand All @@ -40,6 +44,10 @@ public class ImagenGenerationConfig(
*
* This is mainly intended for Java interop. For Kotlin, use [imagenGenerationConfig] for a more
* idiomatic experience.
*
* @deprecated **Deprecation Notice:** All Imagen models are deprecated and will shut down as
* early as June 2026. As a replacement, you can
* [migrate your apps to use Gemini Image models (the 'Nano Banana' models)](https://firebase.google.com/docs/ai-logic/imagen-models-migration)
*/
public class Builder {
@JvmField public var negativePrompt: String? = null
Expand All @@ -48,27 +56,57 @@ public class ImagenGenerationConfig(
@JvmField public var imageFormat: ImagenImageFormat? = null
@JvmField public var addWatermark: Boolean? = null

/** See [ImagenGenerationConfig.negativePrompt]. */
/**
* See [ImagenGenerationConfig.negativePrompt].
*
* @deprecated **Deprecation Notice:** All Imagen models are deprecated and will shut down as
* early as June 2026. As a replacement, you can
* [migrate your apps to use Gemini Image models (the 'Nano Banana' models)](https://firebase.google.com/docs/ai-logic/imagen-models-migration)
*/
public fun setNegativePrompt(negativePrompt: String): Builder = apply {
this.negativePrompt = negativePrompt
}

/** See [ImagenGenerationConfig.numberOfImages]. */
/**
* See [ImagenGenerationConfig.numberOfImages].
*
* @deprecated **Deprecation Notice:** All Imagen models are deprecated and will shut down as
* early as June 2026. As a replacement, you can
* [migrate your apps to use Gemini Image models (the 'Nano Banana' models)](https://firebase.google.com/docs/ai-logic/imagen-models-migration)
*/
public fun setNumberOfImages(numberOfImages: Int): Builder = apply {
this.numberOfImages = numberOfImages
}

/** See [ImagenGenerationConfig.aspectRatio]. */
/**
* See [ImagenGenerationConfig.aspectRatio].
*
* @deprecated **Deprecation Notice:** All Imagen models are deprecated and will shut down as
* early as June 2026. As a replacement, you can
* [migrate your apps to use Gemini Image models (the 'Nano Banana' models)](https://firebase.google.com/docs/ai-logic/imagen-models-migration)
*/
public fun setAspectRatio(aspectRatio: ImagenAspectRatio): Builder = apply {
this.aspectRatio = aspectRatio
}

/** See [ImagenGenerationConfig.imageFormat]. */
/**
* See [ImagenGenerationConfig.imageFormat].
*
* @deprecated **Deprecation Notice:** All Imagen models are deprecated and will shut down as
* early as June 2026. As a replacement, you can
* [migrate your apps to use Gemini Image models (the 'Nano Banana' models)](https://firebase.google.com/docs/ai-logic/imagen-models-migration)
*/
public fun setImageFormat(imageFormat: ImagenImageFormat): Builder = apply {
this.imageFormat = imageFormat
}

/** See [ImagenGenerationConfig.addWatermark]. */
/**
* See [ImagenGenerationConfig.addWatermark].
*
* @deprecated **Deprecation Notice:** All Imagen models are deprecated and will shut down as
* early as June 2026. As a replacement, you can
* [migrate your apps to use Gemini Image models (the 'Nano Banana' models)](https://firebase.google.com/docs/ai-logic/imagen-models-migration)
*/
public fun setAddWatermark(addWatermark: Boolean): Builder = apply {
this.addWatermark = addWatermark
}
Expand All @@ -78,6 +116,10 @@ public class ImagenGenerationConfig(
* ```
* val config = GenerationConfig.builder()
* ```
*
* @deprecated **Deprecation Notice:** All Imagen models are deprecated and will shut down as
* early as June 2026. As a replacement, you can
* [migrate your apps to use Gemini Image models (the 'Nano Banana' models)](https://firebase.google.com/docs/ai-logic/imagen-models-migration)
*/
public fun build(): ImagenGenerationConfig =
ImagenGenerationConfig(
Expand Down Expand Up @@ -107,6 +149,10 @@ public class ImagenGenerationConfig(
* addWatermark = false
* }
* ```
*
* @deprecated **Deprecation Notice:** All Imagen models are deprecated and will shut down as early
* as June 2026. As a replacement, you can
* [migrate your apps to use Gemini Image models (the 'Nano Banana' models)](https://firebase.google.com/docs/ai-logic/imagen-models-migration)
*/
public fun imagenGenerationConfig(
init: ImagenGenerationConfig.Builder.() -> Unit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ import kotlinx.serialization.Serializable
* @param images contains the generated images
* @param filteredReason if fewer images were generated than were requested, this field will contain
* the reason they were filtered out.
*
* @deprecated **Deprecation Notice:** All Imagen models are deprecated and will shut down as early
* as June 2026. As a replacement, you can
* [migrate your apps to use Gemini Image models (the 'Nano Banana' models)](https://firebase.google.com/docs/ai-logic/imagen-models-migration)
*/
public class ImagenGenerationResponse<T>
internal constructor(public val images: List<T>, public val filteredReason: String?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ import kotlinx.serialization.Serializable
* @param compressionQuality an int (1-100) representing the quality of the image; a lower number
* means the image is permitted to be lower quality to reduce size. This parameter is not relevant
* for every MIME type.
*
* @deprecated **Deprecation Notice:** All Imagen models are deprecated and will shut down as early
* as June 2026. As a replacement, you can
* [migrate your apps to use Gemini Image models (the 'Nano Banana' models)](https://firebase.google.com/docs/ai-logic/imagen-models-migration)
*/
public class ImagenImageFormat
private constructor(public val mimeType: String, public val compressionQuality: Int?) {
Expand All @@ -39,13 +43,23 @@ private constructor(public val mimeType: String, public val compressionQuality:
*
* @param compressionQuality an int (1-100) representing the quality of the image; a lower
* number means the image is permitted to be lower quality to reduce size.
*
* @deprecated **Deprecation Notice:** All Imagen models are deprecated and will shut down as
* early as June 2026. As a replacement, you can
* [migrate your apps to use Gemini Image models (the 'Nano Banana' models)](https://firebase.google.com/docs/ai-logic/imagen-models-migration)
*/
@JvmStatic
public fun jpeg(compressionQuality: Int? = null): ImagenImageFormat {
return ImagenImageFormat("image/jpeg", compressionQuality)
}

/** An [ImagenImageFormat] representing a PNG image */
/**
* An [ImagenImageFormat] representing a PNG image
*
* @deprecated **Deprecation Notice:** All Imagen models are deprecated and will shut down as
* early as June 2026. As a replacement, you can
* [migrate your apps to use Gemini Image models (the 'Nano Banana' models)](https://firebase.google.com/docs/ai-logic/imagen-models-migration)
*/
@JvmStatic
public fun png(): ImagenImageFormat {
return ImagenImageFormat("image/png", null)
Expand Down
Loading
Loading