Function calling with image return values

I am currently using several function calls with Gemini, a few of which need to give images as a response back to the model. The images however are being treated and tokenized as text from base64:

Is there a way to fix this within functionResponse? Or is it more appropriate to pass the image back into the conversation as inline_data?

Hello! Welcome to the Forum,

My understanding is that you’re currently receiving an image as a Base64 string from your function call. When this string is returned to the model, it’s being tokenized as a string rather than an image.

To address this, you could try decoding the Base64 string into an image before passing it back to the model. You can typically achieve this using a Base64 library (e.g., base64.b64decode in Python) to ensure the model processes the image directly.