Issue with Base64 Image Handling in OpenAI Module Starting from Google Drive

Hi everyone,

I’m currently working on a Make scenario that involves watching a folder in Google Drive. When a new image is added, I download it using another Google Drive module. Next, I use a Tools module to create a variable a that contains the base64 encoded image data.

However, when I pass this variable to the OpenAI module, I encounter an error. Here is a detailed breakdown of my scenario:

  1. Google Drive - Watch Files in a Folder:
  • This module is set to monitor a specific folder for new files.
  1. Google Drive - Download a File:
  • This module downloads the newly added file from the watched folder.
  1. Tools - Set Variable:
  • I create a variable a with the following value: data:{{1.mimeType}};base64,{{base64(6.data)}}
  1. OpenAI - Message an Assistant:
  • I pass the variable a to the Image Files field in this module.

Despite following this setup, I receive the following error:

RuntimeError
[500] The server had an error processing your request. Sorry about that! You can retry your request, or contact us through our help center at help.openai.com if you keep seeing this error. (Please include the request ID ###### in your email.)

Here is an example of the base64 string I am generating:

data:image/webp;base64,UklGRqz8AABXRUJQVlA4IKD8AAAQqgSdASrIBIcCPm02lkikIyKsI/LpwYANiWVuc/a8bjC/3dJNkb5IhF0/nts/…

Could someone help me understand what might be going wrong or provide guidance on how to correctly pass a base64 encoded image to the OpenAI module in Make? Any suggestions or insights would be greatly appreciated!

Thank you in advance for your help! :pray:


Capture d’écran 2024-06-16 à 09.50.14

Welcome to the Make community!

Turn this off:

Screenshot_2024-06-16_200656

If you turn it on you’ll have to send an array of collections.

samliewrequest private consultation

Join the Make Fans Discord server to chat with other makers!

1 Like

Hi Samliew,

Thank you for the suggestion. I initially enabled the “Map” option because without it, I can’t access the panel that allows me to use variables from other modules, nor can I input anything into the “Image Files” field. When “Map” is turned off, the field remains inaccessible, and I’m unable to proceed.

Is there an alternative way to input variables from other modules into the “Image Files” field without enabling the “Map” option? Or is there a different method I should be using to achieve this?

Thanks in advance for your help!

You can try this:

Every result (item/record) from an Iterator module will output a bundle. To “combine” them into a single structure, you’ll need to use an aggregator of some sort.

Aggregators are modules that accumulate multiple bundles into one single bundle. An example of a commonly-used aggregator module is the Array aggregator module.

Read this

The Array Aggregator module also allows you to build a complex array of collections for a later module’s field to map multiple items (collections) to it.

Here is an example of using the “Target structure type” of an Array Aggregator module:

As you can see, the “Map” toggle on fields are used when you have an array. You can easily build an array variable to map to a field, by using an Array Aggregator module and select the “Target Structure Type” as the future field you want to map the array into.

samliewrequest private consultation

Join the unofficial Make Discord server to chat with us!

1 Like

It still doesn’t work, maybe beacause I can’t select a ‘target structure type’, it stays on ‘Custom’.

Are you sure you need to encode the data file into base64? Why not just download the file from Google Drive and then map the OpenAI module afterwards and select the output file downlaoded from Google Drive without the map toggle turned on?

I see the image box doesn’t map to a previous download but I think you may need to use the upload a file module first in openAI to make it available to other OpenAI modules:

here’s the Upload a File configuration

1 Like

Thank you all for your responses and sorry for the late reply! I found a solution to efficiently share an image from Google Drive to Instagram. In its scenario templates, Make only offers to retrieve the image thumbnail, which is in very low resolution.

Here are the steps I followed:

  1. I monitor the arrival of a new image in a Google Drive folder.

  2. I create a shareable link, which serves to open the rights to the image.

  3. With this Tool module, I retrieve the image ID with the following expression: {{substring(1.webViewLink; indexOf(1.webViewLink; “/d/”) + 3; indexOf(1.webViewLink; “/view”))}}

  4. I ask ChatGPT to describe my image.

  5. I have a GPT assistant who knows all the lyrics of my songs, my musical journey, and the topics I’m passionate about. I send him the description of the image and he writes the post based on the description, what he knows about me, includes a snippet of lyrics from a song, and adds hashtags.

  6. I post on Instagram by inserting into the “Photo url”: https://drive.google.com/uc?export=download&id={{14.a}}(14.a is the variable I created with the tool).

  7. Finally, I delete the image from the folder.

Et voilà!

1 Like