diff --git a/ai-logic/firebase-ai/CHANGELOG.md b/ai-logic/firebase-ai/CHANGELOG.md index ad7be4a8513..cb69d77093c 100644 --- a/ai-logic/firebase-ai/CHANGELOG.md +++ b/ai-logic/firebase-ai/CHANGELOG.md @@ -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) diff --git a/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/ImagenModel.kt b/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/ImagenModel.kt index c562ea0233b..d16a528fb49 100644 --- a/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/ImagenModel.kt +++ b/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/ImagenModel.kt @@ -44,7 +44,12 @@ 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) */ +@Deprecated("All Imagen models are deprecated.") public class ImagenModel internal constructor( private val modelName: String, @@ -86,7 +91,12 @@ 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) */ + @Deprecated("All Imagen models are deprecated.") public suspend fun generateImages(prompt: String): ImagenGenerationResponse = try { controller @@ -104,7 +114,12 @@ 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) */ + @Deprecated("All Imagen models are deprecated.") @PublicPreviewAPI public suspend fun editImage( referenceImages: List, @@ -129,7 +144,12 @@ 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) */ + @Deprecated("All Imagen models are deprecated.") @PublicPreviewAPI public suspend fun inpaintImage( image: ImagenInlineImage, @@ -154,7 +174,12 @@ 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) */ + @Deprecated("All Imagen models are deprecated.") @PublicPreviewAPI public suspend fun outpaintImage( image: ImagenInlineImage, diff --git a/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/java/ImagenModelFutures.kt b/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/java/ImagenModelFutures.kt index 2f0299da406..ccbc7b8d8f2 100644 --- a/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/java/ImagenModelFutures.kt +++ b/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/java/ImagenModelFutures.kt @@ -33,14 +33,24 @@ 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) */ +@Deprecated("All Imagen models are deprecated.") @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) */ + @Deprecated("All Imagen models are deprecated.") public abstract fun generateImages( prompt: String, ): ListenableFuture> @@ -52,7 +62,12 @@ 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) */ + @Deprecated("All Imagen models are deprecated.") public abstract fun editImage( referenceImages: List, prompt: String, @@ -65,7 +80,12 @@ 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) */ + @Deprecated("All Imagen models are deprecated.") public abstract fun editImage( referenceImages: List, prompt: String, @@ -78,7 +98,12 @@ 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) */ + @Deprecated("All Imagen models are deprecated.") public abstract fun inpaintImage( image: ImagenInlineImage, prompt: String, @@ -99,7 +124,12 @@ 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) */ + @Deprecated("All Imagen models are deprecated.") public abstract fun outpaintImage( image: ImagenInlineImage, newDimensions: Dimensions, @@ -108,8 +138,14 @@ public abstract class ImagenModelFutures internal constructor() { config: ImagenEditingConfig? = null, ): ListenableFuture> - /** Returns the [ImagenModel] object wrapped by this object. */ - public abstract fun getImageModel(): ImagenModel + /** + * 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) + */ + @Deprecated("All Imagen models are deprecated.") public abstract fun getImageModel(): ImagenModel private class FuturesImpl(private val model: ImagenModel) : ImagenModelFutures() { override fun generateImages( @@ -154,7 +190,15 @@ public abstract class ImagenModelFutures internal constructor() { public companion object { - /** @return a [ImagenModelFutures] created around the provided [ImagenModel] */ - @JvmStatic public fun from(model: ImagenModel): ImagenModelFutures = FuturesImpl(model) + /** + * @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) + */ + @Deprecated("All Imagen models are deprecated.") + @JvmStatic + public fun from(model: ImagenModel): ImagenModelFutures = FuturesImpl(model) } } diff --git a/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenAspectRatio.kt b/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenAspectRatio.kt index a5d5e22fca3..f67896a11c8 100644 --- a/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenAspectRatio.kt +++ b/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenAspectRatio.kt @@ -16,7 +16,14 @@ 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) + */ +@Deprecated("All Imagen models are deprecated.") public class ImagenAspectRatio private constructor(internal val internalVal: String) { public companion object { /** A square image, useful for icons, profile pictures, etc. */ diff --git a/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenControlType.kt b/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenControlType.kt index 6d0bf1a98ab..a770e6e84ff 100644 --- a/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenControlType.kt +++ b/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenControlType.kt @@ -15,7 +15,14 @@ */ 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) + */ +@Deprecated("All Imagen models are deprecated.") public class ImagenControlType internal constructor(internal val value: String) { public companion object { diff --git a/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenEditMode.kt b/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenEditMode.kt index 6be2b44baab..b80ab24565d 100644 --- a/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenEditMode.kt +++ b/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenEditMode.kt @@ -15,7 +15,14 @@ */ 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) + */ +@Deprecated("All Imagen models are deprecated.") public class ImagenEditMode private constructor(internal val value: String) { public companion object { diff --git a/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenEditingConfig.kt b/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenEditingConfig.kt index 60e54261c1e..eeb35ea4c54 100644 --- a/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenEditingConfig.kt +++ b/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenEditingConfig.kt @@ -21,7 +21,12 @@ 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) */ +@Deprecated("All Imagen models are deprecated.") @PublicPreviewAPI public class ImagenEditingConfig( internal val editMode: ImagenEditMode? = null, diff --git a/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenGenerationConfig.kt b/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenGenerationConfig.kt index 1b4407a12a6..db00a0ed383 100644 --- a/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenGenerationConfig.kt +++ b/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenGenerationConfig.kt @@ -25,9 +25,14 @@ 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 +@Deprecated("All Imagen models are deprecated.") public class ImagenGenerationConfig( public val negativePrompt: String? = null, public val numberOfImages: Int? = 1, @@ -40,7 +45,12 @@ 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) */ + @Deprecated("All Imagen models are deprecated.") public class Builder { @JvmField public var negativePrompt: String? = null @JvmField public var numberOfImages: Int? = 1 @@ -48,27 +58,62 @@ 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) + */ + @Deprecated("All Imagen models are deprecated.") 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) + */ + @Deprecated("All Imagen models are deprecated.") 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) + */ + @Deprecated("All Imagen models are deprecated.") 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) + */ + @Deprecated("All Imagen models are deprecated.") 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) + */ + @Deprecated("All Imagen models are deprecated.") public fun setAddWatermark(addWatermark: Boolean): Builder = apply { this.addWatermark = addWatermark } @@ -78,7 +123,12 @@ 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) */ + @Deprecated("All Imagen models are deprecated.") public fun build(): ImagenGenerationConfig = ImagenGenerationConfig( negativePrompt = negativePrompt, @@ -107,7 +157,12 @@ 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) */ +@Deprecated("All Imagen models are deprecated.") public fun imagenGenerationConfig( init: ImagenGenerationConfig.Builder.() -> Unit ): ImagenGenerationConfig { diff --git a/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenGenerationResponse.kt b/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenGenerationResponse.kt index f8956eafab2..4dbd9c19972 100644 --- a/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenGenerationResponse.kt +++ b/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenGenerationResponse.kt @@ -26,7 +26,12 @@ 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) */ +@Deprecated("All Imagen models are deprecated.") public class ImagenGenerationResponse internal constructor(public val images: List, public val filteredReason: String?) { diff --git a/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenImageFormat.kt b/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenImageFormat.kt index f9bfc40575c..250c4b56b3b 100644 --- a/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenImageFormat.kt +++ b/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenImageFormat.kt @@ -25,7 +25,12 @@ 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) */ +@Deprecated("All Imagen models are deprecated.") public class ImagenImageFormat private constructor(public val mimeType: String, public val compressionQuality: Int?) { @@ -39,13 +44,25 @@ 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) */ + @Deprecated("All Imagen models are deprecated.") @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) + */ + @Deprecated("All Imagen models are deprecated.") @JvmStatic public fun png(): ImagenImageFormat { return ImagenImageFormat("image/png", null) diff --git a/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenImagePlacement.kt b/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenImagePlacement.kt index db003a15344..65d373743b3 100644 --- a/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenImagePlacement.kt +++ b/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenImagePlacement.kt @@ -18,7 +18,12 @@ package com.google.firebase.ai.type /** * Represents where the placement of an image is within a new, larger image, usually in the context * of an outpainting request. + * + * @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) */ +@Deprecated("All Imagen models are deprecated.") public class ImagenImagePlacement private constructor(public val x: Int? = null, public val y: Int? = null) { @@ -72,7 +77,12 @@ private constructor(public val x: Int? = null, public val y: Int? = null) { * coordinates represent the location of the top left corner of the original image. * @param x the x coordinate of the top left corner of the original image * @param y the y coordinate of the top left corner of the original 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) */ + @Deprecated("All Imagen models are deprecated.") @JvmStatic public fun fromCoordinate(x: Int, y: Int): ImagenImagePlacement { return ImagenImagePlacement(x, y) diff --git a/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenInlineImage.kt b/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenInlineImage.kt index ccf084d6aa7..bc751c83474 100644 --- a/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenInlineImage.kt +++ b/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenInlineImage.kt @@ -28,7 +28,12 @@ import kotlinx.serialization.Serializable * @property data The raw image bytes in JPEG or PNG format, as specified by [mimeType]. * @property mimeType The IANA standard MIME type of the image data; either `"image/png"` or * `"image/jpeg"`; to request a different format, 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) */ +@Deprecated("All Imagen models are deprecated.") public class ImagenInlineImage internal constructor( public val data: ByteArray, @@ -37,7 +42,12 @@ internal constructor( /** * Returns the image as an Android OS native [Bitmap] so that it can be saved or sent to the UI. + * + * @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) */ + @Deprecated("All Imagen models are deprecated.") public fun asBitmap(): Bitmap { return BitmapFactory.decodeByteArray(data, 0, data.size) } @@ -50,6 +60,14 @@ internal constructor( } } +/** + * Helper method to convert an Android bitmap to an Imagen inline data 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) + */ +@Deprecated("All Imagen models are deprecated.") @PublicPreviewAPI public fun Bitmap.toImagenInlineImage(): ImagenInlineImage { val byteArrayOutputStream = ByteArrayOutputStream() diff --git a/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenPersonFilterLevel.kt b/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenPersonFilterLevel.kt index baecec0cfb4..122dbd247e5 100644 --- a/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenPersonFilterLevel.kt +++ b/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenPersonFilterLevel.kt @@ -16,7 +16,14 @@ package com.google.firebase.ai.type -/** A filter used to prevent images from containing depictions of children or people. */ +/** + * A filter used to prevent images from containing depictions of children or people. + * + * @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) + */ +@Deprecated("All Imagen models are deprecated.") public class ImagenPersonFilterLevel private constructor(internal val internalVal: String) { public companion object { /** diff --git a/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenReferenceImage.kt b/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenReferenceImage.kt index 59eb927e687..1bbd64c47e6 100644 --- a/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenReferenceImage.kt +++ b/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenReferenceImage.kt @@ -23,7 +23,14 @@ import android.graphics.Rect import com.google.firebase.ai.common.GenerateImageRequest import kotlinx.serialization.Serializable -/** Represents an reference image for an Imagen editing request */ +/** + * Represents an reference image for an Imagen editing request + * + * @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) + */ +@Deprecated("All Imagen models are deprecated.") @PublicPreviewAPI public abstract class ImagenReferenceImage internal constructor( @@ -85,7 +92,12 @@ internal constructor( * the generated referenced image * @param superpixelRuler if type is [ImagenControlType.COLOR_SUPERPIXEL] and [enableComputation] is * true, this will control the superpixel smoothness factor for the generated referenced 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) */ +@Deprecated("All Imagen models are deprecated.") @PublicPreviewAPI public class ImagenControlReference( type: ImagenControlType, @@ -105,7 +117,12 @@ public class ImagenControlReference( /** * Represents a mask for Imagen editing. This image (generated or provided) should contain only * black and white pixels, with black representing parts of the image which should not change. + * + * @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) */ +@Deprecated("All Imagen models are deprecated.") @PublicPreviewAPI public abstract class ImagenMaskReference internal constructor(maskConfig: ImagenMaskConfig, image: ImagenInlineImage? = null) : @@ -124,7 +141,12 @@ internal constructor(maskConfig: ImagenMaskConfig, image: ImagenInlineImage? = n * @param newDimensions the new dimensions for outpainting. These new dimensions *must* be more * than the original image. * @param newPosition the placement of the original image within the new outpainted 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) */ + @Deprecated("All Imagen models are deprecated.") @JvmOverloads @JvmStatic public fun generateMaskAndPadForOutpainting( @@ -147,7 +169,12 @@ internal constructor(maskConfig: ImagenMaskConfig, image: ImagenInlineImage? = n * than the original image. * @param newPosition the placement of the original image within the new outpainted image. * @param dilation the dilation for the outpainting mask. See: [ImagenRawMask]. + * + * @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) */ + @Deprecated("All Imagen models are deprecated.") @JvmStatic public fun generateMaskAndPadForOutpainting( image: ImagenInlineImage, @@ -214,7 +241,12 @@ internal constructor(maskConfig: ImagenMaskConfig, image: ImagenInlineImage? = n * white, and the foreground black * @param dilation the amount to dilate the mask. This can help smooth the borders of an edit and * make it seem more convincing. For example, `0.05` will dilate the mask 5%. + * + * @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) */ +@Deprecated("All Imagen models are deprecated.") @PublicPreviewAPI public class ImagenBackgroundMask(dilation: Double? = null) : ImagenMaskReference(maskConfig = ImagenMaskConfig(ImagenMaskMode.BACKGROUND, dilation)) {} @@ -224,7 +256,12 @@ public class ImagenBackgroundMask(dilation: Double? = null) : * black, and the foreground white * @param dilation the amount to dilate the mask. This can help smooth the borders of an edit and * make it seem more convincing. For example, `0.05` will dilate the mask 5%. + * + * @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) */ +@Deprecated("All Imagen models are deprecated.") @PublicPreviewAPI public class ImagenForegroundMask(dilation: Double? = null) : ImagenMaskReference(maskConfig = ImagenMaskConfig(ImagenMaskMode.FOREGROUND, dilation)) {} @@ -236,7 +273,12 @@ public class ImagenForegroundMask(dilation: Double? = null) : * @param mask the mask image * @param dilation the amount to dilate the mask. This can help smooth the borders of an edit and * make it seem more convincing. For example, `0.05` will dilate the mask 5%. + * + * @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) */ +@Deprecated("All Imagen models are deprecated.") @PublicPreviewAPI public class ImagenRawMask(mask: ImagenInlineImage, dilation: Double? = null) : ImagenMaskReference( @@ -252,7 +294,12 @@ public class ImagenRawMask(mask: ImagenInlineImage, dilation: Double? = null) : * in the Vertex AI documentation. * @param dilation the amount to dilate the mask. This can help smooth the borders of an edit and * make it seem more convincing. For example, `0.05` will dilate the mask 5%. + * + * @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) */ +@Deprecated("All Imagen models are deprecated.") @PublicPreviewAPI public class ImagenSemanticMask(classes: List, dilation: Double? = null) : ImagenMaskReference(maskConfig = ImagenMaskConfig(ImagenMaskMode.SEMANTIC, dilation, classes)) {} @@ -260,7 +307,12 @@ public class ImagenSemanticMask(classes: List, dilation: Double? = null) : /** * Represents a base image for Imagen editing * @param image the 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) */ +@Deprecated("All Imagen models are deprecated.") @PublicPreviewAPI public class ImagenRawImage(image: ImagenInlineImage) : ImagenReferenceImage(image = image) {} @@ -269,7 +321,12 @@ public class ImagenRawImage(image: ImagenInlineImage) : ImagenReferenceImage(ima * @param image the image representing the style you want to transfer to your original images * @param referenceId the reference ID you can use to reference this style in your prompt * @param description the description you can use to reference this style in your 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) */ +@Deprecated("All Imagen models are deprecated.") @PublicPreviewAPI public class ImagenStyleReference( image: ImagenInlineImage, @@ -288,7 +345,12 @@ public class ImagenStyleReference( * @param referenceId the reference ID you can use to reference this subject in your prompt * @param description the description you can use to reference this subject in your prompt * @param subjectType the type of the subject + * + * @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) */ +@Deprecated("All Imagen models are deprecated.") @PublicPreviewAPI public class ImagenSubjectReference( image: ImagenInlineImage, diff --git a/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenSafetyFilterLevel.kt b/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenSafetyFilterLevel.kt index 6ac34e96fd3..39ee932c3dd 100644 --- a/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenSafetyFilterLevel.kt +++ b/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenSafetyFilterLevel.kt @@ -16,7 +16,14 @@ package com.google.firebase.ai.type -/** Used for safety filtering. */ +/** + * Used for safety filtering. + * + * @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) + */ +@Deprecated("All Imagen models are deprecated.") public class ImagenSafetyFilterLevel private constructor(internal val internalVal: String) { public companion object { /** Strongest filtering level, most strict blocking. */ diff --git a/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenSafetySettings.kt b/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenSafetySettings.kt index fe13234321f..89e0eea3bd0 100644 --- a/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenSafetySettings.kt +++ b/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenSafetySettings.kt @@ -21,6 +21,10 @@ package com.google.firebase.ai.type * * @param safetyFilterLevel Used to filter unsafe content. * @param personFilterLevel Used to filter images containing people. + * + * @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 ImagenSafetySettings( internal val safetyFilterLevel: ImagenSafetyFilterLevel, diff --git a/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenSubjectReferenceType.kt b/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenSubjectReferenceType.kt index dfe77f9adf5..b8b54f03f73 100644 --- a/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenSubjectReferenceType.kt +++ b/ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/ImagenSubjectReferenceType.kt @@ -15,7 +15,14 @@ */ package com.google.firebase.ai.type -/** Represents a type for a subject reference, specifying how it should be interpreted. */ +/** + * Represents a type for a subject reference, specifying how it should be interpreted. + * + * @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) + */ +@Deprecated("All Imagen models are deprecated.") public class ImagenSubjectReferenceType private constructor(internal val value: String) { public companion object {