Hi there. I had two questions about including docu...
# koog-agentic-framework
f
Hi there. I had two questions about including documents in prompts. I currently have the following:
Copy code
attachments {
    document(Path(documentPath).toString())
}
However, I'm wondering if it's possible to include a Byte[]? I am processing a file received via upload, and would like to avoid writing it to disk if possible. Follow-up, is there a way to include documents in subsequent prompts?
d
Hey Filip. With the newest API that will be released in the 0.3 version coming in a few days, you'll be able to do:
Copy code
attachments {
    file(
        Attachment.File(
            content = AttachmentContent.Binary.Bytes(myByteArray),
            format = "pdf",
            mimeType = "application/pdf",
            fileName = "report.pdf"
        )
    )
}
or even, if you receive your file as Base 64:
Copy code
attachments {
    file(
        Attachment.File(
            content = AttachmentContent.Binary.Base64(myBase64String),
            format = "pdf",
            mimeType = "application/pdf",
            fileName = "report.pdf"
        )
    )
}
I am not sure I understand your last question. Once an attachment is included in a
Prompt
object it won't move out of it... (Clearly I don't understand your question. 😕)
🙌 1
f
@Didier Villevalois - this is great. Thanks! My second question had to do with including documents in subsequent messages after the initial prompt. I was not totally clear if that's possible or doable. I am still fairly new to Koog so this just might be question of me going deeper into the documentation.
d
@Filip Zalewski OK, tell me if I am wrong, but I believe you are asking how you can maintain a prompt over a chat-bot style conversation. If that's the case, then Koog doesn't fully support that yet and you have to work around it. Here is what I currently do: https://github.com/ptitjes/konvo/blob/main/konvo-core/src/commonMain/kotlin/io/github/ptitjes/konvo/core/ai/koog/ChatAgent.kt
f
Yes, that's exactly right. I do it manually myself when working directly with the Bedrock SDK. This is really helpful. Thank you again!
thank you color 1
@Didier Villevalois - is there an estimated delivery timeline for 0.3?
d
I don't know exactly. Some days, I believe.
f
I love the pace at which this moving at! Thank you!
K 2
v
Hi! The new Checkpoints/Persistency feature should also cover this case , please correct me if I’m wrong. (merged today) https://github.com/JetBrains/koog/pull/305 It will be in 0.3.0
👍 1
0.3.0 should be released start of next week (approx. Monday evening or Tuesday)
🙌 1