How to detach the vector store used by file search tool resource from assistant?

I can use the following to attach a vector store for use by file search for example:

await openai.beta.assistants.update(assistant.id, {
  tool_resources: { file_search: { vector_store_ids: [vectorStore.id] } },
});

But updating the assistant without the tool resource property, or without the file search property, or without the vector store ids property, or by providing an empty list (or even null list) for vector store ids - does not detach the vector store from the assistant.

Is detaching exposed anywhere in the API?

Thanks in advance!

1 Like

Hi, welcome!

The only way I know to “detach” a vector store from an Assistant is via the platform.openai.com GUI. Not that that’s helpful—it’s just not usual to have an ability in the GUI that isn’t available first programmatically.

You might try deleting the vector store when you’re done with it, or setting an expiration for it.

@mprocarione , did you ever find the solution here? I’m wondering if updating the assistant with a new vector store would simply overwrite the existing one?

What the playground does is to send an empty "vector_store_ids" list to ‘modify assistant’ (which is basically a “re-create assistant”).

You can GET the assistant object, and send it back without the list entry.

Here, file search is left enabled as it was, to take any threads attachment vector store.

POST https://api.openai.com/v1/assistants/{assistant_id}

{
   "model": "gpt-4o",
   "tools": [
      {
         "type": "code_interpreter"
      },
      {
         "type": "file_search",
         "file_search": {
            "max_num_results": 8
         }
      }
   ],
   "name": "analysis bot",
   "instructions": "You a handsome bot",
   "tool_resources": {
      "code_interpreter": {
         "file_ids": [
            "file-bch3sDZTx1Vx2yUBmZp7FhjS"
         ]
      },
      "file_search": {
         "vector_store_ids": []
      }
   },
   "temperature": 0.25,
   "top_p": 0.11,
   "response_format": {
      "type": "text"
   }
}