@@ -25,27 +25,33 @@ public class VertexAI: NSObject {
25
25
26
26
/// The default `VertexAI` instance.
27
27
///
28
+ /// - Parameter location: The region identifier, defaulting to `us-central1`; see [Vertex AI
29
+ /// regions](https://cloud.google.com/vertex-ai/docs/general/locations#vertex-ai-regions) for a
30
+ /// list of supported regions.
28
31
/// - Returns: An instance of `VertexAI`, configured with the default `FirebaseApp`.
29
- public static func vertexAI( ) -> VertexAI {
32
+ public static func vertexAI( location : String = " us-central1 " ) -> VertexAI {
30
33
guard let app = FirebaseApp . app ( ) else {
31
34
fatalError ( " No instance of the default Firebase app was found. " )
32
35
}
33
36
34
- return vertexAI ( app: app)
37
+ return vertexAI ( app: app, location : location )
35
38
}
36
39
37
40
/// Creates an instance of `VertexAI` configured with a custom `FirebaseApp`.
38
41
///
39
42
/// - Parameters:
40
43
/// - app: The custom `FirebaseApp` used for initialization.
44
+ /// - location: The region identifier, defaulting to `us-central1`; see [Vertex AI
45
+ /// regions](https://cloud.google.com/vertex-ai/docs/general/locations#vertex-ai-regions)
46
+ /// for a list of supported regions.
41
47
/// - Returns: A `VertexAI` instance, configured with the custom `FirebaseApp`.
42
- public static func vertexAI( app: FirebaseApp ) -> VertexAI {
48
+ public static func vertexAI( app: FirebaseApp , location : String = " us-central1 " ) -> VertexAI {
43
49
guard let provider = ComponentType< VertexAIProvider> . instance( for: VertexAIProvider . self,
44
50
in: app. container) else {
45
51
fatalError ( " No \( VertexAIProvider . self) instance found for Firebase app: \( app. name) " )
46
52
}
47
53
48
- return provider. vertexAI ( " us-central1 " )
54
+ return provider. vertexAI ( location )
49
55
}
50
56
51
57
/// Initializes a generative model with the given parameters.
0 commit comments