Skip to content

Commit

Permalink
Add @experimental annotation for imagen apis (#17149)
Browse files Browse the repository at this point in the history
Co-authored-by: Russell Wheatley <russellwheatley85@gmail.com>
  • Loading branch information
cynthiajoan and russellwheatley authored Mar 4, 2025
1 parent bb13127 commit 6c0eb6c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart'
show FirebasePluginPlatform;
import 'package:meta/meta.dart';

import 'api.dart';
import 'content.dart';
Expand Down Expand Up @@ -117,6 +118,7 @@ class FirebaseVertexAI extends FirebasePluginPlatform {
///
/// The optional [safetySettings] can be used to control and guide the
/// generation. See [ImagenSafetySettings] for details.
@experimental
ImagenModel imagenModel(
{required String model,
ImagenGenerationConfig? generationConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import 'package:meta/meta.dart';

/// Specifies the level of safety filtering for image generation.
///
/// If not specified, default will be "block_medium_and_above".
@experimental
enum ImagenSafetyFilterLevel {
/// Strongest filtering level, most strict blocking.
blockLowAndAbove('block_low_and_above'),
Expand Down Expand Up @@ -56,6 +58,7 @@ enum ImagenSafetyFilterLevel {
/// Allow generation of people by the model.
///
/// If not specified, the default value is "allow_adult".
@experimental
enum ImagenPersonFilterLevel {
/// Disallow the inclusion of people or faces in images.
blockAll('dont_allow'),
Expand Down Expand Up @@ -91,6 +94,7 @@ enum ImagenPersonFilterLevel {
/// A class representing safety settings for image generation.
///
/// It includes a safety filter level and a person filter level.
@experimental
final class ImagenSafetySettings {
// ignore: public_member_api_docs
ImagenSafetySettings(this.safetyFilterLevel, this.personFilterLevel);
Expand All @@ -113,6 +117,7 @@ final class ImagenSafetySettings {
/// The aspect ratio for the image.
///
/// The default value is "1:1".
@experimental
enum ImagenAspectRatio {
/// Square (1:1).
square1x1('1:1'),
Expand Down Expand Up @@ -154,6 +159,7 @@ enum ImagenAspectRatio {
}

/// Configuration options for image generation.
@experimental
final class ImagenGenerationConfig {
// ignore: public_member_api_docs
ImagenGenerationConfig(
Expand Down Expand Up @@ -194,6 +200,7 @@ final class ImagenGenerationConfig {
}

/// Represents the image format and compression quality.
@experimental
final class ImagenFormat {
// ignore: public_member_api_docs
ImagenFormat(this.mimeType, this.compressionQuality);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.
import 'dart:convert';
import 'dart:typed_data';
import 'package:meta/meta.dart';
import 'error.dart';

/// Base type of Imagen Image.
Expand All @@ -28,6 +29,7 @@ sealed class ImagenImage {
}

/// Represents an image stored as a base64-encoded string.
@experimental
final class ImagenInlineImage implements ImagenImage {
// ignore: public_member_api_docs
ImagenInlineImage({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import 'package:firebase_app_check/firebase_app_check.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:meta/meta.dart';

import 'base_model.dart';
import 'client.dart';
Expand All @@ -30,6 +31,7 @@ import 'imagen_content.dart';
/// > Warning: For Vertex AI in Firebase, image generation using Imagen 3 models
/// is in Public Preview, which means that the feature is not subject to any SLA
/// or deprecation policy and could change in backwards-incompatible ways.
@experimental
final class ImagenModel extends BaseModel {
ImagenModel._(
{required FirebaseApp app,
Expand Down Expand Up @@ -83,6 +85,7 @@ final class ImagenModel extends BaseModel {

/// Generates images with format of [ImagenInlineImage] based on the given
/// prompt.
@experimental
Future<ImagenGenerationResponse<ImagenInlineImage>> generateImages(
String prompt,
) =>
Expand Down Expand Up @@ -115,6 +118,7 @@ final class ImagenModel extends BaseModel {
}

/// Returns a [ImagenModel] using it's private constructor.
@experimental
ImagenModel createImagenModel({
required FirebaseApp app,
required String location,
Expand Down

0 comments on commit 6c0eb6c

Please sign in to comment.