@@ -44,9 +44,9 @@ public class VertexAI: NSObject {
44
44
///
45
45
/// - Parameters:
46
46
/// - app: The custom `FirebaseApp` used for initialization.
47
- /// - location: The region identifier, defaulting to `us-central1`; see [Vertex AI regions
48
- /// ](https://cloud .google.com/vertex-ai/generative-ai/docs/learn/ locations#available-regions )
49
- /// for a list of supported regions .
47
+ /// - location: The region identifier, defaulting to `us-central1`; see
48
+ /// [Vertex AI locations ](https://firebase .google.com/docs/ vertex-ai/locations?platform=ios )
49
+ /// for a list of supported locations .
50
50
/// - Returns: A `VertexAI` instance, configured with the custom `FirebaseApp`.
51
51
public static func vertexAI( app: FirebaseApp , location: String = " us-central1 " ) -> VertexAI {
52
52
guard let provider = ComponentType< VertexAIProvider> . instance( for: VertexAIProvider . self,
@@ -117,18 +117,23 @@ public class VertexAI: NSObject {
117
117
}
118
118
119
119
private func modelResourceName( modelName: String , location: String ) -> String {
120
- if modelName. contains ( " / " ) {
121
- return modelName
122
- }
123
120
guard let projectID = app. options. projectID else {
124
121
fatalError ( " The Firebase app named \" \( app. name) \" has no project ID in its configuration. " )
125
122
}
123
+ guard !modelName. isEmpty && modelName
124
+ . allSatisfy ( { !$0. isWhitespace && !$0. isNewline && $0 != " / " } ) else {
125
+ fatalError ( """
126
+ Invalid model name " \( modelName) " specified; see \
127
+ https://firebase.google.com/docs/vertex-ai/gemini-model#available-models for a list of \
128
+ available models.
129
+ """ )
130
+ }
126
131
guard !location. isEmpty && location
127
132
. allSatisfy ( { !$0. isWhitespace && !$0. isNewline && $0 != " / " } ) else {
128
133
fatalError ( """
129
134
Invalid location " \( location) " specified; see \
130
- https://cloud .google.com/vertex-ai/generative-ai/docs/learn/ locations#available-regions for \
131
- a list of available regions .
135
+ https://firebase .google.com/docs/ vertex-ai/locations?platform=ios for a list of available \
136
+ locations .
132
137
""" )
133
138
}
134
139
0 commit comments