Skip to content

[Firebase AI] More naming updates #14779

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 2 commits into from
Apr 28, 2025
Merged
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: 3 additions & 3 deletions FirebaseAI/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Vertex AI for Firebase SDK
# Firebase AI SDK

- For developer documentation, please visit https://firebase.google.com/docs/vertex-ai.
- Try out the [sample app](https://github.com/firebase/quickstart-ios/tree/main/vertexai to get started.
Expand All @@ -7,15 +7,15 @@

After following the Swift Package Manager
[setup instructions](https://github.com/firebase/firebase-ios-sdk#swift-package-manager-1),
choose the `FirebaseVertexAI` scheme to build the SDK.
choose the `FirebaseAI` scheme to build the SDK.

### Unit Tests

> [!IMPORTANT]
> These unit tests require mock response files, which can be downloaded by
running `scripts/update_vertexai_responses.sh` from the root of this repository.

Choose the `FirebaseVertexAIUnit` scheme to build and run the unit tests.
Choose the `FirebaseAIUnit` scheme to build and run the unit tests.

#### Updating Mock Responses

Expand Down
4 changes: 2 additions & 2 deletions FirebaseAI/Sample/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Vertex AI for Firebase Quickstart
# Firebase AI SDK Quickstart

Try out the
[Vertex AI Quickstart](https://github.com/firebase/quickstart-ios/tree/main/vertexai)
[Firebase AI SDK Quickstart](https://github.com/firebase/quickstart-ios/tree/main/firebaseai)
in the `quickstart-ios` repository to get started.
2 changes: 1 addition & 1 deletion FirebaseAI/Sources/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import Foundation

/// Constants associated with the Vertex AI for Firebase SDK.
/// Constants associated with the Firebase AI SDK.
enum Constants {
/// The base reverse-DNS name for `NSError` or `CustomNSError` error domains.
///
Expand Down
33 changes: 12 additions & 21 deletions FirebaseAI/Sources/FirebaseAI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Foundation
// Avoids exposing internal FirebaseCore APIs to Swift users.
internal import FirebaseCoreExtension

/// The Vertex AI for Firebase SDK provides access to Gemini models directly from your app.
/// The Firebase AI SDK provides access to Gemini models directly from your app.
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
public final class FirebaseAI: Sendable {
// MARK: - Public APIs
Expand Down Expand Up @@ -95,7 +95,7 @@ public final class FirebaseAI: Sendable {

/// **[Public Preview]** Initializes an ``ImagenModel`` with the given parameters.
///
/// > Warning: For Vertex AI in Firebase, image generation using Imagen 3 models is in Public
/// > Warning: For Firebase AI SDK, 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.
///
Expand Down Expand Up @@ -129,32 +129,23 @@ public final class FirebaseAI: Sendable {
)
}

/// Class to enable VertexAI to register via the Objective-C based Firebase component system
/// to include VertexAI in the userAgent.
/// Class to enable FirebaseAI to register via the Objective-C based Firebase component system
/// to include FirebaseAI in the userAgent.
@objc(FIRVertexAIComponent) class FirebaseVertexAIComponent: NSObject {}

// MARK: - Private

/// Firebase data relevant to Vertex AI.
/// Firebase data relevant to Firebase AI.
let firebaseInfo: FirebaseInfo

let apiConfig: APIConfig

#if compiler(>=6)
/// A map of active `VertexAI` instances keyed by the `FirebaseApp` name and the `location`, in
/// the format `appName:location`.
private nonisolated(unsafe) static var instances: [InstanceKey: FirebaseAI] = [:]
/// A map of active `FirebaseAI` instances keyed by the `FirebaseApp` name and the `location`,
/// in the format `appName:location`.
private nonisolated(unsafe) static var instances: [InstanceKey: FirebaseAI] = [:]

/// Lock to manage access to the `instances` array to avoid race conditions.
private nonisolated(unsafe) static var instancesLock: os_unfair_lock = .init()
#else
/// A map of active `VertexAI` instances keyed by the `FirebaseApp` name and the `location`, in
/// the format `appName:location`.
private static var instances: [InstanceKey: VertexAI] = [:]

/// Lock to manage access to the `instances` array to avoid race conditions.
private static var instancesLock: os_unfair_lock = .init()
#endif
/// Lock to manage access to the `instances` array to avoid race conditions.
private nonisolated(unsafe) static var instancesLock: os_unfair_lock = .init()

let location: String?

Expand Down Expand Up @@ -225,7 +216,7 @@ public final class FirebaseAI: Sendable {

private func vertexAIModelResourceName(modelName: String) -> String {
guard let location else {
fatalError("Location must be specified for the Vertex AI service.")
fatalError("Location must be specified for the Firebase AI service.")
}
guard !location.isEmpty && location
.allSatisfy({ !$0.isWhitespace && !$0.isNewline && $0 != "/" }) else {
Expand All @@ -250,7 +241,7 @@ public final class FirebaseAI: Sendable {
}
}

/// Identifier for a unique instance of ``VertexAI``.
/// Identifier for a unique instance of ``FirebaseAI``.
///
/// This type is `Hashable` so that it can be used as a key in the `instances` dictionary.
private struct InstanceKey: Sendable, Hashable {
Expand Down
2 changes: 1 addition & 1 deletion FirebaseAI/Sources/FirebaseInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import Foundation
@preconcurrency import FirebaseAuthInterop
@preconcurrency import FirebaseCore

/// Firebase data used by VertexAI
/// Firebase data used by FirebaseAI
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
struct FirebaseInfo: Sendable {
let appCheck: AppCheckInterop?
Expand Down
4 changes: 2 additions & 2 deletions FirebaseAI/Sources/GenerativeModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ public final class GenerativeModel: Sendable {
/// - modelName: The name of the model, for example "gemini-2.0-flash".
/// - modelResourceName: The model resource name corresponding with `modelName` in the backend.
/// The form depends on the backend and will be one of:
/// - Vertex AI via Vertex AI in Firebase:
/// - Vertex AI via Firebase AI SDK:
/// `"projects/{projectID}/locations/{locationID}/publishers/google/models/{modelName}"`
/// - Developer API via Vertex AI in Firebase: `"projects/{projectID}/models/{modelName}"`
/// - Developer API via Firebase AI SDK: `"projects/{projectID}/models/{modelName}"`
/// - Developer API via Generative Language: `"models/{modelName}"`
/// - firebaseInfo: Firebase data used by the SDK, including project ID and API key.
/// - apiConfig: Configuration for the backend API used by this model.
Expand Down
4 changes: 2 additions & 2 deletions FirebaseAI/Sources/Types/Internal/APIConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ extension APIConfig {
extension APIConfig.Service {
/// Network addresses for generative AI API services.
enum Endpoint: String {
/// The Vertex AI in Firebase production endpoint.
/// The Firebase AI SDK production endpoint.
case firebaseVertexAIProd = "https://firebasevertexai.googleapis.com"

/// The Vertex AI in Firebase staging endpoint; for SDK development and testing only.
/// The Firebase AI SDK staging endpoint; for SDK development and testing only.
case firebaseVertexAIStaging = "https://staging-firebasevertexai.sandbox.googleapis.com"

/// The Gemini Developer API production endpoint; for SDK development and testing only.
Expand Down
8 changes: 4 additions & 4 deletions FirebaseAI/Sources/Types/Public/Imagen/ImagenModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import Foundation
/// See the [generate images
/// documentation](https://firebase.google.com/docs/vertex-ai/generate-images-imagen?platform=ios)
/// for more details about the image generation capabilities offered by the Imagen model in the
/// Vertex AI in Firebase SDK.
/// Firebase AI SDK SDK.
///
/// > Warning: For Vertex AI in Firebase, image generation using Imagen 3 models is in Public
/// > Warning: For Firebase AI SDK, 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.
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
Expand Down Expand Up @@ -73,7 +73,7 @@ public final class ImagenModel {
/// > Note: By default, 1 image sample is generated; see ``ImagenGenerationConfig/numberOfImages``
/// to configure the number of images that are generated.
///
/// > Warning: For Vertex AI in Firebase, image generation using Imagen 3 models is in Public
/// > Warning: For Firebase AI SDK, 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.
///
Expand Down Expand Up @@ -105,7 +105,7 @@ public final class ImagenModel {
/// > Note: By default, 1 image sample is generated; see ``ImagenGenerationConfig/numberOfImages``
/// to configure the number of images that are generated.
///
/// > Warning: For Vertex AI in Firebase, image generation using Imagen 3 models is in Public
/// > Warning: For Firebase AI SDK, 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.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ struct GenerateContentIntegrationTests {
InstanceConfig.vertexV1AppCheckNotConfigured,
InstanceConfig.vertexV1BetaAppCheckNotConfigured,
// App Check is not supported on the Generative Language Developer API endpoint since it
// bypasses the Vertex AI in Firebase proxy.
// bypasses the Firebase AI SDK proxy.
])
func generateContent_appCheckNotConfigured_shouldFail(_ config: InstanceConfig) async throws {
let model = FirebaseAI.componentInstance(config).generativeModel(
Expand Down
2 changes: 1 addition & 1 deletion FirebaseAI/Tests/Unit/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
See the Vertex AI for Firebase
See the Firebase AI SDK
[README](https://github.com/firebase/firebase-ios-sdk/tree/main/FirebaseVertexAI#unit-tests)
for required setup instructions.
2 changes: 1 addition & 1 deletion FirebaseAI/Tests/Unit/Snippets/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Vertex AI in Firebase Code Snippet Tests
# Firebase AI SDK Code Snippet Tests

These "tests" are for verifying that the code snippets provided in our
documentation continue to compile. They are intentionally skipped in CI but can
Expand Down
Loading