Skip to content
Calling OpenAI assi...
 
Notifications
Clear all

Calling OpenAI assistant with a variable number of file IDs

13 Posts
3 Users
0 Reactions
6 Views
RalfW
(@ralfw)
Posts: 6
Active Member
Topic starter
 

How can I pass multiple file IDs to an OpenAI assistant module?

Passing a single file ID is straightforward: simply enter the file ID into the module's form field.

Passing a specific quantity of file IDs is also manageable: use the "add item" option to input each subsequent file ID.

However, how does one pass a variable number of file IDs? When I enable "map" and input a single file ID, it functions correctly. But when I try to separate multiple IDs with a comma or a newline, it doesn't work.

Should I be using JSON? I came across a format somewhere like this:

json
[
{ "id": "some file id"},
...
]

But this approach also failed.

So, what is the correct method to pass a variable number of file IDs that I can retrieve from an array?

 
Posted : 06/03/2024 6:30 am
samliew
(@samliew)
Posts: 293
Reputable Member
 

Welcome to the callin.io community!

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

Next, map the file IDs into the Files field.

Screenshot_2024-03-06_150350

Ensure you select “Knowledge Retrieval”; otherwise, the AI will not be able to access the files.

Screenshot_2024-03-06_150352

 
Posted : 06/03/2024 7:05 am
RalfW
(@ralfw)
Posts: 6
Active Member
Topic starter
 

Thanks! That was successful!
It's quite straightforward.

:roll_eyes:

Why did I miss the most apparent solution? I simply need to provide the array without any modifications. It's acceptable if it's empty as well.

I really appreciate the prompt reply!

 
Posted : 06/03/2024 7:51 am
Ruben
(@ruben)
Posts: 5
Active Member
 

Do I need to specify file IDs if they're already linked to the assistant via the Playground? Does it not retrieve them automatically? It appears the Playground shows file information, but callin.io doesn't seem to.:frowning:

 
Posted : 07/03/2024 6:01 pm
RalfW
(@ralfw)
Posts: 6
Active Member
Topic starter
 

I haven't tested this myself, but my assumption is:

  • If you upload files to the assistant within the playground, no further action is required. You won't need to include file IDs when invoking it in a scenario. However, ensure that "knowledge retrieval" is enabled, and I'd suggest referencing the knowledge base in your instructions or prompt.
  • Conversely, if you upload files directly within a scenario and receive file IDs, these are not linked to any specific assistant. You'll need to provide these file IDs to your assistant each time you wish to reference them in a prompt.

The assistant does maintain a record of chat messages, but it doesn't retain information about which file IDs were provided with specific prompts.

 
Posted : 07/03/2024 7:31 pm
Ruben
(@ruben)
Posts: 5
Active Member
 

In my situation, within the Playground, I have the files attached and have selected the retrieval tool. The prompt also references the file names. In callin.io, I simply configure the message and the assistant ID, without specifying any file IDs or tools (the documentation states, "If specified, will override the tools to use for the current response generation," so I'm not overriding it). However, when I run the same query from callin.io and the Playground, it doesn't produce the correct response in callin.io, whereas it works fine in the Playground.

:frowning:

 
Posted : 07/03/2024 8:26 pm
RalfW
(@ralfw)
Posts: 6
Active Member
Topic starter
 

Hmm, that's peculiar. I'm not sure why that's happening.

It appears there are two distinct moments when you can upload files:

  • To the assistant itself
  • Within a specific thread of the assistant

In the playground interface, the first action is performed on the left side, while the second is done within the chat on the right side.

My hypothesis is that any files uploaded to the assistant on the left side of the playground are not permanently associated with it (which seems counterintuitive). This might be because they incur costs.

The documentation doesn't seem to offer clarity on the appropriate times to upload files.

:frowning:

Unfortunately, I can't provide further assistance on this matter.

 
Posted : 07/03/2024 8:55 pm
Ruben
(@ruben)
Posts: 5
Active Member
 

Does anyone have information on this?

 
Posted : 07/03/2024 9:04 pm
samliew
(@samliew)
Posts: 293
Reputable Member
 

I approach it a bit differently. My files are uploaded through the assistant web interface, and I then reference the file IDs only when necessary (utilizing the filter demonstrated in the screenshot).

 
Posted : 08/03/2024 1:25 am
Ruben
(@ruben)
Posts: 5
Active Member
 

However, I understand that even without referencing file IDs, the module responsible for sending messages to the assistant, along with the assistant itself, will utilize the default configuration from the web interface, including its associated files for information retrieval, correct?

This is because, as per the documentation, associating file IDs at the Message level results in different behavior and, apparently, incurs the file cost again: https://platform.openai.com/docs/assistants/tools/uploading-files-for-retrieval

 
Posted : 08/03/2024 8:23 am
RalfW
(@ralfw)
Posts: 6
Active Member
Topic starter
 

One would assume so - but your experience indicates otherwise. Try asking the question on the OpenAI community forum. It relates to the general API; it should not be specific to callin.io.

 
Posted : 08/03/2024 9:02 am
Ruben
(@ruben)
Posts: 5
Active Member
 

I was asking here because the Message to assistant module internally utilizes the API. It's possible that it's overwriting the file IDs with an empty list, or something similar. This is because callin.io handles the internal management of creating the thread if it doesn't exist, creating the message, launching the run, and waiting for the response from the run. This process is more involved with the OpenAI API, whereas callin.io manages it internally.

 
Posted : 08/03/2024 9:37 am
RalfW
(@ralfw)
Posts: 6
Active Member
Topic starter
 

: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 callin.io documentation for modules is notoriously bad.

:-1:

They’d help many people by either open sourcing them or at least explaining more in detail/giving more examples.

 
Posted : 08/03/2024 10:28 am
Share: