Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand All @@ -204,15 +205,15 @@ 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(
"success" to JsonPrimitive(false),
"message" to JsonPrimitive("Task $taskDescription wasn't properly added to the list"),
),
)
FunctionResponsePart(functionCall.name, response)
FunctionResponsePart(functionCall.name, response, functionCall.id)
}

}
Expand All @@ -226,15 +227,15 @@ 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(
"success" to JsonPrimitive(false),
"message" to JsonPrimitive("Something went wrong: ${e.message}"),
),
)
FunctionResponsePart(functionCall.name, response)
FunctionResponsePart(functionCall.name, response, functionCall.id)
}

}
Expand All @@ -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)
}
}
}
Expand Down
Loading