Specific files per thread for assistants api

In my usecase I want all my threads to use the same assistant, however each thread needs to have access to a specific file.

What I’ve gathered from the docs is that its not possible to use a single vector store with a single assistant and upon creating a new thread, point it to a specific file in that single vector store.

So my question is should i then create a vector store for each thread and store this single file in there? And will this incur extra costs because it will result in a large amount of vector stores?

I have not tried this, but you could.

In each of the Run Assistant, you can recreate the run parameters of the Assistants for that Thread ONLY.

Basically you can run the below statement for each of the Run Statement:

tool_resources={"file_search": {"vector_store_ids": [vector_store.id]}}

where [vector_store.id] will point the file that you want in each of the thread which is stored in its corresponding vector store. So you will have X files, and X vector stores.

Ref API link: https://platform.openai.com/docs/api-reference/runs/createRun#runs-createrun-tools

when creating a message you can add a file to it! It will be specific to the thread!

1 Like