@@ -26,8 +26,9 @@ public class VertexAI: NSObject {
26
26
/// The default `VertexAI` instance.
27
27
///
28
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.
29
+ /// regions
30
+ /// ](https://cloud.google.com/vertex-ai/generative-ai/docs/learn/locations#available-regions)
31
+ /// for a list of supported regions.
31
32
/// - Returns: An instance of `VertexAI`, configured with the default `FirebaseApp`.
32
33
public static func vertexAI( location: String = " us-central1 " ) -> VertexAI {
33
34
guard let app = FirebaseApp . app ( ) else {
@@ -41,8 +42,8 @@ public class VertexAI: NSObject {
41
42
///
42
43
/// - Parameters:
43
44
/// - 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)
45
+ /// - location: The region identifier, defaulting to `us-central1`; see [Vertex AI regions
46
+ /// ](https://cloud.google.com/vertex-ai/generative-ai/ docs/learn /locations#available -regions)
46
47
/// for a list of supported regions.
47
48
/// - Returns: A `VertexAI` instance, configured with the custom `FirebaseApp`.
48
49
public static func vertexAI( app: FirebaseApp , location: String = " us-central1 " ) -> VertexAI {
@@ -117,11 +118,12 @@ public class VertexAI: NSObject {
117
118
guard let projectID = app. options. projectID else {
118
119
fatalError ( " The Firebase app named \" \( app. name) \" has no project ID in its configuration. " )
119
120
}
120
- guard !location. isEmpty else {
121
+ guard !location. isEmpty && location
122
+ . allSatisfy ( { !$0. isWhitespace && !$0. isNewline && $0 != " / " } ) else {
121
123
fatalError ( """
122
- No location specified; see
123
- https://cloud.google.com/vertex-ai/generative-ai/docs/learn/locations#available-regions for a
124
- list of available regions.
124
+ Invalid location " \( location ) " specified; see \
125
+ https://cloud.google.com/vertex-ai/generative-ai/docs/learn/locations#available-regions for \
126
+ a list of available regions.
125
127
""" )
126
128
}
127
129
0 commit comments