Hello,
I am using an assistant with a vectorStore containing multiple files, in order to answer questions regarding these files :
await this.openAIClient.beta.assistants.create({
model: 'gpt-4-turbo',
instructions:
'You are a knowledgeable assistant that uses the provided files to answer questions.',
tools: [{ type: 'file_search' }],
tool_resources: {
file_search: {
vector_store_ids: [vectorStoreId],
},
},
});
Then, I am creating a thread and a run :
const threadMessage = {
role: 'user',
content: message,
};
const thread = await this.openAIClient.beta.threads.create();
await this.openAIClient.beta.threads.messages.create(
threadId,
threadMessage,
);
return this.openAIClient.beta.threads.runs.stream(threadId, {
assistant_id: assistantId,
});
At this point, everything is working as expected and the assistant answers questions regarding the documents in the vectorStore.
Now I want to use different documents for this assistant, but obviously I want to keep the conversation history, so I don’t remove neither the Assistant nor the Thread, but instead I update them with a new vectorStore (containing different documents) :
await this.openAIClient.beta.assistants.update(assistantId, {
tool_resources: {
file_search: {
vector_store_ids: [newVectorStoreId] ,
},
},
});
await this.openAIClient.beta.threads.update(threadId, {
tool_resources: {
file_search: {
vector_store_ids: [newVectorStoreId] ,
},
},
});
But now comes my issue, the Assistant is still answering questions regarding previous documents and completely ignore the new vectorStore.
After a lot of different tests, I found out that if I just update the Assistant BUT I use a new empty Thread, the Assistant is now taking into account the new vectorStore (but obviously I lost all the history of my previous messages to the Assistant).
So the issue seems related to the Thread himself and not the Assistant, like if the previous context of the Thread was still on and couldn’t be replaced by the new vectorStore.
If anyone have an idea about this, it would be very much appreciated. Of course I have thought about a workaround but it isn’t optimal : it would require to “clone” the thread by requesting all the previous messages and create a new one by inserting these messages. So I could keep my message history and have a new Thread without previous vectorStore context (solution not tested yet).