-
-
Save skydoves/fac89f38d17f24d4e39d2cc0be180a13 to your computer and use it in GitHub Desktop.
photo_reasoning_gemini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private suspend fun photoReasoning(message: Message, bitmaps: List<Bitmap>): String? { | |
val text = message.text | |
val prompt = "Look at the image(s), and then answer the following question: $text" | |
val content = content { | |
for (bitmap in bitmaps) { | |
image(bitmap) | |
} | |
text(prompt) | |
} | |
val response = generativeModel.generateContent(content) | |
val responseText = response.text | |
if (responseText != null) { | |
channelClient.sendMessage( | |
message = Message( | |
id = UUID.randomUUID().toString(), | |
cid = channelClient.cid, | |
text = responseText, | |
extraData = mutableMapOf(STREAM_CHANNEL_GEMINI_FLAG to true) | |
) | |
).await() | |
} | |
return responseText | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment