Add ability to upload a file at thread level

I can’t be the only one wishing to upload a file at a Thread level!
It’s quite rational to assume there will only be a single file discussed during a single thread. However, currently I need to upload the file during each new message request, which can be long and cumbersome (and add to response time).

At the moment, the only other alternative is uploading a file at assistant level feels too broad! I don’t want to have to create a new assistant for each new thread.

4 Likes

Yes, I had the same thoughts. There need to be flexibility in uploading things at the thread level as well.

1 Like

Hey @Digist, when you upload a file at the Message level, it is automatically accessible to the entire thread, you do not need to upload it again for every message, you can read more in our docs: https://platform.openai.com/docs/assistants/tools/uploading-files-for-retrieval

Let me know if there are parts of the docs that don’t make this clear.

1 Like

If I upload a file in the first message of the thread, will the retrieval quality drop as the number of messages increases in the thread?
Also, what happens when we start dropping the starting messages when the context length maxes out?

1 Like

As a future enhancement to consider, it would be great to be able to attach files to threads directly, or retroactively to messages. A particular use case right now is with a function tool call, where I often want to have it attach files that retrieval or code interpreter can therefore process (e.g. a “query our financial database” tool, which dumps a csv in the thread, which Code Interpreter analyzes and charts). There’s no way to do this now that isn’t clunky, as right now the API seems very limited to a straight ChatGPT use case of “user uploads file and types a message to go with it”.

3 Likes

Bumping this thread to find out more about the question regarding retrieval quality. Are files attached on the assistant level vs thread level using the same process for retrieval?

1 Like

This no longer seems to be the case. The link is dead.

Looking through the docs that seem related in the navigation tree, all that seems possible is to upload the file to a vector store that is connected to the assistant. Thus making it available for all users of the assistant rather than just the current thread.

Is this functionality deprecated or has it been moved?

willer for your problem:

I had the same problem. I have a function which allows me to connect chatgpt to database. But the problem was to respond in tool_output. Tool output only allows string responses and does not have any tools option. I solved this using following:

1- Function call from chatgpt
2- Access database and get data
3- Format data in csv or json format
4- Upload file using openAi.files.create
Know it comes
5- Update your thread using openAi.beta.threads.update
6- Tool output should be following. ‘There is a file with id xxx is attached which contains the data’.

This solves the problem. You upload a file to api and attach it to the thread.