diff --git a/generativeai/src/main/java/com/google/ai/client/generativeai/Chat.kt b/generativeai/src/main/java/com/google/ai/client/generativeai/Chat.kt index 7131c7de..48f2058e 100644 --- a/generativeai/src/main/java/com/google/ai/client/generativeai/Chat.kt +++ b/generativeai/src/main/java/com/google/ai/client/generativeai/Chat.kt @@ -73,7 +73,7 @@ class Chat(private val model: GenerativeModel, val history: MutableList tempHistory.add(prompt) tempHistory.add(response.candidates.first().content) if (responsePart is FunctionCallPart) { - if (!model.requestOptions.disableAutoFunction) { + if (model.requestOptions.disableAutoFunction) { break } val output = model.executeFunction(responsePart) @@ -191,7 +191,7 @@ class Chat(private val model: GenerativeModel, val history: MutableList tempHistory.add(Content("model", listOf(part))) } is FunctionCallPart -> { - if (!model.requestOptions.disableAutoFunction) { + if (model.requestOptions.disableAutoFunction) { tempHistory.add(response.candidates.first().content) continue }