Hey everyone , I'm building a Kotlin project using...
# koog-agentic-framework
f
Hey everyone , I'm building a Kotlin project using Koog (0.6.4) with Gemini embeddings and ran into something I wanted to ask about. Google's embedding API supports a
taskType
parameter (
RETRIEVAL_DOCUMENT
,
RETRIEVAL_QUERY
,
CODE_RETRIEVAL_QUERY
, etc.) that changes the embedding output depending on the use case. From what I can tell, Koog's
Embedder
interface only exposes
embed(text: String)
— no way to pass
taskType
through. I ended up writing a custom
Embedder
implementation that calls the Gemini REST API directly with
taskType
included. Works fine, but wanted to check: 1. Am I missing something? Is there a way to pass
taskType
that I haven't found? 2. If not, is this something being considered for a future release? For context, Google's docs are pretty clear that
taskType
matters for retrieval quality — using
RETRIEVAL_DOCUMENT
for indexing vs
RETRIEVAL_QUERY
for search gives noticeably better results than omitting it. Happy to share my workaround or open a GitHub issue if that's more useful. Still fairly new to Koog so apologies if I've overlooked something obvious!
s
Hi @Fidelity Chauke! Sorry for the late reply. There's no easy way to pass a
taskType
for now unfortunately, but there is an open PR https://github.com/JetBrains/koog/pull/1715 (with
GoogleGenaiEmbeddingProvider
that can accept
EmbedContentConfig
with the taskType). Hopefully, this PR will be included in the upcoming release. I also created a task about it - https://youtrack.jetbrains.com/issue/KG-780
f
Thanks Sergei, much appreciated!