Skip to content

Commit

Permalink
Merge pull request #459 from google-ai-edge/mrschmidt/androidprompt
Browse files Browse the repository at this point in the history
Suport Gemma2 in Android sample app
  • Loading branch information
khanhlvg authored Sep 25, 2024
2 parents 7e69d9e + f2e291d commit 3576115
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/llm_inference/android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ dependencies {
implementation("androidx.compose.ui:ui-tooling-preview")
implementation("androidx.compose.material3:material3")

implementation ("com.google.mediapipe:tasks-genai:0.10.15")
implementation ("com.google.mediapipe:tasks-genai:0.10.16")

testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ class InferenceModel private constructor(context: Context) {
}

fun generateResponseAsync(prompt: String) {
llmInference.generateResponseAsync(prompt)
// Add the gemma prompt prefix to trigger the response.
val gemmaPrompt = prompt + "<start_of_turn>model\n"
llmInference.generateResponseAsync(gemmaPrompt)
}

companion object {
Expand Down

0 comments on commit 3576115

Please sign in to comment.