diff --git a/samples/gemini-live-todo/src/main/java/com/android/ai/samples/geminilivetodo/ui/TodoScreenViewModel.kt b/samples/gemini-live-todo/src/main/java/com/android/ai/samples/geminilivetodo/ui/TodoScreenViewModel.kt index f7f3d9d2..7106da2a 100644 --- a/samples/gemini-live-todo/src/main/java/com/android/ai/samples/geminilivetodo/ui/TodoScreenViewModel.kt +++ b/samples/gemini-live-todo/src/main/java/com/android/ai/samples/geminilivetodo/ui/TodoScreenViewModel.kt @@ -159,8 +159,9 @@ class TodoScreenViewModel @Inject constructor(private val todoRepository: TodoRe emptyMap(), ) - val generativeModel = Firebase.ai(backend = GenerativeBackend.vertexAI()).liveModel( - "gemini-2.0-flash-live-preview-04-09", + // See https://firebase.google.com/docs/ai-logic/live-api for an overview of available models + val generativeModel = Firebase.ai(backend = GenerativeBackend.googleAI()).liveModel( + "gemini-2.5-flash-native-audio-preview-09-2025", generationConfig = liveGenerationConfig, systemInstruction = systemInstruction, tools = listOf( @@ -191,7 +192,7 @@ class TodoScreenViewModel @Inject constructor(private val todoRepository: TodoRe "message" to JsonPrimitive("List of tasks in the todo list: $todoList"), ), ) - FunctionResponsePart(functionCall.name, response) + FunctionResponsePart(functionCall.name, response, functionCall.id) } "addTodo" -> { val taskDescription = functionCall.args["taskDescription"]!!.jsonPrimitive.content @@ -204,7 +205,7 @@ class TodoScreenViewModel @Inject constructor(private val todoRepository: TodoRe "message" to JsonPrimitive("Task $taskDescription added to the todo list (id: $id)"), ), ) - FunctionResponsePart(functionCall.name, response) + FunctionResponsePart(functionCall.name, response, functionCall.id) } else { val response = JsonObject( mapOf( @@ -212,7 +213,7 @@ class TodoScreenViewModel @Inject constructor(private val todoRepository: TodoRe "message" to JsonPrimitive("Task $taskDescription wasn't properly added to the list"), ), ) - FunctionResponsePart(functionCall.name, response) + FunctionResponsePart(functionCall.name, response, functionCall.id) } } @@ -226,7 +227,7 @@ class TodoScreenViewModel @Inject constructor(private val todoRepository: TodoRe "message" to JsonPrimitive("Task was removed from the todo list"), ), ) - FunctionResponsePart(functionCall.name, response) + FunctionResponsePart(functionCall.name, response, functionCall.id) } catch (e: Exception) { val response = JsonObject( mapOf( @@ -234,7 +235,7 @@ class TodoScreenViewModel @Inject constructor(private val todoRepository: TodoRe "message" to JsonPrimitive("Something went wrong: ${e.message}"), ), ) - FunctionResponsePart(functionCall.name, response) + FunctionResponsePart(functionCall.name, response, functionCall.id) } } @@ -247,13 +248,13 @@ class TodoScreenViewModel @Inject constructor(private val todoRepository: TodoRe "message" to JsonPrimitive("Task was toggled in the todo list"), ), ) - FunctionResponsePart(functionCall.name, response) + FunctionResponsePart(functionCall.name, response, functionCall.id) } else -> { val response = JsonObject( mapOf("error" to JsonPrimitive("Unknown function: ${functionCall.name}")), ) - FunctionResponsePart(functionCall.name, response) + FunctionResponsePart(functionCall.name, response, functionCall.id) } } }