skominas.ainis
09/01/2025, 7:25 PMGemini2_5FlashImagePreview
🍌 and didn't like my personal solution with cURL, thus I've tried to add support for it in Koog and it was quite simple thanks to junie
• Added the model in GoogleModels.kt
and LLMModelParser.kt
• Handled GooglePart.InlineData
inside GoogleLLMClient.processGoogleCandidate
with this code snippet:
is GooglePart.InlineData -> {
val mime = part.inlineData.mimeType
val format = mime.substringAfter('/', missingDelimiterValue = "bin")
val content = AttachmentContent.Binary.Base64(part.inlineData.data)
val attachment: Attachment = when {
mime.startsWith("image/") -> Attachment.Image(content = content, format = format, mimeType = mime)
else -> Attachment.File(content = content, format = format, mimeType = mime)
}
Message.Assistant(
content = "",
attachments = listOf(attachment),
finishReason = candidate.finishReason,
metaInfo = metaInfo
)
}
And it works like a charm passing down Base64 blob within Message.Assistant
attachments that later can be easily transpiled to any format model outputs (mostly PNG)
However, I have two questions regarding this before I submit a PR to Koog:
1. Does Koog support Image or Video output officially?
2. Is it even worth to maintain *Preview
models?Vadim Briliantov
09/02/2025, 9:35 AMattachments
field in the Message.Assistant
, which could also contain Attachments.Video
.
But as I see right now — only OpenAI LLM client actually processes such attachments from any messages (both user and assistant), while, for example, Google LLM Client only processes the user attachments.
So, of course it depends on the model and provider, but in theory yes — video attachments should be supported.
Though, we don’t support the models that generate videos, and hence we never tested them. But eventually such support will be added to Koog. If you would like to contribute — you’re always welcome 🙂
> Is it even worth to maintain *Preview
models?
It depends. Usually, they get replaced by the release model versions, and even released non-preview models suffer from bugs (ex: https://discuss.ai.google.dev/t/gemini-2-5-pro-with-empty-response-text/81175).
But if you would like to start experimenting with something new — then it makes sense to have them as early as possible