Issue Updating Vector Store in Existing Thread with OpenAI Assistant API

Hi everyone,

I’m encountering an issue with the OpenAI Assistant API when trying to bind a new vector store to an existing thread. Here’s the situation:

  1. Initially, I attach a vector store to a thread and query the assistant. It works perfectly, retrieving accurate information from the attached files.
  2. Later, I update the thread to use a new vector store (with updated files) by providing the new vector_store_id.

Despite updating the vector store, the assistant continues answering based on the previous vector store instead of the updated one.

Here’s the code snippet I’m using to update the vector store:

python

Copy code

def update_thread_vector_store(self, thread_id, vector_store_id):
    self.client.beta.threads.update(
        thread_id,
        tool_resources={"file_search": {"vector_store_ids": [vector_store_id]}},
    )

I expect the assistant to retrieve information from the updated vector store, but it still references the old one.

  • Has anyone else faced a similar issue?
  • Am I missing something in the update process?
  • Could this be an API caching issue, or do I need to explicitly reset some context?

Any guidance or insights would be greatly appreciated!

Thanks in advance!