Call OpenAI assistant with variable number of file IDs

How to pass multiple (!) file IDs to an OpenAI assistant module?

Putting in a single file ID is no problem: put in the file ID in the module‘s form field.

Passing a specific number of file IDs is not a problem: just „add item“ and put in the next file ID.

But how to pass a variable number of file ID? When I switch on „map“ and put in a single file ID it works, wenn I separate multiple with comma or newline it does not work.

Should I use JSON? I somewhere found

{ „id“: „some file id“},


but it does not work either.

So, what should I do to pass a variable number of file IDs I can retrieve from an array?

Welcome to the Make community!

You can iterate the files list, and then aggregate into an array.

Then, map the file IDs into the Files field.


Don’t forget to select “Knowledge Retrieval”, otherwise the AI cannot access the files.



Thanks! That worked!
It’s so easy.:roll_eyes: Why did I overlook the most obvious solution? I just need to pass in the array w/o any changes. If it’s empty that’s fine too.

Thanks a lot for the quick response!


is it necessary to indicate the IDs of the files even if they are already associated with the assitant from the Playground? it do not get it by default? It seems that in the playground it gives me info of the files, but not from Make :frowning:

I haven’t tried it but I would imagine:

  • if you upload files to the assistant in the playground you don’t need to do anything. no file IDs need to be included when calling it in a scenario. but you have to check “knowledge retrieval” - and i even recommend to refer to the knowledgebase in the instructions or the prompt.

  • but if you upload files in a scenario and get back file IDs they are not associated with any assistant. you need to pass them to your assistant every time you want to refer to the files in a prompt.

the assistant keeps track of the chat messages. but it does not remember which file IDs where passed to it with the prompts.


In my case, in the Playground i’ve have the files attached and selected the retrieval tool, and the prompt mention the name of the files. In Make i just set the message and the assistant ID, NO files ID and neither tool (it says “If specified, will override the tools to use for the current response generation” so I dont override it). But launching the same ask from make and playground, in Make dont response correctly and it does in Playground :frowning:

Hm… strange. Don’t know why that is.

There seem to be two points in time when you can upload files:

  • to the assistant
  • into a thread of the assistant

In the playground you do the first on the left side and the second in the chat on the right side.

My guess is, that any files uploaded to the assistant on the left side in the playground are not permanently attached to it. (Even though that’s counter intuitive.) Because they’s cost you money.

The documentation does not seem to be clear on when to upload files. :frowning:

Sorry, I am unable to help you more.


@samliew you know something about this?

I do it slightly different, I have my files uploaded via the assistant web interface, and then I reference the file IDs only when relevant (using the filter shown in the screenshot).


But I understand that even if you do not refer to the file IDs, the module that sends the message to the assitant and the assitant will use the default configuration from the web interface (with its associated files to retrieve the info from, etc), right?

Because according to the documentation, associating file IDs at the Message level has a different behavior (and costs you again the file price apparently):

One would assume so - but your experience speaks differently. Try some OpenAI community and ask the question there. It pertains to the general API; should not be specific.


Well actually I was asking here because the Message to assistant module internally uses the API, and it could be that it is “overwriting” the file IDs with an empty list or something (I don’t know), because it is Make that does the internal management of creating the thread if it doesn’t exist, creating the message, launching the run, waiting for the response from the run, etc. That with the OpenAI API is more hassle and here it is Make that manages it internally.

:man_shrugging: Trust your experiments. If they are solid you’ll see the reality of the module implementation. If it’s overwriting the already uploaded files.

Unfortunately the documentation of modules notoriously is bad :-1: They’d help many people by either open sourcing them or at least explaining more in detail/give more examples.