Skip to content

Commit 6c88b19

Browse files
committed
add exception
1 parent a6c1c48 commit 6c88b19

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/FirebaseVertexAI.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,23 @@ internal constructor(
106106
* @return The initialized [LiveGenerativeModel] instance.
107107
*/
108108
@JvmOverloads
109+
@PublicPreviewAPI
109110
public fun liveModel(
110111
modelName: String,
111112
generationConfig: LiveGenerationConfig? = null,
112113
tools: List<Tool>? = null,
113114
systemInstruction: Content? = null,
114115
requestOptions: RequestOptions = RequestOptions(),
115116
): LiveGenerativeModel {
117+
if (!modelName.startsWith(GEMINI_MODEL_NAME_PREFIX)) {
118+
Log.w(
119+
TAG,
120+
"""Unsupported Gemini model "${modelName}"; see
121+
https://firebase.google.com/docs/vertex-ai/models for a list supported Gemini model names.
122+
"""
123+
.trimIndent()
124+
)
125+
}
116126
if (location.trim().isEmpty() || location.contains("/")) {
117127
throw InvalidLocationException(location)
118128
}

0 commit comments

Comments
 (0)