Skip to content

Commit

Permalink
Added support for VertexAI (Gemini) version 0.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ethauvin committed Mar 25, 2024
1 parent ee5b5ad commit b2aae15
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/bld/java/net/thauvin/erik/MobibotBuild.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public MobibotBuild() {
// Google
.include(dependency("com.google.code.gson", "gson", "2.10.1"))
.include(dependency("com.google.guava", "guava", "33.1.0-jre"))
.include(dependency("com.google.cloud", "google-cloud-vertexai", version(0, 6, 0)))
.include(dependency("com.google.cloud", "google-cloud-vertexai", version(0, 7, 0)))
// Kotlin
.include(dependency("org.jetbrains.kotlinx", "kotlinx-coroutines-core", "1.8.0"))
.include(dependency("org.jetbrains.kotlinx", "kotlinx-cli-jvm", "0.3.6"))
Expand Down
4 changes: 3 additions & 1 deletion src/main/kotlin/net/thauvin/erik/mobibot/modules/Gemini.kt
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ class Gemini : AbstractModule() {
try {
VertexAI(projectId, location).use { vertexAI ->
val generationConfig = GenerationConfig.newBuilder().setMaxOutputTokens(maxToken).build()
val model = GenerativeModel("gemini-pro-vision", generationConfig, vertexAI)
val model = GenerativeModel.Builder().setModelName("gemini-pro-vision")
.setGenerationConfig(generationConfig)
.setVertexAi(vertexAI).build()
val session = ChatSession(model)
val response = session.sendMessage(query)

Expand Down

0 comments on commit b2aae15

Please sign in to comment.