Ver código fonte

[Firebase AI] More naming updates (#14779)

Paul Beusterien 11 meses atrás
pai
commit
1687f0c1da

+ 3 - 3
FirebaseAI/README.md

@@ -1,4 +1,4 @@
-# Vertex AI for Firebase SDK
+# Firebase AI SDK
 
 
 - For developer documentation, please visit https://firebase.google.com/docs/vertex-ai.
 - 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.
 - Try out the [sample app](https://github.com/firebase/quickstart-ios/tree/main/vertexai to get started.
@@ -7,7 +7,7 @@
 
 
 After following the Swift Package Manager
 After following the Swift Package Manager
 [setup instructions](https://github.com/firebase/firebase-ios-sdk#swift-package-manager-1),
 [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
 ### Unit Tests
 
 
@@ -15,7 +15,7 @@ choose the `FirebaseVertexAI` scheme to build the SDK.
 > These unit tests require mock response files, which can be downloaded by
 > These unit tests require mock response files, which can be downloaded by
 running `scripts/update_vertexai_responses.sh` from the root of this repository.
 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
 #### Updating Mock Responses
 
 

+ 2 - 2
FirebaseAI/Sample/README.md

@@ -1,5 +1,5 @@
-# Vertex AI for Firebase Quickstart
+# Firebase AI SDK Quickstart
 
 
  Try out the
  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.
  in the `quickstart-ios` repository to get started.

+ 1 - 1
FirebaseAI/Sources/Constants.swift

@@ -14,7 +14,7 @@
 
 
 import Foundation
 import Foundation
 
 
-/// Constants associated with the Vertex AI for Firebase SDK.
+/// Constants associated with the Firebase AI SDK.
 enum Constants {
 enum Constants {
   /// The base reverse-DNS name for `NSError` or `CustomNSError` error domains.
   /// The base reverse-DNS name for `NSError` or `CustomNSError` error domains.
   ///
   ///

+ 12 - 21
FirebaseAI/Sources/FirebaseAI.swift

@@ -20,7 +20,7 @@ import Foundation
 // Avoids exposing internal FirebaseCore APIs to Swift users.
 // Avoids exposing internal FirebaseCore APIs to Swift users.
 internal import FirebaseCoreExtension
 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, *)
 @available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
 public final class FirebaseAI: Sendable {
 public final class FirebaseAI: Sendable {
   // MARK: - Public APIs
   // MARK: - Public APIs
@@ -95,7 +95,7 @@ public final class FirebaseAI: Sendable {
 
 
   /// **[Public Preview]** Initializes an ``ImagenModel`` with the given parameters.
   /// **[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
   /// Preview, which means that the feature is not subject to any SLA or deprecation policy and
   /// could change in backwards-incompatible ways.
   /// could change in backwards-incompatible ways.
   ///
   ///
@@ -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 {}
   @objc(FIRVertexAIComponent) class FirebaseVertexAIComponent: NSObject {}
 
 
   // MARK: - Private
   // MARK: - Private
 
 
-  /// Firebase data relevant to Vertex AI.
+  /// Firebase data relevant to Firebase AI.
   let firebaseInfo: FirebaseInfo
   let firebaseInfo: FirebaseInfo
 
 
   let apiConfig: APIConfig
   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?
   let location: String?
 
 
@@ -225,7 +216,7 @@ public final class FirebaseAI: Sendable {
 
 
   private func vertexAIModelResourceName(modelName: String) -> String {
   private func vertexAIModelResourceName(modelName: String) -> String {
     guard let location else {
     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
     guard !location.isEmpty && location
       .allSatisfy({ !$0.isWhitespace && !$0.isNewline && $0 != "/" }) else {
       .allSatisfy({ !$0.isWhitespace && !$0.isNewline && $0 != "/" }) else {
@@ -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.
   /// This type is `Hashable` so that it can be used as a key in the `instances` dictionary.
   private struct InstanceKey: Sendable, Hashable {
   private struct InstanceKey: Sendable, Hashable {

+ 1 - 1
FirebaseAI/Sources/FirebaseInfo.swift

@@ -19,7 +19,7 @@ import Foundation
 @preconcurrency import FirebaseAuthInterop
 @preconcurrency import FirebaseAuthInterop
 @preconcurrency import FirebaseCore
 @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, *)
 @available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
 struct FirebaseInfo: Sendable {
 struct FirebaseInfo: Sendable {
   let appCheck: AppCheckInterop?
   let appCheck: AppCheckInterop?

+ 2 - 2
FirebaseAI/Sources/GenerativeModel.swift

@@ -59,9 +59,9 @@ public final class GenerativeModel: Sendable {
   ///   - modelName: The name of the model, for example "gemini-2.0-flash".
   ///   - modelName: The name of the model, for example "gemini-2.0-flash".
   ///   - modelResourceName: The model resource name corresponding with `modelName` in the backend.
   ///   - modelResourceName: The model resource name corresponding with `modelName` in the backend.
   ///     The form depends on the backend and will be one of:
   ///     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}"`
   ///       `"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}"`
   ///       - Developer API via Generative Language: `"models/{modelName}"`
   ///   - firebaseInfo: Firebase data used by the SDK, including project ID and API key.
   ///   - firebaseInfo: Firebase data used by the SDK, including project ID and API key.
   ///   - apiConfig: Configuration for the backend API used by this model.
   ///   - apiConfig: Configuration for the backend API used by this model.

+ 2 - 2
FirebaseAI/Sources/Types/Internal/APIConfig.swift

@@ -69,10 +69,10 @@ extension APIConfig {
 extension APIConfig.Service {
 extension APIConfig.Service {
   /// Network addresses for generative AI API services.
   /// Network addresses for generative AI API services.
   enum Endpoint: String {
   enum Endpoint: String {
-    /// The Vertex AI in Firebase production endpoint.
+    /// The Firebase AI SDK production endpoint.
     case firebaseVertexAIProd = "https://firebasevertexai.googleapis.com"
     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"
     case firebaseVertexAIStaging = "https://staging-firebasevertexai.sandbox.googleapis.com"
 
 
     /// The Gemini Developer API production endpoint; for SDK development and testing only.
     /// The Gemini Developer API production endpoint; for SDK development and testing only.

+ 4 - 4
FirebaseAI/Sources/Types/Public/Imagen/ImagenModel.swift

@@ -21,9 +21,9 @@ import Foundation
 /// See the [generate images
 /// See the [generate images
 /// documentation](https://firebase.google.com/docs/vertex-ai/generate-images-imagen?platform=ios)
 /// 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
 /// 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
 /// Preview, which means that the feature is not subject to any SLA or deprecation policy and
 /// could change in backwards-incompatible ways.
 /// could change in backwards-incompatible ways.
 @available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
 @available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
@@ -73,7 +73,7 @@ public final class ImagenModel {
   /// > Note: By default, 1 image sample is generated; see ``ImagenGenerationConfig/numberOfImages``
   /// > Note: By default, 1 image sample is generated; see ``ImagenGenerationConfig/numberOfImages``
   /// to configure the number of images that are generated.
   /// 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
   /// Preview, which means that the feature is not subject to any SLA or deprecation policy and
   /// could change in backwards-incompatible ways.
   /// could change in backwards-incompatible ways.
   ///
   ///
@@ -105,7 +105,7 @@ public final class ImagenModel {
   /// > Note: By default, 1 image sample is generated; see ``ImagenGenerationConfig/numberOfImages``
   /// > Note: By default, 1 image sample is generated; see ``ImagenGenerationConfig/numberOfImages``
   /// to configure the number of images that are generated.
   /// 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
   /// Preview, which means that the feature is not subject to any SLA or deprecation policy and
   /// could change in backwards-incompatible ways.
   /// could change in backwards-incompatible ways.
   ///
   ///

+ 1 - 1
FirebaseAI/Tests/TestApp/Tests/Integration/GenerateContentIntegrationTests.swift

@@ -219,7 +219,7 @@ struct GenerateContentIntegrationTests {
     InstanceConfig.vertexV1AppCheckNotConfigured,
     InstanceConfig.vertexV1AppCheckNotConfigured,
     InstanceConfig.vertexV1BetaAppCheckNotConfigured,
     InstanceConfig.vertexV1BetaAppCheckNotConfigured,
     // App Check is not supported on the Generative Language Developer API endpoint since it
     // 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 {
   func generateContent_appCheckNotConfigured_shouldFail(_ config: InstanceConfig) async throws {
     let model = FirebaseAI.componentInstance(config).generativeModel(
     let model = FirebaseAI.componentInstance(config).generativeModel(

+ 1 - 1
FirebaseAI/Tests/Unit/README.md

@@ -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)
 [README](https://github.com/firebase/firebase-ios-sdk/tree/main/FirebaseVertexAI#unit-tests)
 for required setup instructions.
 for required setup instructions.

+ 1 - 1
FirebaseAI/Tests/Unit/Snippets/README.md

@@ -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
 These "tests" are for verifying that the code snippets provided in our
 documentation continue to compile. They are intentionally skipped in CI but can
 documentation continue to compile. They are intentionally skipped in CI but can