@@ -25,12 +25,11 @@ import com.google.firebase.ai.type.GenerativeBackend
25
25
import com.google.firebase.ai.type.GenerativeBackendEnum
26
26
import com.google.firebase.ai.type.ImagenGenerationConfig
27
27
import com.google.firebase.ai.type.ImagenSafetySettings
28
- import com.google.firebase.ai.type.InvalidLocationException
28
+ import com.google.firebase.ai.type.InvalidStateException
29
29
import com.google.firebase.ai.type.LiveGenerationConfig
30
30
import com.google.firebase.ai.type.PublicPreviewAPI
31
31
import com.google.firebase.ai.type.RequestOptions
32
32
import com.google.firebase.ai.type.SafetySetting
33
- import com.google.firebase.ai.type.ServiceDisabledException
34
33
import com.google.firebase.ai.type.Tool
35
34
import com.google.firebase.ai.type.ToolConfig
36
35
import com.google.firebase.annotations.concurrent.Blocking
@@ -49,9 +48,6 @@ internal constructor(
49
48
private val appCheckProvider: Provider <InteropAppCheckTokenProvider >,
50
49
private val internalAuthProvider: Provider <InternalAuthProvider >,
51
50
) {
52
- init {
53
- validateLocation()
54
- }
55
51
56
52
/* *
57
53
* Instantiates a new [GenerativeModel] given the provided parameters.
@@ -142,7 +138,7 @@ internal constructor(
142
138
GenerativeBackendEnum .VERTEX_AI ->
143
139
" projects/${firebaseApp.options.projectId} /locations/${backend.location} /publishers/google/models/${modelName} "
144
140
GenerativeBackendEnum .GOOGLE_AI ->
145
- throw ServiceDisabledException (" Live Model is not yet available on the Google AI backend" )
141
+ throw InvalidStateException (" Live Model is not yet available on the Google AI backend" )
146
142
},
147
143
firebaseApp.options.apiKey,
148
144
firebaseApp,
@@ -202,15 +198,6 @@ internal constructor(
202
198
)
203
199
}
204
200
205
- private fun validateLocation () {
206
- if (backend.backend != GenerativeBackendEnum .VERTEX_AI ) {
207
- return
208
- }
209
- if (backend.location.isBlank() || backend.location.contains(" /" )) {
210
- throw InvalidLocationException (backend.location)
211
- }
212
- }
213
-
214
201
public companion object {
215
202
/* * The [FirebaseAI] instance for the default [FirebaseApp] using the Google AI Backend. */
216
203
@JvmStatic
0 commit comments